[DEV] change mode of color ==> advence interface and conversion

This commit is contained in:
Edouard DUPIN 2014-07-03 21:03:26 +02:00
parent cfc4d435b4
commit a33d198b7c
7 changed files with 748 additions and 447 deletions

View File

@ -10,35 +10,11 @@
#include <etk/tool.h> #include <etk/tool.h>
#include <etk/Color.h> #include <etk/Color.h>
#include <etk/debug.h> #include <etk/debug.h>
#include <etk/stdTools.h>
#include <string> #include <string>
#include <sstream> #include <sstream>
#include <stdexcept> #include <stdexcept>
static bool strnCmpNoCase(const char * _input1, const char * _input2, int32_t _maxLen) {
int32_t iii=0;
while ( '\0' != *_input1
&& '\0' != *_input2
&& iii < _maxLen) {
char in1 = *_input1;
char in2 = *_input2;
if (in1 != in2) {
if (in1 <= 'Z' && in1 >= 'A') {
in1 = in1 - 'A' + 'a';
}
if (in2 <= 'Z' && in2 >= 'A') {
in2 = in2 - 'A' + 'a';
}
if (in1 != in2) {
return false;
}
}
iii++;
_input1++;
_input2++;
}
return true;
}
typedef struct { typedef struct {
const char * colorName; const char * colorName;
etk::Color<> color; etk::Color<> color;
@ -47,344 +23,328 @@ typedef struct {
static int32_t getColorSize(); static int32_t getColorSize();
static const colorList_ts* getColorList(); static const colorList_ts* getColorList();
namespace etk { etk::Color<uint8_t, 4> etk::parseStringStartWithSharp(const std::string& _input) {
template<> void Color<uint8_t>::set(float _r, float _g, float _b, float _a) { TK_INFO("parseStringStartWithSharp('" << _input << "'");
m_r = (uint8_t)(_r*255.0f);
m_g = (uint8_t)(_g*255.0f);
m_b = (uint8_t)(_b*255.0f);
m_a = (uint8_t)(_a*255.0f);
}
template<> void Color<float>::set(float _r, float _g, float _b, float _a) {
m_r = _r;
m_g = _g;
m_b = _b;
m_a = _a;
}
template<> void Color<uint8_t>::set(uint8_t _r, uint8_t _g, uint8_t _b, uint8_t _a) {
m_r = _r;
m_g = _g;
m_b = _b;
m_a = _a;
}
template<> void Color<float>::set(uint8_t _r, uint8_t _g, uint8_t _b, uint8_t _a) {
m_r = ((float)_r)/255.0f;
m_g = ((float)_g)/255.0f;
m_b = ((float)_b)/255.0f;
m_a = ((float)_a)/255.0f;
}
template<> uint32_t Color<uint8_t>::get() const {
return (((uint32_t)m_r)<<24)
+ (((uint32_t)m_g)<<16)
+ (((uint32_t)m_b)<<8)
+ (uint32_t)m_a;
}
template<> uint32_t Color<float>::get() const {
return Color<uint8_t>(*this).get();
}
template<> Color<uint8_t>::Color(const std::string& _input) :
m_r(255),
m_g(255),
m_b(255),
m_a(255) {
const char* inputData = _input.c_str();
size_t len = _input.size(); size_t len = _input.size();
if( len >=1 etk::Color<uint8_t, 4> outputValue(0,0,0,0);
&& inputData[0] == '#') { if(len == 3) {
if(len == 4) {
int32_t red=0, green=0, blue=0; int32_t red=0, green=0, blue=0;
if (sscanf(inputData + 1, "%1x%1x%1x", &red, &green, &blue) == 3) { if (sscanf(_input.c_str(), "%1x%1x%1x", &red, &green, &blue) == 3) {
m_r = (red | red << 4); outputValue.setR(red | red << 4);
m_g = (green | green << 4); outputValue.setG(green | green << 4);
m_b = (blue | blue << 4); outputValue.setB(blue | blue << 4);
} else { } else {
TK_ERROR(" pb in parsing the color : \"" << inputData << "\""); TK_ERROR(" pb in parsing the color : '" << _input << "'");
} }
} else if (len==5) { } else if (len==5) {
int32_t red=0, green=0, blue=0, alpha=0; int32_t red=0, green=0, blue=0, alpha=0;
if (sscanf(inputData + 1, "%1x%1x%1x%1x", &red, &green, &blue, &alpha) == 4) { if (sscanf(_input.c_str(), "%1x%1x%1x%1x", &red, &green, &blue, &alpha) == 4) {
m_r = (red | red << 4); outputValue.setR(red | red << 4);
m_g = (green | green << 4); outputValue.setG(green | green << 4);
m_b = (blue | blue << 4); outputValue.setB(blue | blue << 4);
m_a = (alpha | alpha << 4); outputValue.setA(alpha | alpha << 4);
} else { } else {
TK_ERROR(" pb in parsing the color : \"" << inputData << "\""); TK_ERROR(" pb in parsing the color : '" << _input << "'");
} }
} else if (len == 7) { } else if (len == 7) {
int32_t red=0, green=0, blue=0; int32_t red=0, green=0, blue=0;
if (sscanf(inputData + 1, "%2x%2x%2x", &red, &green, &blue) == 3) { if (sscanf(_input.c_str(), "%2x%2x%2x", &red, &green, &blue) == 3) {
m_r = red; outputValue.setR(red);
m_g = green; outputValue.setG(green);
m_b = blue; outputValue.setB(blue);
} else { } else {
TK_ERROR(" pb in parsing the color : \"" << inputData << "\""); TK_ERROR(" pb in parsing the color : '" << _input << "'");
} }
} else if (len == 9) { } else if (len == 9) {
int32_t red=0, green=0, blue=0, alpha=0; int32_t red=0, green=0, blue=0, alpha=0;
if (sscanf(inputData + 1, "%2x%2x%2x%2x", &red, &green, &blue, &alpha) == 4) { if (sscanf(_input.c_str(), "%2x%2x%2x%2x", &red, &green, &blue, &alpha) == 4) {
m_r = red; outputValue.setR(red);
m_g = green; outputValue.setG(green);
m_b = blue; outputValue.setB(blue);
m_a = alpha; outputValue.setA(alpha);
} else { } else {
TK_ERROR(" pb in parsing the color : \"" << inputData << "\""); TK_ERROR(" pb in parsing the color : '" << _input << "'");
} }
} else { } else {
TK_ERROR(" pb in parsing the color : \"" << inputData << "\" ==> unknown methode ..."); TK_ERROR(" pb in parsing the color : '" << _input << "' ==> unknown methode ...");
} }
} else if( len >= 4 return outputValue;
&& inputData[0] == 'r' }
&& inputData[1] == 'g'
&& inputData[2] == 'b' etk::Color<uint8_t, 4> etk::parseStringStartWithRGBGen(const std::string& _input) {
&& inputData[3] == '(' ) { TK_INFO("parseStringStartWithRGB('" << _input << "'");
etk::Color<uint8_t, 4> outputValue(0,0,0,0);
int32_t red=0, green=0, blue=0, alpha=0; int32_t red=0, green=0, blue=0, alpha=0;
float fred=0, fgreen=0, fblue=0, falpha=0; float fred=0, fgreen=0, fblue=0, falpha=0;
if (sscanf(inputData + 4, "%u,%u,%u,%u", &red, &green, &blue, &alpha) == 4) { if (sscanf(_input.c_str(), "%u,%u,%u,%u", &red, &green, &blue, &alpha) == 4) {
m_r = etk_min(0xFF, red); outputValue.setR(std::min(0xFF, red));
m_g = etk_min(0xFF, green); outputValue.setG(std::min(0xFF, green));
m_b = etk_min(0xFF, blue); outputValue.setB(std::min(0xFF, blue));
m_a = etk_min(0xFF, alpha); outputValue.setA(std::min(0xFF, alpha));
} else if (sscanf(inputData + 4, "%u,%u,%u", &red, &green, &blue) == 3) { } else if (sscanf(_input.c_str(), "%u,%u,%u", &red, &green, &blue) == 3) {
m_r = etk_min(0xFF, red); outputValue.setR(std::min(0xFF, red));
m_g = etk_min(0xFF, green); outputValue.setG(std::min(0xFF, green));
m_b = etk_min(0xFF, blue); outputValue.setB(std::min(0xFF, blue));
} else if (sscanf(inputData + 4, "%f%%,%f%%,%f%%,%f%%", &fred, &fgreen, &fblue, &falpha) == 4) { } else if (sscanf(_input.c_str(), "%f%%,%f%%,%f%%,%f%%", &fred, &fgreen, &fblue, &falpha) == 4) {
fred = etk_avg(0.0, fred, 1.0); fred = std::avg(0.0f, fred, 1.0f);
fgreen = etk_avg(0.0, fgreen, 1.0); fgreen = std::avg(0.0f, fgreen, 1.0f);
fblue = etk_avg(0.0, fblue, 1.0); fblue = std::avg(0.0f, fblue, 1.0f);
falpha = etk_avg(0.0, falpha, 1.0); falpha = std::avg(0.0f, falpha, 1.0f);
m_r = (uint8_t)(fred * 255.); outputValue.setR((uint8_t)(fred * 255.f));
m_g = (uint8_t)(fgreen * 255.); outputValue.setG((uint8_t)(fgreen * 255.f));
m_b = (uint8_t)(fblue * 255.); outputValue.setB((uint8_t)(fblue * 255.f));
m_a = (uint8_t)(falpha * 255.); outputValue.setR((uint8_t)(falpha * 255.f));
} else if (sscanf(inputData + 4, "%f%%,%f%%,%f%%", &fred, &fgreen, &fblue) == 3) { } else if (sscanf(_input.c_str(), "%f%%,%f%%,%f%%", &fred, &fgreen, &fblue) == 3) {
fred = etk_avg(0.0, fred, 1.0); fred = std::avg(0.0f, fred, 1.0f);
fgreen= etk_avg(0.0, fgreen, 1.0); fgreen= std::avg(0.0f, fgreen, 1.0f);
fblue = etk_avg(0.0, fblue, 1.0); fblue = std::avg(0.0f, fblue, 1.0f);
m_r = (uint8_t)(fred * 255.); outputValue.setR((uint8_t)(fred * 255.f));
m_g = (uint8_t)(fgreen * 255.); outputValue.setG((uint8_t)(fgreen * 255.f));
m_b = (uint8_t)(fblue * 255.); outputValue.setB((uint8_t)(fblue * 255.f));
} else { } else {
TK_ERROR(" pb in parsing the color : \"" << inputData << "\" ==> unknown methode ..."); TK_ERROR(" pb in parsing the color : '" << _input << "' ==> unknown methode ...");
} }
return outputValue;
}
etk::Color<double, 4> etk::parseStringStartWithRGB(const std::string& _input) {
TK_INFO("parseStringStartWithRGB('" << _input << "'");
etk::Color<double, 4> outputValue(0,0,0,0);
double fred=0, fgreen=0, fblue=0, falpha=0;
if (sscanf(_input.c_str(), "%lf%%,%lf%%,%lf%%,%lf%%", &fred, &fgreen, &fblue, &falpha) == 4) {
outputValue.setR(fred);
outputValue.setG(fgreen);
outputValue.setB(fblue);
outputValue.setA(falpha);
} else if (sscanf(_input.c_str(), "%lf%%,%lf%%,%lf%%", &fred, &fgreen, &fblue) == 3) {
outputValue.setR(fred);
outputValue.setG(fgreen);
outputValue.setB(fblue);
} else { } else {
bool findIt = false; TK_ERROR(" pb in parsing the color : '" << _input << "' ==> unknown methode ...");
}
return outputValue;
}
etk::Color<uint32_t, 4> etk::parseStringStartWithRGBUnsigned32(const std::string& _input) {
etk::Color<uint32_t, 4> outputValue(0,0,0,0);
int32_t red=0, green=0, blue=0, alpha=0;
if (sscanf(_input.c_str(), "%u,%u,%u,%u", &red, &green, &blue, &alpha) == 4) {
outputValue.setR(red);
outputValue.setG(green);
outputValue.setB(blue);
outputValue.setA(alpha);
} else if (sscanf(_input.c_str(), "%u,%u,%u", &red, &green, &blue) == 3) {
outputValue.setR(red);
outputValue.setG(green);
outputValue.setB(blue);
} else {
TK_ERROR(" pb in parsing the color : '" << _input << "' ==> unknown methode ...");
}
return outputValue;
}
etk::Color<uint16_t, 4> etk::parseStringStartWithRGBUnsigned16(const std::string& _input) {
etk::Color<uint16_t, 4> outputValue(0,0,0,0);
int32_t red=0, green=0, blue=0, alpha=0;
if (sscanf(_input.c_str(), "%u,%u,%u,%u", &red, &green, &blue, &alpha) == 4) {
outputValue.setR(std::min(0xFFFF, red));
outputValue.setG(std::min(0xFFFF, green));
outputValue.setB(std::min(0xFFFF, blue));
outputValue.setA(std::min(0xFFFF, alpha));
} else if (sscanf(_input.c_str(), "%u,%u,%u", &red, &green, &blue) == 3) {
outputValue.setR(std::min(0xFFFF, red));
outputValue.setG(std::min(0xFFFF, green));
outputValue.setB(std::min(0xFFFF, blue));
} else {
TK_ERROR(" pb in parsing the color : '" << _input << "' ==> unknown methode ...");
}
return outputValue;
}
etk::Color<uint8_t, 4> etk::parseStringStartWithRGBUnsigned8(const std::string& _input) {
etk::Color<uint8_t, 4> outputValue(0,0,0,0);
int32_t red=0, green=0, blue=0, alpha=0;
if (sscanf(_input.c_str(), "%u,%u,%u,%u", &red, &green, &blue, &alpha) == 4) {
outputValue.setR(std::min(0xFF, red));
outputValue.setG(std::min(0xFF, green));
outputValue.setB(std::min(0xFF, blue));
outputValue.setA(std::min(0xFF, alpha));
} else if (sscanf(_input.c_str(), "%u,%u,%u", &red, &green, &blue) == 3) {
outputValue.setR(std::min(0xFF, red));
outputValue.setG(std::min(0xFF, green));
outputValue.setB(std::min(0xFF, blue));
} else {
TK_ERROR(" pb in parsing the color : '" << _input << "' ==> unknown methode ...");
}
return outputValue;
}
etk::Color<uint8_t, 4> etk::parseStringColorNamed(const std::string& _input) {
// direct named color ... // direct named color ...
for (int32_t iii=0; iii<getColorSize(); iii++) { for (int32_t iii=0; iii<getColorSize(); iii++) {
if (strnCmpNoCase(getColorList()[iii].colorName, inputData, strlen(getColorList()[iii].colorName)) == true) { if (std::compare_no_case(getColorList()[iii].colorName, _input) == true) {
findIt = true; return getColorList()[iii].color;
*this = getColorList()[iii].color;
// stop searching
break;
} }
} }
// not find color ... TK_ERROR(" pb in parsing the color : '" << _input << "' not find ...");
if (findIt == false) { return etk::Color<uint8_t, 4>(0,0,0,0);
TK_ERROR(" pb in parsing the color : \"" << inputData << "\" not find ...");
}
}
TK_VERBOSE("Parse color : \"" << inputData << "\" ==> " << *this);
} }
template<> Color<float>::Color(const std::string& _input) { template<> uint32_t etk::Color<uint8_t, 4>::get() const {
etk::Color<uint8_t> tmpColor(_input); return (((uint32_t)m_element[0])<<24)
*this = tmpColor; + (((uint32_t)m_element[1])<<16)
} + (((uint32_t)m_element[2])<<8)
}; + (uint32_t)m_element[3];
std::ostream& etk::operator <<(std::ostream& _os, const etk::Color<uint8_t>& _obj) {
_os << "#";
_os << (std::to_string<uint32_t>(_obj.get(), std::hex)).c_str();
return _os;
} }
std::ostream& etk::operator <<(std::ostream& _os, const etk::Color<float>& _obj) const etk::Color<> etk::color::none(0x00, 0x00, 0x00, 0x00);
{ const etk::Color<> etk::color::aliceBlue(0xF0, 0xF8, 0xFF, 0xFF);
_os << "rgba("; const etk::Color<> etk::color::antiqueWhite(0xFA, 0xEB, 0xD7, 0xFF);
_os << _obj.r(); const etk::Color<> etk::color::aqua(0x00, 0xFF, 0xFF, 0xFF);
_os << ","; const etk::Color<> etk::color::aquamarine(0x7F, 0xFF, 0xD4, 0xFF);
_os << _obj.g(); const etk::Color<> etk::color::azure(0xF0, 0xFF, 0xFF, 0xFF);
_os << ","; const etk::Color<> etk::color::beige(0xF5, 0xF5, 0xDC, 0xFF);
_os << _obj.b(); const etk::Color<> etk::color::bisque(0xFF, 0xE4, 0xC4, 0xFF);
_os << ","; const etk::Color<> etk::color::black(0x00, 0x00, 0x00, 0xFF);
_os << _obj.a(); const etk::Color<> etk::color::blanchedAlmond(0xFF, 0xEB, 0xCD, 0xFF);
_os << ")"; const etk::Color<> etk::color::blue(0x00, 0x00, 0xFF, 0xFF);
return _os; const etk::Color<> etk::color::blueViolet(0x8A, 0x2B, 0xE2, 0xFF);
} const etk::Color<> etk::color::brown(0xA5, 0x2A, 0x2A, 0xFF);
const etk::Color<> etk::color::burlyWood(0xDE, 0xB8, 0x87, 0xFF);
std::ostream& etk::operator <<(std::ostream& _os, const std::vector<etk::Color<uint8_t> >& _obj) { const etk::Color<> etk::color::cadetBlue(0x5F, 0x9E, 0xA0, 0xFF);
for (size_t iii = 0; iii < _obj.size(); ++iii) { const etk::Color<> etk::color::chartreuse(0x7F, 0xFF, 0x00, 0xFF);
if (iii != 0) { const etk::Color<> etk::color::chocolate(0xD2, 0x69, 0x1E, 0xFF);
_os << " "; const etk::Color<> etk::color::coral(0xFF, 0x7F, 0x50, 0xFF);
} const etk::Color<> etk::color::cornflowerBlue(0x64, 0x95, 0xED, 0xFF);
_os << _obj[iii]; const etk::Color<> etk::color::cornsilk(0xFF, 0xF8, 0xDC, 0xFF);
} const etk::Color<> etk::color::crimson(0xDC, 0x14, 0x3C, 0xFF);
return _os; const etk::Color<> etk::color::cyan(0x00, 0xFF, 0xFF, 0xFF);
} const etk::Color<> etk::color::darkBlue(0x00, 0x00, 0x8B, 0xFF);
std::ostream& etk::operator <<(std::ostream& _os, const std::vector<etk::Color<float> >& _obj) { const etk::Color<> etk::color::darkCyan(0x00, 0x8B, 0x8B, 0xFF);
for (size_t iii = 0; iii < _obj.size(); ++iii) { const etk::Color<> etk::color::darkGoldenRod(0xB8, 0x86, 0x0B, 0xFF);
if (iii != 0) { const etk::Color<> etk::color::darkGray(0xA9, 0xA9, 0xA9, 0xFF);
_os << " "; const etk::Color<> etk::color::darkGrey(0xA9, 0xA9, 0xA9, 0xFF);
} const etk::Color<> etk::color::darkGreen(0x00, 0x64, 0x00, 0xFF);
_os << _obj[iii]; const etk::Color<> etk::color::darkKhaki(0xBD, 0xB7, 0x6B, 0xFF);
} const etk::Color<> etk::color::darkMagenta(0x8B, 0x00, 0x8B, 0xFF);
return _os; const etk::Color<> etk::color::darkOliveGreen(0x55, 0x6B, 0x2F, 0xFF);
} const etk::Color<> etk::color::darkorange(0xFF, 0x8C, 0x00, 0xFF);
const etk::Color<> etk::color::darkOrchid(0x99, 0x32, 0xCC, 0xFF);
const etk::Color<> etk::color::darkRed(0x8B, 0x00, 0x00, 0xFF);
const etk::Color<> etk::color::none((uint32_t)0x00000000); const etk::Color<> etk::color::darkSalmon(0xE9, 0x96, 0x7A, 0xFF);
const etk::Color<> etk::color::aliceBlue((uint32_t)0xF0F8FFFF); const etk::Color<> etk::color::darkSeaGreen(0x8F, 0xBC, 0x8F, 0xFF);
const etk::Color<> etk::color::antiqueWhite((uint32_t)0xFAEBD7FF); const etk::Color<> etk::color::darkSlateBlue(0x48, 0x3D, 0x8B, 0xFF);
const etk::Color<> etk::color::aqua((uint32_t)0x00FFFFFF); const etk::Color<> etk::color::darkSlateGray(0x2F, 0x4F, 0x4F, 0xFF);
const etk::Color<> etk::color::aquamarine((uint32_t)0x7FFFD4FF); const etk::Color<> etk::color::darkSlateGrey(0x2F, 0x4F, 0x4F, 0xFF);
const etk::Color<> etk::color::azure((uint32_t)0xF0FFFFFF); const etk::Color<> etk::color::darkTurquoise(0x00, 0xCE, 0xD1, 0xFF);
const etk::Color<> etk::color::beige((uint32_t)0xF5F5DCFF); const etk::Color<> etk::color::darkViolet(0x94, 0x00, 0xD3, 0xFF);
const etk::Color<> etk::color::bisque((uint32_t)0xFFE4C4FF); const etk::Color<> etk::color::deepPink(0xFF, 0x14, 0x93, 0xFF);
const etk::Color<> etk::color::black((uint32_t)0x000000FF); const etk::Color<> etk::color::deepSkyBlue(0x00, 0xBF, 0xFF, 0xFF);
const etk::Color<> etk::color::blanchedAlmond((uint32_t)0xFFEBCDFF); const etk::Color<> etk::color::dimGray(0x69, 0x69, 0x69, 0xFF);
const etk::Color<> etk::color::blue((uint32_t)0x0000FFFF); const etk::Color<> etk::color::dimGrey(0x69, 0x69, 0x69, 0xFF);
const etk::Color<> etk::color::blueViolet((uint32_t)0x8A2BE2FF); const etk::Color<> etk::color::dodgerBlue(0x1E, 0x90, 0xFF, 0xFF);
const etk::Color<> etk::color::brown((uint32_t)0xA52A2AFF); const etk::Color<> etk::color::fireBrick(0xB2, 0x22, 0x22, 0xFF);
const etk::Color<> etk::color::burlyWood((uint32_t)0xDEB887FF); const etk::Color<> etk::color::floralWhite(0xFF, 0xFA, 0xF0, 0xFF);
const etk::Color<> etk::color::cadetBlue((uint32_t)0x5F9EA0FF); const etk::Color<> etk::color::forestGreen(0x22, 0x8B, 0x22, 0xFF);
const etk::Color<> etk::color::chartreuse((uint32_t)0x7FFF00FF); const etk::Color<> etk::color::fuchsia(0xFF, 0x00, 0xFF, 0xFF);
const etk::Color<> etk::color::chocolate((uint32_t)0xD2691EFF); const etk::Color<> etk::color::gainsboro(0xDC, 0xDC, 0xDC, 0xFF);
const etk::Color<> etk::color::coral((uint32_t)0xFF7F50FF); const etk::Color<> etk::color::ghostWhite(0xF8, 0xF8, 0xFF, 0xFF);
const etk::Color<> etk::color::cornflowerBlue((uint32_t)0x6495EDFF); const etk::Color<> etk::color::gold(0xFF, 0xD7, 0x00, 0xFF);
const etk::Color<> etk::color::cornsilk((uint32_t)0xFFF8DCFF); const etk::Color<> etk::color::goldenRod(0xDA, 0xA5, 0x20, 0xFF);
const etk::Color<> etk::color::crimson((uint32_t)0xDC143CFF); const etk::Color<> etk::color::gray(0x80, 0x80, 0x80, 0xFF);
const etk::Color<> etk::color::cyan((uint32_t)0x00FFFFFF); const etk::Color<> etk::color::grey(0x80, 0x80, 0x80, 0xFF);
const etk::Color<> etk::color::darkBlue((uint32_t)0x00008BFF); const etk::Color<> etk::color::green(0x00, 0x80, 0x00, 0xFF);
const etk::Color<> etk::color::darkCyan((uint32_t)0x008B8BFF); const etk::Color<> etk::color::greenYellow(0xAD, 0xFF, 0x2F, 0xFF);
const etk::Color<> etk::color::darkGoldenRod((uint32_t)0xB8860BFF); const etk::Color<> etk::color::honeyDew(0xF0, 0xFF, 0xF0, 0xFF);
const etk::Color<> etk::color::darkGray((uint32_t)0xA9A9A9FF); const etk::Color<> etk::color::hotPink(0xFF, 0x69, 0xB4, 0xFF);
const etk::Color<> etk::color::darkGrey((uint32_t)0xA9A9A9FF); const etk::Color<> etk::color::indianRed (0xCD, 0x5C, 0x5C, 0xFF);
const etk::Color<> etk::color::darkGreen((uint32_t)0x006400FF); const etk::Color<> etk::color::indigo (0x4B, 0x00, 0x82, 0xFF);
const etk::Color<> etk::color::darkKhaki((uint32_t)0xBDB76BFF); const etk::Color<> etk::color::ivory(0xFF, 0xFF, 0xF0, 0xFF);
const etk::Color<> etk::color::darkMagenta((uint32_t)0x8B008BFF); const etk::Color<> etk::color::khaki(0xF0, 0xE6, 0x8C, 0xFF);
const etk::Color<> etk::color::darkOliveGreen((uint32_t)0x556B2FFF); const etk::Color<> etk::color::lavender(0xE6, 0xE6, 0xFA, 0xFF);
const etk::Color<> etk::color::darkorange((uint32_t)0xFF8C00FF); const etk::Color<> etk::color::lavenderBlush(0xFF, 0xF0, 0xF5, 0xFF);
const etk::Color<> etk::color::darkOrchid((uint32_t)0x9932CCFF); const etk::Color<> etk::color::lawnGreen(0x7C, 0xFC, 0x00, 0xFF);
const etk::Color<> etk::color::darkRed((uint32_t)0x8B0000FF); const etk::Color<> etk::color::lemonChiffon(0xFF, 0xFA, 0xCD, 0xFF);
const etk::Color<> etk::color::darkSalmon((uint32_t)0xE9967AFF); const etk::Color<> etk::color::lightBlue(0xAD, 0xD8, 0xE6, 0xFF);
const etk::Color<> etk::color::darkSeaGreen((uint32_t)0x8FBC8FFF); const etk::Color<> etk::color::lightCoral(0xF0, 0x80, 0x80, 0xFF);
const etk::Color<> etk::color::darkSlateBlue((uint32_t)0x483D8BFF); const etk::Color<> etk::color::lightCyan(0xE0, 0xFF, 0xFF, 0xFF);
const etk::Color<> etk::color::darkSlateGray((uint32_t)0x2F4F4FFF); const etk::Color<> etk::color::lightGoldenRodYellow(0xFA, 0xFA, 0xD2, 0xFF);
const etk::Color<> etk::color::darkSlateGrey((uint32_t)0x2F4F4FFF); const etk::Color<> etk::color::lightGray(0xD3, 0xD3, 0xD3, 0xFF);
const etk::Color<> etk::color::darkTurquoise((uint32_t)0x00CED1FF); const etk::Color<> etk::color::lightGrey(0xD3, 0xD3, 0xD3, 0xFF);
const etk::Color<> etk::color::darkViolet((uint32_t)0x9400D3FF); const etk::Color<> etk::color::lightGreen(0x90, 0xEE, 0x90, 0xFF);
const etk::Color<> etk::color::deepPink((uint32_t)0xFF1493FF); const etk::Color<> etk::color::lightPink(0xFF, 0xB6, 0xC1, 0xFF);
const etk::Color<> etk::color::deepSkyBlue((uint32_t)0x00BFFFFF); const etk::Color<> etk::color::lightSalmon(0xFF, 0xA0, 0x7A, 0xFF);
const etk::Color<> etk::color::dimGray((uint32_t)0x696969FF); const etk::Color<> etk::color::lightSeaGreen(0x20, 0xB2, 0xAA, 0xFF);
const etk::Color<> etk::color::dimGrey((uint32_t)0x696969FF); const etk::Color<> etk::color::lightSkyBlue(0x87, 0xCE, 0xFA, 0xFF);
const etk::Color<> etk::color::dodgerBlue((uint32_t)0x1E90FFFF); const etk::Color<> etk::color::lightSlateGray(0x77, 0x88, 0x99, 0xFF);
const etk::Color<> etk::color::fireBrick((uint32_t)0xB22222FF); const etk::Color<> etk::color::lightSlateGrey(0x77, 0x88, 0x99, 0xFF);
const etk::Color<> etk::color::floralWhite((uint32_t)0xFFFAF0FF); const etk::Color<> etk::color::lightSteelBlue(0xB0, 0xC4, 0xDE, 0xFF);
const etk::Color<> etk::color::forestGreen((uint32_t)0x228B22FF); const etk::Color<> etk::color::lightYellow(0xFF, 0xFF, 0xE0, 0xFF);
const etk::Color<> etk::color::fuchsia((uint32_t)0xFF00FFFF); const etk::Color<> etk::color::lime(0x00, 0xFF, 0x00, 0xFF);
const etk::Color<> etk::color::gainsboro((uint32_t)0xDCDCDCFF); const etk::Color<> etk::color::limeGreen(0x32, 0xCD, 0x32, 0xFF);
const etk::Color<> etk::color::ghostWhite((uint32_t)0xF8F8FFFF); const etk::Color<> etk::color::linen(0xFA, 0xF0, 0xE6, 0xFF);
const etk::Color<> etk::color::gold((uint32_t)0xFFD700FF); const etk::Color<> etk::color::magenta(0xFF, 0x00, 0xFF, 0xFF);
const etk::Color<> etk::color::goldenRod((uint32_t)0xDAA520FF); const etk::Color<> etk::color::maroon(0x80, 0x00, 0x00, 0xFF);
const etk::Color<> etk::color::gray((uint32_t)0x808080FF); const etk::Color<> etk::color::mediumAquaMarine(0x66, 0xCD, 0xAA, 0xFF);
const etk::Color<> etk::color::grey((uint32_t)0x808080FF); const etk::Color<> etk::color::mediumBlue(0x00, 0x00, 0xCD, 0xFF);
const etk::Color<> etk::color::green((uint32_t)0x008000FF); const etk::Color<> etk::color::mediumOrchid(0xBA, 0x55, 0xD3, 0xFF);
const etk::Color<> etk::color::greenYellow((uint32_t)0xADFF2FFF); const etk::Color<> etk::color::mediumPurple(0x93, 0x70, 0xD8, 0xFF);
const etk::Color<> etk::color::honeyDew((uint32_t)0xF0FFF0FF); const etk::Color<> etk::color::mediumSeaGreen(0x3C, 0xB3, 0x71, 0xFF);
const etk::Color<> etk::color::hotPink((uint32_t)0xFF69B4FF); const etk::Color<> etk::color::mediumSlateBlue(0x7B, 0x68, 0xEE, 0xFF);
const etk::Color<> etk::color::indianRed ((uint32_t)0xCD5C5CFF); const etk::Color<> etk::color::mediumSpringGreen(0x00, 0xFA, 0x9A, 0xFF);
const etk::Color<> etk::color::indigo ((uint32_t)0x4B0082FF); const etk::Color<> etk::color::mediumTurquoise(0x48, 0xD1, 0xCC, 0xFF);
const etk::Color<> etk::color::ivory((uint32_t)0xFFFFF0FF); const etk::Color<> etk::color::mediumVioletRed(0xC7, 0x15, 0x85, 0xFF);
const etk::Color<> etk::color::khaki((uint32_t)0xF0E68CFF); const etk::Color<> etk::color::midnightBlue(0x19, 0x19, 0x70, 0xFF);
const etk::Color<> etk::color::lavender((uint32_t)0xE6E6FAFF); const etk::Color<> etk::color::mintCream(0xF5, 0xFF, 0xFA, 0xFF);
const etk::Color<> etk::color::lavenderBlush((uint32_t)0xFFF0F5FF); const etk::Color<> etk::color::mistyRose(0xFF, 0xE4, 0xE1, 0xFF);
const etk::Color<> etk::color::lawnGreen((uint32_t)0x7CFC00FF); const etk::Color<> etk::color::moccasin(0xFF, 0xE4, 0xB5, 0xFF);
const etk::Color<> etk::color::lemonChiffon((uint32_t)0xFFFACDFF); const etk::Color<> etk::color::navajoWhite(0xFF, 0xDE, 0xAD, 0xFF);
const etk::Color<> etk::color::lightBlue((uint32_t)0xADD8E6FF); const etk::Color<> etk::color::navy(0x00, 0x00, 0x80, 0xFF);
const etk::Color<> etk::color::lightCoral((uint32_t)0xF08080FF); const etk::Color<> etk::color::oldLace(0xFD, 0xF5, 0xE6, 0xFF);
const etk::Color<> etk::color::lightCyan((uint32_t)0xE0FFFFFF); const etk::Color<> etk::color::olive(0x80, 0x80, 0x00, 0xFF);
const etk::Color<> etk::color::lightGoldenRodYellow((uint32_t)0xFAFAD2FF); const etk::Color<> etk::color::oliveDrab(0x6B, 0x8E, 0x23, 0xFF);
const etk::Color<> etk::color::lightGray((uint32_t)0xD3D3D3FF); const etk::Color<> etk::color::orange(0xFF, 0xA5, 0x00, 0xFF);
const etk::Color<> etk::color::lightGrey((uint32_t)0xD3D3D3FF); const etk::Color<> etk::color::orangeRed(0xFF, 0x45, 0x00, 0xFF);
const etk::Color<> etk::color::lightGreen((uint32_t)0x90EE90FF); const etk::Color<> etk::color::orchid(0xDA, 0x70, 0xD6, 0xFF);
const etk::Color<> etk::color::lightPink((uint32_t)0xFFB6C1FF); const etk::Color<> etk::color::paleGoldenRod(0xEE, 0xE8, 0xAA, 0xFF);
const etk::Color<> etk::color::lightSalmon((uint32_t)0xFFA07AFF); const etk::Color<> etk::color::paleGreen(0x98, 0xFB, 0x98, 0xFF);
const etk::Color<> etk::color::lightSeaGreen((uint32_t)0x20B2AAFF); const etk::Color<> etk::color::paleTurquoise(0xAF, 0xEE, 0xEE, 0xFF);
const etk::Color<> etk::color::lightSkyBlue((uint32_t)0x87CEFAFF); const etk::Color<> etk::color::paleVioletRed(0xD8, 0x70, 0x93, 0xFF);
const etk::Color<> etk::color::lightSlateGray((uint32_t)0x778899FF); const etk::Color<> etk::color::papayaWhip(0xFF, 0xEF, 0xD5, 0xFF);
const etk::Color<> etk::color::lightSlateGrey((uint32_t)0x778899FF); const etk::Color<> etk::color::peachPuff(0xFF, 0xDA, 0xB9, 0xFF);
const etk::Color<> etk::color::lightSteelBlue((uint32_t)0xB0C4DEFF); const etk::Color<> etk::color::peru(0xCD, 0x85, 0x3F, 0xFF);
const etk::Color<> etk::color::lightYellow((uint32_t)0xFFFFE0FF); const etk::Color<> etk::color::pink(0xFF, 0xC0, 0xCB, 0xFF);
const etk::Color<> etk::color::lime((uint32_t)0x00FF00FF); const etk::Color<> etk::color::plum(0xDD, 0xA0, 0xDD, 0xFF);
const etk::Color<> etk::color::limeGreen((uint32_t)0x32CD32FF); const etk::Color<> etk::color::powderBlue(0xB0, 0xE0, 0xE6, 0xFF);
const etk::Color<> etk::color::linen((uint32_t)0xFAF0E6FF); const etk::Color<> etk::color::purple(0x80, 0x00, 0x80, 0xFF);
const etk::Color<> etk::color::magenta((uint32_t)0xFF00FFFF); const etk::Color<> etk::color::red(0xFF, 0x00, 0x00, 0xFF);
const etk::Color<> etk::color::maroon((uint32_t)0x800000FF); const etk::Color<> etk::color::rosyBrown(0xBC, 0x8F, 0x8F, 0xFF);
const etk::Color<> etk::color::mediumAquaMarine((uint32_t)0x66CDAAFF); const etk::Color<> etk::color::royalBlue(0x41, 0x69, 0xE1, 0xFF);
const etk::Color<> etk::color::mediumBlue((uint32_t)0x0000CDFF); const etk::Color<> etk::color::saddleBrown(0x8B, 0x45, 0x13, 0xFF);
const etk::Color<> etk::color::mediumOrchid((uint32_t)0xBA55D3FF); const etk::Color<> etk::color::salmon(0xFA, 0x80, 0x72, 0xFF);
const etk::Color<> etk::color::mediumPurple((uint32_t)0x9370D8FF); const etk::Color<> etk::color::sandyBrown(0xF4, 0xA4, 0x60, 0xFF);
const etk::Color<> etk::color::mediumSeaGreen((uint32_t)0x3CB371FF); const etk::Color<> etk::color::seaGreen(0x2E, 0x8B, 0x57, 0xFF);
const etk::Color<> etk::color::mediumSlateBlue((uint32_t)0x7B68EEFF); const etk::Color<> etk::color::seaShell(0xFF, 0xF5, 0xEE, 0xFF);
const etk::Color<> etk::color::mediumSpringGreen((uint32_t)0x00FA9AFF); const etk::Color<> etk::color::sienna(0xA0, 0x52, 0x2D, 0xFF);
const etk::Color<> etk::color::mediumTurquoise((uint32_t)0x48D1CCFF); const etk::Color<> etk::color::silver(0xC0, 0xC0, 0xC0, 0xFF);
const etk::Color<> etk::color::mediumVioletRed((uint32_t)0xC71585FF); const etk::Color<> etk::color::skyBlue(0x87, 0xCE, 0xEB, 0xFF);
const etk::Color<> etk::color::midnightBlue((uint32_t)0x191970FF); const etk::Color<> etk::color::slateBlue(0x6A, 0x5A, 0xCD, 0xFF);
const etk::Color<> etk::color::mintCream((uint32_t)0xF5FFFAFF); const etk::Color<> etk::color::slateGray(0x70, 0x80, 0x90, 0xFF);
const etk::Color<> etk::color::mistyRose((uint32_t)0xFFE4E1FF); const etk::Color<> etk::color::slateGrey(0x70, 0x80, 0x90, 0xFF);
const etk::Color<> etk::color::moccasin((uint32_t)0xFFE4B5FF); const etk::Color<> etk::color::snow(0xFF, 0xFA, 0xFA, 0xFF);
const etk::Color<> etk::color::navajoWhite((uint32_t)0xFFDEADFF); const etk::Color<> etk::color::springGreen(0x00, 0xFF, 0x7F, 0xFF);
const etk::Color<> etk::color::navy((uint32_t)0x000080FF); const etk::Color<> etk::color::steelBlue(0x46, 0x82, 0xB4, 0xFF);
const etk::Color<> etk::color::oldLace((uint32_t)0xFDF5E6FF); const etk::Color<> etk::color::tan(0xD2, 0xB4, 0x8C, 0xFF);
const etk::Color<> etk::color::olive((uint32_t)0x808000FF); const etk::Color<> etk::color::teal(0x00, 0x80, 0x80, 0xFF);
const etk::Color<> etk::color::oliveDrab((uint32_t)0x6B8E23FF); const etk::Color<> etk::color::thistle(0xD8, 0xBF, 0xD8, 0xFF);
const etk::Color<> etk::color::orange((uint32_t)0xFFA500FF); const etk::Color<> etk::color::tomato(0xFF, 0x63, 0x47, 0xFF);
const etk::Color<> etk::color::orangeRed((uint32_t)0xFF4500FF); const etk::Color<> etk::color::turquoise(0x40, 0xE0, 0xD0, 0xFF);
const etk::Color<> etk::color::orchid((uint32_t)0xDA70D6FF); const etk::Color<> etk::color::violet(0xEE, 0x82, 0xEE, 0xFF);
const etk::Color<> etk::color::paleGoldenRod((uint32_t)0xEEE8AAFF); const etk::Color<> etk::color::wheat(0xF5, 0xDE, 0xB3, 0xFF);
const etk::Color<> etk::color::paleGreen((uint32_t)0x98FB98FF); const etk::Color<> etk::color::white(0xFF, 0xFF, 0xFF, 0xFF);
const etk::Color<> etk::color::paleTurquoise((uint32_t)0xAFEEEEFF); const etk::Color<> etk::color::whiteSmoke(0xF5, 0xF5, 0xF5, 0xFF);
const etk::Color<> etk::color::paleVioletRed((uint32_t)0xD87093FF); const etk::Color<> etk::color::yellow(0xFF, 0xFF, 0x00, 0xFF);
const etk::Color<> etk::color::papayaWhip((uint32_t)0xFFEFD5FF); const etk::Color<> etk::color::yellowGreen(0x9A, 0xCD, 0x32, 0xFF);
const etk::Color<> etk::color::peachPuff((uint32_t)0xFFDAB9FF);
const etk::Color<> etk::color::peru((uint32_t)0xCD853FFF);
const etk::Color<> etk::color::pink((uint32_t)0xFFC0CBFF);
const etk::Color<> etk::color::plum((uint32_t)0xDDA0DDFF);
const etk::Color<> etk::color::powderBlue((uint32_t)0xB0E0E6FF);
const etk::Color<> etk::color::purple((uint32_t)0x800080FF);
const etk::Color<> etk::color::red((uint32_t)0xFF0000FF);
const etk::Color<> etk::color::rosyBrown((uint32_t)0xBC8F8FFF);
const etk::Color<> etk::color::royalBlue((uint32_t)0x4169E1FF);
const etk::Color<> etk::color::saddleBrown((uint32_t)0x8B4513FF);
const etk::Color<> etk::color::salmon((uint32_t)0xFA8072FF);
const etk::Color<> etk::color::sandyBrown((uint32_t)0xF4A460FF);
const etk::Color<> etk::color::seaGreen((uint32_t)0x2E8B57FF);
const etk::Color<> etk::color::seaShell((uint32_t)0xFFF5EEFF);
const etk::Color<> etk::color::sienna((uint32_t)0xA0522DFF);
const etk::Color<> etk::color::silver((uint32_t)0xC0C0C0FF);
const etk::Color<> etk::color::skyBlue((uint32_t)0x87CEEBFF);
const etk::Color<> etk::color::slateBlue((uint32_t)0x6A5ACDFF);
const etk::Color<> etk::color::slateGray((uint32_t)0x708090FF);
const etk::Color<> etk::color::slateGrey((uint32_t)0x708090FF);
const etk::Color<> etk::color::snow((uint32_t)0xFFFAFAFF);
const etk::Color<> etk::color::springGreen((uint32_t)0x00FF7FFF);
const etk::Color<> etk::color::steelBlue((uint32_t)0x4682B4FF);
const etk::Color<> etk::color::tan((uint32_t)0xD2B48CFF);
const etk::Color<> etk::color::teal((uint32_t)0x008080FF);
const etk::Color<> etk::color::thistle((uint32_t)0xD8BFD8FF);
const etk::Color<> etk::color::tomato((uint32_t)0xFF6347FF);
const etk::Color<> etk::color::turquoise((uint32_t)0x40E0D0FF);
const etk::Color<> etk::color::violet((uint32_t)0xEE82EEFF);
const etk::Color<> etk::color::wheat((uint32_t)0xF5DEB3FF);
const etk::Color<> etk::color::white((uint32_t)0xFFFFFFFF);
const etk::Color<> etk::color::whiteSmoke((uint32_t)0xF5F5F5FF);
const etk::Color<> etk::color::yellow((uint32_t)0xFFFF00FF);
const etk::Color<> etk::color::yellowGreen((uint32_t)0x9ACD32FF);
static const colorList_ts listOfColor[] = { static const colorList_ts listOfColor[] = {
{ "none", etk::color::none}, { "none", etk::color::none},
@ -547,3 +507,42 @@ static int32_t getColorSize()
static const int32_t tmpp = sizeof(listOfColor) / sizeof(colorList_ts); static const int32_t tmpp = sizeof(listOfColor) / sizeof(colorList_ts);
return tmpp; return tmpp;
} }
namespace etk {
#include "Color_8_bits.cxx"
#include "Color_16_bits.cxx"
#include "Color_32_bits.cxx"
#include "Color_float.cxx"
#include "Color_double.cxx"
};
/*
template<> Color<float,4>::Color(const etk::Color<uint8_t, 4>& _obj) {
if (MY_TYPE_SIZE >= 1) {
if (MY_TYPE_SIZE_2 >= 1) {
m_element[0] = (float)_obj.m_element[0] / 255.0f;
}
}
if (MY_TYPE_SIZE >= 2) {
if (MY_TYPE_SIZE_2 >= 2) {
m_element[1] = (float)_obj.m_element[1] / 255.0f;
} else {
m_element[1] = 0;
}
}
if (MY_TYPE_SIZE >= 3) {
if (MY_TYPE_SIZE_2 >= 3) {
m_element[2] = (float)_obj.m_element[2] / 255.0f;
} else {
m_element[2] = 0;
}
}
if (MY_TYPE_SIZE >= 4) {
if (MY_TYPE_SIZE_2 >= 4) {
m_element[3] = (float)_obj.m_element[3] / 255.0f;
} else {
m_element[3] = 0;
}
}
}
*/

View File

@ -31,12 +31,9 @@ namespace etk {
* *
* @template-param MY_TYPE Type of the internal template value. The generic value is uint8_t and float * @template-param MY_TYPE Type of the internal template value. The generic value is uint8_t and float
*/ */
template<class MY_TYPE=uint8_t> class Color { template<typename MY_TYPE=uint8_t, int MY_TYPE_SIZE=4> class Color {
private: private:
MY_TYPE m_r; //!< Red color value. MY_TYPE m_element[MY_TYPE_SIZE]; //!< all the color.
MY_TYPE m_g; //!< Green color value.
MY_TYPE m_b; //!< Blue color value
MY_TYPE m_a; //!< Alpha blending value.
public: public:
/** /**
* @brief Constructor. It does not initialise element of class. * @brief Constructor. It does not initialise element of class.
@ -49,51 +46,27 @@ namespace etk {
* @param[in] _b Blue color. * @param[in] _b Blue color.
* @param[in] _a Alpha blending. * @param[in] _a Alpha blending.
*/ */
Color(double _r, double _g, double _b, double _a=255) { Color(MY_TYPE _r, MY_TYPE _g, MY_TYPE _b, MY_TYPE _a) {
set((float)_r, (float)_g, (float)_b, (float)_a);
};
/**
* @previous
*/
Color(float _r, float _g, float _b, float _a=255) {
set(_r, _g, _b, _a); set(_r, _g, _b, _a);
}; };
/** //! @previous
* @previous Color(MY_TYPE _r, MY_TYPE _g, MY_TYPE _b) {
*/ set(_r, _g, _b);
Color(uint8_t _r, uint8_t _g, uint8_t _b, uint8_t _a=255) {
set(_r, _g, _b, _a);
}; };
/** //! @previous
* @previous Color(MY_TYPE _r, MY_TYPE _g) {
*/ set(_r, _g);
Color(int _r, int _g, int _b, int _a=255) {
set(_r, _g, _b, _a);
}; };
/** //! @previous
* @brief Constructor with the single integer input. Color(MY_TYPE _r) {
* @note Not forger the alpha blending at the end set(_r);
* @param[in] _input rgba integer value : 0xrrggbbaa >> 0x99AF6DFF
*/
Color(uint32_t _input) {
set((uint8_t)((_input&0xFF000000)>>24),
(uint8_t)((_input&0x00FF0000)>>16),
(uint8_t)((_input&0x0000FF00)>>8),
(uint8_t)((_input&0x000000FF)));
}; };
/** /**
* @brief Copy contructor or convert contructor * @brief Copy contructor or convert contructor
* @param[in] _obj Element to copy in this new color class. * @param[in] _obj Element to copy in this new color class.
*/ */
Color(const etk::Color<float>& _obj) { template<typename MY_TYPE_2, int MY_TYPE_SIZE_2>
set(_obj.r(), _obj.g(), _obj.b(), _obj.a()); Color(const etk::Color<MY_TYPE_2, MY_TYPE_SIZE_2>& _obj);
};
/**
* @previous
*/
Color(const etk::Color<uint8_t>& _obj) {
set(_obj.r(), _obj.g(), _obj.b(), _obj.a());
};
/** /**
* @brief String extractor constructor. * @brief String extractor constructor.
* @param[in] _input Color string to parse. it can be : "#rrggbb", "rgb", "rrggbbaa", "rgba", "blueviolet" ... * @param[in] _input Color string to parse. it can be : "#rrggbb", "rgb", "rrggbbaa", "rgba", "blueviolet" ...
@ -104,11 +77,10 @@ namespace etk {
* @param[in] _input Color object to set in this class. * @param[in] _input Color object to set in this class.
* @return reference on this element. * @return reference on this element.
*/ */
Color<MY_TYPE>& operator=(const etk::Color<MY_TYPE>& _input) { Color<MY_TYPE,MY_TYPE_SIZE>& operator=(const etk::Color<MY_TYPE,MY_TYPE_SIZE>& _input) {
m_r = _input.m_r; for (size_t iii=0; iii<MY_TYPE_SIZE; ++iii) {
m_g = _input.m_g; m_element[iii] = _input.m_element[iii];
m_b = _input.m_b; }
m_a = _input.m_a;
return *this; return *this;
}; };
/** /**
@ -117,13 +89,12 @@ namespace etk {
* @return true This is not the same color * @return true This is not the same color
* @return false This is the same color. * @return false This is the same color.
*/ */
bool operator!= (const etk::Color<MY_TYPE>& _obj) const { bool operator!= (const etk::Color<MY_TYPE,MY_TYPE_SIZE>& _obj) const {
if( m_r != _obj.m_r for (size_t iii=0; iii<MY_TYPE_SIZE; ++iii) {
|| m_g != _obj.m_g if(m_element[iii] != _obj.m_element[iii]) {
|| m_b != _obj.m_b
|| m_a != _obj.m_a) {
return true; return true;
} }
}
return false; return false;
} }
/** /**
@ -132,13 +103,12 @@ namespace etk {
* @return true This is the same color. * @return true This is the same color.
* @return false The color are different. * @return false The color are different.
*/ */
bool operator== (const etk::Color<MY_TYPE>& _obj) const { bool operator== (const etk::Color<MY_TYPE,MY_TYPE_SIZE>& _obj) const {
if( m_r != _obj.m_r for (size_t iii=0; iii<MY_TYPE_SIZE; ++iii) {
|| m_g != _obj.m_g if(m_element[iii] != _obj.m_element[iii]) {
|| m_b != _obj.m_b
|| m_a != _obj.m_a) {
return false; return false;
} }
}
return true; return true;
} }
/** /**
@ -153,16 +123,65 @@ namespace etk {
* @param[in] _b Blue color. * @param[in] _b Blue color.
* @param[in] _a Alpha blending. * @param[in] _a Alpha blending.
*/ */
void set(float _r, float _g, float _b, float _a=255); void set(MY_TYPE _r, MY_TYPE _g, MY_TYPE _b, MY_TYPE _a) {
//! @previous if (MY_TYPE_SIZE >= 1) {
void set(uint8_t _r, uint8_t _g, uint8_t _b, uint8_t _a=255); m_element[0] = _r;
//! @previous
void set(int _r, int _g, int _b, int _a=255) {
set((uint8_t)(etk_avg(0,_r,255)),
(uint8_t)(etk_avg(0,_g,255)),
(uint8_t)(etk_avg(0,_b,255)),
(uint8_t)(etk_avg(0,_a,255)) );
} }
if (MY_TYPE_SIZE >= 2) {
m_element[1] = _g;
}
if (MY_TYPE_SIZE >= 3) {
m_element[2] = _b;
}
if (MY_TYPE_SIZE >= 4) {
m_element[3] = _a;
}
};
//! @previous
void set(MY_TYPE _r, MY_TYPE _g, MY_TYPE _b) {
if (MY_TYPE_SIZE >= 1) {
m_element[0] = _r;
}
if (MY_TYPE_SIZE >= 2) {
m_element[1] = _g;
}
if (MY_TYPE_SIZE >= 3) {
m_element[2] = _b;
}
if (MY_TYPE_SIZE >= 4) {
m_element[3] = 0;
}
};
//! @previous
void set(MY_TYPE _r, MY_TYPE _g) {
if (MY_TYPE_SIZE >= 1) {
m_element[0] = _r;
}
if (MY_TYPE_SIZE >= 2) {
m_element[1] = _g;
}
if (MY_TYPE_SIZE >= 3) {
m_element[2] = 0;
}
if (MY_TYPE_SIZE >= 4) {
m_element[3] = 0;
}
};
//! @previous
void set(MY_TYPE _r) {
if (MY_TYPE_SIZE >= 1) {
m_element[0] = _r;
}
if (MY_TYPE_SIZE >= 2) {
m_element[1] = 0;
}
if (MY_TYPE_SIZE >= 3) {
m_element[2] = 0;
}
if (MY_TYPE_SIZE >= 4) {
m_element[3] = 0;
}
};
/** /**
* @brief Convert the color in an hexedecimal string ("0xFEDCBA98") * @brief Convert the color in an hexedecimal string ("0xFEDCBA98")
* @return The formated string * @return The formated string
@ -186,66 +205,282 @@ namespace etk {
* @return The red color. * @return The red color.
*/ */
MY_TYPE r() const { MY_TYPE r() const {
return m_r; if (MY_TYPE_SIZE >= 1) {
return m_element[0];
} else {
return 0;
}
}; };
/** /**
* @brief Get green color. * @brief Get green color.
* @return The green color. * @return The green color.
*/ */
MY_TYPE g() const { MY_TYPE g() const {
return m_g; if (MY_TYPE_SIZE >= 2) {
return m_element[1];
} else {
return 0;
}
}; };
/** /**
* @brief Get blue color. * @brief Get blue color.
* @return The blue color. * @return The blue color.
*/ */
MY_TYPE b() const { MY_TYPE b() const {
return m_b; if (MY_TYPE_SIZE >= 3) {
return m_element[2];
} else {
return 0;
}
}; };
/** /**
* @brief Get alpha blending. * @brief Get alpha blending.
* @return The alpha blending. * @return The alpha blending.
*/ */
MY_TYPE a() const { MY_TYPE a() const {
return m_a; if (MY_TYPE_SIZE >= 4) {
return m_element[3];
} else {
return 0;
}
}; };
/** /**
* @brief Set red color. * @brief Set red color.
* @param[in] _r The red color to set. * @param[in] _r The red color to set.
*/ */
void setR(MY_TYPE _r) { void setR(MY_TYPE _r) {
m_r=_r; if (MY_TYPE_SIZE >= 1) {
m_element[0] = _r;
}
}; };
/** /**
* @brief Set green color. * @brief Set green color.
* @param[in] _g The green color to set. * @param[in] _g The green color to set.
*/ */
void setG(MY_TYPE _g) { void setG(MY_TYPE _g) {
m_g=_g; if (MY_TYPE_SIZE >= 2) {
m_element[1] = _g;
}
}; };
/** /**
* @brief Set blue color. * @brief Set blue color.
* @param[in] _b The blue color to set. * @param[in] _b The blue color to set.
*/ */
void setB(MY_TYPE _b) { void setB(MY_TYPE _b) {
m_b=_b; if (MY_TYPE_SIZE >= 3) {
m_element[2] = _b;
}
}; };
/** /**
* @brief Set alpha blending. * @brief Set alpha blending.
* @param[in] _a The alpha blending to set. * @param[in] _a The alpha blending to set.
*/ */
void setA(MY_TYPE _a) { void setA(MY_TYPE _a) {
m_a=_a; if (MY_TYPE_SIZE >= 4) {
m_element[3] = _a;
}
}; };
}; };
etk::Color<uint8_t, 4> parseStringStartWithSharp(const std::string& _input);
etk::Color<uint8_t, 4> parseStringStartWithRGBGen(const std::string& _input);
etk::Color<double, 4> parseStringStartWithRGB(const std::string& _input);
etk::Color<uint32_t, 4> parseStringStartWithRGBUnsigned32(const std::string& _input);
etk::Color<uint16_t, 4> parseStringStartWithRGBUnsigned16(const std::string& _input);
etk::Color<uint8_t, 4> parseStringStartWithRGBUnsigned8(const std::string& _input);
etk::Color<uint8_t, 4> parseStringColorNamed(const std::string& _input);
template<> uint32_t Color<uint8_t, 4>::get() const;
template<typename MY_TYPE, int MY_TYPE_SIZE> uint32_t Color<MY_TYPE, MY_TYPE_SIZE>::get() const {
Color<uint8_t, 4> tmp(*this);
return tmp.get();
}
template<typename MY_TYPE, int MY_TYPE_SIZE> Color<MY_TYPE, MY_TYPE_SIZE>::Color(const std::string& _input) {
const char* inputData = _input.c_str();
size_t len = _input.size();
if( len >=1
&& inputData[0] == '#') {
Color<uint8_t, 4> value = etk::parseStringStartWithSharp(std::string(_input, 1));
*this = value;
} else if(std::start_with(_input, "rgb(", false) == true) {
Color<uint8_t, 4> value = etk::parseStringStartWithRGBGen(std::string(_input, 4, _input.size()-1));
*this = value;
} else if(std::start_with(_input, "rgb[FLOAT](", false) == true) {
Color<double, 4> value = etk::parseStringStartWithRGB(std::string(_input, 11, _input.size()-1));
*this = value;
} else if(std::start_with(_input, "rgb[DOUBLE](", false) == true) {
Color<double, 4> value = etk::parseStringStartWithRGB(std::string(_input, 12, _input.size()-1));
*this = value;
} else if(std::start_with(_input, "rgb[U32](", false) == true) {
Color<uint32_t, 4> value = etk::parseStringStartWithRGBUnsigned32(std::string(_input, 9, _input.size()-1));
*this = value;
} else if(std::start_with(_input, "rgb[U16](", false) == true) {
Color<uint16_t, 4> value = etk::parseStringStartWithRGBUnsigned16(std::string(_input, 9, _input.size()-1));
*this = value;
} else if(std::start_with(_input, "rgb[U8](", false) == true) {
Color<uint8_t, 4> value = etk::parseStringStartWithRGBUnsigned8(std::string(_input, 8, _input.size()-1));
*this = value;
} else {
Color<uint8_t, 4> value = etk::parseStringColorNamed(_input);
*this = value;
}
};
//! @not-in-doc //! @not-in-doc
std::ostream& operator <<(std::ostream& _os, const Color<uint8_t>& _obj); template<int MY_TYPE_SIZE> std::ostream& operator <<(std::ostream& _os, const Color<uint8_t, MY_TYPE_SIZE>& _obj) { // RGB & RGBA 8 bits
if (MY_TYPE_SIZE >= 3) {
_os << "#";
_os << (std::to_string<uint32_t, 2>(_obj.r(), std::hex)).c_str();
if (MY_TYPE_SIZE >= 2) {
_os << (std::to_string<uint32_t, 2>(_obj.g(), std::hex)).c_str();
}
if (MY_TYPE_SIZE >= 3) {
_os << (std::to_string<uint32_t, 2>(_obj.b(), std::hex)).c_str();
}
if (MY_TYPE_SIZE >= 4) {
_os << (std::to_string<uint32_t, 2>(_obj.a(), std::hex)).c_str();
}
} else {
if (MY_TYPE_SIZE >= 2) {
_os << "be";
} else {
_os << "Mono";
}
_os << "[U8](";
_os << "0x" << (std::to_string<uint32_t, 2>(_obj.r(), std::hex)).c_str();
if (MY_TYPE_SIZE >= 2) {
_os << ",";
_os << "0x" << (std::to_string<uint32_t, 2>(_obj.g(), std::hex)).c_str();
}
_os << ")";
}
return _os;
}
//! @not-in-doc //! @not-in-doc
std::ostream& operator <<(std::ostream& _os, const Color<float>& _obj); template<int MY_TYPE_SIZE> std::ostream& operator <<(std::ostream& _os, const Color<uint16_t, MY_TYPE_SIZE>& _obj) { // RGB & RGBA 8 bits
if (MY_TYPE_SIZE >= 4) {
_os << "rgba";
} else if (MY_TYPE_SIZE >= 3) {
_os << "rgb";
} else if (MY_TYPE_SIZE >= 2) {
_os << "be";
} else {
_os << "Mono";
}
_os << "[U16](";
_os << "0x" << (std::to_string<uint32_t, 4>(_obj.r(), std::hex)).c_str();
if (MY_TYPE_SIZE >= 2) {
_os << ",";
_os << "0x" << (std::to_string<uint32_t, 4>(_obj.g(), std::hex)).c_str();
}
if (MY_TYPE_SIZE >= 3) {
_os << ",";
_os << "0x" << (std::to_string<uint32_t, 4>(_obj.b(), std::hex)).c_str();
}
if (MY_TYPE_SIZE >= 4) {
_os << ",";
_os << "0x" << (std::to_string<uint32_t, 4>(_obj.a(), std::hex)).c_str();
}
_os << ")";
return _os;
}
//! @not-in-doc //! @not-in-doc
std::ostream& operator <<(std::ostream& _os, const std::vector<Color<uint8_t> >& _obj); template<int MY_TYPE_SIZE> std::ostream& operator <<(std::ostream& _os, const Color<uint32_t, MY_TYPE_SIZE>& _obj) { // RGB & RGBA 8 bits
if (MY_TYPE_SIZE >= 4) {
_os << "rgba";
} else if (MY_TYPE_SIZE >= 3) {
_os << "rgb";
} else if (MY_TYPE_SIZE >= 2) {
_os << "be";
} else {
_os << "Mono";
}
_os << "[U32](";
_os << "0x" << (std::to_string<uint32_t, 8>(_obj.r(), std::hex)).c_str();
if (MY_TYPE_SIZE >= 2) {
_os << ",";
_os << "0x" << (std::to_string<uint32_t, 8>(_obj.g(), std::hex)).c_str();
}
if (MY_TYPE_SIZE >= 3) {
_os << ",";
_os << "0x" << (std::to_string<uint32_t, 8>(_obj.b(), std::hex)).c_str();
}
if (MY_TYPE_SIZE >= 4) {
_os << ",";
_os << "0x" << (std::to_string<uint32_t, 8>(_obj.a(), std::hex)).c_str();
}
_os << ")";
return _os;
}
//! @not-in-doc //! @not-in-doc
std::ostream& operator <<(std::ostream& _os, const std::vector<Color<float> >& _obj); template<int MY_TYPE_SIZE> std::ostream& operator <<(std::ostream& _os, const Color<float, MY_TYPE_SIZE>& _obj) { // RGB float & RGBA float
if (MY_TYPE_SIZE >= 4) {
_os << "rgba";
} else if (MY_TYPE_SIZE >= 3) {
_os << "rgb";
} else if (MY_TYPE_SIZE >= 2) {
_os << "be";
} else {
_os << "Mono";
}
_os << "[FLOAT](";
_os << _obj.r();
if (MY_TYPE_SIZE >= 2) {
_os << ",";
_os << _obj.g();
}
if (MY_TYPE_SIZE >= 3) {
_os << ",";
_os << _obj.b();
}
if (MY_TYPE_SIZE >= 4) {
_os << ",";
_os << _obj.a();
}
_os << ")";
return _os;
}
//! @not-in-doc
template<int MY_TYPE_SIZE> std::ostream& operator <<(std::ostream& _os, const Color<double, MY_TYPE_SIZE>& _obj) { // RGB & RGBA 8 bits
if (MY_TYPE_SIZE >= 4) {
_os << "rgba";
} else if (MY_TYPE_SIZE >= 3) {
_os << "rgb";
} else if (MY_TYPE_SIZE >= 2) {
_os << "be";
} else {
_os << "Mono";
}
_os << "[double](";
_os << _obj.r();
if (MY_TYPE_SIZE >= 2) {
_os << ",";
_os << _obj.g();
}
if (MY_TYPE_SIZE >= 3) {
_os << ",";
_os << _obj.b();
}
if (MY_TYPE_SIZE >= 4) {
_os << ",";
_os << _obj.a();
}
_os << ")";
return _os;
}
//! @not-in-doc
template<typename MY_TYPE, int MY_TYPE_SIZE> std::ostream& operator <<(std::ostream& _os, const std::vector<Color<MY_TYPE, MY_TYPE_SIZE> >& _obj) {
for (size_t iii = 0; iii < _obj.size(); ++iii) {
if (iii != 0) {
_os << " ";
}
_os << _obj[iii];
}
return _os;
};
/** /**
* @brief List of all native define colors ... * @brief List of all native define colors ...
*/ */

