00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef NTG_NRGB_HH
00029 # define NTG_NRGB_HH
00030
00031 # include <ntg/color/color.hh>
00032
00033 namespace ntg
00034 {
00035
00040 enum nrgb_comp
00041 {
00042 nrgb_R = 0,
00043 nrgb_G = 1,
00044 nrgb_B = 2
00045 };
00046
00047 template<unsigned icomp> struct nrgb_traits;
00048 template<>
00049 struct nrgb_traits<nrgb_R>
00050 {
00051 static float lower_bound() { return 0;}
00052 static float upper_bound() { return 1.0885004;}
00053 };
00054
00055
00056 template<>
00057 struct nrgb_traits<nrgb_G>
00058 {
00059 static float lower_bound() { return -0.3321984;}
00060 static float upper_bound() { return 1.3189264;}
00061 };
00062
00063
00064 template<>
00065 struct nrgb_traits<nrgb_B>
00066 {
00067 static float lower_bound() { return -0.0688480;}
00068 static float upper_bound() { return 0.904727;}
00069 };
00070
00071
00072 typedef color<3,8,nrgb_traits> nrgb_8;
00073 typedef color<3,16,nrgb_traits> nrgb_16;
00074 typedef color<3,32,nrgb_traits> nrgb_32;
00075
00076
00077 # define DEFINE_COLOR(Type, Name, V1, V2, V3) \
00078 inline const Type& Name() { \
00079 static const Type tmp(V1, V2, V3); \
00080 return tmp; \
00081 }
00082
00083 namespace nrgb_8_color
00084 {
00085
00086 DEFINE_COLOR(nrgb_8, white, 255, 255, 255)
00087 DEFINE_COLOR(nrgb_8, gray, 128, 128, 128)
00088 DEFINE_COLOR(nrgb_8, black, 0, 0, 0)
00089 DEFINE_COLOR(nrgb_8, red, 255, 0, 0)
00090 DEFINE_COLOR(nrgb_8, green, 0, 255, 0)
00091 DEFINE_COLOR(nrgb_8, blue, 0, 0, 255)
00092 DEFINE_COLOR(nrgb_8, yellow,255, 255, 0)
00093 DEFINE_COLOR(nrgb_8, cyan, 0, 255, 255)
00094 DEFINE_COLOR(nrgb_8, pink, 255, 0, 255)
00095
00096 }
00097
00098 namespace nrgb_16_color
00099 {
00100
00101 DEFINE_COLOR(nrgb_16, white, 255, 255, 255)
00102 DEFINE_COLOR(nrgb_16, gray, 128, 128, 128)
00103 DEFINE_COLOR(nrgb_16, black, 0, 0, 0)
00104 DEFINE_COLOR(nrgb_16, red, 255, 0, 0)
00105 DEFINE_COLOR(nrgb_16, green, 0, 255, 0)
00106 DEFINE_COLOR(nrgb_16, blue, 0, 0, 255)
00107 DEFINE_COLOR(nrgb_16, yellow,255, 255, 0)
00108 DEFINE_COLOR(nrgb_16, cyan, 0, 255, 255)
00109 DEFINE_COLOR(nrgb_16, pink, 255, 0, 255)
00110
00111 }
00112
00113 namespace nrgb_32_color
00114 {
00115
00116 DEFINE_COLOR(nrgb_32, white, 255, 255, 255)
00117 DEFINE_COLOR(nrgb_32, gray, 128, 128, 128)
00118 DEFINE_COLOR(nrgb_32, black, 0, 0, 0)
00119 DEFINE_COLOR(nrgb_32, red, 255, 0, 0)
00120 DEFINE_COLOR(nrgb_32, green, 0, 255, 0)
00121 DEFINE_COLOR(nrgb_32, blue, 0, 0, 255)
00122 DEFINE_COLOR(nrgb_32, yellow,255, 255, 0)
00123 DEFINE_COLOR(nrgb_32, cyan, 0, 255, 255)
00124 DEFINE_COLOR(nrgb_32, pink, 255, 0, 255)
00125
00126 }
00127
00128 }
00129
00130 #endif // !NTG_COLOR_NRGB_HH