Ajout de l'ensemble du workspace.
[GPU.git] / WCudaMSE / BilatTools_CPP / src / core / tools / header / namespace_cpu / ColorTools_CPU.h
1 #ifndef COLOR_TOOLS_CPU_H
2 #define COLOR_TOOLS_CPU_H
3
4 #include "cudaType_CPU.h"
5
6 /**
7 * The two methode HSB_TO_RGB and RGB_TO_HSB are from http://www.easyrgb.com/index.php?X=MATH&H=21#text21
8 */
9 namespace cpu
10 {
11 class ColorTools
12 {
13 public:
14
15 /*--------------------------------------*\
16 |* HSB_TO_RVB *|
17 \*-------------------------------------*/
18
19 /**
20 * Convertir une couleur HSB en RVB !
21 * H,S,B in [0,1]
22 * R,V,B in [0,255]
23 */
24 static void HSB_TO_RVB(const float3& hsb01, uchar4* ptrRVBA);
25
26 /**
27 * Convertir une couleur HSB en RGB !
28 * H,S,B in [0,1]
29 * R,G,B in [0,255]
30 */
31 static void HSB_TO_RVB(float h01, uchar4* ptrRVBA);
32
33 /**
34 * Convertir une couleur HSB en RGB !
35 * H,S,B in [0,1]
36 * R,G,B in [0,255]
37 */
38 static void HSB_TO_RVB(float h01, float s01, float b01, uchar4* ptrRVBA);
39
40 /**
41 * Conversion HSB => RVB
42 * Inputs :
43 * H,S,B in [0,1]
44 * Outputs :
45 * R,V,B in [0,255]
46 */
47 static void HSB_TO_RVB(const float H, const float S, const float V, unsigned char *ptrR, unsigned char *ptrG, unsigned char *ptrB);
48
49 /*--------------------------------------*\
50 |* RGB_TO_HSV *|
51 \*-------------------------------------*/
52
53 /**
54 * Conversion RGB => HSB
55 * Inputs :
56 * R,G,B in [0,255]
57 * Outpus :
58 * H,S,B in [0,1]
59 */
60 static void RGB_TO_HSB(const unsigned char R, const unsigned char G, const unsigned char B, float &H, float &S, float &V);
61
62 /*--------------------------------------*\
63 |* int *|
64 \*-------------------------------------*/
65
66 /**
67 * Conversion HSB => RGBA + toIntRGBA
68 * Inputs :
69 * h01,b01,b01 in [0,1]
70 * Outpus :
71 * intRGBA cod� sur 32 bits, chaque composante (a,r,g,b) �tant cod�e sur 4 bits
72 * intRGBA cod�e : 0xAARRGGBB
73 */
74 static int HSB_TO_IntRGBA(float h01, float s01, float b01, float a01 = 0);
75
76 /**
77 * Conversion (r,g,b,a) => intRGBA
78 * Inputs :
79 * r,g,b,a in [0,255]
80 * Outputs :
81 * intRGBA cod� sur 32 bits, chaque composante (a,r,g,b) �tant cod�e sur 4 bits
82 * intRGBA cod�e : 0xAARRGGBB
83 */
84 static int toIntRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a = 0);
85
86 /**
87 * see toIntRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a = 0)
88 */
89 static int toIntRGBA(float r01, float g01, float b01, float a01 = 0);
90
91 /**
92 * Inputs :
93 * intRGBA cod� sur 32 bits, chaque composante (a,r,g,b) �tant cod�e sur 4 bits
94 * intRGBA cod�e : 0xAARRGGBB
95 * Outputs :
96 * r,g,b,a in [0,255]
97 */
98 static void fromIntRGBA(const int rgb, unsigned char &r, unsigned char &g, unsigned char &b, unsigned char &a);
99
100 };
101 }
102
103 #endif