Ajout de l'ensemble du workspace.
[GPU.git] / WCudaMSE / BilatTools_CPP / src / core / tools / header / namespace_cpu / ColorTools_CPU.h
diff --git a/WCudaMSE/BilatTools_CPP/src/core/tools/header/namespace_cpu/ColorTools_CPU.h b/WCudaMSE/BilatTools_CPP/src/core/tools/header/namespace_cpu/ColorTools_CPU.h
new file mode 100755 (executable)
index 0000000..728e9d2
--- /dev/null
@@ -0,0 +1,103 @@
+#ifndef COLOR_TOOLS_CPU_H\r
+#define COLOR_TOOLS_CPU_H\r
+\r
+#include "cudaType_CPU.h"\r
+\r
+/**\r
+ * The two methode HSB_TO_RGB and RGB_TO_HSB are from http://www.easyrgb.com/index.php?X=MATH&H=21#text21\r
+ */\r
+namespace cpu\r
+    {\r
+    class ColorTools\r
+       {\r
+       public:\r
+\r
+           /*--------------------------------------*\\r
+          |*             HSB_TO_RVB                    *|\r
+            \*-------------------------------------*/\r
+\r
+           /**\r
+            * Convertir une couleur HSB en RVB !\r
+            * H,S,B    in [0,1]\r
+            * R,V,B    in [0,255]\r
+            */\r
+           static void HSB_TO_RVB(const float3& hsb01, uchar4* ptrRVBA);\r
+\r
+           /**\r
+            * Convertir une couleur HSB en RGB !\r
+            * H,S,B in [0,1]\r
+            * R,G,B in [0,255]\r
+            */\r
+           static void HSB_TO_RVB(float h01, uchar4* ptrRVBA);\r
+\r
+           /**\r
+            * Convertir une couleur HSB en RGB !\r
+            * H,S,B in [0,1]\r
+            * R,G,B in [0,255]\r
+            */\r
+           static void HSB_TO_RVB(float h01, float s01, float b01, uchar4* ptrRVBA);\r
+\r
+           /**\r
+            * Conversion HSB => RVB\r
+            * Inputs :\r
+            *  H,S,B in [0,1]\r
+            * Outputs :\r
+            *  R,V,B in [0,255]\r
+            */\r
+           static void HSB_TO_RVB(const float H, const float S, const float V, unsigned char *ptrR, unsigned char *ptrG, unsigned char *ptrB);\r
+\r
+           /*--------------------------------------*\\r
+          |*            RGB_TO_HSV             *|\r
+            \*-------------------------------------*/\r
+\r
+           /**\r
+            * Conversion RGB => HSB\r
+            * Inputs :\r
+            *  R,G,B in [0,255]\r
+            * Outpus :\r
+            *  H,S,B in [0,1]\r
+            */\r
+           static void RGB_TO_HSB(const unsigned char R, const unsigned char G, const unsigned char B, float &H, float &S, float &V);\r
+\r
+           /*--------------------------------------*\\r
+         |*             int                       *|\r
+            \*-------------------------------------*/\r
+\r
+           /**\r
+            * Conversion HSB => RGBA + toIntRGBA\r
+            * Inputs :\r
+            *  h01,b01,b01 in [0,1]\r
+            * Outpus :\r
+            *  intRGBA cod� sur 32 bits, chaque composante (a,r,g,b) �tant cod�e sur 4 bits\r
+            *  intRGBA cod�e :  0xAARRGGBB\r
+            */\r
+           static int HSB_TO_IntRGBA(float h01, float s01, float b01, float a01 = 0);\r
+\r
+           /**\r
+            * Conversion (r,g,b,a) => intRGBA\r
+            * Inputs :\r
+            *  r,g,b,a in [0,255]\r
+            * Outputs :\r
+            *  intRGBA cod� sur 32 bits, chaque composante (a,r,g,b) �tant cod�e sur 4 bits\r
+            *  intRGBA cod�e :  0xAARRGGBB\r
+            */\r
+           static int toIntRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a = 0);\r
+\r
+           /**\r
+            * see toIntRGBA(unsigned char r,  unsigned char g,  unsigned char b,  unsigned char a = 0)\r
+            */\r
+           static int toIntRGBA(float r01, float g01, float b01, float a01 = 0);\r
+\r
+           /**\r
+            * Inputs :\r
+            *  intRGBA cod� sur 32 bits, chaque composante (a,r,g,b) �tant cod�e sur 4 bits\r
+            *  intRGBA cod�e :  0xAARRGGBB\r
+            * Outputs :\r
+            *  r,g,b,a in [0,255]\r
+            */\r
+           static void fromIntRGBA(const int rgb, unsigned char &r, unsigned char &g, unsigned char &b, unsigned char &a);\r
+\r
+       };\r
+    }\r
+\r
+#endif\r