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