32#include "DGtal/base/Common.h"
33#include "ConfigTest.h"
34#include "DGtal/helpers/StdDefs.h"
35#include "DGtal/io/Color.h"
50 unsigned int nbok = 0;
56 Color g(32,32,32,255);
57 Color gg(64,64,64,255);
58 Color w(255,255,255,255);
60 trace.
info() <<
" B+G = g "<< b+g<<std::endl;
61 nbok += ((b+g)==g) ? 1 : 0;
63 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
64 <<
"add" << std::endl;
66 trace.
info() <<
" g+g = gg "<< g*2<<
" expected ="<<gg<<std::endl;
67 nbok += ((g+g)==gg) ? 1 : 0;
69 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
70 <<
"add (bis)" << std::endl;
72 trace.
info() <<
" W+W = w "<< w+w<<std::endl;
73 nbok += ((w+w)==w) ? 1 : 0;
75 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
76 <<
"max " << std::endl;
78 trace.
info() <<
" g*2 = gg "<< g*2<<
" expected ="<<gg<<std::endl;
79 nbok += ((g*2)==gg) ? 1 : 0;
81 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
82 <<
"coeff" << std::endl;
87 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
88 <<
"coeff" << std::endl;
90 trace.
info() <<
" 2*g = gg "<< 2.0*g<<
" expected ="<<gg<<std::endl;
91 nbok += ((2*g)==gg) ? 1 : 0;
93 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
94 <<
"coeff" << std::endl;
100#ifdef COLOR_WITH_ALPHA_ARITH
101 trace.
info() <<
" a+aa = "<< a+aa<<std::endl;
102 nbok += (c ==
Color(0,0,0,96)) ? 1 : 0;
104 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
105 <<
"alpha arith (enabled)" << std::endl;
107 trace.
info() <<
" a+aa = "<< a+aa<<std::endl;
108 nbok += (c ==
Color(0,0,0,64)) ? 1 : 0;
110 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
111 <<
"alpha arith (disabled)" << std::endl;
117 trace.
info() <<
" val == Color::Red "<< val<<std::endl;
121 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
122 <<
"red" << std::endl;
125 const auto is_trivially_copyable_ = std::is_trivially_copyable<Color>::value;
126 trace.
info() <<
"is_trivially_copyable: "<< is_trivially_copyable_ <<std::endl;
127 nbok += (is_trivially_copyable_) ? 1 : 0;
129 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
130 <<
"is_trivially_copyable" << std::endl;
140int main(
int argc,
char** argv )
144 for (
int i = 0; i < argc; ++i )
149 trace.
emphase() << ( res ?
"Passed." :
"Error." ) << endl;
Structure representing an RGB triple with alpha component.
Color & setRGBi(const unsigned char aRedValue, const unsigned char aGreenValue, const unsigned char aBlueValue, const unsigned char aAlphaValue=255)
void beginBlock(const std::string &keyword="")
DGtal is the top-level namespace which contains all DGtal functions and types.