diff --git a/Sources/libagg b/Sources/libagg index 7d902650..6f05d8dc 160000 --- a/Sources/libagg +++ b/Sources/libagg @@ -1 +1 @@ -Subproject commit 7d902650c3195ccd5e6d71daf0d7aa1908fa0fab +Subproject commit 6f05d8dc715c3a8c022def84d63bed8bc255ca8d diff --git a/Sources/libetk/etk/Color.cpp b/Sources/libetk/etk/Color.cpp deleted file mode 100644 index 4931553a..00000000 --- a/Sources/libetk/etk/Color.cpp +++ /dev/null @@ -1,609 +0,0 @@ -/** - ******************************************************************************* - * @file etk/Color.h - * @brief Ewol Tool Kit : basic colors - * @author Edouard DUPIN - * @date 23/04/2012 - * @par Project - * Ewol TK - * - * @par Copyright - * Copyright 2011 Edouard DUPIN, all right reserved - * - * This software is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY. - * - * Licence summary : - * You can modify and redistribute the sources code and binaries. - * You can send me the bug-fix - * - * Term of the licence in in the file licence.txt. - * - ******************************************************************************* - */ - -#include -#include -#include -#include - - -const etk::Color etk::color::none((uint32_t)0x00000000); -const etk::Color etk::color::aliceBlue((uint32_t)0xF0F8FFFF); -const etk::Color etk::color::antiqueWhite((uint32_t)0xFAEBD7FF); -const etk::Color etk::color::aqua((uint32_t)0x00FFFFFF); -const etk::Color etk::color::aquamarine((uint32_t)0x7FFFD4FF); -const etk::Color etk::color::azure((uint32_t)0xF0FFFFFF); -const etk::Color etk::color::beige((uint32_t)0xF5F5DCFF); -const etk::Color etk::color::bisque((uint32_t)0xFFE4C4FF); -const etk::Color etk::color::black((uint32_t)0x000000FF); -const etk::Color etk::color::blanchedAlmond((uint32_t)0xFFEBCDFF); -const etk::Color etk::color::blue((uint32_t)0x0000FFFF); -const etk::Color etk::color::blueViolet((uint32_t)0x8A2BE2FF); -const etk::Color etk::color::brown((uint32_t)0xA52A2AFF); -const etk::Color etk::color::burlyWood((uint32_t)0xDEB887FF); -const etk::Color etk::color::cadetBlue((uint32_t)0x5F9EA0FF); -const etk::Color etk::color::chartreuse((uint32_t)0x7FFF00FF); -const etk::Color etk::color::chocolate((uint32_t)0xD2691EFF); -const etk::Color etk::color::coral((uint32_t)0xFF7F50FF); -const etk::Color etk::color::cornflowerBlue((uint32_t)0x6495EDFF); -const etk::Color etk::color::cornsilk((uint32_t)0xFFF8DCFF); -const etk::Color etk::color::crimson((uint32_t)0xDC143CFF); -const etk::Color etk::color::cyan((uint32_t)0x00FFFFFF); -const etk::Color etk::color::darkBlue((uint32_t)0x00008BFF); -const etk::Color etk::color::darkCyan((uint32_t)0x008B8BFF); -const etk::Color etk::color::darkGoldenRod((uint32_t)0xB8860BFF); -const etk::Color etk::color::darkGray((uint32_t)0xA9A9A9FF); -const etk::Color etk::color::darkGrey((uint32_t)0xA9A9A9FF); -const etk::Color etk::color::darkGreen((uint32_t)0x006400FF); -const etk::Color etk::color::darkKhaki((uint32_t)0xBDB76BFF); -const etk::Color etk::color::darkMagenta((uint32_t)0x8B008BFF); -const etk::Color etk::color::darkOliveGreen((uint32_t)0x556B2FFF); -const etk::Color etk::color::darkorange((uint32_t)0xFF8C00FF); -const etk::Color etk::color::darkOrchid((uint32_t)0x9932CCFF); -const etk::Color etk::color::darkRed((uint32_t)0x8B0000FF); -const etk::Color etk::color::darkSalmon((uint32_t)0xE9967AFF); -const etk::Color etk::color::darkSeaGreen((uint32_t)0x8FBC8FFF); -const etk::Color etk::color::darkSlateBlue((uint32_t)0x483D8BFF); -const etk::Color etk::color::darkSlateGray((uint32_t)0x2F4F4FFF); -const etk::Color etk::color::darkSlateGrey((uint32_t)0x2F4F4FFF); -const etk::Color etk::color::darkTurquoise((uint32_t)0x00CED1FF); -const etk::Color etk::color::darkViolet((uint32_t)0x9400D3FF); -const etk::Color etk::color::deepPink((uint32_t)0xFF1493FF); -const etk::Color etk::color::deepSkyBlue((uint32_t)0x00BFFFFF); -const etk::Color etk::color::dimGray((uint32_t)0x696969FF); -const etk::Color etk::color::dimGrey((uint32_t)0x696969FF); -const etk::Color etk::color::dodgerBlue((uint32_t)0x1E90FFFF); -const etk::Color etk::color::fireBrick((uint32_t)0xB22222FF); -const etk::Color etk::color::floralWhite((uint32_t)0xFFFAF0FF); -const etk::Color etk::color::forestGreen((uint32_t)0x228B22FF); -const etk::Color etk::color::fuchsia((uint32_t)0xFF00FFFF); -const etk::Color etk::color::gainsboro((uint32_t)0xDCDCDCFF); -const etk::Color etk::color::ghostWhite((uint32_t)0xF8F8FFFF); -const etk::Color etk::color::gold((uint32_t)0xFFD700FF); -const etk::Color etk::color::goldenRod((uint32_t)0xDAA520FF); -const etk::Color etk::color::gray((uint32_t)0x808080FF); -const etk::Color etk::color::grey((uint32_t)0x808080FF); -const etk::Color etk::color::green((uint32_t)0x008000FF); -const etk::Color etk::color::greenYellow((uint32_t)0xADFF2FFF); -const etk::Color etk::color::honeyDew((uint32_t)0xF0FFF0FF); -const etk::Color etk::color::hotPink((uint32_t)0xFF69B4FF); -const etk::Color etk::color::indianRed ((uint32_t)0xCD5C5CFF); -const etk::Color etk::color::indigo ((uint32_t)0x4B0082FF); -const etk::Color etk::color::ivory((uint32_t)0xFFFFF0FF); -const etk::Color etk::color::khaki((uint32_t)0xF0E68CFF); -const etk::Color etk::color::lavender((uint32_t)0xE6E6FAFF); -const etk::Color etk::color::lavenderBlush((uint32_t)0xFFF0F5FF); -const etk::Color etk::color::lawnGreen((uint32_t)0x7CFC00FF); -const etk::Color etk::color::lemonChiffon((uint32_t)0xFFFACDFF); -const etk::Color etk::color::lightBlue((uint32_t)0xADD8E6FF); -const etk::Color etk::color::lightCoral((uint32_t)0xF08080FF); -const etk::Color etk::color::lightCyan((uint32_t)0xE0FFFFFF); -const etk::Color etk::color::lightGoldenRodYellow((uint32_t)0xFAFAD2FF); -const etk::Color etk::color::lightGray((uint32_t)0xD3D3D3FF); -const etk::Color etk::color::lightGrey((uint32_t)0xD3D3D3FF); -const etk::Color etk::color::lightGreen((uint32_t)0x90EE90FF); -const etk::Color etk::color::lightPink((uint32_t)0xFFB6C1FF); -const etk::Color etk::color::lightSalmon((uint32_t)0xFFA07AFF); -const etk::Color etk::color::lightSeaGreen((uint32_t)0x20B2AAFF); -const etk::Color etk::color::lightSkyBlue((uint32_t)0x87CEFAFF); -const etk::Color etk::color::lightSlateGray((uint32_t)0x778899FF); -const etk::Color etk::color::lightSlateGrey((uint32_t)0x778899FF); -const etk::Color etk::color::lightSteelBlue((uint32_t)0xB0C4DEFF); -const etk::Color etk::color::lightYellow((uint32_t)0xFFFFE0FF); -const etk::Color etk::color::lime((uint32_t)0x00FF00FF); -const etk::Color etk::color::limeGreen((uint32_t)0x32CD32FF); -const etk::Color etk::color::linen((uint32_t)0xFAF0E6FF); -const etk::Color etk::color::magenta((uint32_t)0xFF00FFFF); -const etk::Color etk::color::maroon((uint32_t)0x800000FF); -const etk::Color etk::color::mediumAquaMarine((uint32_t)0x66CDAAFF); -const etk::Color etk::color::mediumBlue((uint32_t)0x0000CDFF); -const etk::Color etk::color::mediumOrchid((uint32_t)0xBA55D3FF); -const etk::Color etk::color::mediumPurple((uint32_t)0x9370D8FF); -const etk::Color etk::color::mediumSeaGreen((uint32_t)0x3CB371FF); -const etk::Color etk::color::mediumSlateBlue((uint32_t)0x7B68EEFF); -const etk::Color etk::color::mediumSpringGreen((uint32_t)0x00FA9AFF); -const etk::Color etk::color::mediumTurquoise((uint32_t)0x48D1CCFF); -const etk::Color etk::color::mediumVioletRed((uint32_t)0xC71585FF); -const etk::Color etk::color::midnightBlue((uint32_t)0x191970FF); -const etk::Color etk::color::mintCream((uint32_t)0xF5FFFAFF); -const etk::Color etk::color::mistyRose((uint32_t)0xFFE4E1FF); -const etk::Color etk::color::moccasin((uint32_t)0xFFE4B5FF); -const etk::Color etk::color::navajoWhite((uint32_t)0xFFDEADFF); -const etk::Color etk::color::navy((uint32_t)0x000080FF); -const etk::Color etk::color::oldLace((uint32_t)0xFDF5E6FF); -const etk::Color etk::color::olive((uint32_t)0x808000FF); -const etk::Color etk::color::oliveDrab((uint32_t)0x6B8E23FF); -const etk::Color etk::color::orange((uint32_t)0xFFA500FF); -const etk::Color etk::color::orangeRed((uint32_t)0xFF4500FF); -const etk::Color etk::color::orchid((uint32_t)0xDA70D6FF); -const etk::Color etk::color::paleGoldenRod((uint32_t)0xEEE8AAFF); -const etk::Color etk::color::paleGreen((uint32_t)0x98FB98FF); -const etk::Color etk::color::paleTurquoise((uint32_t)0xAFEEEEFF); -const etk::Color etk::color::paleVioletRed((uint32_t)0xD87093FF); -const etk::Color etk::color::papayaWhip((uint32_t)0xFFEFD5FF); -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); - - -typedef struct { - const char * colorName; - etk::Color color; -} colorList_ts; - -static const colorList_ts listOfColor[] = { - { "none", etk::color::none}, - { "AliceBlue", etk::color::aliceBlue}, - { "AntiqueWhite", etk::color::antiqueWhite}, - { "Aqua", etk::color::aqua}, - { "Aquamarine", etk::color::aquamarine}, - { "Azure", etk::color::azure}, - { "Beige", etk::color::beige}, - { "Bisque", etk::color::bisque}, - { "Black", etk::color::black}, - { "BlanchedAlmond", etk::color::blanchedAlmond}, - { "Blue", etk::color::blue}, - { "BlueViolet", etk::color::blueViolet}, - { "Brown", etk::color::brown}, - { "BurlyWood", etk::color::burlyWood}, - { "CadetBlue", etk::color::cadetBlue}, - { "Chartreuse", etk::color::chartreuse}, - { "Chocolate", etk::color::chocolate}, - { "Coral", etk::color::coral}, - { "CornflowerBlue", etk::color::cornflowerBlue}, - { "Cornsilk", etk::color::cornsilk}, - { "Crimson", etk::color::crimson}, - { "Cyan", etk::color::cyan}, - { "DarkBlue", etk::color::darkBlue}, - { "DarkCyan", etk::color::darkCyan}, - { "DarkGoldenRod", etk::color::darkGoldenRod}, - { "DarkGray", etk::color::darkGray}, - { "DarkGrey", etk::color::darkGrey}, - { "DarkGreen", etk::color::darkGreen}, - { "DarkKhaki", etk::color::darkKhaki}, - { "DarkMagenta", etk::color::darkMagenta}, - { "DarkOliveGreen", etk::color::darkOliveGreen}, - { "Darkorange", etk::color::darkorange}, - { "DarkOrchid", etk::color::darkOrchid}, - { "DarkRed", etk::color::darkRed}, - { "DarkSalmon", etk::color::darkSalmon}, - { "DarkSeaGreen", etk::color::darkSeaGreen}, - { "DarkSlateBlue", etk::color::darkSlateBlue}, - { "DarkSlateGray", etk::color::darkSlateGray}, - { "DarkSlateGrey", etk::color::darkSlateGrey}, - { "DarkTurquoise", etk::color::darkTurquoise}, - { "DarkViolet", etk::color::darkViolet}, - { "DeepPink", etk::color::deepPink}, - { "DeepSkyBlue", etk::color::deepSkyBlue}, - { "DimGray", etk::color::dimGray}, - { "DimGrey", etk::color::dimGrey}, - { "DodgerBlue", etk::color::dodgerBlue}, - { "FireBrick", etk::color::fireBrick}, - { "FloralWhite", etk::color::floralWhite}, - { "ForestGreen", etk::color::forestGreen}, - { "Fuchsia", etk::color::fuchsia}, - { "Gainsboro", etk::color::gainsboro}, - { "GhostWhite", etk::color::ghostWhite}, - { "Gold", etk::color::gold}, - { "GoldenRod", etk::color::goldenRod}, - { "Gray", etk::color::gray}, - { "Grey", etk::color::grey}, - { "Green", etk::color::green}, - { "GreenYellow", etk::color::greenYellow}, - { "HoneyDew", etk::color::honeyDew}, - { "HotPink", etk::color::hotPink}, - { "IndianRed", etk::color::indianRed}, - { "Indigo", etk::color::indigo}, - { "Ivory", etk::color::ivory}, - { "Khaki", etk::color::khaki}, - { "Lavender", etk::color::lavender}, - { "LavenderBlush", etk::color::lavenderBlush}, - { "LawnGreen", etk::color::lawnGreen}, - { "LemonChiffon", etk::color::lemonChiffon}, - { "LightBlue", etk::color::lightBlue}, - { "LightCoral", etk::color::lightCoral}, - { "LightCyan", etk::color::lightCyan}, - { "LightGoldenRodYellow", etk::color::lightGoldenRodYellow}, - { "LightGray", etk::color::lightGray}, - { "LightGrey", etk::color::lightGrey}, - { "LightGreen", etk::color::lightGreen}, - { "LightPink", etk::color::lightPink}, - { "LightSalmon", etk::color::lightSalmon}, - { "LightSeaGreen", etk::color::lightSeaGreen}, - { "LightSkyBlue", etk::color::lightSkyBlue}, - { "LightSlateGray", etk::color::lightSlateGray}, - { "LightSlateGrey", etk::color::lightSlateGrey}, - { "LightSteelBlue", etk::color::lightSteelBlue}, - { "LightYellow", etk::color::lightYellow}, - { "Lime", etk::color::lime}, - { "LimeGreen", etk::color::limeGreen}, - { "Linen", etk::color::linen}, - { "Magenta", etk::color::magenta}, - { "Maroon", etk::color::maroon}, - { "MediumAquaMarine", etk::color::mediumAquaMarine}, - { "MediumBlue", etk::color::mediumBlue}, - { "MediumOrchid", etk::color::mediumOrchid}, - { "MediumPurple", etk::color::mediumPurple}, - { "MediumSeaGreen", etk::color::mediumSeaGreen}, - { "MediumSlateBlue", etk::color::mediumSlateBlue}, - { "MediumSpringGreen", etk::color::mediumSpringGreen}, - { "MediumTurquoise", etk::color::mediumTurquoise}, - { "MediumVioletRed", etk::color::mediumVioletRed}, - { "MidnightBlue", etk::color::midnightBlue}, - { "MintCream", etk::color::mintCream}, - { "MistyRose", etk::color::mistyRose}, - { "Moccasin", etk::color::moccasin}, - { "NavajoWhite", etk::color::navajoWhite}, - { "Navy", etk::color::navy}, - { "OldLace", etk::color::oldLace}, - { "Olive", etk::color::olive}, - { "OliveDrab", etk::color::oliveDrab}, - { "Orange", etk::color::orange}, - { "OrangeRed", etk::color::orangeRed}, - { "Orchid", etk::color::orchid}, - { "PaleGoldenRod", etk::color::paleGoldenRod}, - { "PaleGreen", etk::color::paleGreen}, - { "PaleTurquoise", etk::color::paleTurquoise}, - { "PaleVioletRed", etk::color::paleVioletRed}, - { "PapayaWhip", etk::color::papayaWhip}, - { "PeachPuff", etk::color::peachPuff}, - { "Peru", etk::color::peru}, - { "Pink", etk::color::pink}, - { "Plum", etk::color::plum}, - { "PowderBlue", etk::color::powderBlue}, - { "Purple", etk::color::purple}, - { "Red", etk::color::red}, - { "RosyBrown", etk::color::rosyBrown}, - { "RoyalBlue", etk::color::royalBlue}, - { "SaddleBrown", etk::color::saddleBrown}, - { "Salmon", etk::color::salmon}, - { "SandyBrown", etk::color::sandyBrown}, - { "SeaGreen", etk::color::seaGreen}, - { "SeaShell", etk::color::seaShell}, - { "Sienna", etk::color::sienna}, - { "Silver", etk::color::silver}, - { "SkyBlue", etk::color::skyBlue}, - { "SlateBlue", etk::color::slateBlue}, - { "SlateGray", etk::color::slateGray}, - { "SlateGrey", etk::color::slateGrey}, - { "Snow", etk::color::snow}, - { "SpringGreen", etk::color::springGreen}, - { "SteelBlue", etk::color::steelBlue}, - { "Tan", etk::color::tan}, - { "Teal", etk::color::teal}, - { "Thistle", etk::color::thistle}, - { "Tomato", etk::color::tomato}, - { "Turquoise", etk::color::turquoise}, - { "Violet", etk::color::violet}, - { "Wheat", etk::color::wheat}, - { "White", etk::color::white}, - { "WhiteSmoke", etk::color::whiteSmoke}, - { "Yellow", etk::color::yellow}, - { "YellowGreen", etk::color::yellowGreen} -}; -static const int32_t listOfColorSize = sizeof(listOfColor) / sizeof(colorList_ts); - - -etk::Color::Color(void) -{ - red = 0xFF; - green = 0xFF; - blue = 0xFF; - alpha = 0xFF; -} - -etk::Color::Color(const uint32_t _input) -{ - red = (uint8_t)((_input&0xFF000000)>>24); - green = (uint8_t)((_input&0x00FF0000)>>16); - blue = (uint8_t)((_input&0x0000FF00)>>8); - alpha = (uint8_t)((_input&0x000000FF)); -} - -uint32_t etk::Color::Get(void) const -{ - uint32_t directData = red<<24; - directData += green<<16; - directData += blue<<8; - directData += alpha; - return directData; -}; - - -etk::Color::Color(const etk::Color& data) -{ - if( this != &data ) { - red = data.red; - green = data.green; - blue = data.blue; - alpha = data.alpha; - } -} - - - -etk::Color::Color(float _red, float _green, float _blue, float _alpha) -{ - _red = etk_avg(0.0, _red, 1.0); - _green = etk_avg(0.0, _green, 1.0); - _blue = etk_avg(0.0, _blue, 1.0); - _alpha = etk_avg(0.0, _alpha, 1.0); - red = (uint8_t)(_red*256.0); - green = (uint8_t)(_green*256.0); - blue = (uint8_t)(_blue*256.0); - alpha = (uint8_t)(_alpha*256.0); -} - - -etk::Color::Color(uint8_t _red, uint8_t _green, uint8_t _blue, uint8_t _alpha) -{ - red = _red; - green = _green; - blue = _blue; - alpha = _alpha; -} - - -etk::Color::Color(const char * _input) -{ - etk::UString tmpVal = _input; - Set(tmpVal); -} -etk::Color::Color(etk::UString _input) -{ - Set(_input); -} - -void etk::Color::Set(etk::UString _input) -{ - const char * inputData = _input.c_str(); - - *this = etk::color::white; - - uint32_t _red, _green, _blue, _alpha; - float fred, fgreen, fblue, falpha; - size_t len = strlen(inputData); - - if( len >=1 - && inputData[0] == '#') { - if(len == 4) { - if (sscanf(inputData + 1, "%1x%1x%1x", &red, &green, &blue) == 3) { - red = (red | red << 4); - green= (green | green << 4); - blue = (blue | blue << 4); - } else { - TK_ERROR(" pb in parsing the color : \"" << inputData << "\""); - } - } else if (len==5) { - if (sscanf(inputData + 1, "%1x%1x%1x%1x", &_red, &_green, &_blue, &_alpha) == 4) { - red = (_red | _red << 4); - green = (_green | _green << 4); - blue = (_blue | _blue << 4); - alpha = (_alpha | _alpha << 4); - } else { - TK_ERROR(" pb in parsing the color : \"" << inputData << "\""); - } - } else if (len == 7) { - if (sscanf(inputData + 1, "%2x%2x%2x", &_red, &_green, &_blue) == 3) { - red = _red; - green= _green; - blue = _blue; - } else { - TK_ERROR(" pb in parsing the color : \"" << inputData << "\""); - } - } else if (len == 9) { - if (sscanf(inputData + 1, "%2x%2x%2x%2x", &_red, &_green, &_blue, &_alpha) == 4) { - red = _red; - green= _green; - blue = _blue; - alpha = _alpha; - } else { - TK_ERROR(" pb in parsing the color : \"" << inputData << "\""); - } - } else { - TK_ERROR(" pb in parsing the color : \"" << inputData << "\" ==> unknown methode ..."); - } - } else if( 4 <= len - && inputData[0] == 'r' - && inputData[1] == 'g' - && inputData[2] == 'b' - && inputData[3] == '(' ) { - if (sscanf(inputData + 4, "%u,%u,%u,%u", &_red, &_green, &_blue, &_alpha) == 4) { - red = etk_min(0xFF, _red); - green= etk_min(0xFF, _green); - blue = etk_min(0xFF, _blue); - alpha = etk_min(0xFF, _alpha); - } else if (sscanf(inputData + 4, "%u,%u,%u", &_red, &_green, &_blue) == 3) { - red = etk_min(0xFF, _red); - green= etk_min(0xFF, _green); - blue = etk_min(0xFF, _blue); - } else if (sscanf(inputData + 4, "%f%%,%f%%,%f%%,%f%%", &fred, &fgreen, &fblue, &falpha) == 4) { - fred = etk_avg(0.0, fred, 1.0); - fgreen= etk_avg(0.0, fgreen, 1.0); - fblue = etk_avg(0.0, fblue, 1.0); - falpha = etk_avg(0.0, falpha, 1.0); - red = (uint8_t)(fred * 255.); - green= (uint8_t)(fgreen * 255.); - blue = (uint8_t)(fblue * 255.); - alpha = (uint8_t)(falpha * 255.); - } else if (sscanf(inputData + 4, "%f%%,%f%%,%f%%", &fred, &fgreen, &fblue) == 3) { - fred = etk_avg(0.0, fred, 1.0); - fgreen= etk_avg(0.0, fgreen, 1.0); - fblue = etk_avg(0.0, fblue, 1.0); - red = (uint8_t)(fred * 255.); - green= (uint8_t)(fgreen * 255.); - blue = (uint8_t)(fblue * 255.); - } else { - TK_ERROR(" pb in parsing the color : \"" << inputData << "\" ==> unknown methode ..."); - } - } else { - bool findIt = false; - // direct named color ... - for (int32_t iii=0; iii " << *this); -} - -etk::CCout& etk::operator <<(etk::CCout &os, const etk::Color &obj) -{ - char tmpData[256]; - snprintf(tmpData, 256, "#%02X%02X%02X%02X", obj.red, obj.green, obj.blue, obj.alpha); - os << tmpData; - return os; -} - -etk::Color etk::Color::operator *(const etk::Color& _input) -{ - etk::Color tmp(*this); - tmp *= _input; - return tmp; -} - -etk::Color etk::Color::operator +(const etk::Color& _input) -{ - etk::Color tmp(*this); - tmp += _input; - return tmp; -} - -etk::Color etk::Color::operator -(const etk::Color& _input) -{ - etk::Color tmp(*this); - tmp -= _input; - return tmp; -} - -etk::Color& etk::Color::operator *=(const etk::Color& _input) -{ - red = (int32_t)red * (int32_t)_input.red / 255; - green = (int32_t)green * (int32_t)_input.green / 255; - blue = (int32_t)blue * (int32_t)_input.blue / 255; - alpha = (int32_t)alpha * (int32_t)_input.alpha / 255; - return *this; -} - -etk::Color& etk::Color::operator +=(const etk::Color& _input) -{ - red = etk_min((int32_t)red + (int32_t)_input.red, 255); - green = etk_min((int32_t)green + (int32_t)_input.green, 255); - blue = etk_min((int32_t)blue + (int32_t)_input.blue, 255); - alpha = etk_min((int32_t)alpha + (int32_t)_input.alpha, 255); - return *this; -} - -etk::Color& etk::Color::operator -=(const etk::Color& _input) -{ - red = etk_min((int32_t)red - (int32_t)_input.red, 255); - green = etk_min((int32_t)green - (int32_t)_input.green, 255); - blue = etk_min((int32_t)blue - (int32_t)_input.blue, 255); - alpha = etk_min((int32_t)alpha - (int32_t)_input.alpha, 255); - return *this; -} - -etk::Color& etk::Color::operator= (const etk::Color &_input ) -{ - //TK_INFO("OPERATOR de recopie"); - if( this != &_input ) { - red = _input.red; - green = _input.green; - blue = _input.blue; - alpha = _input.alpha; - } - return *this; -} - - -etk::Color& etk::Color::operator= (const uint32_t _input ) -{ - red = (uint8_t)((_input&0xFF000000)>>24); - green = (uint8_t)((_input&0x00FF0000)>>16); - blue = (uint8_t)((_input&0x0000FF00)>>8); - alpha = (uint8_t)((_input&0x000000FF)); - return *this; -} - -bool etk::Color::operator==(const Color& _input) const -{ - if( red != _input.red - || green != _input.green - || blue != _input.blue - || alpha != _input.alpha ) { - return false; - } - return true; -} - -bool etk::Color::operator!=(const Color& _input) const -{ - if( red != _input.red - || green != _input.green - || blue != _input.blue - || alpha != _input.alpha ) { - return true; - } - return false; -} - diff --git a/Sources/libetk/etk/Color.h b/Sources/libetk/etk/Color.h deleted file mode 100644 index 27ad83d2..00000000 --- a/Sources/libetk/etk/Color.h +++ /dev/null @@ -1,228 +0,0 @@ -/** - ******************************************************************************* - * @file etk/Color.h - * @brief Ewol Tool Kit : basic colors - * @author Edouard DUPIN - * @date 23/04/2012 - * @par Project - * Ewol TK - * - * @par Copyright - * Copyright 2011 Edouard DUPIN, all right reserved - * - * This software is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY. - * - * Licence summary : - * You can modify and redistribute the sources code and binaries. - * You can send me the bug-fix - * - * Term of the licence in in the file licence.txt. - * - ******************************************************************************* - */ - -#ifndef __ETK_COLOR_H__ -#define __ETK_COLOR_H__ - -#include - -#ifndef __ETK_USTRING_H__ - namespace etk { - class UString; - }; -#endif - -namespace etk { - - class Color { - public: - uint8_t red; - uint8_t green; - uint8_t blue; - uint8_t alpha; - // constructor : - Color(void); - Color(const etk::Color& data); - Color(const uint32_t data); - Color(uint8_t _red, uint8_t _green, uint8_t _blue, uint8_t _alpha = 255); - Color(float _red, float _green, float _blue, float _alpha = 1.0); - Color(etk::UString data); - Color(const char * data); - // operator : - etk::Color operator *(const etk::Color& _input); - etk::Color operator +(const etk::Color& _input); - etk::Color operator -(const etk::Color& _input); - etk::Color& operator *=(const etk::Color& _input); - etk::Color& operator +=(const etk::Color& _input); - etk::Color& operator -=(const etk::Color& _input); - - etk::Color& operator=(const uint32_t _input); - etk::Color& operator=(const etk::Color& _input); - bool operator==(const etk::Color& _input) const; - bool operator!=(const etk::Color& _input) const; - // access : - void Set(etk::UString _input); - uint32_t Get(void) const; - /***************************************************** - * Cout << operator - *****************************************************/ - friend etk::CCout& operator <<( etk::CCout &os,const etk::Color &obj); - }; - - etk::CCout& operator <<(etk::CCout &os, const etk::Color &obj); - - namespace color { - extern const Color none; - extern const Color aliceBlue; - extern const Color antiqueWhite; - extern const Color aqua; - extern const Color aquamarine; - extern const Color azure; - extern const Color beige; - extern const Color bisque; - extern const Color black; - extern const Color blanchedAlmond; - extern const Color blue; - extern const Color blueViolet; - extern const Color brown; - extern const Color burlyWood; - extern const Color cadetBlue; - extern const Color chartreuse; - extern const Color chocolate; - extern const Color coral; - extern const Color cornflowerBlue; - extern const Color cornsilk; - extern const Color crimson; - extern const Color cyan; - extern const Color darkBlue; - extern const Color darkCyan; - extern const Color darkGoldenRod; - extern const Color darkGray; - extern const Color darkGrey; - extern const Color darkGreen; - extern const Color darkKhaki; - extern const Color darkMagenta; - extern const Color darkOliveGreen; - extern const Color darkorange; - extern const Color darkOrchid; - extern const Color darkRed; - extern const Color darkSalmon; - extern const Color darkSeaGreen; - extern const Color darkSlateBlue; - extern const Color darkSlateGray; - extern const Color darkSlateGrey; - extern const Color darkTurquoise; - extern const Color darkViolet; - extern const Color deepPink; - extern const Color deepSkyBlue; - extern const Color dimGray; - extern const Color dimGrey; - extern const Color dodgerBlue; - extern const Color fireBrick; - extern const Color floralWhite; - extern const Color forestGreen; - extern const Color fuchsia; - extern const Color gainsboro; - extern const Color ghostWhite; - extern const Color gold; - extern const Color goldenRod; - extern const Color gray; - extern const Color grey; - extern const Color green; - extern const Color greenYellow; - extern const Color honeyDew; - extern const Color hotPink; - extern const Color indianRed; - extern const Color indigo; - extern const Color ivory; - extern const Color khaki; - extern const Color lavender; - extern const Color lavenderBlush; - extern const Color lawnGreen; - extern const Color lemonChiffon; - extern const Color lightBlue; - extern const Color lightCoral; - extern const Color lightCyan; - extern const Color lightGoldenRodYellow; - extern const Color lightGray; - extern const Color lightGrey; - extern const Color lightGreen; - extern const Color lightPink; - extern const Color lightSalmon; - extern const Color lightSeaGreen; - extern const Color lightSkyBlue; - extern const Color lightSlateGray; - extern const Color lightSlateGrey; - extern const Color lightSteelBlue; - extern const Color lightYellow; - extern const Color lime; - extern const Color limeGreen; - extern const Color linen; - extern const Color magenta; - extern const Color maroon; - extern const Color mediumAquaMarine; - extern const Color mediumBlue; - extern const Color mediumOrchid; - extern const Color mediumPurple; - extern const Color mediumSeaGreen; - extern const Color mediumSlateBlue; - extern const Color mediumSpringGreen; - extern const Color mediumTurquoise; - extern const Color mediumVioletRed; - extern const Color midnightBlue; - extern const Color mintCream; - extern const Color mistyRose; - extern const Color moccasin; - extern const Color navajoWhite; - extern const Color navy; - extern const Color oldLace; - extern const Color olive; - extern const Color oliveDrab; - extern const Color orange; - extern const Color orangeRed; - extern const Color orchid; - extern const Color paleGoldenRod; - extern const Color paleGreen; - extern const Color paleTurquoise; - extern const Color paleVioletRed; - extern const Color papayaWhip; - extern const Color peachPuff; - extern const Color peru; - extern const Color pink; - extern const Color plum; - extern const Color powderBlue; - extern const Color purple; - extern const Color red; - extern const Color rosyBrown; - extern const Color royalBlue; - extern const Color saddleBrown; - extern const Color salmon; - extern const Color sandyBrown; - extern const Color seaGreen; - extern const Color seaShell; - extern const Color sienna; - extern const Color silver; - extern const Color skyBlue; - extern const Color slateBlue; - extern const Color slateGray; - extern const Color slateGrey; - extern const Color snow; - extern const Color springGreen; - extern const Color steelBlue; - extern const Color tan; - extern const Color teal; - extern const Color thistle; - extern const Color tomato; - extern const Color turquoise; - extern const Color violet; - extern const Color wheat; - extern const Color white; - extern const Color whiteSmoke; - extern const Color yellow; - extern const Color yellowGreen; - }; -}; - -#endif - diff --git a/Sources/libetk/etk/Vector.h b/Sources/libetk/etk/Vector.h index bc30f36e..9a215f3a 100644 --- a/Sources/libetk/etk/Vector.h +++ b/Sources/libetk/etk/Vector.h @@ -325,6 +325,26 @@ namespace etk return m_size; } + /** + * @brief Get the number of element in the vector + * @return The number requested + */ + void ReSize(int32_t newSize, MY_TYPE& basicElement) + { + int32_t idx = m_size; + Resize(newSize); + if (m_size != newSize) { + TK_CRITICAL("error to resize vector"); + return; + } + if (newSize > idx) { + // initialize data ... + for(int32_t iii=idx; iii > m_coord; //!< internal coord of the object - etk::Vector m_coordColor; //!< internal color of the different point + etk::Vector m_coordColor; //!< internal color of the different point //etk::Vector m_linkCoord; //!< internal link between point to generate triangle int32_t m_triElement; - etk::Color m_color[3]; + draw::Color m_color[3]; Vector2D m_triangle[3]; void GenerateTriangle(void); void ResetCount(void); public: void Clear(void); void SetColor(float red, float green, float blue, float alpha = 1.0); - void SetColor(etk::Color color); + void SetColor(draw::Color color); void SetPoint(Vector2D point); void SetPoint(float x, float y); void Line(float sx, float sy, float ex, float ey, float thickness); diff --git a/Sources/libewol/ewol/oObject/2DText.cpp b/Sources/libewol/ewol/oObject/2DText.cpp index 71b20e24..1a9c1b71 100644 --- a/Sources/libewol/ewol/oObject/2DText.cpp +++ b/Sources/libewol/ewol/oObject/2DText.cpp @@ -29,7 +29,7 @@ #undef __class__ #define __class__ "ewol::OObject2DText" -ewol::OObject2DText::OObject2DText(etk::UString FontName, int32_t size, etk::Color textColorFg) +ewol::OObject2DText::OObject2DText(etk::UString FontName, int32_t size, draw::Color textColorFg) { m_textColorFg = textColorFg; if (FontName == "") { @@ -60,7 +60,7 @@ void ewol::OObject2DText::Draw(void) //EWOL_WARNING("Nothink to draw..."); return; } - glColor4ub(m_textColorFg.red, m_textColorFg.green, m_textColorFg.blue, m_textColorFg.alpha); + glColor4ub(m_textColorFg.r, m_textColorFg.g, m_textColorFg.b, m_textColorFg.a); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, ewol::texture::GetGLID(m_FontTextureId)); glEnableClientState( GL_VERTEX_ARRAY ); // Enable Vertex Arrays diff --git a/Sources/libewol/ewol/oObject/2DText.h b/Sources/libewol/ewol/oObject/2DText.h index 9ee7dd91..506a1404 100644 --- a/Sources/libewol/ewol/oObject/2DText.h +++ b/Sources/libewol/ewol/oObject/2DText.h @@ -32,7 +32,7 @@ namespace ewol { class OObject2DText :public ewol::OObject { public: - OObject2DText(etk::UString FontName, int32_t size, etk::Color textColorFg); + OObject2DText(etk::UString FontName, int32_t size, draw::Color textColorFg); OObject2DText(void); virtual ~OObject2DText(void); public: @@ -43,10 +43,10 @@ namespace ewol { int32_t Text(Vector2D textPos, clipping_ts drawClipping, const uniChar_t unicodeChar); protected: int32_t m_FontId; //!< font internal ID - etk::Color m_textColorFg; //!< text color ... + draw::Color m_textColorFg; //!< text color ... int32_t m_FontTextureId; //!< font internal Texture ID - etk::Vector > m_coord; //!< internal coord of the object - etk::Vector m_coordTex; //!< internal texture coordinate for every point + etk::Vector > m_coord; //!< internal coord of the object + etk::Vector m_coordTex; //!< internal texture coordinate for every point }; }; diff --git a/Sources/libewol/ewol/oObject/2DTextColored.cpp b/Sources/libewol/ewol/oObject/2DTextColored.cpp index 511816b8..2a7161c1 100644 --- a/Sources/libewol/ewol/oObject/2DTextColored.cpp +++ b/Sources/libewol/ewol/oObject/2DTextColored.cpp @@ -31,7 +31,7 @@ ewol::OObject2DTextColored::OObject2DTextColored(etk::UString FontName, int32_t size) { - m_color = etk::color::black; + m_color = draw::color::black; if (FontName == "") { m_FontId = GetDefaultFontId(); } else { @@ -48,7 +48,7 @@ ewol::OObject2DTextColored::OObject2DTextColored(etk::UString FontName, int32_t ewol::OObject2DTextColored::OObject2DTextColored(int32_t fontID) { - m_color = etk::color::black; + m_color = draw::color::black; if (fontID < 0) { m_FontId = GetDefaultFontId(); } else { @@ -60,7 +60,7 @@ ewol::OObject2DTextColored::OObject2DTextColored(int32_t fontID) // open with default font ... ewol::OObject2DTextColored::OObject2DTextColored(void) { - m_color = etk::color::black; + m_color = draw::color::black; m_FontId = GetDefaultFontId(); } @@ -140,7 +140,7 @@ int32_t ewol::OObject2DTextColored::Text(Vector2D textPos, const uniChar_ } -void ewol::OObject2DTextColored::SetColor(etk::Color color) +void ewol::OObject2DTextColored::SetColor(draw::Color color) { m_color = color; } @@ -148,7 +148,7 @@ void ewol::OObject2DTextColored::SetColor(etk::Color color) void ewol::OObject2DTextColored::SetColor(float red, float green, float blue, float alpha) { - m_color = etk::Color(red, green, blue, alpha); + m_color = draw::Color(red, green, blue, alpha); } diff --git a/Sources/libewol/ewol/oObject/2DTextColored.h b/Sources/libewol/ewol/oObject/2DTextColored.h index 5eacdf5e..21eaaac2 100644 --- a/Sources/libewol/ewol/oObject/2DTextColored.h +++ b/Sources/libewol/ewol/oObject/2DTextColored.h @@ -38,18 +38,18 @@ namespace ewol { public: virtual void Draw(void); void SetColor(float red, float green, float blue, float alpha = 1.0); - void SetColor(etk::Color color); + void SetColor(draw::Color color); // set a specific text void Clear(void); int32_t Text(Vector2D textPos, const etk::UString& unicodeString); int32_t Text(Vector2D textPos, const uniChar_t unicodeChar); protected: int32_t m_FontId; //!< font internal ID - etk::Color m_color; //!< tmp text color ... + draw::Color m_color; //!< tmp text color ... int32_t m_FontTextureId; //!< font internal Texture ID etk::Vector > m_coord; //!< internal coord of the object etk::Vector m_coordTex; //!< internal texture coordinate for every point - etk::Vector m_coordColor; //!< internal color of the different point + etk::Vector m_coordColor; //!< internal color of the different point public: void SetFontID(int32_t fontID) { m_FontId = fontID; }; int32_t GetFontID(void) { return m_FontId; }; diff --git a/Sources/libewol/ewol/oObject/2DTextured.cpp b/Sources/libewol/ewol/oObject/2DTextured.cpp index 525d95da..058b743a 100644 --- a/Sources/libewol/ewol/oObject/2DTextured.cpp +++ b/Sources/libewol/ewol/oObject/2DTextured.cpp @@ -84,12 +84,12 @@ void ewol::OObject2DTextured::Clear(void) m_coordColor.Clear(); } -void ewol::OObject2DTextured::Rectangle(float x, float y, float w, float h, etk::Color tmpColor) +void ewol::OObject2DTextured::Rectangle(float x, float y, float w, float h, draw::Color tmpColor) { Rectangle(x, y, w, h, 0.0, 0.0, 1.0, 1.0, tmpColor); } -void ewol::OObject2DTextured::Rectangle(float x, float y, float w, float h, float texX, float texY, float texSX, float texSY, etk::Color tmpColor) +void ewol::OObject2DTextured::Rectangle(float x, float y, float w, float h, float texX, float texY, float texSX, float texSY, draw::Color tmpColor) { //EWOL_DEBUG("Add rectangle : ..."); Vector2D point; diff --git a/Sources/libewol/ewol/oObject/2DTextured.h b/Sources/libewol/ewol/oObject/2DTextured.h index 018f1e83..298bd5c4 100644 --- a/Sources/libewol/ewol/oObject/2DTextured.h +++ b/Sources/libewol/ewol/oObject/2DTextured.h @@ -37,13 +37,13 @@ namespace ewol { public: virtual void Draw(void); void Clear(void); - void Rectangle(float x, float y, float w, float h, float texX=0.0, float texY=0.0, float texSX=1.0, float texSY=1.0, etk::Color tmpColor=etk::color::white); - void Rectangle(float x, float y, float w, float h, etk::Color tmpColor); + void Rectangle(float x, float y, float w, float h, float texX=0.0, float texY=0.0, float texSX=1.0, float texSY=1.0, draw::Color tmpColor=draw::color::white); + void Rectangle(float x, float y, float w, float h, draw::Color tmpColor); protected: int32_t m_textureId; //!< texture internal ID etk::Vector > m_coord; //!< internal coord of the object etk::Vector m_coordTex; //!< internal texture coordinate for every point - etk::Vector m_coordColor; //!< internal color of the different point + etk::Vector m_coordColor; //!< internal color of the different point }; }; diff --git a/Sources/libewol/ewol/oObject/OObject.h b/Sources/libewol/ewol/oObject/OObject.h index d6c9c1a7..eeace492 100644 --- a/Sources/libewol/ewol/oObject/OObject.h +++ b/Sources/libewol/ewol/oObject/OObject.h @@ -26,7 +26,7 @@ #define __EWOL_O_OBJECT_H__ #include -#include +#include #include #include #include diff --git a/Sources/libewol/ewol/oObject/Sprite.cpp b/Sources/libewol/ewol/oObject/Sprite.cpp index ea877269..3a94ea22 100644 --- a/Sources/libewol/ewol/oObject/Sprite.cpp +++ b/Sources/libewol/ewol/oObject/Sprite.cpp @@ -90,7 +90,7 @@ void ewol::Sprite::Clear(void) void ewol::Sprite::Element(Vector2D pos, float size, float angle) { - etk::Color tmpColor(0xFFFFFFFF); + draw::Color tmpColor(0xFFFFFFFF); Vector3D pos2; pos2.x = pos.x; pos2.y = pos.y; @@ -100,11 +100,11 @@ void ewol::Sprite::Element(Vector2D pos, float size, float angle) void ewol::Sprite::Element(Vector3D pos, float size, float angle) { - etk::Color tmpColor(0xFFFFFFFF); + draw::Color tmpColor(0xFFFFFFFF); Element(pos, size, angle, tmpColor); } -void ewol::Sprite::Element(Vector2D pos, float size, float angle, etk::Color tmpColor) +void ewol::Sprite::Element(Vector2D pos, float size, float angle, draw::Color tmpColor) { Vector3D pos2; pos2.x = pos.x; @@ -114,7 +114,7 @@ void ewol::Sprite::Element(Vector2D pos, float size, float angle, etk::Co } -void ewol::Sprite::Element(Vector3D pos, float size, float angle, etk::Color tmpColor) +void ewol::Sprite::Element(Vector3D pos, float size, float angle, draw::Color tmpColor) { angle -= M_PI/4; size *= 0.7; diff --git a/Sources/libewol/ewol/oObject/Sprite.h b/Sources/libewol/ewol/oObject/Sprite.h index bb036b1a..0f23b84a 100644 --- a/Sources/libewol/ewol/oObject/Sprite.h +++ b/Sources/libewol/ewol/oObject/Sprite.h @@ -40,14 +40,14 @@ namespace ewol { void Clear(void); void Element(Vector2D pos, float size, float angle); void Element(Vector3D pos, float size, float angle); - void Element(Vector2D pos, float size, float angle, etk::Color tmpColor); - void Element(Vector3D pos, float size, float angle, etk::Color tmpColor); + void Element(Vector2D pos, float size, float angle, draw::Color tmpColor); + void Element(Vector3D pos, float size, float angle, draw::Color tmpColor); bool HasName(etk::UString& name) { return name == m_name; }; protected: int32_t m_textureId; //!< texture internal ID etk::Vector > m_coord; //!< internal coord of the object etk::Vector m_coordTex; //!< internal texture coordinate for every point - etk::Vector m_coordColor; //!< internal color of the different point + etk::Vector m_coordColor; //!< internal color of the different point }; }; diff --git a/Sources/libewol/ewol/os/eSystem.cpp b/Sources/libewol/ewol/os/eSystem.cpp index f796b9a8..0516885d 100644 --- a/Sources/libewol/ewol/os/eSystem.cpp +++ b/Sources/libewol/ewol/os/eSystem.cpp @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include #include @@ -242,8 +242,8 @@ void eSystem::Init(void) ewol::EObjectManager::Init(); ewol::EObjectMessageMultiCast::Init(); l_managementInput.Reset(); + ewol::textureManager::Init(); ewol::widgetManager::Init(); - ewol::texture::Init(); ewol::InitFont(); ewol::shortCut::Init(); APP_Init(); @@ -265,11 +265,11 @@ void eSystem::UnInit(void) // call application to uninit APP_UnInit(); ewol::shortCut::UnInit(); - ewol::texture::UnInit(); ewol::UnInitFont(); ewol::widgetManager::UnInit(); ewol::EObjectMessageMultiCast::UnInit(); ewol::EObjectManager::UnInit(); + ewol::textureManager::UnInit(); l_managementInput.Reset(); l_msgSystem.Clean(); } @@ -542,7 +542,7 @@ bool eSystem::Draw(bool displayEveryTime) // check if the regenerate is needed ... if( true == ewol::widgetManager::IsDrawingNeeded() || true == displayEveryTime) { - ewol::texture::UpdateContext(); + ewol::textureManager::UpdateContext(); l_FpsSystem.IncrementCounter(); tmpWindows->SysDraw(); } @@ -583,7 +583,7 @@ void eSystem::ResetIOEvent(void) */ void eSystem::OpenGlContextDestroy(void) { - ewol::texture::UpdateContextIsDestroy(); + ewol::textureManager::OpenGlContextHasBeenDestroyed(); } diff --git a/Sources/libewol/ewol/os/gui.X11.cpp b/Sources/libewol/ewol/os/gui.X11.cpp index 5a7fbe26..8ecf09b9 100644 --- a/Sources/libewol/ewol/os/gui.X11.cpp +++ b/Sources/libewol/ewol/os/gui.X11.cpp @@ -30,8 +30,7 @@ #include #include -#include -#include +#include #include #include diff --git a/Sources/libewol/ewol/texture/Texture.cpp b/Sources/libewol/ewol/texture/Texture.cpp index 55e20330..ed9b1802 100644 --- a/Sources/libewol/ewol/texture/Texture.cpp +++ b/Sources/libewol/ewol/texture/Texture.cpp @@ -27,210 +27,7 @@ #include #include #include -#include -#include -#include -//! One Texture element -class LoadedTexture -{ - public: - etk::UString m_filename; - int32_t m_nbTimeLoaded; - // openGl configuration : - uint32_t m_openGlTextureID; - int32_t m_target; - int32_t m_level; - int32_t m_internalFormat; - int32_t m_width; - int32_t m_height; - int32_t m_border; - int32_t m_format; - int32_t m_type; - char* m_data; - int32_t m_nbBytes; - bool m_loaded; - bool m_destroy; -}; -//! List of all Texture loaded ... -etk::Vector l_listLoadedTexture; -#undef __class__ -#define __class__ "texture" - - -/** - * @brief Initialise the texture namespace (init a mutex) - * @param --- - * @return --- - */ -void ewol::texture::Init(void) -{ - EWOL_DEBUG("==> Init Texture-Manager"); -} - - -/** - * @brief Un-Initialise the Texture namespace (Remove all loaded texture and temporary data and remove Mutex) - * @param --- - * @return --- - */ -void ewol::texture::UnInit(void) -{ - EWOL_DEBUG("==> Un-Init Texture-Manager"); - for (int32_t iii=0; iiim_data) - { - l_listLoadedTexture[iii]->m_loaded = false; - EWOL_INFO("TEXTURE: Disable [" << iii << "]=(" << l_listLoadedTexture[iii]->m_width << "px," << - l_listLoadedTexture[iii]->m_height << "px) in file:" << - l_listLoadedTexture[iii]->m_filename << " OGl_Id=" <m_openGlTextureID); - // note : the context might be destroy... we can not remove the textures ... - //glDeleteTextures(1, &l_listLoadedTexture[iii]->m_openGlTextureID); - } - } -} - - -/** - * @brief Check all texture and load/Remove/Reload all texture that has been Add/Remove/Change from the previous display cycle - * @param --- - * @return --- - */ -void ewol::texture::UpdateContext(void) -{ - bool needRedraw = false; - for (int32_t iii=0; iii < l_listLoadedTexture.Size(); iii++) { - if( NULL != l_listLoadedTexture[iii] - && NULL != l_listLoadedTexture[iii]->m_data) - { - if( false == l_listLoadedTexture[iii]->m_destroy - && false == l_listLoadedTexture[iii]->m_loaded) - { - GLuint textureid; - glGenTextures(1, &textureid); - glBindTexture(l_listLoadedTexture[iii]->m_target, textureid); - //glTexParameteri(tmpTex->m_target, GL_TEXTURE_WRAP_S, GL_REPEAT); - //glTexParameteri(tmpTex->m_target, GL_TEXTURE_WRAP_T, GL_REPEAT); - //--- mode nearest - //glTexParameteri(tmpTex->m_target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - //glTexParameteri(tmpTex->m_target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - //--- Mode linear - glTexParameteri(l_listLoadedTexture[iii]->m_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(l_listLoadedTexture[iii]->m_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - EWOL_INFO("TEXTURE: Add [" << iii << "]=(" << l_listLoadedTexture[iii]->m_width << "px," << - l_listLoadedTexture[iii]->m_height << "px) in file:" << - l_listLoadedTexture[iii]->m_filename << " OGl_Id=" <m_target, - l_listLoadedTexture[iii]->m_level, - l_listLoadedTexture[iii]->m_internalFormat, - l_listLoadedTexture[iii]->m_width, - l_listLoadedTexture[iii]->m_height, - l_listLoadedTexture[iii]->m_border, - l_listLoadedTexture[iii]->m_format, - l_listLoadedTexture[iii]->m_type, - l_listLoadedTexture[iii]->m_data); - l_listLoadedTexture[iii]->m_openGlTextureID = textureid; - l_listLoadedTexture[iii]->m_loaded = true; - needRedraw = true; - } else if ( true == l_listLoadedTexture[iii]->m_destroy - && true == l_listLoadedTexture[iii]->m_loaded) - { - // Request remove texture ... - EWOL_INFO("TEXTURE: Rm [" << iii << "] file:" << l_listLoadedTexture[iii]->m_filename); - glDeleteTextures(1, &l_listLoadedTexture[iii]->m_openGlTextureID); - l_listLoadedTexture[iii]->m_loaded = false; - l_listLoadedTexture[iii]->m_openGlTextureID = -1; - if (NULL != l_listLoadedTexture[iii]->m_data) { - delete[] l_listLoadedTexture[iii]->m_data; - l_listLoadedTexture[iii]->m_data = NULL; - } - delete(l_listLoadedTexture[iii]); - l_listLoadedTexture[iii] = NULL; - } - } - } - if (true == needRedraw) { - ewol::ForceRedrawAll(); - } -} - - -/** - * @brief Register a texture in the automatic system to load and reload - * @param[in] target Standard element of OpenGL target - * @param[in] level Standard element of OpenGL level - * @param[in] internalFormat Standard element of OpenGL internalFormat - * @param[in] width Standard element of OpenGL width - * @param[in] height Standard element of OpenGL height - * @param[in] border Standard element of OpenGL border - * @param[in] format Standard element of OpenGL format - * @param[in] type Standard element of OpenGL type - * @param[in] data Pointer on the buffer where are contain the data (a copy is done automaticly) - * @param[in] nbBytes Number of byte in the buffer - * @param[in] filename File Name of the texture or "---" if it is an internal loaded texture - * @return The Internal ID of the texture, or -1 if an error occured ... - */ -int32_t ewol::texture::Load(int32_t target, int32_t level, int32_t internalFormat, int32_t width, int32_t height, - int32_t border, int32_t format, int32_t type, - const void* data, int32_t nbBytes, etk::UString filename) -{ - - LoadedTexture *tmpTex = new LoadedTexture(); - int32_t outTextureID = -1; - if (NULL == tmpTex){ - EWOL_ERROR("Texture : Allocation ERROR... " << filename); - return -1; - } - if (NULL == data){ - EWOL_ERROR("Texture : Input pointer of the data texture =NULL... " << filename); - return -1; - } - - tmpTex->m_filename = filename; - tmpTex->m_nbTimeLoaded = 1; - tmpTex->m_openGlTextureID = -1; - tmpTex->m_target = target; - tmpTex->m_level = level; - tmpTex->m_internalFormat = internalFormat; - tmpTex->m_width = width; - tmpTex->m_height = height; - tmpTex->m_border = border; - tmpTex->m_format = format; - tmpTex->m_type = type; - tmpTex->m_nbBytes = nbBytes; - tmpTex->m_data = new char[tmpTex->m_nbBytes+4096]; - tmpTex->m_loaded = false; - tmpTex->m_destroy = false; - if (NULL == tmpTex->m_data) { - EWOL_ERROR("Texture : Data Allocation ERROR... " << filename); - return -1; - } - memcpy(tmpTex->m_data, data, sizeof(char) * tmpTex->m_nbBytes); - - l_listLoadedTexture.PushBack(tmpTex); - outTextureID = l_listLoadedTexture.Size()-1; - return outTextureID; -} /** @@ -252,6 +49,96 @@ static int32_t nextP2(int32_t value) } + +ewol::Texture::Texture(void) +{ + // add it to the texture manager + m_uniqueId = ewol::textureManager::Add(this); + + m_loaded = false; + m_texId = 0; + m_endPointSize.x = 1.0; + m_endPointSize.y = 1.0; +} + +ewol::Texture::~Texture(void) +{ + // unregister from the texture manager + ewol::textureManager::Rm(this); + RemoveContext(); + +} + + +void ewol::Texture::UpdateContext(void) +{ + if (false == m_loaded) { + // Request a new texture at OpenGl : + glGenTextures(1, &m_texId); + // TODO : check error ??? + glBindTexture(GL_TEXTURE_2D, m_texId); + // TODO : Check error ??? + //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + //--- mode nearest + //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + //--- Mode linear + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + EWOL_INFO("TEXTURE: Add [" << m_uniqueId << "]=" << m_data.GetSize() << " OGl_Id=" <m_nbTimeLoaded--; - if (0 == l_listLoadedTexture[textureID]->m_nbTimeLoaded) { - EWOL_DEBUG("Remove openGL texture ID=" << textureID << " file:" << l_listLoadedTexture[textureID]->m_filename); - l_listLoadedTexture[textureID]->m_destroy = true; - } - return; - } - EWOL_CRITICAL("Can not find TextureId=" << (int)textureID << " in the list of texture loaded...==> to remove it ..."); -} - - -/** - * @brief Get the openGL texture ID whith the internal ID - * @param textureID the internal texture ID - * @return the OpenGl texture ID (or 0 if an error occured...) - */ -uint32_t ewol::texture::GetGLID(uint32_t textureID) -{ - if ((int32_t)textureIDm_openGlTextureID; - } else { - EWOL_ERROR("Texture has been removed previously : " << textureID); - } - } - return 0; -} - - -/** - * @brief Get the size of the specific texture - * @param[in] textureID the internal texture ID - * @return the width of the texture - */ -int32_t ewol::texture::GetSize(uint32_t textureID) -{ - for (int32_t iii=0; iiim_openGlTextureID == textureID) { - return l_listLoadedTexture[iii]->m_width; - } - } else { - EWOL_ERROR("Texture has been removed previously : " << textureID); - } - } - EWOL_ERROR("Can not find TextureId=" << textureID << " in the list of texture loaded..."); - return -1; -} \ No newline at end of file +#endif diff --git a/Sources/libewol/ewol/texture/Texture.h b/Sources/libewol/ewol/texture/Texture.h index e555b0ce..d97804c1 100644 --- a/Sources/libewol/ewol/texture/Texture.h +++ b/Sources/libewol/ewol/texture/Texture.h @@ -27,22 +27,40 @@ #include #include -#include +#include +#include -namespace ewol -{ - namespace texture { - void Init(void); - void UnInit(void); - int32_t Load(etk::UString fileName, int32_t requestedWidth=-1); - int32_t Load(int32_t target, int32_t level, int32_t internalFormat, int32_t width, int32_t height, int32_t border, int32_t format, int32_t type, const void* data, int32_t nbBytes, etk::UString filename); - void UnLoad(uint32_t textureID); - int32_t GetSize(uint32_t textureID); - uint32_t GetGLID(uint32_t textureID); - void UpdateContext(void); - void UpdateContextIsDestroy(void); - void OGLContext(bool enable); +namespace ewol { + class Texture { + private: + uint32_t m_uniqueId; + // openGl Context propoerties : + draw::Image m_data; + // OpenGl textureID : + GLuint m_texId; + // some image are not square ==> we need to sqared it to prevent some openGl api error the the displayable size is not all the time 0.0 -> 1.0 + Vector2D m_endPointSize; + // internal state of the openGl system : + bool m_loaded; + // Ewol internal API: + public: + void UpdateContext(void); + void RemoveContext(void); + void RemoveContextToLate(void); + // middleware interface: + public: + GLuint GetId(void) { return m_texId; }; + Vector2D GetUsableSize(void) { return m_endPointSize; }; + // Public API: + public: + Texture(void); + ~Texture(void); + // get the reference on this image to draw nomething on it ... + inline draw::Image& Get(void) { return m_data; }; + // Flush the data to send it at the OpenGl system + void Flush(void); }; + }; #endif diff --git a/Sources/libewol/ewol/texture/TextureManager.cpp b/Sources/libewol/ewol/texture/TextureManager.cpp new file mode 100644 index 00000000..4a585f4b --- /dev/null +++ b/Sources/libewol/ewol/texture/TextureManager.cpp @@ -0,0 +1,158 @@ +/** + ******************************************************************************* + * @file ewol/texture/textureManager.cpp + * @brief ewol Texture manager system (Sources) + * @author Edouard DUPIN + * @date 21/08/2012 + * @par Project + * ewol + * + * @par Copyright + * Copyright 2011 Edouard DUPIN, all right reserved + * + * This software is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY. + * + * Licence summary : + * You can modify and redistribute the sources code and binaries. + * You can send me the bug-fix + * + * Term of the licence in in the file licence.txt. + * + ******************************************************************************* + */ + +#ifndef __EWOL_TEXTURE_MANAGER_H__ +#define __EWOL_TEXTURE_MANAGER_H__ + +#include +#include +#include +#include +#include + + +static etk::Vector l_textureList; +static etk::Vector l_textureListToUpdate; + +static uint32_t l_uniqueIdTexture = 0; +static bool l_contextHasBeenRemoved = true; + +void ewol::textureManager::Init(void) +{ + // nothing to do in théory then, we clean the buffers : + // NOTE : If we do domething here, then the system does not work corectly + l_textureList.Clear(); + l_textureListToUpdate.Clear(); + l_uniqueIdTexture = 0; + l_contextHasBeenRemoved = true; +} + +void ewol::textureManager::UnInit(void) +{ + l_textureListToUpdate.Clear(); + for (int32_t iii=0; iiiRemoveContext(); + } + } +} + +// note : Return the UniqueID ... +uint32_t ewol::textureManager::Add(ewol::Texture *object) +{ + if (object==NULL) { + EWOL_CRITICAL("try to add a texture with NULL pointer ..."); + return 0; + } + for (int32_t iii=0; iii=0; iii--) { + if (l_textureListToUpdate[iii] != NULL) { + if (l_textureListToUpdate[iii] == object) { + // we find the texture : + l_textureListToUpdate.Erase(iii); + } + } + } + for (int32_t iii=l_textureList.Size()-1; iii>=0; iii--) { + if (l_textureList[iii] != NULL) { + if (l_textureList[iii] == object) { + // we find the texture : + l_textureList.Erase(iii); + return; + } + } + } + EWOL_CRITICAL("Try to remove a texture that is not present in the texture pool"); +} + +void ewol::textureManager::Update(ewol::Texture *object) +{ + // chek if not added before + for (int32_t iii=0; iii system use only +void ewol::textureManager::UpdateContext(void) +{ + if (true == l_contextHasBeenRemoved) { + // need to update all ... + l_contextHasBeenRemoved = false; + for (int32_t iii=0; iiiUpdateContext(); + } + } + }else { + for (int32_t iii=0; iiiUpdateContext(); + } + } + } + // Clean the update list + l_textureListToUpdate.Clear(); +} + +void ewol::textureManager::OpenGlContextHasBeenDestroyed(void) +{ + for (int32_t iii=0; iiiUpdateContext(); + } + } + // no context preent ... + l_contextHasBeenRemoved = true; +} + diff --git a/Sources/libewol/ewol/texture/TextureManager.h b/Sources/libewol/ewol/texture/TextureManager.h new file mode 100644 index 00000000..eaec0c0b --- /dev/null +++ b/Sources/libewol/ewol/texture/TextureManager.h @@ -0,0 +1,47 @@ +/** + ******************************************************************************* + * @file ewol/texture/textureManager.h + * @brief ewol Texture manager system (header) + * @author Edouard DUPIN + * @date 21/08/2012 + * @par Project + * ewol + * + * @par Copyright + * Copyright 2011 Edouard DUPIN, all right reserved + * + * This software is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY. + * + * Licence summary : + * You can modify and redistribute the sources code and binaries. + * You can send me the bug-fix + * + * Term of the licence in in the file licence.txt. + * + ******************************************************************************* + */ + +#ifndef __EWOL_TEXTURE_MANAGER_H__ +#define __EWOL_TEXTURE_MANAGER_H__ + +#include +#include +#include +#include + +namespace ewol +{ + namespace textureManager { + void Init(void); + void UnInit(void); + uint32_t Add(ewol::Texture *object); // note : Return the UniqueID ... + void Rm(ewol::Texture *object); + void Update(ewol::Texture *object); + // Specific to load or update the data in the openGl context ==> system use only + void UpdateContext(void); + void OpenGlContextHasBeenDestroyed(void); + }; +}; + +#endif \ No newline at end of file diff --git a/Sources/libewol/ewol/widget/Button.cpp b/Sources/libewol/ewol/widget/Button.cpp index a16f7568..8edfeaa7 100644 --- a/Sources/libewol/ewol/widget/Button.cpp +++ b/Sources/libewol/ewol/widget/Button.cpp @@ -68,10 +68,10 @@ void ewol::Button::Init(void) m_padding.x = 4; #endif - m_textColorFg = etk::color::black; + m_textColorFg = draw::color::black; - m_textColorBg = etk::color::black; - m_textColorBg.alpha = 0x3F; + m_textColorBg = draw::color::black; + m_textColorBg.a = 0x3F; SetCanHaveFocus(true); } diff --git a/Sources/libewol/ewol/widget/Button.h b/Sources/libewol/ewol/widget/Button.h index 0ad53ab5..ef4d8c17 100644 --- a/Sources/libewol/ewol/widget/Button.h +++ b/Sources/libewol/ewol/widget/Button.h @@ -62,16 +62,16 @@ namespace ewol { bool GetValue(void); void SetAlignement(textAlignement_te typeAlign); void SetPadding(Vector2D newPadding); - void SetColorBg(etk::Color newColor) { m_textColorBg = newColor; }; - void SetColorFg(etk::Color newColor) { m_textColorFg = newColor; }; + void SetColorBg(draw::Color newColor) { m_textColorBg = newColor; }; + void SetColorFg(draw::Color newColor) { m_textColorFg = newColor; }; private: bool m_hasAnImage; etk::UString m_imageSelected; textAlignement_te m_alignement; Vector2D m_padding; etk::UString m_label; - etk::Color m_textColorFg; //!< Text color - etk::Color m_textColorBg; //!< Background color + draw::Color m_textColorFg; //!< Text color + draw::Color m_textColorBg; //!< Background color public: virtual void OnRegenerateDisplay(void); /** diff --git a/Sources/libewol/ewol/widget/ButtonColor.cpp b/Sources/libewol/ewol/widget/ButtonColor.cpp index bd985b09..79c0c0e7 100644 --- a/Sources/libewol/ewol/widget/ButtonColor.cpp +++ b/Sources/libewol/ewol/widget/ButtonColor.cpp @@ -63,8 +63,8 @@ void ewol::ButtonColor::Init(void) #endif - m_textColorBg = etk::color::black; - m_textColorBg.alpha = 0x3F; + m_textColorBg = draw::color::black; + m_textColorBg.a = 0x3F; m_widgetContextMenu = NULL; SetCanHaveFocus(true); } @@ -159,10 +159,10 @@ void ewol::ButtonColor::OnRegenerateDisplay(void) tmpSizeX -= 2*m_padding.x; tmpSizeY -= 2*m_padding.y; - if ((m_textColorBg.red>0.5) || (m_textColorBg.green>0.5) || (m_textColorBg.blue > 0.8) ) { - m_textColorFg = etk::color::black; + if ((m_textColorBg.r>0.5) || (m_textColorBg.g>0.5) || (m_textColorBg.b > 0.8) ) { + m_textColorFg = draw::color::black; } else { - m_textColorFg = etk::color::white; + m_textColorFg = draw::color::white; } ewol::OObject2DText * tmpText = new ewol::OObject2DText("", -1, m_textColorFg); /* @@ -241,7 +241,7 @@ bool ewol::ButtonColor::OnEventInput(ewol::inputType_te type, int32_t IdInput, e } -void ewol::ButtonColor::SetCurrentColor(etk::Color color) +void ewol::ButtonColor::SetCurrentColor(draw::Color color) { m_selectedColor = color; m_textColorBg = m_selectedColor; @@ -262,8 +262,8 @@ void ewol::ButtonColor::OnReceiveMessage(ewol::EObject * CallerObject, const cha { if (eventId == ewolEventColorChooserChange) { // TODO : Parse the input color ... - //etk::Color tmpColor(data); - etk::Color tmpColor; + //draw::Color tmpColor(data); + draw::Color tmpColor; m_selectedColor = tmpColor; m_textColorBg = m_selectedColor; char colorText[256]; diff --git a/Sources/libewol/ewol/widget/ButtonColor.h b/Sources/libewol/ewol/widget/ButtonColor.h index c56c2d84..aa63276b 100644 --- a/Sources/libewol/ewol/widget/ButtonColor.h +++ b/Sources/libewol/ewol/widget/ButtonColor.h @@ -59,9 +59,9 @@ namespace ewol { textAlignement_te m_alignement; Vector2D m_padding; etk::UString m_label; - etk::Color m_textColorFg; //!< Text color - etk::Color m_textColorBg; //!< Background color - etk::Color m_selectedColor; //!< user current selected Color + draw::Color m_textColorFg; //!< Text color + draw::Color m_textColorBg; //!< Background color + draw::Color m_selectedColor; //!< user current selected Color ewol::ContextMenu* m_widgetContextMenu; public: virtual void OnRegenerateDisplay(void); @@ -76,8 +76,8 @@ namespace ewol { * @return false the event is not used */ virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D pos); - etk::Color GetCurrentColor(void) { return m_selectedColor; }; - void SetCurrentColor(etk::Color color); + draw::Color GetCurrentColor(void) { return m_selectedColor; }; + void SetCurrentColor(draw::Color color); /** * @brief Receive a message from an other EObject with a specific eventId and data * @param[in] CallerObject Pointer on the EObject that information came from diff --git a/Sources/libewol/ewol/widget/ButtonImage.cpp b/Sources/libewol/ewol/widget/ButtonImage.cpp index fb086cef..21b32868 100644 --- a/Sources/libewol/ewol/widget/ButtonImage.cpp +++ b/Sources/libewol/ewol/widget/ButtonImage.cpp @@ -41,7 +41,7 @@ void ewol::WIDGET_ButtonImageInit(void) #undef __class__ #define __class__ "ButtonImage" -ewol::ButtonImage::ButtonImage(etk::UString imageName, etk::Color col) +ewol::ButtonImage::ButtonImage(etk::UString imageName, draw::Color col) { AddEventId(ewolEventButtonPressed); AddEventId(ewolEventButtonDown); @@ -68,7 +68,7 @@ ewol::ButtonImage::~ButtonImage(void) } -void ewol::ButtonImage::SetImage(etk::UString imageName, etk::Color col) +void ewol::ButtonImage::SetImage(etk::UString imageName, draw::Color col) { m_image = imageName; m_color = col; @@ -76,7 +76,7 @@ void ewol::ButtonImage::SetImage(etk::UString imageName, etk::Color col) MarkToRedraw(); } -void ewol::ButtonImage::SetImageBG(etk::UString imageName, etk::Color col) +void ewol::ButtonImage::SetImageBG(etk::UString imageName, draw::Color col) { m_imageBg1 = imageName; m_colorBg1 = col; @@ -84,7 +84,7 @@ void ewol::ButtonImage::SetImageBG(etk::UString imageName, etk::Color col) MarkToRedraw(); } -void ewol::ButtonImage::SetImageSelected(etk::UString imageName, etk::Color col) +void ewol::ButtonImage::SetImageSelected(etk::UString imageName, draw::Color col) { m_imageBg2 = imageName; m_colorBg2 = col; diff --git a/Sources/libewol/ewol/widget/ButtonImage.h b/Sources/libewol/ewol/widget/ButtonImage.h index 52342fe7..9f0fe224 100644 --- a/Sources/libewol/ewol/widget/ButtonImage.h +++ b/Sources/libewol/ewol/widget/ButtonImage.h @@ -34,7 +34,7 @@ namespace ewol { class ButtonImage :public ewol::Widget { public: - ButtonImage(etk::UString image, etk::Color col=0xFFFFFFFF); + ButtonImage(etk::UString image, draw::Color col=0xFFFFFFFF); /** * @brief Get the current Object type of the EObject * @note In Embended platforme, it is many time no -rtti flag, then it is not possible to use dynamic cast ==> this will replace it @@ -44,9 +44,9 @@ namespace ewol { virtual const char * const GetObjectType(void) { return "EwolButtonImage"; }; void Init(void); virtual ~ButtonImage(void); - void SetImage(etk::UString imageName, etk::Color col=0xFFFFFFFF); - void SetImageBG(etk::UString imageName, etk::Color col=0xFFFFFFFF); - void SetImageSelected(etk::UString imageName, etk::Color col=0xFFFFFFFF); + void SetImage(etk::UString imageName, draw::Color col=0xFFFFFFFF); + void SetImageBG(etk::UString imageName, draw::Color col=0xFFFFFFFF); + void SetImageSelected(etk::UString imageName, draw::Color col=0xFFFFFFFF); void SetValue(bool val); bool GetValue(void); void SetToggleMode(bool val); @@ -55,15 +55,15 @@ namespace ewol { etk::UString m_image; bool m_resetNeeded; ewol::OObject2DTextured* m_OOImage; - etk::Color m_color; + draw::Color m_color; etk::UString m_imageBg1; ewol::OObject2DTextured* m_OOImageBg1; - etk::Color m_colorBg1; + draw::Color m_colorBg1; etk::UString m_imageBg2; ewol::OObject2DTextured* m_OOImageBG2; - etk::Color m_colorBg2; + draw::Color m_colorBg2; bool m_over; bool m_down; diff --git a/Sources/libewol/ewol/widget/CheckBox.cpp b/Sources/libewol/ewol/widget/CheckBox.cpp index 87537412..aad8a6bd 100644 --- a/Sources/libewol/ewol/widget/CheckBox.cpp +++ b/Sources/libewol/ewol/widget/CheckBox.cpp @@ -38,8 +38,8 @@ extern const char * const ewolEventCheckBoxClicked = "ewol CheckBox Clicked"; void ewol::CheckBox::Init(void) { AddEventId(ewolEventCheckBoxClicked); - m_textColorFg = etk::color::black; - m_textColorBg = etk::color::white; + m_textColorFg = draw::color::black; + m_textColorBg = draw::color::white; m_value = false; SetCanHaveFocus(true); SetMouseLimit(1); diff --git a/Sources/libewol/ewol/widget/CheckBox.h b/Sources/libewol/ewol/widget/CheckBox.h index ce98cfac..1eb4cf14 100644 --- a/Sources/libewol/ewol/widget/CheckBox.h +++ b/Sources/libewol/ewol/widget/CheckBox.h @@ -53,8 +53,8 @@ namespace ewol { private: etk::UString m_label; bool m_value; - etk::Color m_textColorFg; //!< Text color - etk::Color m_textColorBg; //!< Background color + draw::Color m_textColorFg; //!< Text color + draw::Color m_textColorBg; //!< Background color public: virtual void OnRegenerateDisplay(void); public: diff --git a/Sources/libewol/ewol/widget/ColorBar.cpp b/Sources/libewol/ewol/widget/ColorBar.cpp index ed4bc02c..a90f0056 100644 --- a/Sources/libewol/ewol/widget/ColorBar.cpp +++ b/Sources/libewol/ewol/widget/ColorBar.cpp @@ -27,7 +27,7 @@ #include #include -#include +#include extern const char * const ewolEventColorBarChange = "ewol-color-bar-change"; @@ -49,7 +49,7 @@ ewol::ColorBar::ColorBar(void) #endif m_currentUserPos.x=0; m_currentUserPos.y=0; - m_currentColor = etk::color::black; + m_currentColor = draw::color::black; SetCanHaveFocus(true); } @@ -66,10 +66,10 @@ bool ewol::ColorBar::CalculateMinSize(void) MarkToRedraw(); return true; } -static etk::Color s_listColorWhite(0xFFFFFFFF); -static etk::Color s_listColorBlack(0x000000FF); +static draw::Color s_listColorWhite(0xFFFFFFFF); +static draw::Color s_listColorBlack(0x000000FF); #define NB_BAND_COLOR (6) -static etk::Color s_listColor[NB_BAND_COLOR+1] = { +static draw::Color s_listColor[NB_BAND_COLOR+1] = { 0xFF0000FF, 0xFFFF00FF, 0x00FF00FF, @@ -79,14 +79,14 @@ static etk::Color s_listColor[NB_BAND_COLOR+1] = { 0xFF0000FF }; -etk::Color ewol::ColorBar::GetCurrentColor(void) +draw::Color ewol::ColorBar::GetCurrentColor(void) { return m_currentColor; } -void ewol::ColorBar::SetCurrentColor(etk::Color newOne) +void ewol::ColorBar::SetCurrentColor(draw::Color newOne) { m_currentColor = newOne; - m_currentColor.alpha = 0xFF; + m_currentColor.a = 0xFF; // estimate the cursor position : // TODO : Later when really needed ... } @@ -193,11 +193,11 @@ void ewol::ColorBar::OnRegenerateDisplay(void) tmpOObjects->SetPoint(tmpOriginX + (iii+0.5)*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY); */ } - etk::Color tmpColor; + draw::Color tmpColor; if (m_currentUserPos.y > 0.5) { - tmpColor = etk::color::white; + tmpColor = draw::color::white; } else { - tmpColor = etk::color::black; + tmpColor = draw::color::black; } tmpOObjects->SetColor(tmpColor); tmpOObjects->Circle(m_currentUserPos.x*m_size.x, m_currentUserPos.y*m_size.y, 3.0, 1.0); @@ -236,49 +236,49 @@ bool ewol::ColorBar::OnEventInput(ewol::inputType_te type, int32_t IdInput, even float localPos = relativePos.x - (m_size.x/6) * bandID; float poroportionnalPos = localPos/(m_size.x/6); EWOL_VERBOSE("bandId=" << bandID << " relative pos=" << localPos); - etk::Color estimateColor = etk::color::white; - if (s_listColor[bandID].red == s_listColor[bandID+1].red) { - estimateColor.red = s_listColor[bandID].red; - } else if (s_listColor[bandID].red < s_listColor[bandID+1].red) { - estimateColor.red = s_listColor[bandID].red + (s_listColor[bandID+1].red-s_listColor[bandID].red)*poroportionnalPos; + draw::Color estimateColor = draw::color::white; + if (s_listColor[bandID].r == s_listColor[bandID+1].r) { + estimateColor.r = s_listColor[bandID].r; + } else if (s_listColor[bandID].r < s_listColor[bandID+1].r) { + estimateColor.r = s_listColor[bandID].r + (s_listColor[bandID+1].r-s_listColor[bandID].r)*poroportionnalPos; } else { - estimateColor.red = s_listColor[bandID+1].red + (s_listColor[bandID].red-s_listColor[bandID+1].red)*(1-poroportionnalPos); + estimateColor.r = s_listColor[bandID+1].r + (s_listColor[bandID].r-s_listColor[bandID+1].r)*(1-poroportionnalPos); } - if (s_listColor[bandID].green == s_listColor[bandID+1].green) { - estimateColor.green = s_listColor[bandID].green; - } else if (s_listColor[bandID].green < s_listColor[bandID+1].green) { - estimateColor.green = s_listColor[bandID].green + (s_listColor[bandID+1].green-s_listColor[bandID].green)*poroportionnalPos; + if (s_listColor[bandID].g == s_listColor[bandID+1].g) { + estimateColor.g = s_listColor[bandID].g; + } else if (s_listColor[bandID].g < s_listColor[bandID+1].g) { + estimateColor.g = s_listColor[bandID].g + (s_listColor[bandID+1].g-s_listColor[bandID].g)*poroportionnalPos; } else { - estimateColor.green = s_listColor[bandID+1].green + (s_listColor[bandID].green-s_listColor[bandID+1].green)*(1-poroportionnalPos); + estimateColor.g = s_listColor[bandID+1].g + (s_listColor[bandID].g-s_listColor[bandID+1].g)*(1-poroportionnalPos); } - if (s_listColor[bandID].blue == s_listColor[bandID+1].blue) { - estimateColor.blue = s_listColor[bandID].blue; - } else if (s_listColor[bandID].blue < s_listColor[bandID+1].blue) { - estimateColor.blue = s_listColor[bandID].blue + (s_listColor[bandID+1].blue-s_listColor[bandID].blue)*poroportionnalPos; + if (s_listColor[bandID].b == s_listColor[bandID+1].b) { + estimateColor.b = s_listColor[bandID].b; + } else if (s_listColor[bandID].b < s_listColor[bandID+1].b) { + estimateColor.b = s_listColor[bandID].b + (s_listColor[bandID+1].b-s_listColor[bandID].b)*poroportionnalPos; } else { - estimateColor.blue = s_listColor[bandID+1].blue + (s_listColor[bandID].blue-s_listColor[bandID+1].blue)*(1-poroportionnalPos); + estimateColor.b = s_listColor[bandID+1].b + (s_listColor[bandID].b-s_listColor[bandID+1].b)*(1-poroportionnalPos); } // step 2 generate the white and black ... if (relativePos.y == (m_size.y/2)) { // nothing to do ... just get the current color ... } else if (relativePos.y < (m_size.y/2)) { float poroportionnalWhite = 1.0-relativePos.y/(m_size.y/2); - estimateColor.red = estimateColor.red + (1.0 - estimateColor.red )*poroportionnalWhite; - estimateColor.green = estimateColor.green + (1.0 - estimateColor.green)*poroportionnalWhite; - estimateColor.blue = estimateColor.blue + (1.0 - estimateColor.blue )*poroportionnalWhite; + estimateColor.r = estimateColor.r + (1.0 - estimateColor.r)*poroportionnalWhite; + estimateColor.g = estimateColor.g + (1.0 - estimateColor.g)*poroportionnalWhite; + estimateColor.b = estimateColor.b + (1.0 - estimateColor.b)*poroportionnalWhite; } else { float poroportionnalBlack = (relativePos.y-(m_size.y/2))/(m_size.y/2); - estimateColor.red = estimateColor.red - (estimateColor.red )*poroportionnalBlack; - estimateColor.green = estimateColor.green - (estimateColor.green)*poroportionnalBlack; - estimateColor.blue = estimateColor.blue - (estimateColor.blue )*poroportionnalBlack; + estimateColor.r = estimateColor.r - (estimateColor.r)*poroportionnalBlack; + estimateColor.g = estimateColor.g - (estimateColor.g)*poroportionnalBlack; + estimateColor.b = estimateColor.b - (estimateColor.b)*poroportionnalBlack; } /* char colorText[256]; sprintf(colorText, "#%02X%02X%02X%02X", - (uint8_t)(estimateColor.red * 0xFF), - (uint8_t)(estimateColor.green * 0xFF), - (uint8_t)(estimateColor.blue * 0xFF), - (uint8_t)(estimateColor.alpha * 0xFF)); + (uint8_t)(estimateColor.r * 0xFF), + (uint8_t)(estimateColor.g * 0xFF), + (uint8_t)(estimateColor.b * 0xFF), + (uint8_t)(estimateColor.a * 0xFF)); EWOL_DEBUG("new color : " << colorText); */ if( m_currentColor != estimateColor) { diff --git a/Sources/libewol/ewol/widget/ColorBar.h b/Sources/libewol/ewol/widget/ColorBar.h index 50fcb708..d0c3454e 100644 --- a/Sources/libewol/ewol/widget/ColorBar.h +++ b/Sources/libewol/ewol/widget/ColorBar.h @@ -45,10 +45,10 @@ namespace ewol { */ virtual const char * const GetObjectType(void) { return "EwolColorBar"; }; virtual bool CalculateMinSize(void); - etk::Color GetCurrentColor(void); - void SetCurrentColor(etk::Color newOne); + draw::Color GetCurrentColor(void); + void SetCurrentColor(draw::Color newOne); private: - etk::Color m_currentColor; + draw::Color m_currentColor; Vector2D m_currentUserPos; Vector2D m_padding; public: diff --git a/Sources/libewol/ewol/widget/ContextMenu.cpp b/Sources/libewol/ewol/widget/ContextMenu.cpp index 822eecb0..0b0fedd6 100644 --- a/Sources/libewol/ewol/widget/ContextMenu.cpp +++ b/Sources/libewol/ewol/widget/ContextMenu.cpp @@ -40,10 +40,10 @@ ewol::ContextMenu::ContextMenu(void) m_padding.y = 4; m_offset = 20; - m_colorBackGroung = etk::color::white; + m_colorBackGroung = draw::color::white; - m_colorBorder = etk::color::black; - m_colorBorder.alpha = 0x7F; + m_colorBorder = draw::color::black; + m_colorBorder.a = 0x7F; m_arrowPos.x = 0; m_arrowPos.y = 0; diff --git a/Sources/libewol/ewol/widget/ContextMenu.h b/Sources/libewol/ewol/widget/ContextMenu.h index 1c9b7970..bdcf3319 100644 --- a/Sources/libewol/ewol/widget/ContextMenu.h +++ b/Sources/libewol/ewol/widget/ContextMenu.h @@ -57,8 +57,8 @@ namespace ewol { virtual void SetExpendX(bool newExpend=false); virtual void SetExpendY(bool newExpend=false); private: - etk::Color m_colorBackGroung; - etk::Color m_colorBorder; + draw::Color m_colorBackGroung; + draw::Color m_colorBorder; Vector2D m_padding; Vector2D m_arrowPos; float m_offset; diff --git a/Sources/libewol/ewol/widget/Entry.cpp b/Sources/libewol/ewol/widget/Entry.cpp index f6aceefc..ea6ad243 100644 --- a/Sources/libewol/ewol/widget/Entry.cpp +++ b/Sources/libewol/ewol/widget/Entry.cpp @@ -51,10 +51,10 @@ void ewol::Entry::Init(void) m_borderSize = 2; m_paddingSize = 3; m_displayCursor = false; - m_textColorFg = etk::color::black; + m_textColorFg = draw::color::black; - m_textColorBg = etk::color::white; - m_textColorBg.alpha = 0xAF; + m_textColorBg = draw::color::white; + m_textColorBg.a = 0xAF; SetCanHaveFocus(true); } diff --git a/Sources/libewol/ewol/widget/Entry.h b/Sources/libewol/ewol/widget/Entry.h index d87262dc..67e9465d 100644 --- a/Sources/libewol/ewol/widget/Entry.h +++ b/Sources/libewol/ewol/widget/Entry.h @@ -57,8 +57,8 @@ namespace ewol { } private: etk::UString m_data; - etk::Color m_textColorFg; //!< Text color - etk::Color m_textColorBg; //!< Background color + draw::Color m_textColorFg; //!< Text color + draw::Color m_textColorBg; //!< Background color int32_t m_userSize; int32_t m_displayStartPosition; int32_t m_displayCursorPos; diff --git a/Sources/libewol/ewol/widget/Image.cpp b/Sources/libewol/ewol/widget/Image.cpp index 26d21d33..deab9aa6 100644 --- a/Sources/libewol/ewol/widget/Image.cpp +++ b/Sources/libewol/ewol/widget/Image.cpp @@ -58,8 +58,8 @@ void ewol::Image::Init(void) m_padding.x = 4; #endif - m_textColorBg = etk::color::black; - m_textColorBg.alpha = 0x00; + m_textColorBg = draw::color::black; + m_textColorBg.a = 0x00; m_imageSize = 32; } diff --git a/Sources/libewol/ewol/widget/Image.h b/Sources/libewol/ewol/widget/Image.h index 2f1fedda..2bbaa878 100644 --- a/Sources/libewol/ewol/widget/Image.h +++ b/Sources/libewol/ewol/widget/Image.h @@ -51,7 +51,7 @@ namespace ewol { private: etk::UString m_imageSelected; Vector2D m_padding; - etk::Color m_textColorBg; //!< Background color + draw::Color m_textColorBg; //!< Background color int32_t m_imageSize; public: virtual void OnRegenerateDisplay(void); diff --git a/Sources/libewol/ewol/widget/Joystick.cpp b/Sources/libewol/ewol/widget/Joystick.cpp index bf8c38b3..ca1111ac 100644 --- a/Sources/libewol/ewol/widget/Joystick.cpp +++ b/Sources/libewol/ewol/widget/Joystick.cpp @@ -103,10 +103,10 @@ ewol::Joystick::Joystick(void) m_lock = false; m_displayMode = ewol::JOYSTICK_NORMAL_MODE; - m_colorFg = etk::color::blue; + m_colorFg = draw::color::blue; - m_colorBg = etk::color::black; - m_colorBg.alpha = 0x3F; + m_colorBg = draw::color::black; + m_colorBg.a = 0x3F; m_displayPos.x = 0.0; m_displayPos.y = 0.0; diff --git a/Sources/libewol/ewol/widget/Joystick.h b/Sources/libewol/ewol/widget/Joystick.h index b13ab967..8bef9e00 100644 --- a/Sources/libewol/ewol/widget/Joystick.h +++ b/Sources/libewol/ewol/widget/Joystick.h @@ -41,8 +41,8 @@ namespace ewol { class Joystick :public ewol::Drawable { private: - etk::Color m_colorFg; //!< Forground color - etk::Color m_colorBg; //!< Background color + draw::Color m_colorFg; //!< Forground color + draw::Color m_colorBg; //!< Background color Vector2D m_displayPos; //!< direction of the cursor ... float m_distance; //!< dintance from the center float m_angle; //!< angle of the arraw (if < 0 : No arraw...) 0 is the TOP ... diff --git a/Sources/libewol/ewol/widget/Label.cpp b/Sources/libewol/ewol/widget/Label.cpp index ece82024..89e00483 100644 --- a/Sources/libewol/ewol/widget/Label.cpp +++ b/Sources/libewol/ewol/widget/Label.cpp @@ -39,7 +39,7 @@ extern const char * const ewolEventLabelPressed = "ewol Label Pressed"; void ewol::Label::Init(void) { AddEventId(ewolEventLabelPressed); - m_textColorFg = etk::color::black; + m_textColorFg = draw::color::black; SetCanHaveFocus(false); } diff --git a/Sources/libewol/ewol/widget/Label.h b/Sources/libewol/ewol/widget/Label.h index 2eb52ca0..701b2b9e 100644 --- a/Sources/libewol/ewol/widget/Label.h +++ b/Sources/libewol/ewol/widget/Label.h @@ -50,7 +50,7 @@ namespace ewol { void SetLabel(etk::UString newLabel); private: etk::UString m_label; - etk::Color m_textColorFg; //!< Text color + draw::Color m_textColorFg; //!< Text color public: virtual void OnRegenerateDisplay(void); public: diff --git a/Sources/libewol/ewol/widget/List.cpp b/Sources/libewol/ewol/widget/List.cpp index 15625346..21d186f7 100644 --- a/Sources/libewol/ewol/widget/List.cpp +++ b/Sources/libewol/ewol/widget/List.cpp @@ -144,7 +144,7 @@ void ewol::List::OnRegenerateDisplay(void) etk::Vector listSizeColomn; ewol::OObject2DColored * BGOObjects = new ewol::OObject2DColored(); - etk::Color basicBG = GetBasicBG(); + draw::Color basicBG = GetBasicBG(); BGOObjects->SetColor(basicBG); BGOObjects->Rectangle(0, 0, m_size.x, m_size.y); @@ -172,8 +172,8 @@ void ewol::List::OnRegenerateDisplay(void) for(int32_t iii=startRaw; iiiSetColor(bg); BGOObjects->Rectangle(0, m_size.y - tmpOriginY, m_size.x, minHeight+2*m_paddingSizeY); diff --git a/Sources/libewol/ewol/widget/List.h b/Sources/libewol/ewol/widget/List.h index f6e0d8d3..2015d691 100644 --- a/Sources/libewol/ewol/widget/List.h +++ b/Sources/libewol/ewol/widget/List.h @@ -74,21 +74,21 @@ namespace ewol { virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D pos); protected: // function call to display the list : - virtual etk::Color GetBasicBG(void) { - etk::Color bg(0xFFFFFFFF); + virtual draw::Color GetBasicBG(void) { + draw::Color bg(0xFFFFFFFF); return bg; } virtual uint32_t GetNuberOfColomn(void) { return 0; }; - virtual bool GetTitle(int32_t colomn, etk::UString &myTitle, etk::Color &fg, etk::Color &bg) { + virtual bool GetTitle(int32_t colomn, etk::UString &myTitle, draw::Color &fg, draw::Color &bg) { myTitle = ""; return false; }; virtual uint32_t GetNuberOfRaw(void) { return 0; }; - virtual bool GetElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, etk::Color &fg, etk::Color &bg) { + virtual bool GetElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, draw::Color &fg, draw::Color &bg) { myTextToWrite = ""; bg = 0xFFFFFFFF; fg = 0x000000FF; diff --git a/Sources/libewol/ewol/widget/ListFileSystem.cpp b/Sources/libewol/ewol/widget/ListFileSystem.cpp index e391d05d..9af770f7 100644 --- a/Sources/libewol/ewol/widget/ListFileSystem.cpp +++ b/Sources/libewol/ewol/widget/ListFileSystem.cpp @@ -86,8 +86,8 @@ ewol::ListFileSystem::~ListFileSystem(void) } }; -etk::Color ewol::ListFileSystem::GetBasicBG(void) { - etk::Color bg(0x00000010); +draw::Color ewol::ListFileSystem::GetBasicBG(void) { + draw::Color bg(0x00000010); return bg; } @@ -267,20 +267,20 @@ void ewol::ListFileSystem::SetSelect( etk::UString data) { uint32_t ewol::ListFileSystem::GetNuberOfColomn(void) { return 1; }; -bool ewol::ListFileSystem::GetTitle(int32_t colomn, etk::UString &myTitle, etk::Color &fg, etk::Color &bg) { +bool ewol::ListFileSystem::GetTitle(int32_t colomn, etk::UString &myTitle, draw::Color &fg, draw::Color &bg) { myTitle = "title"; return true; }; uint32_t ewol::ListFileSystem::GetNuberOfRaw(void) { return m_list.Size(); }; -bool ewol::ListFileSystem::GetElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, etk::Color &fg, etk::Color &bg) { +bool ewol::ListFileSystem::GetElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, draw::Color &fg, draw::Color &bg) { if (raw >= 0 && raw < m_list.Size() && NULL != m_list[raw]) { myTextToWrite = m_list[raw]->m_name; } else { myTextToWrite = "ERROR"; } - fg = etk::color::black; + fg = draw::color::black; if (raw % 2) { bg = 0xFFFFFF00; } else { diff --git a/Sources/libewol/ewol/widget/ListFileSystem.h b/Sources/libewol/ewol/widget/ListFileSystem.h index 0a442434..c3c9fb47 100644 --- a/Sources/libewol/ewol/widget/ListFileSystem.h +++ b/Sources/libewol/ewol/widget/ListFileSystem.h @@ -66,11 +66,11 @@ namespace ewol { ListFileSystem(void); ~ListFileSystem(void); // display API : - virtual etk::Color GetBasicBG(void); + virtual draw::Color GetBasicBG(void); uint32_t GetNuberOfColomn(void); - bool GetTitle(int32_t colomn, etk::UString &myTitle, etk::Color &fg, etk::Color &bg); + bool GetTitle(int32_t colomn, etk::UString &myTitle, draw::Color &fg, draw::Color &bg); uint32_t GetNuberOfRaw(void); - bool GetElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, etk::Color &fg, etk::Color &bg); + bool GetElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, draw::Color &fg, draw::Color &bg); bool OnItemEvent(int32_t IdInput, ewol::eventInputType_te typeEvent, int32_t colomn, int32_t raw, float x, float y); /** * @brief Get the current Object type of the EObject diff --git a/Sources/libewol/ewol/widget/PopUp.cpp b/Sources/libewol/ewol/widget/PopUp.cpp index 395bc80e..8f2222d3 100644 --- a/Sources/libewol/ewol/widget/PopUp.cpp +++ b/Sources/libewol/ewol/widget/PopUp.cpp @@ -36,13 +36,13 @@ ewol::PopUp::PopUp(void) : m_userExpendX = true; m_userExpendY = true; - m_colorBackGroung = etk::color::white; + m_colorBackGroung = draw::color::white; - m_colorEmptyArea = etk::color::black; - m_colorEmptyArea.alpha = 0x7F; + m_colorEmptyArea = draw::color::black; + m_colorEmptyArea.a = 0x7F; - m_colorBorder = etk::color::black; - m_colorBorder.alpha = 0x7F; + m_colorBorder = draw::color::black; + m_colorBorder.a = 0x7F; m_subWidget = 0; } diff --git a/Sources/libewol/ewol/widget/PopUp.h b/Sources/libewol/ewol/widget/PopUp.h index 2956236c..cb9c843a 100644 --- a/Sources/libewol/ewol/widget/PopUp.h +++ b/Sources/libewol/ewol/widget/PopUp.h @@ -51,9 +51,9 @@ namespace ewol { virtual void SetExpendY(bool newExpend=false); void SetDisplayRatio(float ratio); private: - etk::Color m_colorBackGroung; - etk::Color m_colorBorder; - etk::Color m_colorEmptyArea; + draw::Color m_colorBackGroung; + draw::Color m_colorBorder; + draw::Color m_colorEmptyArea; ewol::Widget* m_subWidgetNext; ewol::Widget* m_subWidget; float m_displayRatio; diff --git a/Sources/libewol/ewol/widget/ProgressBar.cpp b/Sources/libewol/ewol/widget/ProgressBar.cpp index 86e17487..12328981 100644 --- a/Sources/libewol/ewol/widget/ProgressBar.cpp +++ b/Sources/libewol/ewol/widget/ProgressBar.cpp @@ -36,12 +36,12 @@ ewol::ProgressBar::ProgressBar(void) { m_value = 0.0; - m_textColorFg = etk::color::black; + m_textColorFg = draw::color::black; m_textColorBgOn = 0x00FF00FF; - m_textColorBgOff = etk::color::black; - m_textColorBgOff.alpha = 0x3F; + m_textColorBgOff = draw::color::black; + m_textColorBgOff.a = 0x3F; SetCanHaveFocus(true); } diff --git a/Sources/libewol/ewol/widget/ProgressBar.h b/Sources/libewol/ewol/widget/ProgressBar.h index 77e616a2..1def92c0 100644 --- a/Sources/libewol/ewol/widget/ProgressBar.h +++ b/Sources/libewol/ewol/widget/ProgressBar.h @@ -46,12 +46,12 @@ namespace ewol { virtual bool CalculateMinSize(void); void ValueSet(float val); float ValueGet(void); - void SetColor(etk::Color newColor) { m_textColorFg = newColor; }; + void SetColor(draw::Color newColor) { m_textColorFg = newColor; }; private: float m_value; //!< % used - etk::Color m_textColorFg; //!< forder bar color - etk::Color m_textColorBgOn; //!< bar color enable - etk::Color m_textColorBgOff; //!< bar color disable + draw::Color m_textColorFg; //!< forder bar color + draw::Color m_textColorBgOn; //!< bar color enable + draw::Color m_textColorBgOff; //!< bar color disable public: virtual void OnRegenerateDisplay(void); }; diff --git a/Sources/libewol/ewol/widget/Slider.cpp b/Sources/libewol/ewol/widget/Slider.cpp index 39922bf6..416ffa9c 100644 --- a/Sources/libewol/ewol/widget/Slider.cpp +++ b/Sources/libewol/ewol/widget/Slider.cpp @@ -45,10 +45,10 @@ ewol::Slider::Slider(void) m_min = 0; m_max = 10; - m_textColorFg = etk::color::black; + m_textColorFg = draw::color::black; - m_textColorBg = etk::color::black; - m_textColorBg.alpha = 0x3F; + m_textColorBg = draw::color::black; + m_textColorBg.a = 0x3F; SetCanHaveFocus(true); } @@ -107,8 +107,8 @@ void ewol::Slider::OnRegenerateDisplay(void) tmpOObjects->SetColor(m_textColorFg); // draw a line : tmpOObjects->Line(dotRadius, m_size.y/2, m_size.x-dotRadius, m_size.y/2, 1); - etk::Color borderDot = m_textColorFg; - borderDot.alpha /= 2; + draw::Color borderDot = m_textColorFg; + borderDot.a /= 2; tmpOObjects->SetColor(borderDot); tmpOObjects->Disc(4+((float)(m_value-m_min)/(float)(m_max-m_min))*(float)(m_size.x-2*dotRadius), m_size.y/2, dotRadius); diff --git a/Sources/libewol/ewol/widget/Slider.h b/Sources/libewol/ewol/widget/Slider.h index 697d07ef..bbfbb1f0 100644 --- a/Sources/libewol/ewol/widget/Slider.h +++ b/Sources/libewol/ewol/widget/Slider.h @@ -49,13 +49,13 @@ namespace ewol { int32_t GetValue(void); void SetMin(int32_t val); void SetMax(int32_t val); - void SetColor(etk::Color newColor) { m_textColorFg = newColor; }; + void SetColor(draw::Color newColor) { m_textColorFg = newColor; }; private: int32_t m_value; int32_t m_min; int32_t m_max; - etk::Color m_textColorFg; //!< Text color - etk::Color m_textColorBg; //!< Background color + draw::Color m_textColorFg; //!< Text color + draw::Color m_textColorBg; //!< Background color public: virtual void OnRegenerateDisplay(void); public: diff --git a/Sources/libewol/ewol/widget/Spacer.cpp b/Sources/libewol/ewol/widget/Spacer.cpp index b5549753..3f3377f4 100644 --- a/Sources/libewol/ewol/widget/Spacer.cpp +++ b/Sources/libewol/ewol/widget/Spacer.cpp @@ -36,7 +36,8 @@ ewol::Spacer::Spacer(void) { m_localSize = 10; SetCanHaveFocus(false); - m_color = 0x00000000; + m_color = draw::color::black; + m_color.a = 0; } ewol::Spacer::~Spacer(void) @@ -67,7 +68,7 @@ void ewol::Spacer::OnRegenerateDisplay(void) } // generate a white background and take gray on other surfaces ClearOObjectList(); - if (m_color.alpha == 0) { + if (m_color.a == 0) { return; } ewol::OObject2DColored * BGOObjects = new ewol::OObject2DColored(); diff --git a/Sources/libewol/ewol/widget/Spacer.h b/Sources/libewol/ewol/widget/Spacer.h index 8d0ac20e..ef2061cc 100644 --- a/Sources/libewol/ewol/widget/Spacer.h +++ b/Sources/libewol/ewol/widget/Spacer.h @@ -53,10 +53,10 @@ namespace ewol { */ virtual ewol::Widget * GetWidgetAtPos(Vector2D pos) { return NULL; }; virtual void OnRegenerateDisplay(void); - void SetColor(etk::Color newColor) { m_color = newColor; MarkToRedraw(); }; + void SetColor(draw::Color newColor) { m_color = newColor; MarkToRedraw(); }; private: float m_localSize; - etk::Color m_color; + draw::Color m_color; }; }; diff --git a/Sources/libewol/ewol/widget/meta/ColorChooser.cpp b/Sources/libewol/ewol/widget/meta/ColorChooser.cpp index 7c849a17..16ce0011 100644 --- a/Sources/libewol/ewol/widget/meta/ColorChooser.cpp +++ b/Sources/libewol/ewol/widget/meta/ColorChooser.cpp @@ -71,8 +71,8 @@ ewol::ColorChooser::ColorChooser(void) */ SubWidgetAdd(m_widgetColorBar); - etk::Color sliderColor; - sliderColor = etk::color::black; + draw::Color sliderColor; + sliderColor = draw::color::black; m_widgetRed = new ewol::Slider(); m_widgetRed->RegisterOnEvent(this, ewolEventSliderChange, eventColorSpecificHasChange); @@ -109,7 +109,7 @@ ewol::ColorChooser::ColorChooser(void) m_widgetAlpha->SetMax(255); SubWidgetAdd(m_widgetAlpha); - m_currentColor = etk::color::white; + m_currentColor = draw::color::white; } @@ -119,20 +119,20 @@ ewol::ColorChooser::~ColorChooser(void) } -void ewol::ColorChooser::SetColor(etk::Color newColor) +void ewol::ColorChooser::SetColor(draw::Color newColor) { m_currentColor = newColor; if (NULL != m_widgetRed) { - m_widgetRed->SetValue(m_currentColor.red); + m_widgetRed->SetValue(m_currentColor.r); } if (NULL != m_widgetGreen) { - m_widgetGreen->SetValue(m_currentColor.green); + m_widgetGreen->SetValue(m_currentColor.g); } if (NULL != m_widgetBlue) { - m_widgetBlue->SetValue(m_currentColor.blue); + m_widgetBlue->SetValue(m_currentColor.b); } if (NULL != m_widgetAlpha) { - m_widgetAlpha->SetValue(m_currentColor.alpha); + m_widgetAlpha->SetValue(m_currentColor.a); } if (NULL != m_widgetColorBar) { m_widgetColorBar->SetCurrentColor(m_currentColor); @@ -140,7 +140,7 @@ void ewol::ColorChooser::SetColor(etk::Color newColor) } -etk::Color ewol::ColorChooser::GetColor(void) +draw::Color ewol::ColorChooser::GetColor(void) { return m_currentColor; } @@ -161,39 +161,39 @@ void ewol::ColorChooser::OnReceiveMessage(ewol::EObject * CallerObject, const ch //EWOL_INFO("Receive Extern Event ... : widgetPointer=" << CallerObject << "\"" << eventId << "\" ==> data=\"" << data << "\"" ); if (eventColorBarHasChange == eventId) { //==> colorBar has change ... - uint8_t tmpAlpha = m_currentColor.alpha; + uint8_t tmpAlpha = m_currentColor.a; // the colorbar has no notion of the alpha ==> keep it ... if (NULL != m_widgetColorBar) { m_currentColor = m_widgetColorBar->GetCurrentColor(); } - m_currentColor.alpha = tmpAlpha; + m_currentColor.a = tmpAlpha; if (NULL != m_widgetRed) { - m_widgetRed->SetValue(m_currentColor.red); + m_widgetRed->SetValue(m_currentColor.r); } if (NULL != m_widgetGreen) { - m_widgetGreen->SetValue(m_currentColor.green); + m_widgetGreen->SetValue(m_currentColor.g); } if (NULL != m_widgetBlue) { - m_widgetBlue->SetValue(m_currentColor.blue); + m_widgetBlue->SetValue(m_currentColor.b); } if (NULL != m_widgetAlpha) { - m_widgetAlpha->SetValue(m_currentColor.alpha); + m_widgetAlpha->SetValue(m_currentColor.a); } // TODO : send the real color ... GenerateEventId(ewolEventColorChooserChange, "0x51452563"); } else if (eventColorSpecificHasChange == eventId) { // Slider has changes his color ==> get the one change ... if (CallerObject == m_widgetRed) { - m_currentColor.red = m_widgetRed->GetValue(); + m_currentColor.r = m_widgetRed->GetValue(); } if (CallerObject == m_widgetGreen) { - m_currentColor.green = m_widgetGreen->GetValue(); + m_currentColor.g = m_widgetGreen->GetValue(); } if (CallerObject == m_widgetBlue) { - m_currentColor.blue = m_widgetBlue->GetValue(); + m_currentColor.b = m_widgetBlue->GetValue(); } if (CallerObject == m_widgetAlpha) { - m_currentColor.alpha = m_widgetAlpha->GetValue(); + m_currentColor.a = m_widgetAlpha->GetValue(); } if (NULL != m_widgetColorBar) { m_widgetColorBar->SetCurrentColor(m_currentColor); diff --git a/Sources/libewol/ewol/widget/meta/ColorChooser.h b/Sources/libewol/ewol/widget/meta/ColorChooser.h index 5c1034c0..b0deb84b 100644 --- a/Sources/libewol/ewol/widget/meta/ColorChooser.h +++ b/Sources/libewol/ewol/widget/meta/ColorChooser.h @@ -66,15 +66,15 @@ namespace ewol { */ virtual void OnObjectRemove(ewol::EObject * removeObject); - void SetColor(etk::Color newColor); - etk::Color GetColor(void); + void SetColor(draw::Color newColor); + draw::Color GetColor(void); private:; ewol::ColorBar* m_widgetColorBar; ewol::Slider* m_widgetRed; ewol::Slider* m_widgetGreen; ewol::Slider* m_widgetBlue; ewol::Slider* m_widgetAlpha; - etk::Color m_currentColor; + draw::Color m_currentColor; }; }; diff --git a/Sources/libewol/ewol/widget/meta/ParameterList.cpp b/Sources/libewol/ewol/widget/meta/ParameterList.cpp index 47cda0ce..601d4e3b 100644 --- a/Sources/libewol/ewol/widget/meta/ParameterList.cpp +++ b/Sources/libewol/ewol/widget/meta/ParameterList.cpp @@ -176,7 +176,7 @@ void ewol::ParameterList::OnRegenerateDisplay(void) for(int32_t iii=startRaw; iiim_label; } diff --git a/Sources/libewol/file.mk b/Sources/libewol/file.mk index cb5c2731..3663deb1 100644 --- a/Sources/libewol/file.mk +++ b/Sources/libewol/file.mk @@ -29,6 +29,7 @@ FILE_LIST+= ewol/oObject/OObject.cpp \ # texture management FILE_LIST+= ewol/texture/Texture.cpp \ + ewol/texture/TextureManager.cpp \ ewol/texture/TextureBMP.cpp \ ewol/texture/TexturePNG.cpp \ ewol/texture/TextureSVG.cpp diff --git a/Sources/libparsersvg b/Sources/libparsersvg index fc100697..2037fb3e 160000 --- a/Sources/libparsersvg +++ b/Sources/libparsersvg @@ -1 +1 @@ -Subproject commit fc100697e315ac17c7fc6e3e4afa9e24e945ef7b +Subproject commit 2037fb3efc117050ef7d32385f93cad3eec3e822