32 #include "DGtal/base/Common.h"
33 #include "DGtal/io/Color.h"
34 #include "DGtal/io/colormaps/CColorMap.h"
35 #include "DGtal/io/colormaps/GrayscaleColorMap.h"
36 #include "DGtal/io/colormaps/HueShadeColorMap.h"
37 #include "DGtal/io/colormaps/ColorBrightnessColorMap.h"
38 #include "DGtal/io/colormaps/SimpleDistanceColorMap.h"
39 #include "DGtal/io/colormaps/GradientColorMap.h"
40 #include "DGtal/io/colormaps/RandomColorMap.h"
41 #include "DGtal/io/boards/Board2D.h"
42 #include "Board/PSFonts.h"
46 using namespace DGtal;
52 template <
typename TColorMap>
54 const TColorMap & aColorMap,
66 for (
Value x = aColorMap.min(); x <= aColorMap.max(); x += step ) {
70 static_cast<double>( step ),
77 unsigned int nbok = 0;
87 <<
"," << int(c0.
green()) <<
"," << int(c0.
blue()) << std::endl;
88 nbok += ( c0 == Color::Black );
90 Color c128 = cmap(128);
92 cerr << int(c128.
red())
93 <<
"," << int(c128.
green()) <<
"," << int(c128.
blue()) << std::endl;
94 nbok += ( c128 ==
Color(128,128,128) );
96 Color c255 = cmap(255);
98 cerr << int(c255.
red())
99 <<
"," << int(c255.
green()) <<
"," << int(c255.
blue()) << std::endl;
100 nbok += ( c255 == Color::White );
109 cerr << int(c0.
red())
110 <<
"," << int(c0.
green()) <<
"," << int(c0.
blue()) << std::endl;
111 nbok += ( c0 == Color::Black );
113 Color c255 = cmap(128);
115 cerr << int(c255.
red())
116 <<
"," << int(c255.
green()) <<
"," << int(c255.
blue()) << std::endl;
117 nbok += ( c255 == Color::White );
126 <<
"," << int(c.green()) <<
"," << int(c.blue()) << std::endl;
127 nbok += (c == Color::White);
130 trace.
info() <<
"Should be around 127,127,127: ";
132 <<
"," << int(c.green()) <<
"," << int(c.blue()) << std::endl;
144 trace.
emphase() << ( res1 ?
"Passed." :
"Error." ) << endl;
168 cmap_random.
addColor(Color::Yellow);
170 const int yellow = DGTAL_RGB2INT(255,255,0);
171 const int red = DGTAL_RGB2INT(255,0,0);
176 cmap_grad3.
addColor( Color::Green );
177 cmap_grad3.
addColor( Color::Yellow );
183 cmap_grad3.
addColor( Color::White );
224 board.
saveEPS(
"colormaps.eps" );
225 board.
saveSVG(
"colormaps.svg" );
229 board.
saveCairo(
"colormaps-cairo.pdf", Board2D::CairoPDF);
232 return ( res1 ) ? 0 : 1;