View File

@ -194,8 +194,8 @@ template<class CLASS_TYPE> class RegExpNode {
* @param[in] _max The maximum appear time. * @param[in] _max The maximum appear time.
*/ */
void setMult(uint32_t _min, uint32_t _max) { void setMult(uint32_t _min, uint32_t _max) {
m_multipleMin = etk_max(_min, 0); m_multipleMin = std::max(_min, (uint32_t)0);
m_multipleMax = etk_max(_max, 1); m_multipleMax = std::max(_max, (uint32_t)1);
} }
protected: protected:
/** /**

View File

@ -130,7 +130,7 @@ namespace etk
{ {
if (m_size != obj.m_size) { if (m_size != obj.m_size) {
//TK_CRITICAL("add 2 Matrix with différent size ... ==> generate the max size of all the 2 matrix"); //TK_CRITICAL("add 2 Matrix with différent size ... ==> generate the max size of all the 2 matrix");
etk::Matrix<T> tmpMatrix(etk_max(m_size.x,obj.m_size.x), etk_max(m_size.y,obj.m_size.y)); etk::Matrix<T> tmpMatrix(std::max(m_size.x,obj.m_size.x), std::max(m_size.y,obj.m_size.y));
for (int32_t jjj=0; jjj< m_size.y; jjj++) { for (int32_t jjj=0; jjj< m_size.y; jjj++) {
T* tmpPointer = tmpMatrix[jjj]; T* tmpPointer = tmpMatrix[jjj];
T* tmpPointerIn = (*this)[jjj]; T* tmpPointerIn = (*this)[jjj];
@ -171,7 +171,7 @@ namespace etk
{ {
if (m_size != obj.m_size) { if (m_size != obj.m_size) {
//TK_CRITICAL("less 2 Matrix with différent size ... ==> generate the max size of all the 2 matrix"); //TK_CRITICAL("less 2 Matrix with différent size ... ==> generate the max size of all the 2 matrix");
etk::Matrix<T> tmpMatrix(etk_max(m_size.x,obj.m_size.x), etk_max(m_size.y,obj.m_size.y)); etk::Matrix<T> tmpMatrix(std::max(m_size.x,obj.m_size.x), std::max(m_size.y,obj.m_size.y));
for (int32_t jjj=0; jjj< m_size.y; jjj++) { for (int32_t jjj=0; jjj< m_size.y; jjj++) {
T* tmpPointer = tmpMatrix[jjj]; T* tmpPointer = tmpMatrix[jjj];
T* tmpPointerIn = (*this)[jjj]; T* tmpPointerIn = (*this)[jjj];
@ -459,7 +459,7 @@ namespace etk
void identity() void identity()
{ {
// copy data for the same size : // copy data for the same size :
for (int32_t iii=0; iii< etk_min(m_size.x, m_size.y); iii++) { for (int32_t iii=0; iii< std::mim(m_size.x, m_size.y); iii++) {
(*this)(iii,iii) = (T)1; (*this)(iii,iii) = (T)1;
} }
}; };

View File

@ -14,6 +14,8 @@
#include <sstream> #include <sstream>
#include <iostream> #include <iostream>
#include <string> #include <string>
#include <iomanip>
#include <algorithm>
namespace u32char { namespace u32char {
extern const char32_t Null; //!< '\0' extern const char32_t Null; //!< '\0'
@ -109,14 +111,22 @@ namespace std {
//! @previous //! @previous
std::u32string to_u32string(long double _val); std::u32string to_u32string(long double _val);
template<class T> std::string to_string(T t, std::ios_base & (*f)(std::ios_base&)) { template<class T, int size=0> std::string to_string(T t, std::ios_base & (*f)(std::ios_base&)) {
std::ostringstream oss; std::ostringstream oss;
if (size==0) {
oss << f << t; oss << f << t;
} else {
oss << std::setw(size) << std::setfill('0') << f << t;
}
return oss.str(); return oss.str();
} }
template<class T> std::u32string to_u32string(T t, std::ios_base & (*f)(std::ios_base&)) { template<class T, int size=0> std::u32string to_u32string(T t, std::ios_base & (*f)(std::ios_base&)) {
std::ostringstream oss; std::ostringstream oss;
if (size==0) {
oss << f << t; oss << f << t;
} else {
oss << std::setw(size) << std::setfill('0') << f << t;
}
return std::to_u32string(oss.str()); return std::to_u32string(oss.str());
} }
@ -209,6 +219,10 @@ namespace std {
void sort(std::vector<std::u32string *>& _list); void sort(std::vector<std::u32string *>& _list);
//! @previous //! @previous
void sort(std::vector<std::string *>& _list); void sort(std::vector<std::string *>& _list);
template <class T> const T& avg(const T& a, const T& b, const T& c) {
return std::min(std::max(a,b),c);
}
}; };
namespace std { namespace std {

View File

@ -40,11 +40,6 @@
#define UINT64_MAX (__UINT64_C(18446744073709551615)) #define UINT64_MAX (__UINT64_C(18446744073709551615))
#endif #endif
#endif #endif
#define etk_min(elemA,elemB) (((elemA)<(elemB)) ? (elemA) : (elemB))
#define etk_max(elemA,elemB) (((elemA)<(elemB)) ? (elemB) : (elemA))
#define etk_avg(minimim,elem,maximum) (((minimim)>(elem)) ? (minimim) : ((maximum)<(elem)) ? (maximum) : (elem))
#include <etk/stdTools.h> #include <etk/stdTools.h>
typedef float float_t; typedef float float_t;

View File

@ -14,6 +14,7 @@
#include <etk/os/FSNode.h> #include <etk/os/FSNode.h>
#include <etk/archive/Archive.h> #include <etk/archive/Archive.h>
#include <etk/log.h> #include <etk/log.h>
#include <etk/Color.h>
#undef __class__ #undef __class__
#define __class__ "etktest" #define __class__ "etktest"
@ -131,6 +132,62 @@ void testDimension() {
exit(0); exit(0);
} }
*/ */
void testColor() {
TK_INFO("==> test of COLOR (START)");
etk::Color<uint8_t, 4> colorRGBA8(0x52,0x0F, 0x65, 0x44);
etk::Color<uint16_t, 4> colorRGBA16(0x52,0x0F, 0x65, 0x44);
etk::Color<uint32_t, 4> colorRGBA32(0x52,0x0F, 0x65, 0x44);
etk::Color<float, 4> colorRGBAF(0.1,0.2, 0.8, 1.0);
etk::Color<uint8_t, 3> colorRGB8(0x52,0x0F, 0x65);
etk::Color<uint16_t, 3> colorRGB16(0x52,0x0F, 0x65);
etk::Color<uint32_t, 3> colorRGB32(0x52,0x0F, 0x65);
etk::Color<float, 3> colorRGBF(0.1,0.2, 0.8);
etk::Color<uint8_t, 1> colorMono8(0x52);
etk::Color<uint16_t, 1> colorMono16(0x52);
etk::Color<uint32_t, 1> colorMono32(0x52);
etk::Color<float, 1> colorMonoF(5200.22);
etk::Color<double, 1> colorMonoD(520000.22);
/*
etk::Color<uint8_t, 4> colorRGBA8__("#520F6544");
etk::Color<uint16_t, 4> colorRGBA16__("rgba(0x52, 0x0F, 0x65, 0x44)");
etk::Color<uint32_t, 4> colorRGBA32__("rgba(0x52,0x0F, 0x65, 0x44)");
etk::Color<float, 4> colorRGBAF__("rgba(0.1,0.2, 0.8, 1.0)");
etk::Color<uint8_t, 3> colorRGB8__("rgba(0x52,0x0F, 0x65)");
etk::Color<uint16_t, 3> colorRGB16__("rgba(0x52,0x0F, 0x65)");
etk::Color<uint32_t, 3> colorRGB32__("rgba(0x52,0x0F, 0x65)");
etk::Color<float, 3> colorRGBF__("rgba(0.1,0.2, 0.8)");
etk::Color<uint8_t, 1> colorMono8__("mono(0x52)");
etk::Color<uint16_t, 1> colorMono16__("mono(0x52)");
etk::Color<uint32_t, 1> colorMono32__("mono(0x52)");
etk::Color<float, 1> colorMonoF__("mono(5200.22)");
etk::Color<double, 1> colorMonoD__("mono(520000.22)");
*/
etk::Color<float, 4> colorRGBAf__(colorRGBA8);
etk::Color<uint32_t, 2> colorXX332__(colorRGBA8);
TK_INFO("Create a color : RGBA 8 : " << colorRGBA8);
TK_INFO("Create a color : RGBA 8 : " << colorRGBAf__ << " (converted)");
TK_INFO("Create a color : XX 32 : " << colorXX332__ << " (converted)");
TK_INFO("Create a color : RGBA 16 : " << colorRGBA16);
TK_INFO("Create a color : RGBA 32 : " << colorRGBA32);
TK_INFO("Create a color : RGBA float : " << colorRGBAF);
TK_INFO("Create a color : RGB 8 : " << colorRGB8);
TK_INFO("Create a color : RGB 16 : " << colorRGB16);
TK_INFO("Create a color : RGB 32 : " << colorRGB32);
TK_INFO("Create a color : RGB float : " << colorRGBF);
TK_INFO("Create a color : MONO 8 : " << colorMono8);
TK_INFO("Create a color : MONO 16 : " << colorMono16);
TK_INFO("Create a color : MONO 32 : " << colorMono32);
TK_INFO("Create a color : MONO float : " << colorMonoF);
TK_INFO("Create a color : MONO double : " << colorMonoD);
TK_INFO("==> test of Color (STOP)");
exit(0);
}
int main(int argc, const char *argv[]) { int main(int argc, const char *argv[]) {
// the only one init for etk: // the only one init for etk:
etk::log::setLevel(etk::log::logLevelDebug); etk::log::setLevel(etk::log::logLevelDebug);
@ -143,6 +200,7 @@ int main(int argc, const char *argv[]) {
testFSNode(); testFSNode();
//testDimension(); //testDimension();
testArchive(); testArchive();
testColor();
return 0; return 0;
} }