change the color_ts in a better class anc rename VectorType in Vector

This commit is contained in:
Edouard DUPIN 2012-08-14 16:12:03 +02:00
parent ea19353387
commit dadd22bfe1
93 changed files with 1674 additions and 1924 deletions

View File

@ -25,350 +25,394 @@
#include <etk/Types.h> #include <etk/Types.h>
#include <etk/Color.h> #include <etk/Color.h>
#include <etk/DebugInternal.h> #include <etk/DebugInternal.h>
#include <etk/tool.h>
const color_ts etk::color::color_none(0x00000000); const etk::Color etk::color::none((uint32_t)0x00000000);
const color_ts etk::color::color_AliceBlue(0xF0F8FFFF); const etk::Color etk::color::aliceBlue((uint32_t)0xF0F8FFFF);
const color_ts etk::color::color_AntiqueWhite(0xFAEBD7FF); const etk::Color etk::color::antiqueWhite((uint32_t)0xFAEBD7FF);
const color_ts etk::color::color_Aqua(0x00FFFFFF); const etk::Color etk::color::aqua((uint32_t)0x00FFFFFF);
const color_ts etk::color::color_Aquamarine(0x7FFFD4FF); const etk::Color etk::color::aquamarine((uint32_t)0x7FFFD4FF);
const color_ts etk::color::color_Azure(0xF0FFFFFF); const etk::Color etk::color::azure((uint32_t)0xF0FFFFFF);
const color_ts etk::color::color_Beige(0xF5F5DCFF); const etk::Color etk::color::beige((uint32_t)0xF5F5DCFF);
const color_ts etk::color::color_Bisque(0xFFE4C4FF); const etk::Color etk::color::bisque((uint32_t)0xFFE4C4FF);
const color_ts etk::color::color_Black(0x000000FF); const etk::Color etk::color::black((uint32_t)0x000000FF);
const color_ts etk::color::color_BlanchedAlmond(0xFFEBCDFF); const etk::Color etk::color::blanchedAlmond((uint32_t)0xFFEBCDFF);
const color_ts etk::color::color_Blue(0x0000FFFF); const etk::Color etk::color::blue((uint32_t)0x0000FFFF);
const color_ts etk::color::color_BlueViolet(0x8A2BE2FF); const etk::Color etk::color::blueViolet((uint32_t)0x8A2BE2FF);
const color_ts etk::color::color_Brown(0xA52A2AFF); const etk::Color etk::color::brown((uint32_t)0xA52A2AFF);
const color_ts etk::color::color_BurlyWood(0xDEB887FF); const etk::Color etk::color::burlyWood((uint32_t)0xDEB887FF);
const color_ts etk::color::color_CadetBlue(0x5F9EA0FF); const etk::Color etk::color::cadetBlue((uint32_t)0x5F9EA0FF);
const color_ts etk::color::color_Chartreuse(0x7FFF00FF); const etk::Color etk::color::chartreuse((uint32_t)0x7FFF00FF);
const color_ts etk::color::color_Chocolate(0xD2691EFF); const etk::Color etk::color::chocolate((uint32_t)0xD2691EFF);
const color_ts etk::color::color_Coral(0xFF7F50FF); const etk::Color etk::color::coral((uint32_t)0xFF7F50FF);
const color_ts etk::color::color_CornflowerBlue(0x6495EDFF); const etk::Color etk::color::cornflowerBlue((uint32_t)0x6495EDFF);
const color_ts etk::color::color_Cornsilk(0xFFF8DCFF); const etk::Color etk::color::cornsilk((uint32_t)0xFFF8DCFF);
const color_ts etk::color::color_Crimson(0xDC143CFF); const etk::Color etk::color::crimson((uint32_t)0xDC143CFF);
const color_ts etk::color::color_Cyan(0x00FFFFFF); const etk::Color etk::color::cyan((uint32_t)0x00FFFFFF);
const color_ts etk::color::color_DarkBlue(0x00008BFF); const etk::Color etk::color::darkBlue((uint32_t)0x00008BFF);
const color_ts etk::color::color_DarkCyan(0x008B8BFF); const etk::Color etk::color::darkCyan((uint32_t)0x008B8BFF);
const color_ts etk::color::color_DarkGoldenRod(0xB8860BFF); const etk::Color etk::color::darkGoldenRod((uint32_t)0xB8860BFF);
const color_ts etk::color::color_DarkGray(0xA9A9A9FF); const etk::Color etk::color::darkGray((uint32_t)0xA9A9A9FF);
const color_ts etk::color::color_DarkGrey(0xA9A9A9FF); const etk::Color etk::color::darkGrey((uint32_t)0xA9A9A9FF);
const color_ts etk::color::color_DarkGreen(0x006400FF); const etk::Color etk::color::darkGreen((uint32_t)0x006400FF);
const color_ts etk::color::color_DarkKhaki(0xBDB76BFF); const etk::Color etk::color::darkKhaki((uint32_t)0xBDB76BFF);
const color_ts etk::color::color_DarkMagenta(0x8B008BFF); const etk::Color etk::color::darkMagenta((uint32_t)0x8B008BFF);
const color_ts etk::color::color_DarkOliveGreen(0x556B2FFF); const etk::Color etk::color::darkOliveGreen((uint32_t)0x556B2FFF);
const color_ts etk::color::color_Darkorange(0xFF8C00FF); const etk::Color etk::color::darkorange((uint32_t)0xFF8C00FF);
const color_ts etk::color::color_DarkOrchid(0x9932CCFF); const etk::Color etk::color::darkOrchid((uint32_t)0x9932CCFF);
const color_ts etk::color::color_DarkRed(0x8B0000FF); const etk::Color etk::color::darkRed((uint32_t)0x8B0000FF);
const color_ts etk::color::color_DarkSalmon(0xE9967AFF); const etk::Color etk::color::darkSalmon((uint32_t)0xE9967AFF);
const color_ts etk::color::color_DarkSeaGreen(0x8FBC8FFF); const etk::Color etk::color::darkSeaGreen((uint32_t)0x8FBC8FFF);
const color_ts etk::color::color_DarkSlateBlue(0x483D8BFF); const etk::Color etk::color::darkSlateBlue((uint32_t)0x483D8BFF);
const color_ts etk::color::color_DarkSlateGray(0x2F4F4FFF); const etk::Color etk::color::darkSlateGray((uint32_t)0x2F4F4FFF);
const color_ts etk::color::color_DarkSlateGrey(0x2F4F4FFF); const etk::Color etk::color::darkSlateGrey((uint32_t)0x2F4F4FFF);
const color_ts etk::color::color_DarkTurquoise(0x00CED1FF); const etk::Color etk::color::darkTurquoise((uint32_t)0x00CED1FF);
const color_ts etk::color::color_DarkViolet(0x9400D3FF); const etk::Color etk::color::darkViolet((uint32_t)0x9400D3FF);
const color_ts etk::color::color_DeepPink(0xFF1493FF); const etk::Color etk::color::deepPink((uint32_t)0xFF1493FF);
const color_ts etk::color::color_DeepSkyBlue(0x00BFFFFF); const etk::Color etk::color::deepSkyBlue((uint32_t)0x00BFFFFF);
const color_ts etk::color::color_DimGray(0x696969FF); const etk::Color etk::color::dimGray((uint32_t)0x696969FF);
const color_ts etk::color::color_DimGrey(0x696969FF); const etk::Color etk::color::dimGrey((uint32_t)0x696969FF);
const color_ts etk::color::color_DodgerBlue(0x1E90FFFF); const etk::Color etk::color::dodgerBlue((uint32_t)0x1E90FFFF);
const color_ts etk::color::color_FireBrick(0xB22222FF); const etk::Color etk::color::fireBrick((uint32_t)0xB22222FF);
const color_ts etk::color::color_FloralWhite(0xFFFAF0FF); const etk::Color etk::color::floralWhite((uint32_t)0xFFFAF0FF);
const color_ts etk::color::color_ForestGreen(0x228B22FF); const etk::Color etk::color::forestGreen((uint32_t)0x228B22FF);
const color_ts etk::color::color_Fuchsia(0xFF00FFFF); const etk::Color etk::color::fuchsia((uint32_t)0xFF00FFFF);
const color_ts etk::color::color_Gainsboro(0xDCDCDCFF); const etk::Color etk::color::gainsboro((uint32_t)0xDCDCDCFF);
const color_ts etk::color::color_GhostWhite(0xF8F8FFFF); const etk::Color etk::color::ghostWhite((uint32_t)0xF8F8FFFF);
const color_ts etk::color::color_Gold(0xFFD700FF); const etk::Color etk::color::gold((uint32_t)0xFFD700FF);
const color_ts etk::color::color_GoldenRod(0xDAA520FF); const etk::Color etk::color::goldenRod((uint32_t)0xDAA520FF);
const color_ts etk::color::color_Gray(0x808080FF); const etk::Color etk::color::gray((uint32_t)0x808080FF);
const color_ts etk::color::color_Grey(0x808080FF); const etk::Color etk::color::grey((uint32_t)0x808080FF);
const color_ts etk::color::color_Green(0x008000FF); const etk::Color etk::color::green((uint32_t)0x008000FF);
const color_ts etk::color::color_GreenYellow(0xADFF2FFF); const etk::Color etk::color::greenYellow((uint32_t)0xADFF2FFF);
const color_ts etk::color::color_HoneyDew(0xF0FFF0FF); const etk::Color etk::color::honeyDew((uint32_t)0xF0FFF0FF);
const color_ts etk::color::color_HotPink(0xFF69B4FF); const etk::Color etk::color::hotPink((uint32_t)0xFF69B4FF);
const color_ts etk::color::color_IndianRed (0xCD5C5CFF); const etk::Color etk::color::indianRed ((uint32_t)0xCD5C5CFF);
const color_ts etk::color::color_Indigo (0x4B0082FF); const etk::Color etk::color::indigo ((uint32_t)0x4B0082FF);
const color_ts etk::color::color_Ivory(0xFFFFF0FF); const etk::Color etk::color::ivory((uint32_t)0xFFFFF0FF);
const color_ts etk::color::color_Khaki(0xF0E68CFF); const etk::Color etk::color::khaki((uint32_t)0xF0E68CFF);
const color_ts etk::color::color_Lavender(0xE6E6FAFF); const etk::Color etk::color::lavender((uint32_t)0xE6E6FAFF);
const color_ts etk::color::color_LavenderBlush(0xFFF0F5FF); const etk::Color etk::color::lavenderBlush((uint32_t)0xFFF0F5FF);
const color_ts etk::color::color_LawnGreen(0x7CFC00FF); const etk::Color etk::color::lawnGreen((uint32_t)0x7CFC00FF);
const color_ts etk::color::color_LemonChiffon(0xFFFACDFF); const etk::Color etk::color::lemonChiffon((uint32_t)0xFFFACDFF);
const color_ts etk::color::color_LightBlue(0xADD8E6FF); const etk::Color etk::color::lightBlue((uint32_t)0xADD8E6FF);
const color_ts etk::color::color_LightCoral(0xF08080FF); const etk::Color etk::color::lightCoral((uint32_t)0xF08080FF);
const color_ts etk::color::color_LightCyan(0xE0FFFFFF); const etk::Color etk::color::lightCyan((uint32_t)0xE0FFFFFF);
const color_ts etk::color::color_LightGoldenRodYellow(0xFAFAD2FF); const etk::Color etk::color::lightGoldenRodYellow((uint32_t)0xFAFAD2FF);
const color_ts etk::color::color_LightGray(0xD3D3D3FF); const etk::Color etk::color::lightGray((uint32_t)0xD3D3D3FF);
const color_ts etk::color::color_LightGrey(0xD3D3D3FF); const etk::Color etk::color::lightGrey((uint32_t)0xD3D3D3FF);
const color_ts etk::color::color_LightGreen(0x90EE90FF); const etk::Color etk::color::lightGreen((uint32_t)0x90EE90FF);
const color_ts etk::color::color_LightPink(0xFFB6C1FF); const etk::Color etk::color::lightPink((uint32_t)0xFFB6C1FF);
const color_ts etk::color::color_LightSalmon(0xFFA07AFF); const etk::Color etk::color::lightSalmon((uint32_t)0xFFA07AFF);
const color_ts etk::color::color_LightSeaGreen(0x20B2AAFF); const etk::Color etk::color::lightSeaGreen((uint32_t)0x20B2AAFF);
const color_ts etk::color::color_LightSkyBlue(0x87CEFAFF); const etk::Color etk::color::lightSkyBlue((uint32_t)0x87CEFAFF);
const color_ts etk::color::color_LightSlateGray(0x778899FF); const etk::Color etk::color::lightSlateGray((uint32_t)0x778899FF);
const color_ts etk::color::color_LightSlateGrey(0x778899FF); const etk::Color etk::color::lightSlateGrey((uint32_t)0x778899FF);
const color_ts etk::color::color_LightSteelBlue(0xB0C4DEFF); const etk::Color etk::color::lightSteelBlue((uint32_t)0xB0C4DEFF);
const color_ts etk::color::color_LightYellow(0xFFFFE0FF); const etk::Color etk::color::lightYellow((uint32_t)0xFFFFE0FF);
const color_ts etk::color::color_Lime(0x00FF00FF); const etk::Color etk::color::lime((uint32_t)0x00FF00FF);
const color_ts etk::color::color_LimeGreen(0x32CD32FF); const etk::Color etk::color::limeGreen((uint32_t)0x32CD32FF);
const color_ts etk::color::color_Linen(0xFAF0E6FF); const etk::Color etk::color::linen((uint32_t)0xFAF0E6FF);
const color_ts etk::color::color_Magenta(0xFF00FFFF); const etk::Color etk::color::magenta((uint32_t)0xFF00FFFF);
const color_ts etk::color::color_Maroon(0x800000FF); const etk::Color etk::color::maroon((uint32_t)0x800000FF);
const color_ts etk::color::color_MediumAquaMarine(0x66CDAAFF); const etk::Color etk::color::mediumAquaMarine((uint32_t)0x66CDAAFF);
const color_ts etk::color::color_MediumBlue(0x0000CDFF); const etk::Color etk::color::mediumBlue((uint32_t)0x0000CDFF);
const color_ts etk::color::color_MediumOrchid(0xBA55D3FF); const etk::Color etk::color::mediumOrchid((uint32_t)0xBA55D3FF);
const color_ts etk::color::color_MediumPurple(0x9370D8FF); const etk::Color etk::color::mediumPurple((uint32_t)0x9370D8FF);
const color_ts etk::color::color_MediumSeaGreen(0x3CB371FF); const etk::Color etk::color::mediumSeaGreen((uint32_t)0x3CB371FF);
const color_ts etk::color::color_MediumSlateBlue(0x7B68EEFF); const etk::Color etk::color::mediumSlateBlue((uint32_t)0x7B68EEFF);
const color_ts etk::color::color_MediumSpringGreen(0x00FA9AFF); const etk::Color etk::color::mediumSpringGreen((uint32_t)0x00FA9AFF);
const color_ts etk::color::color_MediumTurquoise(0x48D1CCFF); const etk::Color etk::color::mediumTurquoise((uint32_t)0x48D1CCFF);
const color_ts etk::color::color_MediumVioletRed(0xC71585FF); const etk::Color etk::color::mediumVioletRed((uint32_t)0xC71585FF);
const color_ts etk::color::color_MidnightBlue(0x191970FF); const etk::Color etk::color::midnightBlue((uint32_t)0x191970FF);
const color_ts etk::color::color_MintCream(0xF5FFFAFF); const etk::Color etk::color::mintCream((uint32_t)0xF5FFFAFF);
const color_ts etk::color::color_MistyRose(0xFFE4E1FF); const etk::Color etk::color::mistyRose((uint32_t)0xFFE4E1FF);
const color_ts etk::color::color_Moccasin(0xFFE4B5FF); const etk::Color etk::color::moccasin((uint32_t)0xFFE4B5FF);
const color_ts etk::color::color_NavajoWhite(0xFFDEADFF); const etk::Color etk::color::navajoWhite((uint32_t)0xFFDEADFF);
const color_ts etk::color::color_Navy(0x000080FF); const etk::Color etk::color::navy((uint32_t)0x000080FF);
const color_ts etk::color::color_OldLace(0xFDF5E6FF); const etk::Color etk::color::oldLace((uint32_t)0xFDF5E6FF);
const color_ts etk::color::color_Olive(0x808000FF); const etk::Color etk::color::olive((uint32_t)0x808000FF);
const color_ts etk::color::color_OliveDrab(0x6B8E23FF); const etk::Color etk::color::oliveDrab((uint32_t)0x6B8E23FF);
const color_ts etk::color::color_Orange(0xFFA500FF); const etk::Color etk::color::orange((uint32_t)0xFFA500FF);
const color_ts etk::color::color_OrangeRed(0xFF4500FF); const etk::Color etk::color::orangeRed((uint32_t)0xFF4500FF);
const color_ts etk::color::color_Orchid(0xDA70D6FF); const etk::Color etk::color::orchid((uint32_t)0xDA70D6FF);
const color_ts etk::color::color_PaleGoldenRod(0xEEE8AAFF); const etk::Color etk::color::paleGoldenRod((uint32_t)0xEEE8AAFF);
const color_ts etk::color::color_PaleGreen(0x98FB98FF); const etk::Color etk::color::paleGreen((uint32_t)0x98FB98FF);
const color_ts etk::color::color_PaleTurquoise(0xAFEEEEFF); const etk::Color etk::color::paleTurquoise((uint32_t)0xAFEEEEFF);
const color_ts etk::color::color_PaleVioletRed(0xD87093FF); const etk::Color etk::color::paleVioletRed((uint32_t)0xD87093FF);
const color_ts etk::color::color_PapayaWhip(0xFFEFD5FF); const etk::Color etk::color::papayaWhip((uint32_t)0xFFEFD5FF);
const color_ts etk::color::color_PeachPuff(0xFFDAB9FF); const etk::Color etk::color::peachPuff((uint32_t)0xFFDAB9FF);
const color_ts etk::color::color_Peru(0xCD853FFF); const etk::Color etk::color::peru((uint32_t)0xCD853FFF);
const color_ts etk::color::color_Pink(0xFFC0CBFF); const etk::Color etk::color::pink((uint32_t)0xFFC0CBFF);
const color_ts etk::color::color_Plum(0xDDA0DDFF); const etk::Color etk::color::plum((uint32_t)0xDDA0DDFF);
const color_ts etk::color::color_PowderBlue(0xB0E0E6FF); const etk::Color etk::color::powderBlue((uint32_t)0xB0E0E6FF);
const color_ts etk::color::color_Purple(0x800080FF); const etk::Color etk::color::purple((uint32_t)0x800080FF);
const color_ts etk::color::color_Red(0xFF0000FF); const etk::Color etk::color::red((uint32_t)0xFF0000FF);
const color_ts etk::color::color_RosyBrown(0xBC8F8FFF); const etk::Color etk::color::rosyBrown((uint32_t)0xBC8F8FFF);
const color_ts etk::color::color_RoyalBlue(0x4169E1FF); const etk::Color etk::color::royalBlue((uint32_t)0x4169E1FF);
const color_ts etk::color::color_SaddleBrown(0x8B4513FF); const etk::Color etk::color::saddleBrown((uint32_t)0x8B4513FF);
const color_ts etk::color::color_Salmon(0xFA8072FF); const etk::Color etk::color::salmon((uint32_t)0xFA8072FF);
const color_ts etk::color::color_SandyBrown(0xF4A460FF); const etk::Color etk::color::sandyBrown((uint32_t)0xF4A460FF);
const color_ts etk::color::color_SeaGreen(0x2E8B57FF); const etk::Color etk::color::seaGreen((uint32_t)0x2E8B57FF);
const color_ts etk::color::color_SeaShell(0xFFF5EEFF); const etk::Color etk::color::seaShell((uint32_t)0xFFF5EEFF);
const color_ts etk::color::color_Sienna(0xA0522DFF); const etk::Color etk::color::sienna((uint32_t)0xA0522DFF);
const color_ts etk::color::color_Silver(0xC0C0C0FF); const etk::Color etk::color::silver((uint32_t)0xC0C0C0FF);
const color_ts etk::color::color_SkyBlue(0x87CEEBFF); const etk::Color etk::color::skyBlue((uint32_t)0x87CEEBFF);
const color_ts etk::color::color_SlateBlue(0x6A5ACDFF); const etk::Color etk::color::slateBlue((uint32_t)0x6A5ACDFF);
const color_ts etk::color::color_SlateGray(0x708090FF); const etk::Color etk::color::slateGray((uint32_t)0x708090FF);
const color_ts etk::color::color_SlateGrey(0x708090FF); const etk::Color etk::color::slateGrey((uint32_t)0x708090FF);
const color_ts etk::color::color_Snow(0xFFFAFAFF); const etk::Color etk::color::snow((uint32_t)0xFFFAFAFF);
const color_ts etk::color::color_SpringGreen(0x00FF7FFF); const etk::Color etk::color::springGreen((uint32_t)0x00FF7FFF);
const color_ts etk::color::color_SteelBlue(0x4682B4FF); const etk::Color etk::color::steelBlue((uint32_t)0x4682B4FF);
const color_ts etk::color::color_Tan(0xD2B48CFF); const etk::Color etk::color::tan((uint32_t)0xD2B48CFF);
const color_ts etk::color::color_Teal(0x008080FF); const etk::Color etk::color::teal((uint32_t)0x008080FF);
const color_ts etk::color::color_Thistle(0xD8BFD8FF); const etk::Color etk::color::thistle((uint32_t)0xD8BFD8FF);
const color_ts etk::color::color_Tomato(0xFF6347FF); const etk::Color etk::color::tomato((uint32_t)0xFF6347FF);
const color_ts etk::color::color_Turquoise(0x40E0D0FF); const etk::Color etk::color::turquoise((uint32_t)0x40E0D0FF);
const color_ts etk::color::color_Violet(0xEE82EEFF); const etk::Color etk::color::violet((uint32_t)0xEE82EEFF);
const color_ts etk::color::color_Wheat(0xF5DEB3FF); const etk::Color etk::color::wheat((uint32_t)0xF5DEB3FF);
const color_ts etk::color::color_White(0xFFFFFFFF); const etk::Color etk::color::white((uint32_t)0xFFFFFFFF);
const color_ts etk::color::color_WhiteSmoke(0xF5F5F5FF); const etk::Color etk::color::whiteSmoke((uint32_t)0xF5F5F5FF);
const color_ts etk::color::color_Yellow(0xFFFF00FF); const etk::Color etk::color::yellow((uint32_t)0xFFFF00FF);
const color_ts etk::color::color_YellowGreen(0x9ACD32FF); const etk::Color etk::color::yellowGreen((uint32_t)0x9ACD32FF);
typedef struct { typedef struct {
const char * colorName; const char * colorName;
color_ts color; etk::Color color;
} colorList_ts; } colorList_ts;
static const colorList_ts listOfColor[] = { static const colorList_ts listOfColor[] = {
{ "none", etk::color::color_none}, { "none", etk::color::none},
{ "AliceBlue", etk::color::color_AliceBlue}, { "AliceBlue", etk::color::aliceBlue},
{ "AntiqueWhite", etk::color::color_AntiqueWhite}, { "AntiqueWhite", etk::color::antiqueWhite},
{ "Aqua", etk::color::color_Aqua}, { "Aqua", etk::color::aqua},
{ "Aquamarine", etk::color::color_Aquamarine}, { "Aquamarine", etk::color::aquamarine},
{ "Azure", etk::color::color_Azure}, { "Azure", etk::color::azure},
{ "Beige", etk::color::color_Beige}, { "Beige", etk::color::beige},
{ "Bisque", etk::color::color_Bisque}, { "Bisque", etk::color::bisque},
{ "Black", etk::color::color_Black}, { "Black", etk::color::black},
{ "BlanchedAlmond", etk::color::color_BlanchedAlmond}, { "BlanchedAlmond", etk::color::blanchedAlmond},
{ "Blue", etk::color::color_Blue}, { "Blue", etk::color::blue},
{ "BlueViolet", etk::color::color_BlueViolet}, { "BlueViolet", etk::color::blueViolet},
{ "Brown", etk::color::color_Brown}, { "Brown", etk::color::brown},
{ "BurlyWood", etk::color::color_BurlyWood}, { "BurlyWood", etk::color::burlyWood},
{ "CadetBlue", etk::color::color_CadetBlue}, { "CadetBlue", etk::color::cadetBlue},
{ "Chartreuse", etk::color::color_Chartreuse}, { "Chartreuse", etk::color::chartreuse},
{ "Chocolate", etk::color::color_Chocolate}, { "Chocolate", etk::color::chocolate},
{ "Coral", etk::color::color_Coral}, { "Coral", etk::color::coral},
{ "CornflowerBlue", etk::color::color_CornflowerBlue}, { "CornflowerBlue", etk::color::cornflowerBlue},
{ "Cornsilk", etk::color::color_Cornsilk}, { "Cornsilk", etk::color::cornsilk},
{ "Crimson", etk::color::color_Crimson}, { "Crimson", etk::color::crimson},
{ "Cyan", etk::color::color_Cyan}, { "Cyan", etk::color::cyan},
{ "DarkBlue", etk::color::color_DarkBlue}, { "DarkBlue", etk::color::darkBlue},
{ "DarkCyan", etk::color::color_DarkCyan}, { "DarkCyan", etk::color::darkCyan},
{ "DarkGoldenRod", etk::color::color_DarkGoldenRod}, { "DarkGoldenRod", etk::color::darkGoldenRod},
{ "DarkGray", etk::color::color_DarkGray}, { "DarkGray", etk::color::darkGray},
{ "DarkGrey", etk::color::color_DarkGrey}, { "DarkGrey", etk::color::darkGrey},
{ "DarkGreen", etk::color::color_DarkGreen}, { "DarkGreen", etk::color::darkGreen},
{ "DarkKhaki", etk::color::color_DarkKhaki}, { "DarkKhaki", etk::color::darkKhaki},
{ "DarkMagenta", etk::color::color_DarkMagenta}, { "DarkMagenta", etk::color::darkMagenta},
{ "DarkOliveGreen", etk::color::color_DarkOliveGreen}, { "DarkOliveGreen", etk::color::darkOliveGreen},
{ "Darkorange", etk::color::color_Darkorange}, { "Darkorange", etk::color::darkorange},
{ "DarkOrchid", etk::color::color_DarkOrchid}, { "DarkOrchid", etk::color::darkOrchid},
{ "DarkRed", etk::color::color_DarkRed}, { "DarkRed", etk::color::darkRed},
{ "DarkSalmon", etk::color::color_DarkSalmon}, { "DarkSalmon", etk::color::darkSalmon},
{ "DarkSeaGreen", etk::color::color_DarkSeaGreen}, { "DarkSeaGreen", etk::color::darkSeaGreen},
{ "DarkSlateBlue", etk::color::color_DarkSlateBlue}, { "DarkSlateBlue", etk::color::darkSlateBlue},
{ "DarkSlateGray", etk::color::color_DarkSlateGray}, { "DarkSlateGray", etk::color::darkSlateGray},
{ "DarkSlateGrey", etk::color::color_DarkSlateGrey}, { "DarkSlateGrey", etk::color::darkSlateGrey},
{ "DarkTurquoise", etk::color::color_DarkTurquoise}, { "DarkTurquoise", etk::color::darkTurquoise},
{ "DarkViolet", etk::color::color_DarkViolet}, { "DarkViolet", etk::color::darkViolet},
{ "DeepPink", etk::color::color_DeepPink}, { "DeepPink", etk::color::deepPink},
{ "DeepSkyBlue", etk::color::color_DeepSkyBlue}, { "DeepSkyBlue", etk::color::deepSkyBlue},
{ "DimGray", etk::color::color_DimGray}, { "DimGray", etk::color::dimGray},
{ "DimGrey", etk::color::color_DimGrey}, { "DimGrey", etk::color::dimGrey},
{ "DodgerBlue", etk::color::color_DodgerBlue}, { "DodgerBlue", etk::color::dodgerBlue},
{ "FireBrick", etk::color::color_FireBrick}, { "FireBrick", etk::color::fireBrick},
{ "FloralWhite", etk::color::color_FloralWhite}, { "FloralWhite", etk::color::floralWhite},
{ "ForestGreen", etk::color::color_ForestGreen}, { "ForestGreen", etk::color::forestGreen},
{ "Fuchsia", etk::color::color_Fuchsia}, { "Fuchsia", etk::color::fuchsia},
{ "Gainsboro", etk::color::color_Gainsboro}, { "Gainsboro", etk::color::gainsboro},
{ "GhostWhite", etk::color::color_GhostWhite}, { "GhostWhite", etk::color::ghostWhite},
{ "Gold", etk::color::color_Gold}, { "Gold", etk::color::gold},
{ "GoldenRod", etk::color::color_GoldenRod}, { "GoldenRod", etk::color::goldenRod},
{ "Gray", etk::color::color_Gray}, { "Gray", etk::color::gray},
{ "Grey", etk::color::color_Grey}, { "Grey", etk::color::grey},
{ "Green", etk::color::color_Green}, { "Green", etk::color::green},
{ "GreenYellow", etk::color::color_GreenYellow}, { "GreenYellow", etk::color::greenYellow},
{ "HoneyDew", etk::color::color_HoneyDew}, { "HoneyDew", etk::color::honeyDew},
{ "HotPink", etk::color::color_HotPink}, { "HotPink", etk::color::hotPink},
{ "IndianRed", etk::color::color_IndianRed}, { "IndianRed", etk::color::indianRed},
{ "Indigo", etk::color::color_Indigo}, { "Indigo", etk::color::indigo},
{ "Ivory", etk::color::color_Ivory}, { "Ivory", etk::color::ivory},
{ "Khaki", etk::color::color_Khaki}, { "Khaki", etk::color::khaki},
{ "Lavender", etk::color::color_Lavender}, { "Lavender", etk::color::lavender},
{ "LavenderBlush", etk::color::color_LavenderBlush}, { "LavenderBlush", etk::color::lavenderBlush},
{ "LawnGreen", etk::color::color_LawnGreen}, { "LawnGreen", etk::color::lawnGreen},
{ "LemonChiffon", etk::color::color_LemonChiffon}, { "LemonChiffon", etk::color::lemonChiffon},
{ "LightBlue", etk::color::color_LightBlue}, { "LightBlue", etk::color::lightBlue},
{ "LightCoral", etk::color::color_LightCoral}, { "LightCoral", etk::color::lightCoral},
{ "LightCyan", etk::color::color_LightCyan}, { "LightCyan", etk::color::lightCyan},
{ "LightGoldenRodYellow", etk::color::color_LightGoldenRodYellow}, { "LightGoldenRodYellow", etk::color::lightGoldenRodYellow},
{ "LightGray", etk::color::color_LightGray}, { "LightGray", etk::color::lightGray},
{ "LightGrey", etk::color::color_LightGrey}, { "LightGrey", etk::color::lightGrey},
{ "LightGreen", etk::color::color_LightGreen}, { "LightGreen", etk::color::lightGreen},
{ "LightPink", etk::color::color_LightPink}, { "LightPink", etk::color::lightPink},
{ "LightSalmon", etk::color::color_LightSalmon}, { "LightSalmon", etk::color::lightSalmon},
{ "LightSeaGreen", etk::color::color_LightSeaGreen}, { "LightSeaGreen", etk::color::lightSeaGreen},
{ "LightSkyBlue", etk::color::color_LightSkyBlue}, { "LightSkyBlue", etk::color::lightSkyBlue},
{ "LightSlateGray", etk::color::color_LightSlateGray}, { "LightSlateGray", etk::color::lightSlateGray},
{ "LightSlateGrey", etk::color::color_LightSlateGrey}, { "LightSlateGrey", etk::color::lightSlateGrey},
{ "LightSteelBlue", etk::color::color_LightSteelBlue}, { "LightSteelBlue", etk::color::lightSteelBlue},
{ "LightYellow", etk::color::color_LightYellow}, { "LightYellow", etk::color::lightYellow},
{ "Lime", etk::color::color_Lime}, { "Lime", etk::color::lime},
{ "LimeGreen", etk::color::color_LimeGreen}, { "LimeGreen", etk::color::limeGreen},
{ "Linen", etk::color::color_Linen}, { "Linen", etk::color::linen},
{ "Magenta", etk::color::color_Magenta}, { "Magenta", etk::color::magenta},
{ "Maroon", etk::color::color_Maroon}, { "Maroon", etk::color::maroon},
{ "MediumAquaMarine", etk::color::color_MediumAquaMarine}, { "MediumAquaMarine", etk::color::mediumAquaMarine},
{ "MediumBlue", etk::color::color_MediumBlue}, { "MediumBlue", etk::color::mediumBlue},
{ "MediumOrchid", etk::color::color_MediumOrchid}, { "MediumOrchid", etk::color::mediumOrchid},
{ "MediumPurple", etk::color::color_MediumPurple}, { "MediumPurple", etk::color::mediumPurple},
{ "MediumSeaGreen", etk::color::color_MediumSeaGreen}, { "MediumSeaGreen", etk::color::mediumSeaGreen},
{ "MediumSlateBlue", etk::color::color_MediumSlateBlue}, { "MediumSlateBlue", etk::color::mediumSlateBlue},
{ "MediumSpringGreen", etk::color::color_MediumSpringGreen}, { "MediumSpringGreen", etk::color::mediumSpringGreen},
{ "MediumTurquoise", etk::color::color_MediumTurquoise}, { "MediumTurquoise", etk::color::mediumTurquoise},
{ "MediumVioletRed", etk::color::color_MediumVioletRed}, { "MediumVioletRed", etk::color::mediumVioletRed},
{ "MidnightBlue", etk::color::color_MidnightBlue}, { "MidnightBlue", etk::color::midnightBlue},
{ "MintCream", etk::color::color_MintCream}, { "MintCream", etk::color::mintCream},
{ "MistyRose", etk::color::color_MistyRose}, { "MistyRose", etk::color::mistyRose},
{ "Moccasin", etk::color::color_Moccasin}, { "Moccasin", etk::color::moccasin},
{ "NavajoWhite", etk::color::color_NavajoWhite}, { "NavajoWhite", etk::color::navajoWhite},
{ "Navy", etk::color::color_Navy}, { "Navy", etk::color::navy},
{ "OldLace", etk::color::color_OldLace}, { "OldLace", etk::color::oldLace},
{ "Olive", etk::color::color_Olive}, { "Olive", etk::color::olive},
{ "OliveDrab", etk::color::color_OliveDrab}, { "OliveDrab", etk::color::oliveDrab},
{ "Orange", etk::color::color_Orange}, { "Orange", etk::color::orange},
{ "OrangeRed", etk::color::color_OrangeRed}, { "OrangeRed", etk::color::orangeRed},
{ "Orchid", etk::color::color_Orchid}, { "Orchid", etk::color::orchid},
{ "PaleGoldenRod", etk::color::color_PaleGoldenRod}, { "PaleGoldenRod", etk::color::paleGoldenRod},
{ "PaleGreen", etk::color::color_PaleGreen}, { "PaleGreen", etk::color::paleGreen},
{ "PaleTurquoise", etk::color::color_PaleTurquoise}, { "PaleTurquoise", etk::color::paleTurquoise},
{ "PaleVioletRed", etk::color::color_PaleVioletRed}, { "PaleVioletRed", etk::color::paleVioletRed},
{ "PapayaWhip", etk::color::color_PapayaWhip}, { "PapayaWhip", etk::color::papayaWhip},
{ "PeachPuff", etk::color::color_PeachPuff}, { "PeachPuff", etk::color::peachPuff},
{ "Peru", etk::color::color_Peru}, { "Peru", etk::color::peru},
{ "Pink", etk::color::color_Pink}, { "Pink", etk::color::pink},
{ "Plum", etk::color::color_Plum}, { "Plum", etk::color::plum},
{ "PowderBlue", etk::color::color_PowderBlue}, { "PowderBlue", etk::color::powderBlue},
{ "Purple", etk::color::color_Purple}, { "Purple", etk::color::purple},
{ "Red", etk::color::color_Red}, { "Red", etk::color::red},
{ "RosyBrown", etk::color::color_RosyBrown}, { "RosyBrown", etk::color::rosyBrown},
{ "RoyalBlue", etk::color::color_RoyalBlue}, { "RoyalBlue", etk::color::royalBlue},
{ "SaddleBrown", etk::color::color_SaddleBrown}, { "SaddleBrown", etk::color::saddleBrown},
{ "Salmon", etk::color::color_Salmon}, { "Salmon", etk::color::salmon},
{ "SandyBrown", etk::color::color_SandyBrown}, { "SandyBrown", etk::color::sandyBrown},
{ "SeaGreen", etk::color::color_SeaGreen}, { "SeaGreen", etk::color::seaGreen},
{ "SeaShell", etk::color::color_SeaShell}, { "SeaShell", etk::color::seaShell},
{ "Sienna", etk::color::color_Sienna}, { "Sienna", etk::color::sienna},
{ "Silver", etk::color::color_Silver}, { "Silver", etk::color::silver},
{ "SkyBlue", etk::color::color_SkyBlue}, { "SkyBlue", etk::color::skyBlue},
{ "SlateBlue", etk::color::color_SlateBlue}, { "SlateBlue", etk::color::slateBlue},
{ "SlateGray", etk::color::color_SlateGray}, { "SlateGray", etk::color::slateGray},
{ "SlateGrey", etk::color::color_SlateGrey}, { "SlateGrey", etk::color::slateGrey},
{ "Snow", etk::color::color_Snow}, { "Snow", etk::color::snow},
{ "SpringGreen", etk::color::color_SpringGreen}, { "SpringGreen", etk::color::springGreen},
{ "SteelBlue", etk::color::color_SteelBlue}, { "SteelBlue", etk::color::steelBlue},
{ "Tan", etk::color::color_Tan}, { "Tan", etk::color::tan},
{ "Teal", etk::color::color_Teal}, { "Teal", etk::color::teal},
{ "Thistle", etk::color::color_Thistle}, { "Thistle", etk::color::thistle},
{ "Tomato", etk::color::color_Tomato}, { "Tomato", etk::color::tomato},
{ "Turquoise", etk::color::color_Turquoise}, { "Turquoise", etk::color::turquoise},
{ "Violet", etk::color::color_Violet}, { "Violet", etk::color::violet},
{ "Wheat", etk::color::color_Wheat}, { "Wheat", etk::color::wheat},
{ "White", etk::color::color_White}, { "White", etk::color::white},
{ "WhiteSmoke", etk::color::color_WhiteSmoke}, { "WhiteSmoke", etk::color::whiteSmoke},
{ "Yellow", etk::color::color_Yellow}, { "Yellow", etk::color::yellow},
{ "YellowGreen", etk::color::color_YellowGreen} { "YellowGreen", etk::color::yellowGreen}
}; };
static const int32_t listOfColorSize = sizeof(listOfColor) / sizeof(colorList_ts); static const int32_t listOfColorSize = sizeof(listOfColor) / sizeof(colorList_ts);
static bool strnCmpNoCase(const char * input1, const char * input2, int32_t maxLen) etk::Color::Color(void)
{ {
int32_t iii=0; red = 0xFF;
while ('\0' != *input1 && '\0' != *input2 && iii < maxLen) { green = 0xFF;
char in1 = *input1; blue = 0xFF;
char in2 = *input2; alpha = 0xFF;
if (in1 != in2) {
if (in1 <= 'Z' && in1 >= 'A') {
in1 = in1 - 'A' + 'a';
}
if (in2 <= 'Z' && in2 >= 'A') {
in2 = in2 - 'A' + 'a';
}
if (in1 != in2) {
return false;
}
}
iii++;
input1++;
input2++;
}
return true;
} }
/** etk::Color::Color(const uint32_t _input)
* @brief Parse a color specification from the svg file
* @param[in] inputData Data C String with the xml definition
* @return the parsed color
*/
color_ts etk::color::Parse(const char *inputData)
{ {
color_ts localColor = etk::color::color_White; 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 red, green, blue, alpha; 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; float fred, fgreen, fblue, falpha;
size_t len = strlen(inputData); size_t len = strlen(inputData);
@ -376,35 +420,35 @@ color_ts etk::color::Parse(const char *inputData)
&& inputData[0] == '#') { && inputData[0] == '#') {
if(len == 4) { if(len == 4) {
if (sscanf(inputData + 1, "%1x%1x%1x", &red, &green, &blue) == 3) { if (sscanf(inputData + 1, "%1x%1x%1x", &red, &green, &blue) == 3) {
localColor.red = (red | red << 4); red = (red | red << 4);
localColor.green= (green | green << 4); green= (green | green << 4);
localColor.blue = (blue | blue << 4); blue = (blue | blue << 4);
} else { } else {
TK_ERROR(" pb in parsing the color : \"" << inputData << "\""); TK_ERROR(" pb in parsing the color : \"" << inputData << "\"");
} }
} else if (len==5) { } else if (len==5) {
if (sscanf(inputData + 1, "%1x%1x%1x%1x", &red, &green, &blue, &alpha) == 4) { if (sscanf(inputData + 1, "%1x%1x%1x%1x", &_red, &_green, &_blue, &_alpha) == 4) {
localColor.red = (red | red << 4); red = (_red | _red << 4);
localColor.green = (green | green << 4); green = (_green | _green << 4);
localColor.blue = (blue | blue << 4); blue = (_blue | _blue << 4);
localColor.alpha = (alpha | alpha << 4); alpha = (_alpha | _alpha << 4);
} else { } else {
TK_ERROR(" pb in parsing the color : \"" << inputData << "\""); TK_ERROR(" pb in parsing the color : \"" << inputData << "\"");
} }
} else if (len == 7) { } else if (len == 7) {
if (sscanf(inputData + 1, "%2x%2x%2x", &red, &green, &blue) == 3) { if (sscanf(inputData + 1, "%2x%2x%2x", &_red, &_green, &_blue) == 3) {
localColor.red = red; red = _red;
localColor.green= green; green= _green;
localColor.blue = blue; blue = _blue;
} else { } else {
TK_ERROR(" pb in parsing the color : \"" << inputData << "\""); TK_ERROR(" pb in parsing the color : \"" << inputData << "\"");
} }
} else if (len == 9) { } else if (len == 9) {
if (sscanf(inputData + 1, "%2x%2x%2x%2x", &red, &green, &blue, &alpha) == 4) { if (sscanf(inputData + 1, "%2x%2x%2x%2x", &_red, &_green, &_blue, &_alpha) == 4) {
localColor.red = red; red = _red;
localColor.green= green; green= _green;
localColor.blue = blue; blue = _blue;
localColor.alpha = alpha; alpha = _alpha;
} else { } else {
TK_ERROR(" pb in parsing the color : \"" << inputData << "\""); TK_ERROR(" pb in parsing the color : \"" << inputData << "\"");
} }
@ -416,31 +460,31 @@ color_ts etk::color::Parse(const char *inputData)
&& inputData[1] == 'g' && inputData[1] == 'g'
&& inputData[2] == 'b' && inputData[2] == 'b'
&& inputData[3] == '(' ) { && inputData[3] == '(' ) {
if (sscanf(inputData + 4, "%u,%u,%u,%u", &red, &green, &blue, &alpha) == 4) { if (sscanf(inputData + 4, "%u,%u,%u,%u", &_red, &_green, &_blue, &_alpha) == 4) {
localColor.red = etk_min(0xFF, red); red = etk_min(0xFF, _red);
localColor.green= etk_min(0xFF, green); green= etk_min(0xFF, _green);
localColor.blue = etk_min(0xFF, blue); blue = etk_min(0xFF, _blue);
localColor.alpha = etk_min(0xFF, alpha); alpha = etk_min(0xFF, _alpha);
} else if (sscanf(inputData + 4, "%u,%u,%u", &red, &green, &blue) == 3) { } else if (sscanf(inputData + 4, "%u,%u,%u", &_red, &_green, &_blue) == 3) {
localColor.red = etk_min(0xFF, red); red = etk_min(0xFF, _red);
localColor.green= etk_min(0xFF, green); green= etk_min(0xFF, _green);
localColor.blue = etk_min(0xFF, blue); blue = etk_min(0xFF, _blue);
} else if (sscanf(inputData + 4, "%f%%,%f%%,%f%%,%f%%", &fred, &fgreen, &fblue, &falpha) == 4) { } else if (sscanf(inputData + 4, "%f%%,%f%%,%f%%,%f%%", &fred, &fgreen, &fblue, &falpha) == 4) {
fred = etk_avg(0.0, fred, 1.0); fred = etk_avg(0.0, fred, 1.0);
fgreen= etk_avg(0.0, fgreen, 1.0); fgreen= etk_avg(0.0, fgreen, 1.0);
fblue = etk_avg(0.0, fblue, 1.0); fblue = etk_avg(0.0, fblue, 1.0);
falpha = etk_avg(0.0, falpha, 1.0); falpha = etk_avg(0.0, falpha, 1.0);
localColor.red = (uint8_t)(fred * 255.); red = (uint8_t)(fred * 255.);
localColor.green= (uint8_t)(fgreen * 255.); green= (uint8_t)(fgreen * 255.);
localColor.blue = (uint8_t)(fblue * 255.); blue = (uint8_t)(fblue * 255.);
localColor.alpha = (uint8_t)(falpha * 255.); alpha = (uint8_t)(falpha * 255.);
} else if (sscanf(inputData + 4, "%f%%,%f%%,%f%%", &fred, &fgreen, &fblue) == 3) { } else if (sscanf(inputData + 4, "%f%%,%f%%,%f%%", &fred, &fgreen, &fblue) == 3) {
fred = etk_avg(0.0, fred, 1.0); fred = etk_avg(0.0, fred, 1.0);
fgreen= etk_avg(0.0, fgreen, 1.0); fgreen= etk_avg(0.0, fgreen, 1.0);
fblue = etk_avg(0.0, fblue, 1.0); fblue = etk_avg(0.0, fblue, 1.0);
localColor.red = (uint8_t)(fred * 255.); red = (uint8_t)(fred * 255.);
localColor.green= (uint8_t)(fgreen * 255.); green= (uint8_t)(fgreen * 255.);
localColor.blue = (uint8_t)(fblue * 255.); blue = (uint8_t)(fblue * 255.);
} else { } else {
TK_ERROR(" pb in parsing the color : \"" << inputData << "\" ==> unknown methode ..."); TK_ERROR(" pb in parsing the color : \"" << inputData << "\" ==> unknown methode ...");
} }
@ -448,9 +492,9 @@ color_ts etk::color::Parse(const char *inputData)
bool findIt = false; bool findIt = false;
// direct named color ... // direct named color ...
for (int32_t iii=0; iii<listOfColorSize; iii++) { for (int32_t iii=0; iii<listOfColorSize; iii++) {
if (strnCmpNoCase(listOfColor[iii].colorName, inputData, strlen(listOfColor[iii].colorName)) == true) { if (etk::tool::strnCmpNoCase(listOfColor[iii].colorName, inputData, strlen(listOfColor[iii].colorName)) == true) {
findIt = true; findIt = true;
localColor = listOfColor[iii].color; *this = listOfColor[iii].color;
// stop searching // stop searching
break; break;
} }
@ -460,42 +504,58 @@ color_ts etk::color::Parse(const char *inputData)
TK_ERROR(" pb in parsing the color : \"" << inputData << "\" not find ..."); TK_ERROR(" pb in parsing the color : \"" << inputData << "\" not find ...");
} }
} }
TK_VERBOSE("Parse color : \"" << inputData << "\" ==> " << localColor); TK_VERBOSE("Parse color : \"" << inputData << "\" ==> " << *this);
return localColor;
} }
etk::CCout& etk::operator <<(etk::CCout &os, const etk::Color &obj)
color_ts etk::color::Create(uint32_t val)
{ {
color_ts tmpColor; char tmpData[256];
tmpColor.red=(uint8_t)((val>>24)&0xFF); snprintf(tmpData, 256, "#%02X%02X%02X%02X", obj.red, obj.green, obj.blue, obj.alpha);
tmpColor.green=(uint8_t)((val>>16)&0xFF); os << tmpData;
tmpColor.blue=(uint8_t)((val>>8)&0xFF); return os;
tmpColor.alpha=(uint8_t)((val)&0xFF);
return tmpColor;
} }
color_ts etk::color::Create(uint8_t _red, uint8_t _green, uint8_t _blue, uint8_t _alpha) etk::Color& etk::Color::operator= (const etk::Color &_input )
{ {
color_ts tmpColor; //TK_INFO("OPERATOR de recopie");
tmpColor.red =_red; if( this != &_input ) {
tmpColor.green=_green; red = _input.red;
tmpColor.blue =_blue; green = _input.green;
tmpColor.alpha=_alpha; blue = _input.blue;
return tmpColor; alpha = _input.alpha;
}
return *this;
} }
color_ts etk::color::Create(float _red, float _green, float _blue, float _alpha)
etk::Color& etk::Color::operator= (const uint32_t _input )
{ {
color_ts tmpColor; red = (uint8_t)((_input&0xFF000000)>>24);
_red = etk_avg((float)0, (float)_red, (float)1); green = (uint8_t)((_input&0x00FF0000)>>16);
_green = etk_avg((float)0, (float)_green, (float)1); blue = (uint8_t)((_input&0x0000FF00)>>8);
_blue = etk_avg((float)0, (float)_blue, (float)1); alpha = (uint8_t)((_input&0x000000FF));
_alpha = etk_avg((float)0, (float)_alpha, (float)1); return *this;
tmpColor.red =(uint8_t)(_red*255); }
tmpColor.green=(uint8_t)(_green*255);
tmpColor.blue =(uint8_t)(_blue*255); bool etk::Color::operator==(const Color& _input) const
tmpColor.alpha=(uint8_t)(_alpha*255); {
return tmpColor; 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;
} }

View File

@ -25,165 +25,195 @@
#ifndef __ETK_COLOR_H__ #ifndef __ETK_COLOR_H__
#define __ETK_COLOR_H__ #define __ETK_COLOR_H__
#include <etk/UString.h>
#ifndef __ETK_USTRING_H__
namespace etk {
class UString;
};
#endif
namespace etk { 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 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 { namespace color {
extern const color_ts color_none; extern const Color none;
extern const color_ts color_AliceBlue; extern const Color aliceBlue;
extern const color_ts color_AntiqueWhite; extern const Color antiqueWhite;
extern const color_ts color_Aqua; extern const Color aqua;
extern const color_ts color_Aquamarine; extern const Color aquamarine;
extern const color_ts color_Azure; extern const Color azure;
extern const color_ts color_Beige; extern const Color beige;
extern const color_ts color_Bisque; extern const Color bisque;
extern const color_ts color_Black; extern const Color black;
extern const color_ts color_BlanchedAlmond; extern const Color blanchedAlmond;
extern const color_ts color_Blue; extern const Color blue;
extern const color_ts color_BlueViolet; extern const Color blueViolet;
extern const color_ts color_Brown; extern const Color brown;
extern const color_ts color_BurlyWood; extern const Color burlyWood;
extern const color_ts color_CadetBlue; extern const Color cadetBlue;
extern const color_ts color_Chartreuse; extern const Color chartreuse;
extern const color_ts color_Chocolate; extern const Color chocolate;
extern const color_ts color_Coral; extern const Color coral;
extern const color_ts color_CornflowerBlue; extern const Color cornflowerBlue;
extern const color_ts color_Cornsilk; extern const Color cornsilk;
extern const color_ts color_Crimson; extern const Color crimson;
extern const color_ts color_Cyan; extern const Color cyan;
extern const color_ts color_DarkBlue; extern const Color darkBlue;
extern const color_ts color_DarkCyan; extern const Color darkCyan;
extern const color_ts color_DarkGoldenRod; extern const Color darkGoldenRod;
extern const color_ts color_DarkGray; extern const Color darkGray;
extern const color_ts color_DarkGrey; extern const Color darkGrey;
extern const color_ts color_DarkGreen; extern const Color darkGreen;
extern const color_ts color_DarkKhaki; extern const Color darkKhaki;
extern const color_ts color_DarkMagenta; extern const Color darkMagenta;
extern const color_ts color_DarkOliveGreen; extern const Color darkOliveGreen;
extern const color_ts color_Darkorange; extern const Color darkorange;
extern const color_ts color_DarkOrchid; extern const Color darkOrchid;
extern const color_ts color_DarkRed; extern const Color darkRed;
extern const color_ts color_DarkSalmon; extern const Color darkSalmon;
extern const color_ts color_DarkSeaGreen; extern const Color darkSeaGreen;
extern const color_ts color_DarkSlateBlue; extern const Color darkSlateBlue;
extern const color_ts color_DarkSlateGray; extern const Color darkSlateGray;
extern const color_ts color_DarkSlateGrey; extern const Color darkSlateGrey;
extern const color_ts color_DarkTurquoise; extern const Color darkTurquoise;
extern const color_ts color_DarkViolet; extern const Color darkViolet;
extern const color_ts color_DeepPink; extern const Color deepPink;
extern const color_ts color_DeepSkyBlue; extern const Color deepSkyBlue;
extern const color_ts color_DimGray; extern const Color dimGray;
extern const color_ts color_DimGrey; extern const Color dimGrey;
extern const color_ts color_DodgerBlue; extern const Color dodgerBlue;
extern const color_ts color_FireBrick; extern const Color fireBrick;
extern const color_ts color_FloralWhite; extern const Color floralWhite;
extern const color_ts color_ForestGreen; extern const Color forestGreen;
extern const color_ts color_Fuchsia; extern const Color fuchsia;
extern const color_ts color_Gainsboro; extern const Color gainsboro;
extern const color_ts color_GhostWhite; extern const Color ghostWhite;
extern const color_ts color_Gold; extern const Color gold;
extern const color_ts color_GoldenRod; extern const Color goldenRod;
extern const color_ts color_Gray; extern const Color gray;
extern const color_ts color_Grey; extern const Color grey;
extern const color_ts color_Green; extern const Color green;
extern const color_ts color_GreenYellow; extern const Color greenYellow;
extern const color_ts color_HoneyDew; extern const Color honeyDew;
extern const color_ts color_HotPink; extern const Color hotPink;
extern const color_ts color_IndianRed; extern const Color indianRed;
extern const color_ts color_Indigo; extern const Color indigo;
extern const color_ts color_Ivory; extern const Color ivory;
extern const color_ts color_Khaki; extern const Color khaki;
extern const color_ts color_Lavender; extern const Color lavender;
extern const color_ts color_LavenderBlush; extern const Color lavenderBlush;
extern const color_ts color_LawnGreen; extern const Color lawnGreen;
extern const color_ts color_LemonChiffon; extern const Color lemonChiffon;
extern const color_ts color_LightBlue; extern const Color lightBlue;
extern const color_ts color_LightCoral; extern const Color lightCoral;
extern const color_ts color_LightCyan; extern const Color lightCyan;
extern const color_ts color_LightGoldenRodYellow; extern const Color lightGoldenRodYellow;
extern const color_ts color_LightGray; extern const Color lightGray;
extern const color_ts color_LightGrey; extern const Color lightGrey;
extern const color_ts color_LightGreen; extern const Color lightGreen;
extern const color_ts color_LightPink; extern const Color lightPink;
extern const color_ts color_LightSalmon; extern const Color lightSalmon;
extern const color_ts color_LightSeaGreen; extern const Color lightSeaGreen;
extern const color_ts color_LightSkyBlue; extern const Color lightSkyBlue;
extern const color_ts color_LightSlateGray; extern const Color lightSlateGray;
extern const color_ts color_LightSlateGrey; extern const Color lightSlateGrey;
extern const color_ts color_LightSteelBlue; extern const Color lightSteelBlue;
extern const color_ts color_LightYellow; extern const Color lightYellow;
extern const color_ts color_Lime; extern const Color lime;
extern const color_ts color_LimeGreen; extern const Color limeGreen;
extern const color_ts color_Linen; extern const Color linen;
extern const color_ts color_Magenta; extern const Color magenta;
extern const color_ts color_Maroon; extern const Color maroon;
extern const color_ts color_MediumAquaMarine; extern const Color mediumAquaMarine;
extern const color_ts color_MediumBlue; extern const Color mediumBlue;
extern const color_ts color_MediumOrchid; extern const Color mediumOrchid;
extern const color_ts color_MediumPurple; extern const Color mediumPurple;
extern const color_ts color_MediumSeaGreen; extern const Color mediumSeaGreen;
extern const color_ts color_MediumSlateBlue; extern const Color mediumSlateBlue;
extern const color_ts color_MediumSpringGreen; extern const Color mediumSpringGreen;
extern const color_ts color_MediumTurquoise; extern const Color mediumTurquoise;
extern const color_ts color_MediumVioletRed; extern const Color mediumVioletRed;
extern const color_ts color_MidnightBlue; extern const Color midnightBlue;
extern const color_ts color_MintCream; extern const Color mintCream;
extern const color_ts color_MistyRose; extern const Color mistyRose;
extern const color_ts color_Moccasin; extern const Color moccasin;
extern const color_ts color_NavajoWhite; extern const Color navajoWhite;
extern const color_ts color_Navy; extern const Color navy;
extern const color_ts color_OldLace; extern const Color oldLace;
extern const color_ts color_Olive; extern const Color olive;
extern const color_ts color_OliveDrab; extern const Color oliveDrab;
extern const color_ts color_Orange; extern const Color orange;
extern const color_ts color_OrangeRed; extern const Color orangeRed;
extern const color_ts color_Orchid; extern const Color orchid;
extern const color_ts color_PaleGoldenRod; extern const Color paleGoldenRod;
extern const color_ts color_PaleGreen; extern const Color paleGreen;
extern const color_ts color_PaleTurquoise; extern const Color paleTurquoise;
extern const color_ts color_PaleVioletRed; extern const Color paleVioletRed;
extern const color_ts color_PapayaWhip; extern const Color papayaWhip;
extern const color_ts color_PeachPuff; extern const Color peachPuff;
extern const color_ts color_Peru; extern const Color peru;
extern const color_ts color_Pink; extern const Color pink;
extern const color_ts color_Plum; extern const Color plum;
extern const color_ts color_PowderBlue; extern const Color powderBlue;
extern const color_ts color_Purple; extern const Color purple;
extern const color_ts color_Red; extern const Color red;
extern const color_ts color_RosyBrown; extern const Color rosyBrown;
extern const color_ts color_RoyalBlue; extern const Color royalBlue;
extern const color_ts color_SaddleBrown; extern const Color saddleBrown;
extern const color_ts color_Salmon; extern const Color salmon;
extern const color_ts color_SandyBrown; extern const Color sandyBrown;
extern const color_ts color_SeaGreen; extern const Color seaGreen;
extern const color_ts color_SeaShell; extern const Color seaShell;
extern const color_ts color_Sienna; extern const Color sienna;
extern const color_ts color_Silver; extern const Color silver;
extern const color_ts color_SkyBlue; extern const Color skyBlue;
extern const color_ts color_SlateBlue; extern const Color slateBlue;
extern const color_ts color_SlateGray; extern const Color slateGray;
extern const color_ts color_SlateGrey; extern const Color slateGrey;
extern const color_ts color_Snow; extern const Color snow;
extern const color_ts color_SpringGreen; extern const Color springGreen;
extern const color_ts color_SteelBlue; extern const Color steelBlue;
extern const color_ts color_Tan; extern const Color tan;
extern const color_ts color_Teal; extern const Color teal;
extern const color_ts color_Thistle; extern const Color thistle;
extern const color_ts color_Tomato; extern const Color tomato;
extern const color_ts color_Turquoise; extern const Color turquoise;
extern const color_ts color_Violet; extern const Color violet;
extern const color_ts color_Wheat; extern const Color wheat;
extern const color_ts color_White; extern const Color white;
extern const color_ts color_WhiteSmoke; extern const Color whiteSmoke;
extern const color_ts color_Yellow; extern const Color yellow;
extern const color_ts color_YellowGreen; extern const Color yellowGreen;
color_ts Parse(const char *inputData);
color_ts Create(uint32_t val);
color_ts Create( uint8_t _red, uint8_t _green, uint8_t _blue, uint8_t _alpha=255);
color_ts Create(float _red, float _green, float _blue, float _alpha=1.0);
}; };
}; };

View File

@ -56,7 +56,7 @@ etk::UString baseApplName = "ewolNoName";
static void loadAPK(etk::UString& apkPath) static void loadAPK(etk::UString& apkPath)
{ {
TK_DEBUG("Loading APK \"" << apkPath << "\""); TK_DEBUG("Loading APK \"" << apkPath << "\"");
s_APKArchive = zip_open(apkPath.Utf8Data(), 0, NULL); s_APKArchive = zip_open(apkPath.c_str(), 0, NULL);
TK_ASSERT(s_APKArchive != NULL, "Error loading APK ... \"" << apkPath << "\""); TK_ASSERT(s_APKArchive != NULL, "Error loading APK ... \"" << apkPath << "\"");
//Just for debug, print APK contents //Just for debug, print APK contents
s_APKnbFiles = zip_get_num_files(s_APKArchive); s_APKnbFiles = zip_get_num_files(s_APKArchive);
@ -399,7 +399,7 @@ void etk::File::SetCompleateName(etk::UString &newFilename, etk::FileType_te typ
TK_VERBOSE("3 : Get file Name : " << destFilename ); TK_VERBOSE("3 : Get file Name : " << destFilename );
if (true == needUnpack) { if (true == needUnpack) {
// Get the real Path of the current File // Get the real Path of the current File
ok = realpath(destFilename.Utf8Data(), buf); ok = realpath(destFilename.c_str(), buf);
if (!ok) { if (!ok) {
int32_t lastPos = destFilename.FindBack('/'); int32_t lastPos = destFilename.FindBack('/');
if (-1 != lastPos) { if (-1 != lastPos) {
@ -407,7 +407,7 @@ void etk::File::SetCompleateName(etk::UString &newFilename, etk::FileType_te typ
etk::UString tmpFilename = destFilename.Extract(lastPos+1); etk::UString tmpFilename = destFilename.Extract(lastPos+1);
destFilename.Remove(lastPos, destFilename.Size() - lastPos); destFilename.Remove(lastPos, destFilename.Size() - lastPos);
TK_VERBOSE("try to find :\"" << destFilename << "\" / \"" << tmpFilename << "\" "); TK_VERBOSE("try to find :\"" << destFilename << "\" / \"" << tmpFilename << "\" ");
ok = realpath(destFilename.Utf8Data(), buf); ok = realpath(destFilename.c_str(), buf);
if (!ok) { if (!ok) {
TK_VERBOSE("Can not find real Path name of \"" << destFilename << "\""); TK_VERBOSE("Can not find real Path name of \"" << destFilename << "\"");
m_shortFilename = tmpFilename; m_shortFilename = tmpFilename;
@ -562,7 +562,7 @@ int32_t etk::File::Size(void)
break; break;
} }
myCompleateName += GetCompleateName(); myCompleateName += GetCompleateName();
myFile=fopen(myCompleateName.Utf8Data(),"rb"); myFile=fopen(myCompleateName.c_str(),"rb");
if(NULL == myFile) { if(NULL == myFile) {
//EWOL_ERROR("Can not find the file name=\"" << m_folder << "\" / \"" << m_shortFilename << "\""); //EWOL_ERROR("Can not find the file name=\"" << m_folder << "\" / \"" << m_shortFilename << "\"");
return -1; return -1;
@ -604,9 +604,9 @@ bool etk::File::Exist(void)
break; break;
} }
myCompleateName += GetCompleateName(); myCompleateName += GetCompleateName();
myFile=fopen(myCompleateName.Utf8Data(),"rb"); myFile=fopen(myCompleateName.c_str(),"rb");
if(NULL == myFile) { if(NULL == myFile) {
TK_DEBUG("try to open : " << myCompleateName.Utf8Data()); TK_DEBUG("try to open : " << myCompleateName.c_str());
return false; return false;
} }
fclose(myFile); fclose(myFile);
@ -643,7 +643,7 @@ bool etk::File::fOpenRead(void)
break; break;
} }
myCompleateName += GetCompleateName(); myCompleateName += GetCompleateName();
m_PointerFile=fopen(myCompleateName.Utf8Data(),"rb"); m_PointerFile=fopen(myCompleateName.c_str(),"rb");
if(NULL == m_PointerFile) { if(NULL == m_PointerFile) {
TK_ERROR("Can not find the file name=\"" << GetCompleateName() << "\""); TK_ERROR("Can not find the file name=\"" << GetCompleateName() << "\"");
return false; return false;
@ -679,7 +679,7 @@ bool etk::File::fOpenWrite(void)
break; break;
} }
myCompleateName += GetCompleateName(); myCompleateName += GetCompleateName();
m_PointerFile=fopen(myCompleateName.Utf8Data(),"wb"); m_PointerFile=fopen(myCompleateName.c_str(),"wb");
if(NULL == m_PointerFile) { if(NULL == m_PointerFile) {
TK_ERROR("Can not find the file name=\"" << GetCompleateName() << "\""); TK_ERROR("Can not find the file name=\"" << GetCompleateName() << "\"");
return false; return false;

View File

@ -88,7 +88,7 @@ const int32_t etk::constConvertionTableSize = sizeof(etk::constConvertionTable)
* @return --- * @return ---
* *
*/ */
void etk::DisplayData(etk::VectorType<char> &data) void etk::DisplayData(etk::Vector<char> &data)
{ {
int32_t i; int32_t i;
for (i=0; i<(int32_t)data.Size() ; i++) { for (i=0; i<(int32_t)data.Size() ; i++) {
@ -106,7 +106,7 @@ void etk::DisplayData(etk::VectorType<char> &data)
* @return --- * @return ---
* *
*/ */
void etk::DisplayElem(etk::VectorType<int16_t> &data, int32_t start, int32_t stop) void etk::DisplayElem(etk::Vector<int16_t> &data, int32_t start, int32_t stop)
{ {
int32_t i; int32_t i;
etk::cout<< ETK_BASH_COLOR_NORMAL; etk::cout<< ETK_BASH_COLOR_NORMAL;
@ -176,7 +176,7 @@ char * etk::levelSpace(int32_t level)
* @return --- * @return ---
* *
*/ */
int32_t etk::GetLenOfPTheseElem(etk::VectorType<int16_t> &data, int32_t startPos) int32_t etk::GetLenOfPTheseElem(etk::Vector<int16_t> &data, int32_t startPos)
{ {
int32_t pos = startPos; int32_t pos = startPos;
int32_t nbOpen = 0; int32_t nbOpen = 0;
@ -225,7 +225,7 @@ int32_t etk::GetLenOfPTheseElem(etk::VectorType<int16_t> &data, int32_t startPos
* @return --- * @return ---
* *
*/ */
int32_t etk::GetLenOfPThese(etk::VectorType<int16_t> &data, int32_t startPos) int32_t etk::GetLenOfPThese(etk::Vector<int16_t> &data, int32_t startPos)
{ {
int32_t pos = startPos; int32_t pos = startPos;
int32_t nbOpen = 0; int32_t nbOpen = 0;
@ -278,7 +278,7 @@ int32_t etk::GetLenOfPThese(etk::VectorType<int16_t> &data, int32_t startPos)
* @return --- * @return ---
* *
*/ */
int32_t etk::GetLenOfBracket(etk::VectorType<int16_t> &data, int32_t startPos) int32_t etk::GetLenOfBracket(etk::Vector<int16_t> &data, int32_t startPos)
{ {
int32_t pos = startPos; int32_t pos = startPos;
// special case of the (...) or | ==> we search '|' or ')' // special case of the (...) or | ==> we search '|' or ')'
@ -322,7 +322,7 @@ int32_t etk::GetLenOfBracket(etk::VectorType<int16_t> &data, int32_t startPos)
* @return --- * @return ---
* *
*/ */
int32_t etk::GetLenOfBrace(etk::VectorType<int16_t> &data, int32_t startPos) int32_t etk::GetLenOfBrace(etk::Vector<int16_t> &data, int32_t startPos)
{ {
int32_t pos = startPos; int32_t pos = startPos;
// special case of the (...) or | ==> we search '|' or ')' // special case of the (...) or | ==> we search '|' or ')'
@ -366,7 +366,7 @@ int32_t etk::GetLenOfBrace(etk::VectorType<int16_t> &data, int32_t startPos)
* @return --- * @return ---
* *
*/ */
int32_t etk::GetLenOfNormal(etk::VectorType<int16_t> &data, int32_t startPos) int32_t etk::GetLenOfNormal(etk::Vector<int16_t> &data, int32_t startPos)
{ {
int32_t pos = startPos; int32_t pos = startPos;
@ -423,7 +423,7 @@ int32_t etk::GetLenOfNormal(etk::VectorType<int16_t> &data, int32_t startPos)
* @return --- * @return ---
* *
*/ */
bool etk::ParseBrace(etk::VectorType<int16_t> &data, int32_t &min, int32_t &max) bool etk::ParseBrace(etk::Vector<int16_t> &data, int32_t &min, int32_t &max)
{ {
//TK_INFO("parse {...} in "; DisplayElem(data); ); //TK_INFO("parse {...} in "; DisplayElem(data); );
int32_t k=0; int32_t k=0;

View File

@ -29,7 +29,7 @@
#include <etk/DebugInternal.h> #include <etk/DebugInternal.h>
#include <etk/Memory.h> #include <etk/Memory.h>
#include <etk/UString.h> #include <etk/UString.h>
#include <etk/VectorType.h> #include <etk/Vector.h>
namespace etk { namespace etk {
@ -94,15 +94,15 @@ typedef struct {
extern const convertionTable_ts constConvertionTable[]; extern const convertionTable_ts constConvertionTable[];
extern const int32_t constConvertionTableSize; extern const int32_t constConvertionTableSize;
void DisplayData(etk::VectorType<char> &data); void DisplayData(etk::Vector<char> &data);
void DisplayElem(etk::VectorType<int16_t> &data, int32_t start=0, int32_t stop=0x7FFFFFFF); void DisplayElem(etk::Vector<int16_t> &data, int32_t start=0, int32_t stop=0x7FFFFFFF);
char * levelSpace(int32_t level); char * levelSpace(int32_t level);
int32_t GetLenOfPTheseElem(etk::VectorType<int16_t> &data, int32_t startPos); int32_t GetLenOfPTheseElem(etk::Vector<int16_t> &data, int32_t startPos);
int32_t GetLenOfPThese(etk::VectorType<int16_t> &data, int32_t startPos); int32_t GetLenOfPThese(etk::Vector<int16_t> &data, int32_t startPos);
int32_t GetLenOfBracket(etk::VectorType<int16_t> &data, int32_t startPos); int32_t GetLenOfBracket(etk::Vector<int16_t> &data, int32_t startPos);
int32_t GetLenOfBrace(etk::VectorType<int16_t> &data, int32_t startPos); int32_t GetLenOfBrace(etk::Vector<int16_t> &data, int32_t startPos);
int32_t GetLenOfNormal(etk::VectorType<int16_t> &data, int32_t startPos); int32_t GetLenOfNormal(etk::Vector<int16_t> &data, int32_t startPos);
bool ParseBrace(etk::VectorType<int16_t> &data, int32_t &min, int32_t &max); bool ParseBrace(etk::Vector<int16_t> &data, int32_t &min, int32_t &max);
#undef __class__ #undef __class__
@ -139,7 +139,7 @@ template<class CLASS_TYPE> class RegExpNode{
* @param[in,out] * @param[in,out]
* @return * @return
*/ */
virtual int32_t Generate(etk::VectorType<int16_t> &data) virtual int32_t Generate(etk::Vector<int16_t> &data)
{ {
return 0; return 0;
}; };
@ -199,7 +199,7 @@ template<class CLASS_TYPE> class RegExpNode{
int32_t m_multipleMin; //!< minimum repetition (included) int32_t m_multipleMin; //!< minimum repetition (included)
int32_t m_multipleMax; //!< maximum repetition (included) int32_t m_multipleMax; //!< maximum repetition (included)
// Data Section ... (can have no data...) // Data Section ... (can have no data...)
etk::VectorType<int16_t> m_RegExpData; //!< data to parse and compare in some case ... etk::Vector<int16_t> m_RegExpData; //!< data to parse and compare in some case ...
}; };
#undef __class__ #undef __class__
@ -233,7 +233,7 @@ template<class CLASS_TYPE> class RegExpNodeValue : public RegExpNode<CLASS_TYPE>
* @param[in,out] * @param[in,out]
* @return * @return
*/ */
int32_t Generate(etk::VectorType<int16_t> &data) int32_t Generate(etk::Vector<int16_t> &data)
{ {
RegExpNode<CLASS_TYPE>::m_RegExpData = data; RegExpNode<CLASS_TYPE>::m_RegExpData = data;
//TK_DEBUG("Request Parse \"Value\" data="; DisplayElem(RegExpNode<CLASS_TYPE>::m_RegExpData);); //TK_DEBUG("Request Parse \"Value\" data="; DisplayElem(RegExpNode<CLASS_TYPE>::m_RegExpData););
@ -303,7 +303,7 @@ template<class CLASS_TYPE> class RegExpNodeValue : public RegExpNode<CLASS_TYPE>
}; };
protected : protected :
// SubNodes : // SubNodes :
etk::VectorType<char> m_data; etk::Vector<char> m_data;
}; };
#undef __class__ #undef __class__
#define __class__ "etk::RegExpNodeBracket" #define __class__ "etk::RegExpNodeBracket"
@ -336,7 +336,7 @@ template<class CLASS_TYPE> class RegExpNodeBracket : public RegExpNode<CLASS_TYP
* @param[in,out] * @param[in,out]
* @return * @return
*/ */
int32_t Generate(etk::VectorType<int16_t> &data) int32_t Generate(etk::Vector<int16_t> &data)
{ {
RegExpNode<CLASS_TYPE>::m_RegExpData = data; RegExpNode<CLASS_TYPE>::m_RegExpData = data;
//TK_DEBUG("Request Parse [...] data="; DisplayElem(RegExpNode<CLASS_TYPE>::m_RegExpData);); //TK_DEBUG("Request Parse [...] data="; DisplayElem(RegExpNode<CLASS_TYPE>::m_RegExpData););
@ -421,7 +421,7 @@ template<class CLASS_TYPE> class RegExpNodeBracket : public RegExpNode<CLASS_TYP
}; };
protected : protected :
// SubNodes : // SubNodes :
etk::VectorType<char> m_data; etk::Vector<char> m_data;
}; };
#undef __class__ #undef __class__
#define __class__ "etk::RegExpNodeDigit" #define __class__ "etk::RegExpNodeDigit"
@ -1211,14 +1211,14 @@ template<class CLASS_TYPE> class RegExpNodePTheseElem : public RegExpNode<CLASS_
* @param[in,out] * @param[in,out]
* @return * @return
*/ */
int32_t Generate(etk::VectorType<int16_t> &data) int32_t Generate(etk::Vector<int16_t> &data)
{ {
RegExpNode<CLASS_TYPE>::m_RegExpData = data; RegExpNode<CLASS_TYPE>::m_RegExpData = data;
//TK_DEBUG("Request Parse (elem) data="; DisplayElem(RegExpNode<CLASS_TYPE>::m_RegExpData);); //TK_DEBUG("Request Parse (elem) data="; DisplayElem(RegExpNode<CLASS_TYPE>::m_RegExpData););
int32_t pos = 0; int32_t pos = 0;
int32_t elementSize = 0; int32_t elementSize = 0;
etk::VectorType<int16_t> tmpData; etk::Vector<int16_t> tmpData;
while (pos < RegExpNode<CLASS_TYPE>::m_RegExpData.Size()) { while (pos < RegExpNode<CLASS_TYPE>::m_RegExpData.Size()) {
tmpData.Clear(); tmpData.Clear();
switch (RegExpNode<CLASS_TYPE>::m_RegExpData[pos]) switch (RegExpNode<CLASS_TYPE>::m_RegExpData[pos])
@ -1404,7 +1404,7 @@ template<class CLASS_TYPE> class RegExpNodePTheseElem : public RegExpNode<CLASS_
}; };
protected : protected :
// SubNodes : // SubNodes :
etk::VectorType<RegExpNode<CLASS_TYPE>*> m_subNode; etk::Vector<RegExpNode<CLASS_TYPE>*> m_subNode;
private : private :
/** /**
* @brief Set the number of repeate time on a the last node in the list ... * @brief Set the number of repeate time on a the last node in the list ...
@ -1461,7 +1461,7 @@ template<class CLASS_TYPE> class RegExpNodePThese : public RegExpNode<CLASS_TYPE
* @param[in,out] * @param[in,out]
* @return * @return
*/ */
int32_t Generate(etk::VectorType<int16_t> &data) int32_t Generate(etk::Vector<int16_t> &data)
{ {
RegExpNode<CLASS_TYPE>::m_RegExpData = data; RegExpNode<CLASS_TYPE>::m_RegExpData = data;
//TK_DEBUG("Request Parse (...) data="; DisplayElem(RegExpNode<CLASS_TYPE>::m_RegExpData);); //TK_DEBUG("Request Parse (...) data="; DisplayElem(RegExpNode<CLASS_TYPE>::m_RegExpData););
@ -1471,7 +1471,7 @@ template<class CLASS_TYPE> class RegExpNodePThese : public RegExpNode<CLASS_TYPE
// generate all the "elemTypePTheseElem" of the Node // generate all the "elemTypePTheseElem" of the Node
while (elementSize>0) { while (elementSize>0) {
// geerate output deta ... // geerate output deta ...
etk::VectorType<int16_t> tmpData; etk::Vector<int16_t> tmpData;
for (int32_t k=pos; k<pos+elementSize; k++) { for (int32_t k=pos; k<pos+elementSize; k++) {
tmpData.PushBack(RegExpNode<CLASS_TYPE>::m_RegExpData[k]); tmpData.PushBack(RegExpNode<CLASS_TYPE>::m_RegExpData[k]);
} }
@ -1547,7 +1547,7 @@ template<class CLASS_TYPE> class RegExpNodePThese : public RegExpNode<CLASS_TYPE
protected : protected :
// SubNodes : // SubNodes :
etk::VectorType<RegExpNode<CLASS_TYPE>*> m_subNode; etk::Vector<RegExpNode<CLASS_TYPE>*> m_subNode;
//int32_t m_posPthese; //!< position of the element is detected in the output element //int32_t m_posPthese; //!< position of the element is detected in the output element
}; };
#undef __class__ #undef __class__
@ -1634,7 +1634,7 @@ template<class CLASS_TYPE> class RegExp {
void SetRegExp(etk::UString &expressionRequested) void SetRegExp(etk::UString &expressionRequested)
{ {
m_expressionRequested = expressionRequested; // TODO : Must be deprecated ... m_expressionRequested = expressionRequested; // TODO : Must be deprecated ...
etk::VectorType<int16_t> tmpExp; etk::Vector<int16_t> tmpExp;
//TK_DEBUG("Parse RegExp : " << expressionRequested.c_str() ); //TK_DEBUG("Parse RegExp : " << expressionRequested.c_str() );
m_isOk = false; m_isOk = false;
@ -1644,7 +1644,7 @@ template<class CLASS_TYPE> class RegExp {
m_notEndWithChar = false; m_notEndWithChar = false;
// TODO : Check this ... ==> could create some errors ... // TODO : Check this ... ==> could create some errors ...
char * exp = expressionRequested.Utf8Data(); char * exp = expressionRequested.c_str();
int32_t regExpLen = strlen(exp); int32_t regExpLen = strlen(exp);
// change in the regular Opcode ==> replace \x with the corect element ... x if needed // change in the regular Opcode ==> replace \x with the corect element ... x if needed
int32_t iii; int32_t iii;
@ -1977,7 +1977,7 @@ template<class CLASS_TYPE> class RegExp {
* @param[in,out] * @param[in,out]
* @return * @return
*/ */
bool CheckGoodPosition(etk::VectorType<int16_t> tmpExp, int32_t &pos) bool CheckGoodPosition(etk::Vector<int16_t> tmpExp, int32_t &pos)
{ {
int16_t curentCode = tmpExp[pos]; int16_t curentCode = tmpExp[pos];
int16_t endCode = REGEXP_OPCODE_PTHESE_OUT; int16_t endCode = REGEXP_OPCODE_PTHESE_OUT;
@ -2083,7 +2083,7 @@ template<class CLASS_TYPE> class RegExp {
* @param[in,out] * @param[in,out]
* @return * @return
*/ */
bool CheckGoodPosition(etk::VectorType<int16_t> tmpExp) bool CheckGoodPosition(etk::Vector<int16_t> tmpExp)
{ {
int32_t pos = 0; int32_t pos = 0;
while (pos < (int32_t)tmpExp.Size()) { while (pos < (int32_t)tmpExp.Size()) {

View File

@ -187,11 +187,6 @@ namespace etk{
strncat(m_tmpChar, tmp, MAX_LOG_SIZE); strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
return *this; return *this;
} }
CCout& operator << (color_ts t) {
snprintf(tmp, MAX_LOG_SIZE_TMP, "#%02X%02X%02X%02X", t.red, t.green, t.blue, t.alpha);
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
return *this;
}
CCout& operator << (clipping_ts t) { CCout& operator << (clipping_ts t) {
snprintf(tmp, MAX_LOG_SIZE_TMP, "origin=(%f,%f) size=(%f,%f)", t.x, t.y, t.w, t.h); snprintf(tmp, MAX_LOG_SIZE_TMP, "origin=(%f,%f) size=(%f,%f)", t.x, t.y, t.w, t.h);
strncat(m_tmpChar, tmp, MAX_LOG_SIZE); strncat(m_tmpChar, tmp, MAX_LOG_SIZE);

View File

@ -68,8 +68,6 @@ typedef enum {
#define etk_max(elemA, elemB) (((elemA)<(elemB)) ? (elemB) : (elemA)) #define etk_max(elemA, elemB) (((elemA)<(elemB)) ? (elemB) : (elemA))
#define etk_avg(minimim, elem, maximum) (((minimim)>(elem)) ? (minimim) : ((maximum)<(elem)) ? (maximum) : (elem)) #define etk_avg(minimim, elem, maximum) (((minimim)>(elem)) ? (minimim) : ((maximum)<(elem)) ? (maximum) : (elem))
#include <etk/TypesCoordonate.h>
typedef struct { typedef struct {
float u; float u;
float v; float v;
@ -82,38 +80,6 @@ typedef struct {
float h; float h;
}clipping_ts; }clipping_ts;
typedef struct color_ts {
uint8_t red;
uint8_t green;
uint8_t blue;
uint8_t alpha;
color_ts(void) {
red = 0xFF;
green = 0xFF;
blue = 0xFF;
alpha = 0xFF;
};
color_ts(uint32_t data) {
red = (uint8_t)((data&0xFF000000)>>24);
green = (uint8_t)((data&0x00FF0000)>>16);
blue = (uint8_t)((data&0x0000FF00)>>8);
alpha = (uint8_t)((data&0x000000FF));
};
color_ts(float _red, float _green, float _blue, float _alpha = 1.0) {
_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);
};
}color_ts;
#include <etk/Color.h>
#endif #endif
#include <etk/TypesCoordonate.h>

View File

@ -47,7 +47,7 @@ int32_t strlen(const uniChar_t * data)
etk::CCout& etk::operator <<(etk::CCout &os, const etk::UString &obj) etk::CCout& etk::operator <<(etk::CCout &os, const etk::UString &obj)
{ {
etk::VectorType<char> output_UTF8; etk::Vector<char> output_UTF8;
unicode::convertUnicodeToUtf8(obj.m_data, output_UTF8); unicode::convertUnicodeToUtf8(obj.m_data, output_UTF8);
output_UTF8.PushBack('\0'); output_UTF8.PushBack('\0');
os << &output_UTF8[0]; os << &output_UTF8[0];
@ -135,7 +135,7 @@ void etk::UString::Set(const char * inputData, int32_t len)
len = strlen(inputData); len = strlen(inputData);
} }
// convert the string // convert the string
etk::VectorType<char> tmpChar; etk::Vector<char> tmpChar;
for (int32_t iii=0; iii<len; iii++) { for (int32_t iii=0; iii<len; iii++) {
tmpChar.PushBack(inputData[iii]); tmpChar.PushBack(inputData[iii]);
} }
@ -276,9 +276,9 @@ const etk::UString& etk::UString::operator= (const etk::UString &etkS )
* @return * @return
* *
*/ */
const etk::UString& etk::UString::operator= (etk::VectorType<char> inputData) const etk::UString& etk::UString::operator= (etk::Vector<char> inputData)
{ {
etk::VectorType<uniChar_t> output_Unicode; etk::Vector<uniChar_t> output_Unicode;
unicode::convertUtf8ToUnicode(inputData, output_Unicode); unicode::convertUtf8ToUnicode(inputData, output_Unicode);
*this = output_Unicode; *this = output_Unicode;
return *this; return *this;
@ -292,9 +292,9 @@ const etk::UString& etk::UString::operator= (etk::VectorType<char> inputData)
* @return * @return
* *
*/ */
const etk::UString& etk::UString::operator= (etk::VectorType<int8_t> inputData) const etk::UString& etk::UString::operator= (etk::Vector<int8_t> inputData)
{ {
etk::VectorType<uniChar_t> output_Unicode; etk::Vector<uniChar_t> output_Unicode;
unicode::convertUtf8ToUnicode(inputData, output_Unicode); unicode::convertUtf8ToUnicode(inputData, output_Unicode);
*this = output_Unicode; *this = output_Unicode;
return *this; return *this;
@ -309,7 +309,7 @@ const etk::UString& etk::UString::operator= (etk::VectorType<int8_t> inputData)
* @return * @return
* *
*/ */
const etk::UString& etk::UString::operator= (etk::VectorType<uniChar_t> inputData) const etk::UString& etk::UString::operator= (etk::Vector<uniChar_t> inputData)
{ {
m_data = inputData; m_data = inputData;
if (m_data.Size()>0) { if (m_data.Size()>0) {
@ -734,9 +734,9 @@ etk::UString etk::UString::Extract(int32_t posStart, int32_t posEnd)
* @return The desired vector with data * @return The desired vector with data
* *
*/ */
etk::VectorType<uniChar_t> etk::UString::GetVector(void) etk::Vector<uniChar_t> etk::UString::GetVector(void)
{ {
etk::VectorType<uniChar_t> out = m_data; etk::Vector<uniChar_t> out = m_data;
out.PopBack(); out.PopBack();
return out; return out;
} }
@ -780,7 +780,7 @@ bool etk::UString::EndWith(const etk::UString& data)
} }
char * etk::UString::Utf8Data(void) char * etk::UString::c_str(void)
{ {
// UTF8 generation : // UTF8 generation :
m_dataUtf8.Clear(); m_dataUtf8.Clear();

View File

@ -26,7 +26,7 @@
#define __ETK_USTRING_H__ #define __ETK_USTRING_H__
#include <etk/Stream.h> #include <etk/Stream.h>
#include <etk/VectorType.h> #include <etk/Vector.h>
namespace etk namespace etk
{ {
@ -54,9 +54,9 @@ namespace etk
* = assigment * = assigment
*****************************************************/ *****************************************************/
const etk::UString& operator= (const etk::UString &etkS ); const etk::UString& operator= (const etk::UString &etkS );
const etk::UString& operator= (etk::VectorType<char> inputData); const etk::UString& operator= (etk::Vector<char> inputData);
const etk::UString& operator= (etk::VectorType<int8_t> inputData); const etk::UString& operator= (etk::Vector<int8_t> inputData);
const etk::UString& operator= (etk::VectorType<uniChar_t> inputData); const etk::UString& operator= (etk::Vector<uniChar_t> inputData);
/***************************************************** /*****************************************************
* == operator * == operator
*****************************************************/ *****************************************************/
@ -116,8 +116,8 @@ namespace etk
// Find element // Find element
int32_t FindForward(const char data, int32_t startPos=0); int32_t FindForward(const char data, int32_t startPos=0);
int32_t FindForward(const uniChar_t data, int32_t startPos=0); int32_t FindForward(const uniChar_t data, int32_t startPos=0);
int32_t FindBack(const char data, int32_t startPos=0x7FFFFFFF); int32_t FindBack(const char data, int32_t startPos=0x7FFFFFFF);
int32_t FindBack(const uniChar_t data, int32_t startPos=0x7FFFFFFF); int32_t FindBack(const uniChar_t data, int32_t startPos=0x7FFFFFFF);
bool IsEmpty(void) const; bool IsEmpty(void) const;
int32_t Size(void) const; int32_t Size(void) const;
@ -131,17 +131,17 @@ namespace etk
void Remove(int32_t currentID, int32_t len); void Remove(int32_t currentID, int32_t len);
void Clear(void); void Clear(void);
etk::VectorType<uniChar_t> GetVector(void); etk::Vector<uniChar_t> GetVector(void);
uniChar_t * pointer(void) { return &m_data[0]; }; uniChar_t * pointer(void) { return &m_data[0]; };
// generate temporary allocation (auto unallocated...) // generate temporary allocation (auto unallocated...)
char * Utf8Data(void); char * c_str(void);
// Sting operation : // Sting operation :
etk::UString Extract(int32_t posStart=0, int32_t posEnd=0x7FFFFFFF); etk::UString Extract(int32_t posStart=0, int32_t posEnd=0x7FFFFFFF);
private : private :
etk::VectorType<uniChar_t> m_data; //!< internal data is stored in the Unicode properties ... etk::Vector<uniChar_t> m_data; //!< internal data is stored in the Unicode properties ...
etk::VectorType<char> m_dataUtf8; //!< Tmp data for the Utf8Data() function etk::Vector<char> m_dataUtf8; //!< Tmp data for the Utf8Data() function
}; };
etk::CCout& operator <<(etk::CCout &os, const etk::UString &obj); etk::CCout& operator <<(etk::CCout &os, const etk::UString &obj);

View File

@ -32,288 +32,691 @@
#undef __class__ #undef __class__
#define __class__ "etk::Vector" #define __class__ "etk::Vector"
/**
* @brief etkVector classes ...
*
* @tparam[in] T The type of objects to store.
* @tparam[in] INC Incrementation mode (0 : Exponential to 200 and increment by stemp of 200)
*
* @todo : Need to add : popBack / Assign / Insert / Erase / Swap / Clear
*
* m_data
* ---------- |-----------------------|
* | 0 |-------->| Class Data |
* |--------| |-----------------------|
* | 1 |----|
* |--------| |
* | 2 |====|==============| |-----------------------|
* |--------| | --->| Class Data |
* m_count | 3 |-| | |-----------------------|
* |--------| | |
* | x | | | |-----------------------|
* |--------| | -------->| Class Data |
* | x | | |-----------------------|
* |--------| |
* | x | |
* |--------| | |-----------------------|
* | x | --------------------->| Class Data |
* |--------| |-----------------------|
* | x |
* |--------|
* | x |
* |--------|
* m_size | x |
* ----------
*
*/
namespace etk namespace etk
{ {
template<class T, int32_t INC=0> class Vector
{
public:
/** /**
* @brief * @brief Vector classes ...
* *
* @param[in,out] --- * @tparam[in] SIZE Size of the current element.
* *
* @return --- * m_data
* <------------ m_dataSize ------------>
* ----------------------------------------
* | 0 |
* |--------------------------------------|
* | 1 |
* |--------------------------------------|
* | 2 |
* |--------------------------------------|
* m_size | 3 |
* |--------------------------------------|
* | x |
* |--------------------------------------|
* | x |
* |--------------------------------------|
* | x |
* |--------------------------------------|
* | x |
* |--------------------------------------|
* | x |
* |--------------------------------------|
* | x |
* |--------------------------------------|
* m_allocated | x |
* ----------------------------------------
* *
*/ */
Vector(int count = 0): template<typename MY_TYPE=int32_t> class Vector
m_data(NULL),
m_count(0),
m_size(0)
{ {
Resize(count); public:
} class Iterator
{
// Private data :
private:
int32_t m_current; //!< curent Id on the vector
Vector<MY_TYPE> * m_vector; //!< Pointer on the curent element of the vectorBin
public:
/**
* @brief Basic itarator constructor with no link with an etkVector
*/
Iterator():
m_current(-1),
m_vector(NULL)
{
// nothing to do ...
}
/**
* @brief Recopy constructor on a specific etkVector.
* @param[in] otherIterator The Iterator that might be copy
*/
Iterator(const Iterator & otherIterator):
m_current(otherIterator.m_current),
m_vector(otherIterator.m_vector)
{
// nothing to do ...
}
/**
* @brief Asignation operator.
* @param[in] otherIterator The Iterator that might be copy
* @return reference on the curent Iterator
*/
Iterator& operator=(const Iterator & otherIterator)
{
m_current = otherIterator.m_current;
m_vector = otherIterator.m_vector;
return *this;
}
/**
* @brief Basic destructor
*/
~Iterator()
{
m_current = -1;
m_vector = NULL;
}
/**
* @brief basic boolean cast
* @return true if the element is present in the etkVector size
*/
operator bool ()
{
if( 0 <= m_current
&& m_current < m_vector->Size() )
{
return true;
} else {
return false;
}
}
/**
* @brief Incremental operator
* @return Reference on the current iterator incremented
*/
Iterator& operator++ ()
{
if( NULL != m_vector
&& m_current < m_vector->Size() )
{
m_current++;
}
return *this;
}
/**
* @brief Decremental operator
* @return Reference on the current iterator decremented
*/
Iterator& operator-- ()
{
if (m_current >= 0) {
m_current--;
}
return *this;
}
/**
* @brief Incremental operator
* @return Reference on a new iterator and increment the other one
*/
Iterator operator++ (int32_t)
{
Iterator it(*this);
++(*this);
return it;
}
/**
* @brief Decremental operator
* @return Reference on a new iterator and decrement the other one
*/
Iterator operator-- (int32_t)
{
Iterator it(*this);
--(*this);
return it;
}
/**
* @brief Get reference on the current Element
* @return the reference on the current Element
*/
MY_TYPE & operator-> () const
{
TK_CHECK_INOUT(m_current >= 0 && m_current < m_vector->Size());
return &m_vector->Get(m_current);
}
/**
* @brief Get reference on the current Element
* @return the reference on the current Element
*/
MY_TYPE & operator* () const
{
TK_CHECK_INOUT(m_current >= 0 && m_current < m_vector->Size());
return m_vector->Get(m_current);
}
private:
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
Iterator(Vector<MY_TYPE> * Evb, int32_t pos):
m_current(pos),
m_vector(Evb)
{
// nothing to do ...
}
friend class Vector;
};
/** private:
* @brief MY_TYPE * m_data; //!< pointer on the curetn table of Data
* int32_t m_size; //!< nb Element in the buffer
* @param[in,out] --- int32_t m_allocated; //!< Current allocated size
* int32_t m_increment; //!< methode of increment
* @return --- public:
* /**
*/ * @brief Create an empty vector
Vector(const etk::Vector<T> & myVector): * @param[in] count Minimum request size of the Buffer
m_size(myVector.m_size), */
m_count(myVector.m_count), Vector(int32_t count = 0):
m_data(NULL) m_data(NULL),
{ m_size(0),
int32_t i; m_allocated(0),
ETK_MALLOC_CAST(m_data, m_size, T, T*);//reinterpret_cast<T*>); m_increment(1)
for(i=0; i<m_count; i++) { {
new (&m_data[i]) T(myVector[i]); ChangeAllocation(count);
} }
}
/** /**
* @brief * @brief Re-copy constructor (copy all needed data)
* * @param[in] Evb Vector that might be copy
* @param[in,out] --- */
* Vector(const etk::Vector<MY_TYPE> & Evb)
* @return --- {
* m_allocated = Evb.m_allocated;
*/ m_size = Evb.m_size;
~Vector() m_increment = Evb.m_increment;
{ m_data = NULL;
Destroy(); //TK_DEBUG("USE Specific vector allocator ... Evb.m_size=" << Evb.m_size << " Evb.m_increment=" << Evb.m_increment);
} // allocate all same data
ETK_MALLOC(m_data, m_allocated, MY_TYPE);
TK_ASSERT(NULL!=m_data, "Error in data allocation");
// Copy all data ...
memcpy(m_data, Evb.m_data, m_allocated * sizeof(MY_TYPE) );
}
/** /**
* @brief * @brief Destructor of the current Class
* */
* @param[in,out] --- ~Vector()
* {
* @return --- if (NULL!=m_data) {
* ETK_FREE(m_data);
*/ m_data = NULL;
Vector& operator=(const etk::Vector<T> & etkVector) }
{ m_allocated = 0;
int32_t i; m_size = 0;
this->~etkVector(); m_increment = 0;
m_size = etkVector.m_size; }
m_count = etkVector.m_count;
ETK_MALLOC_CAST(m_data, m_size, T, T*);//reinterpret_cast<T*>);
for(i=0; i<m_count; i++) {
new (&m_data[i]) T(etkVector[i]);
}
return *this;
}
/** /**
* @brief * @brief Re-copy operator
* * @param[in] Evb Vector that might be copy
* @param[in,out] --- * @return reference on the curent re-copy vector
* */
* @return --- Vector& operator=(const etk::Vector<MY_TYPE> & Evb)
* {
*/ //TK_DEBUG("USE RECOPY vector ... Evb.m_size=" << Evb.m_size << " Evb.m_increment=" << Evb.m_increment);
int32_t Size() if( this != &Evb ) // avoid copy to itself
{ {
return m_count; if (NULL!=m_data) {
} ETK_FREE(m_data);
m_data = NULL;
}
// Set the new value
m_allocated = Evb.m_allocated;
m_size = Evb.m_size;
m_increment = Evb.m_increment;
// allocate all same data
ETK_MALLOC(m_data, m_allocated, MY_TYPE);
TK_ASSERT(NULL!=m_data, "Error in data allocation");
// Copy all data ...
memcpy(m_data, Evb.m_data, m_allocated * sizeof(MY_TYPE) );
}
// Return the curent pointer
return *this;
}
/** /**
* @brief * @brief Add at the Last position of the Vector
* * @param[in] item Element to add at the end of vector
* @param[in,out] --- */
* Vector& operator+= (const etk::Vector<MY_TYPE> & Evb) // += operator
* @return --- {
* int32_t nbElememt = Evb.Size();
*/ int32_t idx = m_size;
T& Get(int32_t pos) Resize(m_size+nbElememt);
{ memcpy(&m_data[idx], &Evb.m_data[0], nbElememt*sizeof(MY_TYPE) );
return m_data[pos]; // Return the curent pointer
} return *this;
}
/** /**
* @brief * @brief Set increment mode of this vector (default it match corectly with the number of element inside)
* * @param[in] newIncrementNumber methode requested
* @param[in,out] --- */
* void SetIncrement(int32_t newIncrementNumber)
* @return --- {
* m_increment = newIncrementNumber;
*/ }
T& operator[] (int32_t pos)
{
return Get(pos);
}
/** /**
* @brief * @brief Get the number of element in the vector
* * @return The number requested
* @param[in,out] --- */
* int32_t Size() const
* @return --- {
* return m_size;
*/ }
const T& operator[] (int32_t pos) const
{
return m_data[pos];
}
/** /**
* @brief * @brief Get the Allocated size in the vector
* * @return The size of allocation
* @param[in,out] --- */
* int32_t AllocatedSize() const
* @return --- {
* return m_allocated;
*/ }
int IndexOf(const T * item) const
{
int32_t res = item - m_data;
if( 0 > res
|| res >= Size())
{
return -1;
} else {
return res;
}
}
/** /**
* @brief * @brief Get a current element in the vector
* * @param[in] pos Desired position read
* @param[in,out] --- * @return Reference on the Element
* */
* @return --- MY_TYPE& Get(int32_t pos)
* {
*/ return m_data[pos];
void PushBack(const T& item) }
{
int32_t idx = Size();
Resize(idx+1);
Get(idx) = item;
}
/** /**
* @brief * @brief Get an copy Element an a special position
* * @param[in] pos Position in the vector that might be get [0..Size()]
* @param[in,out] --- * @return An reference on the copy of selected element
* */
* @return --- MY_TYPE& operator[] (int32_t pos)
* {
*/ return Get(pos);
void Resize(int32_t count) }
{
int32_t i;
// Reallocate memory
if (count > m_size) {
ChangeAllocation(count);
}
// Remove deprecated element /**
for(i=count; i<m_count; i++) { * @brief Get an Element an a special position
m_data[i].~T(); * @param[in] pos Position in the vector that might be get [0..Size()]
} * @return An reference on the selected element
*/
const MY_TYPE& operator[] (int32_t pos) const
{
return m_data[pos];
}
// Create nex item /**
for(i=m_count;i<count;i++) { * @brief Add at the Last position of the Vector
new (&m_data[i]) T(); * @param[in] item Element to add at the end of vector
} */
void PushBack(const MY_TYPE& item)
{
int32_t idx = m_size;
Resize(m_size+1);
m_data[idx] = item;
}
m_count = count; /**
} * @brief Add at the Last position of the Vector
* @param[in] item Element to add at the end of vector
*/
void PushBack(const MY_TYPE * item, int32_t nbElement)
{
if (NULL == item) {
return;
}
int32_t idx = m_size;
Resize(m_size+nbElement);
memcpy(&m_data[idx], item, nbElement*sizeof(MY_TYPE) );
}
/** /**
* @brief * @brief Remove the last element of the vector
* */
* @param[in,out] --- void PopBack(void)
* {
* @return --- if(m_size>0) {
* Resize(m_size-1);
*/
void ChangeAllocation(int count)
{
if (count > m_size) {
// generate new size
while(count > m_size) {
if (INC) {
m_size = (m_size + INC);
} else if (m_size==0) {
m_size = 1;
} else {
m_size = m_size * 2;
} }
} }
// Allocate the curent element
T * data = NULL;
ETK_MALLOC_CAST(data, m_size, T, T*);//reinterpret_cast<T*>);
for(int i=0; i<m_count; i++) {
new (&data[i]) T(m_data[i]);
}
Destroy();
m_data = data;
}
}
private: /**
T * m_data; //!< pointer on the current Data * @brief Remove all alement in the current vector
int32_t m_count; //!< number of element */
int32_t m_size; //!< current allocated size void Clear(void)
{
if(m_size>0) {
Resize(0);
}
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
void Insert(int32_t pos, const MY_TYPE& item)
{
if (pos>m_size) {
TK_ERROR(" can not insert Element at this position : " << pos << " > " << m_size<< " add it at the end ... ");
PushBack(item);
return;
}
int32_t tmpSize = m_size;
// Request resize of the current buffer
Resize(m_size+1);
// move curent data
int32_t sizeToMove = (tmpSize - pos)*sizeof(MY_TYPE);
if ( 0 < sizeToMove) {
memmove((m_data + pos + 1), (m_data + pos), sizeToMove );
}
// affectation of the current element
m_data[pos] = item;
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
void Insert(int32_t pos, const MY_TYPE * item, int32_t nbElement)
{
if (pos>m_size) {
TK_WARNING(" can not insert Element at this position : " << pos << " > " << m_size << " add it at the end ... ");
PushBack(item, nbElement);
return;
}
int32_t tmpSize = m_size;
// Request resize of the current buffer
Resize(m_size+nbElement);
// move curent data (after the position)
int32_t sizeToMove = (tmpSize - pos)*sizeof(MY_TYPE);
if ( 0 < sizeToMove) {
memmove((m_data + pos + nbElement), (m_data + pos), sizeToMove );
}
// affectation of all input element
memcpy(&m_data[pos], item, nbElement*sizeof(MY_TYPE) );
}
/**
* @brief Remove one element
*
* @param[in] pos Position to remove the data
*
* @return ---
*
*/
void Erase(int32_t pos)
{
if (pos<0 || (uint32_t)pos>m_size) {
TK_ERROR(" can not Erase Element at this position : " << pos << " > " << m_size);
return;
}
int32_t tmpSize = m_size;
int32_t sizeToMove = (tmpSize - (pos+1))*sizeof(MY_TYPE);
if ( 0 < sizeToMove) {
// move curent data
memmove((m_data + pos), (m_data + pos + 1), sizeToMove );
}
// Request resize of the current buffer
Resize(m_size-1);
}
/**
* @brief Remove N elements
*
* @param[in] pos Position to remove the data
* @param[in] posEnd Last position number
*
* @return ---
*
*/
void Erase(int32_t pos, int32_t posEnd)
{
if (pos>m_size) {
TK_ERROR(" can not Erase Element at this position : " << pos << " > " << m_size);
return;
}
if (posEnd>m_size) {
posEnd = m_size;
}
int32_t nbElement = m_size - pos;
int32_t tmpSize = m_size;
// move curent data
int32_t sizeToMove = (tmpSize - (pos+nbElement))*sizeof(MY_TYPE);
if ( 0 < sizeToMove) {
memmove((m_data + pos), (m_data + pos + nbElement), sizeToMove );
}
// Request resize of the current buffer
Resize(m_size-nbElement);
}
/**
* @brief Remove N element
*
* @param[in] pos Position to remove the data
* @param[in] nbElement number of element to remove
*
* @return ---
*
*/
void EraseLen(int32_t pos, int32_t nbElement)
{
if (pos>m_size) {
TK_ERROR(" can not Erase Len Element at this position : " << pos << " > " << m_size);
return;
}
if (pos+nbElement>m_size) {
nbElement = m_size - pos;
}
int32_t tmpSize = m_size;
// move curent data
int32_t sizeToMove = (tmpSize - (pos+nbElement))*sizeof(MY_TYPE);
if ( 0 < sizeToMove) {
memmove((m_data + pos), (m_data + pos + nbElement), sizeToMove );
}
// Request resize of the current buffer
Resize(m_size-nbElement);
}
/**
* @brief extract data between two point :
* @param[in] posStart start position to extract data
* @param[in] posEnd End position to extract data
* @return the extracted vector
*/
Vector Extract(int32_t posStart = 0, int32_t posEnd=0x7FFFFFFF)
{
Vector<MY_TYPE> out;
if (posStart < 0) {
posStart = 0;
} else if (posStart >= Size() ) {
return out;
}
if (posEnd < 0) {
return out;
} else if (posEnd >= Size() ) {
posEnd = Size();
}
out.PushBack(&m_data[posStart], posEnd-posStart);
return out;
}
/**
* @brief Set the minimum allocation in memory for the curent vector ==> reallocate the
* buffer to fit exactly the mumber of element needed
*/
void Fit(void)
{
if (m_size > m_allocated) {
// Reallocate the curent data to the correct size ...
ETK_REALLOC(m_data, m_size, MY_TYPE);
}
// Check result with assert :
TK_ASSERT(NULL!=m_data, "Error in data Fitting");
m_allocated = m_size;
}
/**
* @brief Get an iterator an an specific position
* @param[in] pos Requested position of the iterator in the vector
* @return The Iterator
*/
Iterator Position(int32_t pos)
{
return Iterator(this, pos);
}
/**
* @brief Get an Iterator on the start position of the Vector
* @return The Iterator
*/
Iterator Begin(void)
{
return Position(0);
}
/**
* @brief Get an Iterator on the end position of the Vector
* @return The Iterator
*/
Iterator End(void)
{
return Position( Size()-1 );
}
private:
/**
* @brief Change the current size of the vector
* @param[in] newSize New requested size of element in the vector
*/
void Resize(int32_t newSize)
{
// Reallocate memory
if (newSize > m_allocated) {
ChangeAllocation(newSize);
}
m_size = newSize;
}
/**
* @brief Change the current allocation to the corect one (depend on the current size)
* @param[in] newSize Minimum number of element needed
*/
void ChangeAllocation(int32_t newSize)
{
// set the minimal size to 1
if(newSize <= 0) {
newSize = 1;
}
int32_t requestSize = m_allocated;
// set the size with the corect chose type :
if (newSize == m_allocated) {
return;
} else if (newSize < requestSize) {
// down the size of the vector:
if (0==m_increment) {
// never down size...
} else {
int32_t devide = m_increment;
if (devide == 0) {
devide = 1;
}
int32_t numberOfStep = m_allocated / devide;
if (newSize< ((numberOfStep-2)*devide + devide/2) ) {
//Allow Reallocation of a new size shorter
requestSize = ((newSize / devide)+1) * devide;
}
}
} else {
while(newSize > requestSize) {
if (0 == requestSize) {
requestSize = 1;
} else if (0==m_increment) {
requestSize = requestSize * 2;
} else {
requestSize = (requestSize + m_increment);
}
}
}
// No reallocation needed :
if (requestSize == m_allocated) {
return;
}
// check if something is allocated :
if (NULL == m_data) {
// no data allocated ==> request an allocation (might be the first)
ETK_MALLOC(m_data, requestSize, MY_TYPE);
} else {
// move datas
ETK_REALLOC(m_data, requestSize, MY_TYPE);
}
// Check result with assert :
TK_ASSERT(NULL!=m_data, "Error in data allocation");
// set the new allocation size
m_allocated = requestSize;
}
};
/** /**
* @brief * @brief VectorP classes ...
* *
* @param[in,out] --- * @tparam[in] T The type of objects to store.
* @tparam[in] INC Incrementation mode (0 : Exponential to 200 and increment by stemp of 200)
* *
* @return --- * m_data
* ---------- |-----------------------|
* | 0 |-------->| Class Data |
* |--------| |-----------------------|
* | 1 |----|
* |--------| |
* | 2 |====|==============| |-----------------------|
* |--------| | --->| Class Data |
* m_count | 3 |-| | |-----------------------|
* |--------| | |
* | x | | | |-----------------------|
* |--------| | -------->| Class Data |
* | x | | |-----------------------|
* |--------| |
* | x | |
* |--------| | |-----------------------|
* | x | --------------------->| Class Data |
* |--------| |-----------------------|
* | x |
* |--------|
* | x |
* |--------|
* m_size | x |
* ----------
* *
*/ */
void Destroy() /*
template<class MY_CLASS> class VectorP private Vector<MY_CLASS*>
{ {
for(int i=0; i<m_count; i++) {
m_data[i].~T();
}
if (m_data) {
ETK_FREE(m_data);
}
}
};
};
*/
} }
#undef __class__ #undef __class__

View File

@ -1,687 +0,0 @@
/**
*******************************************************************************
* @file etk/VectorType.h
* @brief Ewol Tool Kit : Basic VectorType for direct data insertion (template)
* @author Edouard DUPIN
* @date 07/04/2011
* @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_VECTOR_TYPE_H__
#define __ETK_VECTOR_TYPE_H__
#include <etk/Types.h>
#include <etk/DebugInternal.h>
#include <etk/Memory.h>
#undef __class__
#define __class__ "etk::VectorType"
/**
* @brief VectorType classes ...
*
* @tparam[in] SIZE Size of the current element.
*
* m_data
* <------------ m_dataSize ------------>
* ----------------------------------------
* | 0 |
* |--------------------------------------|
* | 1 |
* |--------------------------------------|
* | 2 |
* |--------------------------------------|
* m_size | 3 |
* |--------------------------------------|
* | x |
* |--------------------------------------|
* | x |
* |--------------------------------------|
* | x |
* |--------------------------------------|
* | x |
* |--------------------------------------|
* | x |
* |--------------------------------------|
* | x |
* |--------------------------------------|
* m_allocated | x |
* ----------------------------------------
*
*/
namespace etk
{
template<typename MY_TYPE=int32_t> class VectorType
{
public:
class Iterator
{
// Private data :
private:
int32_t m_current; //!< curent Id on the vector
VectorType<MY_TYPE> * m_VectorType; //!< Pointer on the curent element of the vectorBin
public:
/**
* @brief Basic itarator constructor with no link with an etkVector
*/
Iterator():
m_current(-1),
m_VectorType(NULL)
{
// nothing to do ...
}
/**
* @brief Recopy constructor on a specific etkVector.
* @param[in] otherIterator The Iterator that might be copy
*/
Iterator(const Iterator & otherIterator):
m_current(otherIterator.m_current),
m_VectorType(otherIterator.m_VectorType)
{
// nothing to do ...
}
/**
* @brief Asignation operator.
* @param[in] otherIterator The Iterator that might be copy
* @return reference on the curent Iterator
*/
Iterator& operator=(const Iterator & otherIterator)
{
m_current = otherIterator.m_current;
m_VectorType = otherIterator.m_VectorType;
return *this;
}
/**
* @brief Basic destructor
*/
~Iterator()
{
m_current = -1;
m_VectorType = NULL;
}
/**
* @brief basic boolean cast
* @return true if the element is present in the etkVector size
*/
operator bool ()
{
if( 0 <= m_current
&& m_current < m_VectorType->Size() )
{
return true;
} else {
return false;
}
}
/**
* @brief Incremental operator
* @return Reference on the current iterator incremented
*/
Iterator& operator++ ()
{
if( NULL != m_VectorType
&& m_current < m_VectorType->Size() )
{
m_current++;
}
return *this;
}
/**
* @brief Decremental operator
* @return Reference on the current iterator decremented
*/
Iterator& operator-- ()
{
if (m_current >= 0) {
m_current--;
}
return *this;
}
/**
* @brief Incremental operator
* @return Reference on a new iterator and increment the other one
*/
Iterator operator++ (int32_t)
{
Iterator it(*this);
++(*this);
return it;
}
/**
* @brief Decremental operator
* @return Reference on a new iterator and decrement the other one
*/
Iterator operator-- (int32_t)
{
Iterator it(*this);
--(*this);
return it;
}
/**
* @brief Get reference on the current Element
* @return the reference on the current Element
*/
MY_TYPE & operator-> () const
{
TK_CHECK_INOUT(m_current >= 0 && m_current < m_VectorType->Size());
return &m_VectorType->Get(m_current);
}
/**
* @brief Get reference on the current Element
* @return the reference on the current Element
*/
MY_TYPE & operator* () const
{
TK_CHECK_INOUT(m_current >= 0 && m_current < m_VectorType->Size());
return m_VectorType->Get(m_current);
}
private:
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
Iterator(VectorType<MY_TYPE> * Evb, int32_t pos):
m_current(pos),
m_VectorType(Evb)
{
// nothing to do ...
}
friend class VectorType;
};
private:
MY_TYPE * m_data; //!< pointer on the curetn table of Data
int32_t m_size; //!< nb Element in the buffer
int32_t m_allocated; //!< Current allocated size
int32_t m_increment; //!< methode of increment
public:
/**
* @brief Create an empty vector
* @param[in] count Minimum request size of the Buffer
*/
VectorType(int32_t count = 0):
m_data(NULL),
m_size(0),
m_allocated(0),
m_increment(1)
{
ChangeAllocation(count);
}
/**
* @brief Re-copy constructor (copy all needed data)
* @param[in] Evb Vector that might be copy
*/
VectorType(const etk::VectorType<MY_TYPE> & Evb)
{
m_allocated = Evb.m_allocated;
m_size = Evb.m_size;
m_increment = Evb.m_increment;
m_data = NULL;
//TK_DEBUG("USE Specific vector allocator ... Evb.m_size=" << Evb.m_size << " Evb.m_increment=" << Evb.m_increment);
// allocate all same data
ETK_MALLOC(m_data, m_allocated, MY_TYPE);
TK_ASSERT(NULL!=m_data, "Error in data allocation");
// Copy all data ...
memcpy(m_data, Evb.m_data, m_allocated * sizeof(MY_TYPE) );
}
/**
* @brief Destructor of the current Class
*/
~VectorType()
{
if (NULL!=m_data) {
ETK_FREE(m_data);
m_data = NULL;
}
m_allocated = 0;
m_size = 0;
m_increment = 0;
}
/**
* @brief Re-copy operator
* @param[in] Evb Vector that might be copy
* @return reference on the curent re-copy vector
*/
VectorType& operator=(const etk::VectorType<MY_TYPE> & Evb)
{
//TK_DEBUG("USE RECOPY vector ... Evb.m_size=" << Evb.m_size << " Evb.m_increment=" << Evb.m_increment);
if( this != &Evb ) // avoid copy to itself
{
if (NULL!=m_data) {
ETK_FREE(m_data);
m_data = NULL;
}
// Set the new value
m_allocated = Evb.m_allocated;
m_size = Evb.m_size;
m_increment = Evb.m_increment;
// allocate all same data
ETK_MALLOC(m_data, m_allocated, MY_TYPE);
TK_ASSERT(NULL!=m_data, "Error in data allocation");
// Copy all data ...
memcpy(m_data, Evb.m_data, m_allocated * sizeof(MY_TYPE) );
}
// Return the curent pointer
return *this;
}
/**
* @brief Add at the Last position of the Vector
* @param[in] item Element to add at the end of vector
*/
VectorType& operator+= (const etk::VectorType<MY_TYPE> & Evb) // += operator
{
int32_t nbElememt = Evb.Size();
int32_t idx = m_size;
Resize(m_size+nbElememt);
memcpy(&m_data[idx], &Evb.m_data[0], nbElememt*sizeof(MY_TYPE) );
// Return the curent pointer
return *this;
}
/**
* @brief Set increment mode of this vector (default it match corectly with the number of element inside)
* @param[in] newIncrementNumber methode requested
*/
void SetIncrement(int32_t newIncrementNumber)
{
m_increment = newIncrementNumber;
}
/**
* @brief Get the number of element in the vector
* @return The number requested
*/
int32_t Size() const
{
return m_size;
}
/**
* @brief Get the Allocated size in the vector
* @return The size of allocation
*/
int32_t AllocatedSize() const
{
return m_allocated;
}
/**
* @brief Get a current element in the vector
* @param[in] pos Desired position read
* @return Reference on the Element
*/
MY_TYPE& Get(int32_t pos)
{
return m_data[pos];
}
/**
* @brief Get an copy Element an a special position
* @param[in] pos Position in the vector that might be get [0..Size()]
* @return An reference on the copy of selected element
*/
MY_TYPE& operator[] (int32_t pos)
{
return Get(pos);
}
/**
* @brief Get an Element an a special position
* @param[in] pos Position in the vector that might be get [0..Size()]
* @return An reference on the selected element
*/
const MY_TYPE& operator[] (int32_t pos) const
{
return m_data[pos];
}
/**
* @brief Add at the Last position of the Vector
* @param[in] item Element to add at the end of vector
*/
void PushBack(const MY_TYPE& item)
{
int32_t idx = m_size;
Resize(m_size+1);
m_data[idx] = item;
}
/**
* @brief Add at the Last position of the Vector
* @param[in] item Element to add at the end of vector
*/
void PushBack(const MY_TYPE * item, int32_t nbElement)
{
if (NULL == item) {
return;
}
int32_t idx = m_size;
Resize(m_size+nbElement);
memcpy(&m_data[idx], item, nbElement*sizeof(MY_TYPE) );
}
/**
* @brief Remove the last element of the vector
*/
void PopBack(void)
{
if(m_size>0) {
Resize(m_size-1);
}
}
/**
* @brief Remove all alement in the current vector
*/
void Clear(void)
{
if(m_size>0) {
Resize(0);
}
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
void Insert(int32_t pos, const MY_TYPE& item)
{
if (pos>m_size) {
TK_ERROR(" can not insert Element at this position : " << pos << " > " << m_size<< " add it at the end ... ");
PushBack(item);
return;
}
int32_t tmpSize = m_size;
// Request resize of the current buffer
Resize(m_size+1);
// move curent data
int32_t sizeToMove = (tmpSize - pos)*sizeof(MY_TYPE);
if ( 0 < sizeToMove) {
memmove((m_data + pos + 1), (m_data + pos), sizeToMove );
}
// affectation of the current element
m_data[pos] = item;
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
void Insert(int32_t pos, const MY_TYPE * item, int32_t nbElement)
{
if (pos>m_size) {
TK_WARNING(" can not insert Element at this position : " << pos << " > " << m_size << " add it at the end ... ");
PushBack(item, nbElement);
return;
}
int32_t tmpSize = m_size;
// Request resize of the current buffer
Resize(m_size+nbElement);
// move curent data (after the position)
int32_t sizeToMove = (tmpSize - pos)*sizeof(MY_TYPE);
if ( 0 < sizeToMove) {
memmove((m_data + pos + nbElement), (m_data + pos), sizeToMove );
}
// affectation of all input element
memcpy(&m_data[pos], item, nbElement*sizeof(MY_TYPE) );
}
/**
* @brief Remove one element
*
* @param[in] pos Position to remove the data
*
* @return ---
*
*/
void Erase(int32_t pos)
{
if (pos<0 || (uint32_t)pos>m_size) {
TK_ERROR(" can not Erase Element at this position : " << pos << " > " << m_size);
return;
}
int32_t tmpSize = m_size;
int32_t sizeToMove = (tmpSize - (pos+1))*sizeof(MY_TYPE);
if ( 0 < sizeToMove) {
// move curent data
memmove((m_data + pos), (m_data + pos + 1), sizeToMove );
}
// Request resize of the current buffer
Resize(m_size-1);
}
/**
* @brief Remove N elements
*
* @param[in] pos Position to remove the data
* @param[in] posEnd Last position number
*
* @return ---
*
*/
void Erase(int32_t pos, int32_t posEnd)
{
if (pos>m_size) {
TK_ERROR(" can not Erase Element at this position : " << pos << " > " << m_size);
return;
}
if (posEnd>m_size) {
posEnd = m_size;
}
int32_t nbElement = m_size - pos;
int32_t tmpSize = m_size;
// move curent data
int32_t sizeToMove = (tmpSize - (pos+nbElement))*sizeof(MY_TYPE);
if ( 0 < sizeToMove) {
memmove((m_data + pos), (m_data + pos + nbElement), sizeToMove );
}
// Request resize of the current buffer
Resize(m_size-nbElement);
}
/**
* @brief Remove N element
*
* @param[in] pos Position to remove the data
* @param[in] nbElement number of element to remove
*
* @return ---
*
*/
void EraseLen(int32_t pos, int32_t nbElement)
{
if (pos>m_size) {
TK_ERROR(" can not Erase Len Element at this position : " << pos << " > " << m_size);
return;
}
if (pos+nbElement>m_size) {
nbElement = m_size - pos;
}
int32_t tmpSize = m_size;
// move curent data
int32_t sizeToMove = (tmpSize - (pos+nbElement))*sizeof(MY_TYPE);
if ( 0 < sizeToMove) {
memmove((m_data + pos), (m_data + pos + nbElement), sizeToMove );
}
// Request resize of the current buffer
Resize(m_size-nbElement);
}
/**
* @brief extract data between two point :
* @param[in] posStart start position to extract data
* @param[in] posEnd End position to extract data
* @return the extracted vector
*/
VectorType Extract(int32_t posStart = 0, int32_t posEnd=0x7FFFFFFF)
{
VectorType<MY_TYPE> out;
if (posStart < 0) {
posStart = 0;
} else if (posStart >= Size() ) {
return out;
}
if (posEnd < 0) {
return out;
} else if (posEnd >= Size() ) {
posEnd = Size();
}
out.PushBack(&m_data[posStart], posEnd-posStart);
return out;
}
/**
* @brief Set the minimum allocation in memory for the curent vector ==> reallocate the
* buffer to fit exactly the mumber of element needed
*/
void Fit(void)
{
if (m_size > m_allocated) {
// Reallocate the curent data to the correct size ...
ETK_REALLOC(m_data, m_size, MY_TYPE);
}
// Check result with assert :
TK_ASSERT(NULL!=m_data, "Error in data Fitting");
m_allocated = m_size;
}
/**
* @brief Get an iterator an an specific position
* @param[in] pos Requested position of the iterator in the vector
* @return The Iterator
*/
Iterator Position(int32_t pos)
{
return Iterator(this, pos);
}
/**
* @brief Get an Iterator on the start position of the Vector
* @return The Iterator
*/
Iterator Begin(void)
{
return Position(0);
}
/**
* @brief Get an Iterator on the end position of the Vector
* @return The Iterator
*/
Iterator End(void)
{
return Position( Size()-1 );
}
private:
/**
* @brief Change the current size of the vector
* @param[in] newSize New requested size of element in the vector
*/
void Resize(int32_t newSize)
{
// Reallocate memory
if (newSize > m_allocated) {
ChangeAllocation(newSize);
}
m_size = newSize;
}
/**
* @brief Change the current allocation to the corect one (depend on the current size)
* @param[in] newSize Minimum number of element needed
*/
void ChangeAllocation(int32_t newSize)
{
// set the minimal size to 1
if(newSize <= 0) {
newSize = 1;
}
int32_t requestSize = m_allocated;
// set the size with the corect chose type :
if (newSize == m_allocated) {
return;
} else if (newSize < requestSize) {
// down the size of the vector:
if (0==m_increment) {
// never down size...
} else {
int32_t devide = m_increment;
if (devide == 0) {
devide = 1;
}
int32_t numberOfStep = m_allocated / devide;
if (newSize< ((numberOfStep-2)*devide + devide/2) ) {
//Allow Reallocation of a new size shorter
requestSize = ((newSize / devide)+1) * devide;
}
}
} else {
while(newSize > requestSize) {
if (0 == requestSize) {
requestSize = 1;
} else if (0==m_increment) {
requestSize = requestSize * 2;
} else {
requestSize = (requestSize + m_increment);
}
}
}
// No reallocation needed :
if (requestSize == m_allocated) {
return;
}
// check if something is allocated :
if (NULL == m_data) {
// no data allocated ==> request an allocation (might be the first)
ETK_MALLOC(m_data, requestSize, MY_TYPE);
} else {
// move datas
ETK_REALLOC(m_data, requestSize, MY_TYPE);
}
// Check result with assert :
TK_ASSERT(NULL!=m_data, "Error in data allocation");
// set the new allocation size
m_allocated = requestSize;
}
};
}
#undef __class__
#define __class__ NULL
#endif

View File

@ -39,9 +39,9 @@ int32_t etk::tool::irand(int32_t a, int32_t b)
} }
void etk::tool::SortList(etk::VectorType<etk::UString *> &m_listDirectory) void etk::tool::SortList(etk::Vector<etk::UString *> &m_listDirectory)
{ {
etk::VectorType<etk::UString *> tmpList = m_listDirectory; etk::Vector<etk::UString *> tmpList = m_listDirectory;
m_listDirectory.Clear(); m_listDirectory.Clear();
for(int32_t iii=0; iii<tmpList.Size(); iii++) { for(int32_t iii=0; iii<tmpList.Size(); iii++) {
@ -56,3 +56,29 @@ void etk::tool::SortList(etk::VectorType<etk::UString *> &m_listDirectory)
m_listDirectory.Insert(findPos, tmpList[iii]); m_listDirectory.Insert(findPos, tmpList[iii]);
} }
} }
bool etk::tool::strnCmpNoCase(const char * input1, const char * input2, int32_t maxLen)
{
int32_t iii=0;
while ('\0' != *input1 && '\0' != *input2 && iii < maxLen) {
char in1 = *input1;
char in2 = *input2;
if (in1 != in2) {
if (in1 <= 'Z' && in1 >= 'A') {
in1 = in1 - 'A' + 'a';
}
if (in2 <= 'Z' && in2 >= 'A') {
in2 = in2 - 'A' + 'a';
}
if (in1 != in2) {
return false;
}
}
iii++;
input1++;
input2++;
}
return true;
}

View File

@ -32,7 +32,8 @@ namespace etk {
namespace tool { namespace tool {
float frand(float a, float b); float frand(float a, float b);
int32_t irand(int32_t a, int32_t b); int32_t irand(int32_t a, int32_t b);
void SortList(etk::VectorType<etk::UString *> &m_listDirectory); void SortList(etk::Vector<etk::UString *> &m_listDirectory);
bool strnCmpNoCase(const char * input1, const char * input2, int32_t maxLen);
}; };
}; };

View File

@ -99,7 +99,7 @@ void unicode::convertUnicodeToIso(charset_te inputCharset, uniChar_t input_Unico
} }
int32_t unicode::convertIsoToUnicode(charset_te inputCharset, etk::VectorType<char>& input_ISO, etk::VectorType<uniChar_t>& output_Unicode) int32_t unicode::convertIsoToUnicode(charset_te inputCharset, etk::Vector<char>& input_ISO, etk::Vector<uniChar_t>& output_Unicode)
{ {
output_Unicode.Clear(); output_Unicode.Clear();
uniChar_t output; uniChar_t output;
@ -115,7 +115,7 @@ int32_t unicode::convertIsoToUnicode(charset_te inputCharset, etk::VectorType<ch
return output_Unicode.Size(); return output_Unicode.Size();
} }
int32_t unicode::convertIsoToUnicode(charset_te inputCharset, etk::VectorType<int8_t>& input_ISO, etk::VectorType<uniChar_t>& output_Unicode) int32_t unicode::convertIsoToUnicode(charset_te inputCharset, etk::Vector<int8_t>& input_ISO, etk::Vector<uniChar_t>& output_Unicode)
{ {
output_Unicode.Clear(); output_Unicode.Clear();
uniChar_t output; uniChar_t output;
@ -132,7 +132,7 @@ int32_t unicode::convertIsoToUnicode(charset_te inputCharset, etk::VectorType<in
} }
int32_t unicode::convertUnicodeToIso(charset_te inputCharset, etk::VectorType<uniChar_t>& input_Unicode, etk::VectorType<char>& output_ISO) int32_t unicode::convertUnicodeToIso(charset_te inputCharset, etk::Vector<uniChar_t>& input_Unicode, etk::Vector<char>& output_ISO)
{ {
output_ISO.Clear(); output_ISO.Clear();
char output[10]; char output[10];
@ -148,7 +148,7 @@ int32_t unicode::convertUnicodeToIso(charset_te inputCharset, etk::VectorType<un
return output_ISO.Size(); return output_ISO.Size();
} }
int32_t unicode::convertUnicodeToIso(charset_te inputCharset, etk::VectorType<uniChar_t>& input_Unicode, etk::VectorType<int8_t>& output_ISO) int32_t unicode::convertUnicodeToIso(charset_te inputCharset, etk::Vector<uniChar_t>& input_Unicode, etk::Vector<int8_t>& output_ISO)
{ {
output_ISO.Clear(); output_ISO.Clear();
char output[10]; char output[10];
@ -254,7 +254,7 @@ void unicode::convertUtf8ToUnicode(char * input_UTF8, uniChar_t &output_Unicode)
} }
int32_t unicode::convertUnicodeToUtf8(const etk::VectorType<uniChar_t>& input_Unicode, etk::VectorType<char>& output_UTF8) int32_t unicode::convertUnicodeToUtf8(const etk::Vector<uniChar_t>& input_Unicode, etk::Vector<char>& output_UTF8)
{ {
char output[10]; char output[10];
@ -270,7 +270,7 @@ int32_t unicode::convertUnicodeToUtf8(const etk::VectorType<uniChar_t>& input_Un
return output_UTF8.Size()-1; return output_UTF8.Size()-1;
} }
int32_t unicode::convertUnicodeToUtf8(const etk::VectorType<uniChar_t>& input_Unicode, etk::VectorType<int8_t>& output_UTF8) int32_t unicode::convertUnicodeToUtf8(const etk::Vector<uniChar_t>& input_Unicode, etk::Vector<int8_t>& output_UTF8)
{ {
char output[10]; char output[10];
@ -287,7 +287,7 @@ int32_t unicode::convertUnicodeToUtf8(const etk::VectorType<uniChar_t>& input_Un
} }
int32_t unicode::convertUtf8ToUnicode(etk::VectorType<char>& input_UTF8, etk::VectorType<uniChar_t>& output_Unicode) int32_t unicode::convertUtf8ToUnicode(etk::Vector<char>& input_UTF8, etk::Vector<uniChar_t>& output_Unicode)
{ {
char tmpData[20]; char tmpData[20];
int32_t pos = 0; int32_t pos = 0;
@ -338,7 +338,7 @@ int32_t unicode::convertUtf8ToUnicode(etk::VectorType<char>& input_UTF8, etk::Ve
return 0; return 0;
} }
int32_t unicode::convertUtf8ToUnicode(etk::VectorType<int8_t>& input_UTF8, etk::VectorType<uniChar_t>& output_Unicode) int32_t unicode::convertUtf8ToUnicode(etk::Vector<int8_t>& input_UTF8, etk::Vector<uniChar_t>& output_Unicode)
{ {
char tmpData[20]; char tmpData[20];
int32_t pos = 0; int32_t pos = 0;
@ -389,7 +389,7 @@ int32_t unicode::convertUtf8ToUnicode(etk::VectorType<int8_t>& input_UTF8, etk::
return 0; return 0;
} }
int32_t unicode::convertUtf8ToUnicode(char * input_UTF8, etk::VectorType<uniChar_t>& output_Unicode) int32_t unicode::convertUtf8ToUnicode(char * input_UTF8, etk::Vector<uniChar_t>& output_Unicode)
{ {
char tmpData[20]; char tmpData[20];
int32_t pos = 0; int32_t pos = 0;
@ -466,14 +466,14 @@ void unicode::convertUtf8ToIso(charset_te inputCharset, char * input_UTF8, char
} }
int32_t unicode::convertIsoToUtf8(charset_te inputCharset, etk::VectorType<char>& input_ISO, etk::VectorType<char>& output_UTF8) int32_t unicode::convertIsoToUtf8(charset_te inputCharset, etk::Vector<char>& input_ISO, etk::Vector<char>& output_UTF8)
{ {
TK_WARNING("TODO : not coded..."); TK_WARNING("TODO : not coded...");
return 0; return 0;
} }
int32_t unicode::convertUtf8ToIso(charset_te inputCharset, etk::VectorType<char>& input_UTF8, etk::VectorType<char>& output_ISO) int32_t unicode::convertUtf8ToIso(charset_te inputCharset, etk::Vector<char>& input_UTF8, etk::Vector<char>& output_ISO)
{ {
TK_WARNING("TODO : not coded..."); TK_WARNING("TODO : not coded...");
return 0; return 0;

View File

@ -26,7 +26,7 @@
#define __UNICODE_H__ #define __UNICODE_H__
#include <etk/Types.h> #include <etk/Types.h>
#include <etk/VectorType.h> #include <etk/Vector.h>
namespace unicode { namespace unicode {
typedef enum { typedef enum {
EDN_CHARSET_UTF8, EDN_CHARSET_UTF8,
@ -47,25 +47,25 @@ namespace unicode {
} charset_te; } charset_te;
// transform ISO <==> Unicode // transform ISO <==> Unicode
void convertIsoToUnicode(charset_te inputCharset, char input_ISO, uniChar_t & output_Unicode); void convertIsoToUnicode(charset_te inputCharset, char input_ISO, uniChar_t & output_Unicode);
void convertUnicodeToIso(charset_te inputCharset, uniChar_t input_Unicode, char & output_ISO); void convertUnicodeToIso(charset_te inputCharset, uniChar_t input_Unicode, char & output_ISO);
int32_t convertIsoToUnicode(charset_te inputCharset, etk::VectorType<char>& input_ISO, etk::VectorType<uniChar_t>& output_Unicode); int32_t convertIsoToUnicode(charset_te inputCharset, etk::Vector<char>& input_ISO, etk::Vector<uniChar_t>& output_Unicode);
int32_t convertIsoToUnicode(charset_te inputCharset, etk::VectorType<int8_t>& input_ISO, etk::VectorType<uniChar_t>& output_Unicode); int32_t convertIsoToUnicode(charset_te inputCharset, etk::Vector<int8_t>& input_ISO, etk::Vector<uniChar_t>& output_Unicode);
int32_t convertUnicodeToIso(charset_te inputCharset, etk::VectorType<uniChar_t>& input_Unicode, etk::VectorType<char>& output_ISO); int32_t convertUnicodeToIso(charset_te inputCharset, etk::Vector<uniChar_t>& input_Unicode, etk::Vector<char>& output_ISO);
int32_t convertUnicodeToIso(charset_te inputCharset, etk::VectorType<uniChar_t>& input_Unicode, etk::VectorType<int8_t>& output_ISO); int32_t convertUnicodeToIso(charset_te inputCharset, etk::Vector<uniChar_t>& input_Unicode, etk::Vector<int8_t>& output_ISO);
// Transform UTF-8 <==> Unicode // Transform UTF-8 <==> Unicode
void convertUnicodeToUtf8( uniChar_t input_Unicode, char * output_UTF8); void convertUnicodeToUtf8( uniChar_t input_Unicode, char * output_UTF8);
void convertUtf8ToUnicode( char * input_UTF8, uniChar_t& output_Unicode); void convertUtf8ToUnicode( char * input_UTF8, uniChar_t& output_Unicode);
int32_t convertUnicodeToUtf8( const etk::VectorType<uniChar_t>& input_Unicode, etk::VectorType<char>& output_UTF8); int32_t convertUnicodeToUtf8( const etk::Vector<uniChar_t>& input_Unicode, etk::Vector<char>& output_UTF8);
int32_t convertUnicodeToUtf8( const etk::VectorType<uniChar_t>& input_Unicode, etk::VectorType<int8_t>& output_UTF8); int32_t convertUnicodeToUtf8( const etk::Vector<uniChar_t>& input_Unicode, etk::Vector<int8_t>& output_UTF8);
int32_t convertUtf8ToUnicode( etk::VectorType<char>& input_UTF8, etk::VectorType<uniChar_t>& output_Unicode); int32_t convertUtf8ToUnicode( etk::Vector<char>& input_UTF8, etk::Vector<uniChar_t>& output_Unicode);
int32_t convertUtf8ToUnicode( etk::VectorType<int8_t>& input_UTF8, etk::VectorType<uniChar_t>& output_Unicode); int32_t convertUtf8ToUnicode( etk::Vector<int8_t>& input_UTF8, etk::Vector<uniChar_t>& output_Unicode);
int32_t convertUtf8ToUnicode( char * input_UTF8, etk::VectorType<uniChar_t>& output_Unicode); int32_t convertUtf8ToUnicode( char * input_UTF8, etk::Vector<uniChar_t>& output_Unicode);
// Transform ISO <==> UTF-8 // Transform ISO <==> UTF-8
void convertIsoToUtf8( charset_te inputCharset, char input_ISO, char * output_UTF8); void convertIsoToUtf8( charset_te inputCharset, char input_ISO, char * output_UTF8);
void convertUtf8ToIso( charset_te inputCharset, char * input_UTF8, char & output_ISO); void convertUtf8ToIso( charset_te inputCharset, char * input_UTF8, char & output_ISO);
int32_t convertIsoToUtf8( charset_te inputCharset, etk::VectorType<char>& input_ISO, etk::VectorType<char>& output_UTF8); int32_t convertIsoToUtf8( charset_te inputCharset, etk::Vector<char>& input_ISO, etk::Vector<char>& output_UTF8);
int32_t convertUtf8ToIso( charset_te inputCharset, etk::VectorType<char>& input_UTF8, etk::VectorType<char>& output_ISO); int32_t convertUtf8ToIso( charset_te inputCharset, etk::Vector<char>& input_UTF8, etk::Vector<char>& output_ISO);
void Utf8_SizeElement(const char * data, int32_t lenMax , uint8_t &size, bool &baseValid); void Utf8_SizeElement(const char * data, int32_t lenMax , uint8_t &size, bool &baseValid);
int32_t strUtf8Len(const char *input_UTF8); int32_t strUtf8Len(const char *input_UTF8);

View File

@ -311,9 +311,9 @@ class RequestPlay {
} }
}; };
#include <etk/VectorType.h> #include <etk/Vector.h>
etk::VectorType<EffectsLoaded*> ListEffects; etk::Vector<EffectsLoaded*> ListEffects;
etk::VectorType<RequestPlay*> ListEffectsPlaying; etk::Vector<RequestPlay*> ListEffectsPlaying;
int32_t ewol::audio::effects::Add(etk::UString file) int32_t ewol::audio::effects::Add(etk::UString file)

View File

@ -38,7 +38,7 @@ extern "C" {
}; };
// internal element of the widget manager : // internal element of the widget manager :
static etk::VectorType<messageList_ts> m_messageList; // all widget allocated ==> all time increment ... never removed ... static etk::Vector<messageList_ts> m_messageList; // all widget allocated ==> all time increment ... never removed ...
void ewol::EObjectMessageMultiCast::Init(void) void ewol::EObjectMessageMultiCast::Init(void)

View File

@ -27,7 +27,7 @@
#include <etk/Types.h> #include <etk/Types.h>
#include <etk/UString.h> #include <etk/UString.h>
#include <etk/VectorType.h> #include <etk/Vector.h>
namespace ewol { namespace ewol {
namespace EObjectMessageMultiCast { namespace EObjectMessageMultiCast {
@ -55,8 +55,8 @@ namespace ewol {
class EObject { class EObject {
private: private:
int32_t m_uniqueId; //!< Object UniqueID ==> TODO : Check if it use is needed int32_t m_uniqueId; //!< Object UniqueID ==> TODO : Check if it use is needed
etk::VectorType<EventExtGen*> m_externEvent; //!< Generic list of event generation for output link etk::Vector<EventExtGen*> m_externEvent; //!< Generic list of event generation for output link
etk::VectorType<const char*> m_availlableEventId; //!< List of all event availlable for this widget etk::Vector<const char*> m_availlableEventId; //!< List of all event availlable for this widget
public: public:
/** /**
* @brief Constructor * @brief Constructor

View File

@ -31,8 +31,8 @@
static bool IsInit = false; static bool IsInit = false;
// internal element of the widget manager : // internal element of the widget manager :
static etk::VectorType<ewol::EObject*> m_eObjectList; // all widget allocated ==> all time increment ... never removed ... static etk::Vector<ewol::EObject*> m_eObjectList; // all widget allocated ==> all time increment ... never removed ...
static etk::VectorType<ewol::EObject*> m_eObjectAutoRemoveList; // all widget allocated static etk::Vector<ewol::EObject*> m_eObjectAutoRemoveList; // all widget allocated
void ewol::EObjectManager::Init(void) void ewol::EObjectManager::Init(void)

View File

@ -57,27 +57,27 @@ namespace ewol
clipping_ts & drawClipping, clipping_ts & drawClipping,
const etk::UString & unicodeString, const etk::UString & unicodeString,
int32_t & fontTextureId, int32_t & fontTextureId,
etk::VectorType<Vector2D<float> > & coord, etk::Vector<Vector2D<float> > & coord,
etk::VectorType<texCoord_ts> & coordTex); etk::Vector<texCoord_ts> & coordTex);
int32_t DrawText(int32_t fontID, int32_t DrawText(int32_t fontID,
Vector2D<float> textPos, Vector2D<float> textPos,
clipping_ts & drawClipping, clipping_ts & drawClipping,
const uniChar_t unicodeChar, const uniChar_t unicodeChar,
int32_t & fontTextureId, int32_t & fontTextureId,
etk::VectorType<Vector2D<float> > & coord, etk::Vector<Vector2D<float> > & coord,
etk::VectorType<texCoord_ts> & coordTex); etk::Vector<texCoord_ts> & coordTex);
int32_t DrawText(int32_t fontID, int32_t DrawText(int32_t fontID,
Vector2D<float> textPos, Vector2D<float> textPos,
const etk::UString & unicodeString, const etk::UString & unicodeString,
int32_t & fontTextureId, int32_t & fontTextureId,
etk::VectorType<Vector2D<float> > & coord, etk::Vector<Vector2D<float> > & coord,
etk::VectorType<texCoord_ts> & coordTex); etk::Vector<texCoord_ts> & coordTex);
int32_t DrawText(int32_t fontID, int32_t DrawText(int32_t fontID,
Vector2D<float> textPos, Vector2D<float> textPos,
const uniChar_t unicodeChar, const uniChar_t unicodeChar,
int32_t & fontTextureId, int32_t & fontTextureId,
etk::VectorType<Vector2D<float> > & coord, etk::Vector<Vector2D<float> > & coord,
etk::VectorType<texCoord_ts> & coordTex); etk::Vector<texCoord_ts> & coordTex);
int32_t LoadFont(etk::File fontFileName); int32_t LoadFont(etk::File fontFileName);
}; };

View File

@ -25,7 +25,7 @@
#include <ewol/Font.h> #include <ewol/Font.h>
#include <ewol/Texture.h> #include <ewol/Texture.h>
#include <etk/unicode.h> #include <etk/unicode.h>
#include <etk/VectorType.h> #include <etk/Vector.h>
#include <ewol/importgl.h> #include <ewol/importgl.h>
extern "C" { extern "C" {
@ -220,7 +220,7 @@ class FTFontInternal
} }
public: public:
etk::UString GetFontName(void) {return m_fontName;}; etk::UString GetFontName(void) {return m_fontName;};
bool GenerateBitmapFont(int32_t size, int32_t &height, int32_t & textureId, etk::VectorType<freeTypeFontElement_ts> & listElement) bool GenerateBitmapFont(int32_t size, int32_t &height, int32_t & textureId, etk::Vector<freeTypeFontElement_ts> & listElement)
{ {
// 300dpi (hight quality) 96 dpi (normal quality) // 300dpi (hight quality) 96 dpi (normal quality)
int32_t fontQuality = 96; int32_t fontQuality = 96;
@ -378,7 +378,7 @@ class FTFontInternal
FT_Face m_fftFace; FT_Face m_fftFace;
}; };
static etk::VectorType<FTFontInternal*> m_listLoadedTTFont; static etk::Vector<FTFontInternal*> m_listLoadedTTFont;
static etk::UString s_currentFolderName = ""; static etk::UString s_currentFolderName = "";
@ -436,7 +436,7 @@ class FTFont{
return false; return false;
}; };
etk::VectorType<freeTypeFontElement_ts> & GetRefOnElement(void) etk::Vector<freeTypeFontElement_ts> & GetRefOnElement(void)
{ {
return m_elements; return m_elements;
}; };
@ -462,10 +462,10 @@ class FTFont{
int32_t m_size; // nb pixel height int32_t m_size; // nb pixel height
int32_t m_lineHeight; // nb pixel height int32_t m_lineHeight; // nb pixel height
int32_t m_interline; // nb pixel between 2 lines int32_t m_interline; // nb pixel between 2 lines
etk::VectorType<freeTypeFontElement_ts> m_elements; // etk::Vector<freeTypeFontElement_ts> m_elements; //
}; };
static etk::VectorType<FTFont*> m_listLoadedFont; static etk::Vector<FTFont*> m_listLoadedFont;
#undef __class__ #undef __class__
#define __class__ "ewol::FontFreeType" #define __class__ "ewol::FontFreeType"
@ -579,14 +579,14 @@ int32_t ewol::DrawText(int32_t fontID,
clipping_ts & drawClipping, clipping_ts & drawClipping,
const etk::UString& unicodeString, const etk::UString& unicodeString,
int32_t & fontTextureId, int32_t & fontTextureId,
etk::VectorType<Vector2D<float> > & coord, etk::Vector<Vector2D<float> > & coord,
etk::VectorType<texCoord_ts> & coordTex) etk::Vector<texCoord_ts> & coordTex)
{ {
if(fontID>=m_listLoadedFont.Size() || fontID < 0) { if(fontID>=m_listLoadedFont.Size() || fontID < 0) {
EWOL_WARNING("try to display text with an fontID that does not existed " << fontID); EWOL_WARNING("try to display text with an fontID that does not existed " << fontID);
return 0; return 0;
} }
etk::VectorType<freeTypeFontElement_ts> & listOfElement = m_listLoadedFont[fontID]->GetRefOnElement(); etk::Vector<freeTypeFontElement_ts> & listOfElement = m_listLoadedFont[fontID]->GetRefOnElement();
fontTextureId = m_listLoadedFont[fontID]->GetOglId(); fontTextureId = m_listLoadedFont[fontID]->GetOglId();
int32_t fontSize = m_listLoadedFont[fontID]->GetSize(); int32_t fontSize = m_listLoadedFont[fontID]->GetSize();
@ -763,15 +763,15 @@ int32_t ewol::DrawText(int32_t fontID,
clipping_ts & drawClipping, clipping_ts & drawClipping,
const uniChar_t unicodeChar, const uniChar_t unicodeChar,
int32_t & fontTextureId, int32_t & fontTextureId,
etk::VectorType<Vector2D<float> > & coord, etk::Vector<Vector2D<float> > & coord,
etk::VectorType<texCoord_ts> & coordTex) etk::Vector<texCoord_ts> & coordTex)
{ {
#if 0 #if 0
if(fontID>=m_listLoadedFont.Size() || fontID < 0) { if(fontID>=m_listLoadedFont.Size() || fontID < 0) {
EWOL_WARNING("try to display text with an fontID that does not existed " << fontID); EWOL_WARNING("try to display text with an fontID that does not existed " << fontID);
return 0; return 0;
} }
etk::VectorType<freeTypeFontElement_ts> & listOfElement = m_listLoadedFont[fontID]->GetRefOnElement(); etk::Vector<freeTypeFontElement_ts> & listOfElement = m_listLoadedFont[fontID]->GetRefOnElement();
fontTextureId = m_listLoadedFont[fontID]->GetOglId(); fontTextureId = m_listLoadedFont[fontID]->GetOglId();
int32_t fontSize = m_listLoadedFont[fontID]->GetSize(); int32_t fontSize = m_listLoadedFont[fontID]->GetSize();
@ -920,14 +920,14 @@ int32_t ewol::DrawText(int32_t fontID,
Vector2D<float> textPos, Vector2D<float> textPos,
const etk::UString& unicodeString, const etk::UString& unicodeString,
int32_t & fontTextureId, int32_t & fontTextureId,
etk::VectorType<Vector2D<float> > & coord, etk::Vector<Vector2D<float> > & coord,
etk::VectorType<texCoord_ts> & coordTex) etk::Vector<texCoord_ts> & coordTex)
{ {
if(fontID>=m_listLoadedFont.Size() || fontID < 0) { if(fontID>=m_listLoadedFont.Size() || fontID < 0) {
EWOL_WARNING("try to display text with an fontID that does not existed " << fontID); EWOL_WARNING("try to display text with an fontID that does not existed " << fontID);
return 0; return 0;
} }
etk::VectorType<freeTypeFontElement_ts> & listOfElement = m_listLoadedFont[fontID]->GetRefOnElement(); etk::Vector<freeTypeFontElement_ts> & listOfElement = m_listLoadedFont[fontID]->GetRefOnElement();
fontTextureId = m_listLoadedFont[fontID]->GetOglId(); fontTextureId = m_listLoadedFont[fontID]->GetOglId();
int32_t fontSize = m_listLoadedFont[fontID]->GetSize(); int32_t fontSize = m_listLoadedFont[fontID]->GetSize();
@ -1056,14 +1056,14 @@ int32_t ewol::DrawText(int32_t fontID,
Vector2D<float> textPos, Vector2D<float> textPos,
const uniChar_t unicodeChar, const uniChar_t unicodeChar,
int32_t & fontTextureId, int32_t & fontTextureId,
etk::VectorType<Vector2D<float> > & coord, etk::Vector<Vector2D<float> > & coord,
etk::VectorType<texCoord_ts> & coordTex) etk::Vector<texCoord_ts> & coordTex)
{ {
if(fontID>=m_listLoadedFont.Size() || fontID < 0) { if(fontID>=m_listLoadedFont.Size() || fontID < 0) {
EWOL_WARNING("try to display text with an fontID that does not existed " << fontID); EWOL_WARNING("try to display text with an fontID that does not existed " << fontID);
return 0; return 0;
} }
etk::VectorType<freeTypeFontElement_ts> & listOfElement = m_listLoadedFont[fontID]->GetRefOnElement(); etk::Vector<freeTypeFontElement_ts> & listOfElement = m_listLoadedFont[fontID]->GetRefOnElement();
fontTextureId = m_listLoadedFont[fontID]->GetOglId(); fontTextureId = m_listLoadedFont[fontID]->GetOglId();
int32_t fontSize = m_listLoadedFont[fontID]->GetSize(); int32_t fontSize = m_listLoadedFont[fontID]->GetSize();
@ -1187,7 +1187,7 @@ int32_t ewol::GetWidth(int32_t fontID, const etk::UString& unicodeString)
EWOL_WARNING("try to display text with an fontID that does not existed " << fontID); EWOL_WARNING("try to display text with an fontID that does not existed " << fontID);
return 0; return 0;
} }
etk::VectorType<freeTypeFontElement_ts> & listOfElement = m_listLoadedFont[fontID]->GetRefOnElement(); etk::Vector<freeTypeFontElement_ts> & listOfElement = m_listLoadedFont[fontID]->GetRefOnElement();
float posDrawX = 0.0; float posDrawX = 0.0;
for(int32_t iii=0; iii<unicodeString.Size(); iii++) { for(int32_t iii=0; iii<unicodeString.Size(); iii++) {

View File

@ -34,7 +34,7 @@
//For every acces : //For every acces :
static ewol::GameElementLua * tmpObj = NULL; static ewol::GameElementLua * tmpObj = NULL;
static etk::VectorType<ewol::Sprite*> * tmpSprite = NULL; static etk::Vector<ewol::Sprite*> * tmpSprite = NULL;
static ewol::SceneElement * tmpScene = NULL; static ewol::SceneElement * tmpScene = NULL;
template <typename T> int index(lua_State* L); template <typename T> int index(lua_State* L);
@ -90,12 +90,12 @@ template <typename T> class LuaValue
lua_pushcfunction(L, newindex<T>); lua_pushcfunction(L, newindex<T>);
lua_setfield(L, -2, "__newindex"); lua_setfield(L, -2, "__newindex");
lua_setmetatable(L, -2); lua_setmetatable(L, -2);
lua_setglobal(L, name.Utf8Data()); lua_setglobal(L, name.c_str());
} }
virtual ~LuaValue(void) virtual ~LuaValue(void)
{ {
lua_pushnil(L); lua_pushnil(L);
lua_setglobal(L, name.Utf8Data()); lua_setglobal(L, name.c_str());
ptr = 0; ptr = 0;
L = 0; L = 0;
} }
@ -399,7 +399,7 @@ LUAMOD_API int lua_ElementAdd(lua_State *L)
int32_t group = luaL_checkint(L, 2); int32_t group = luaL_checkint(L, 2);
// TODO : Remove this when find an other way do do it ... // TODO : Remove this when find an other way do do it ...
ewol::GameElementLua * ttmpObj = tmpObj; ewol::GameElementLua * ttmpObj = tmpObj;
etk::VectorType<ewol::Sprite*> * ttmpSprite = tmpSprite; etk::Vector<ewol::Sprite*> * ttmpSprite = tmpSprite;
ewol::SceneElement * ttmpScene = tmpScene; ewol::SceneElement * ttmpScene = tmpScene;
uint32_t elementId = tmpScene->AddElementNamed(group, elementName); uint32_t elementId = tmpScene->AddElementNamed(group, elementName);
tmpObj = ttmpObj; tmpObj = ttmpObj;
@ -542,7 +542,7 @@ LUAMOD_API int lua_HaveImpact(lua_State *L)
// TODO : Remove this when find an other way do do it ... // TODO : Remove this when find an other way do do it ...
ewol::GameElementLua * ttmpObj = tmpObj; ewol::GameElementLua * ttmpObj = tmpObj;
etk::VectorType<ewol::Sprite*> * ttmpSprite = tmpSprite; etk::Vector<ewol::Sprite*> * ttmpSprite = tmpSprite;
ewol::SceneElement * ttmpScene = tmpScene; ewol::SceneElement * ttmpScene = tmpScene;
bool result = tmpScene->HaveImpact(tmpObj->GroupGet(), tmpObj->TypeGet(), tmpObj->PositionGet(), tmpObj->SizeGet()); bool result = tmpScene->HaveImpact(tmpObj->GroupGet(), tmpObj->TypeGet(), tmpObj->PositionGet(), tmpObj->SizeGet());
@ -566,7 +566,7 @@ LUAMOD_API int lua_Explosion(lua_State *L)
// TODO : Remove this when find an other way do do it ... // TODO : Remove this when find an other way do do it ...
ewol::GameElementLua * ttmpObj = tmpObj; ewol::GameElementLua * ttmpObj = tmpObj;
etk::VectorType<ewol::Sprite*> * ttmpSprite = tmpSprite; etk::Vector<ewol::Sprite*> * ttmpSprite = tmpSprite;
ewol::SceneElement * ttmpScene = tmpScene; ewol::SceneElement * ttmpScene = tmpScene;
tmpScene->Explosion(tmpObj->GroupGet(), tmpObj->TypeGet(), tmpObj->PositionGet(), 0.01, tmpObj->PowerGet()); tmpScene->Explosion(tmpObj->GroupGet(), tmpObj->TypeGet(), tmpObj->PositionGet(), 0.01, tmpObj->PowerGet());
@ -674,7 +674,7 @@ ewol::GameElementLua::GameElementLua(ewol::SceneElement & sceneElement, etk::USt
// close the file: // close the file:
fileElement.fClose(); fileElement.fClose();
if (luaL_loadbuffer(m_luaState, fileBuffer, fileSize, tmpName.Utf8Data())) { if (luaL_loadbuffer(m_luaState, fileBuffer, fileSize, tmpName.c_str())) {
//if (luaL_loadfile(m_luaState, "/home/heero/dev/perso/TethysDefender/assets/elementGame/Cube.lua" ) ) { //if (luaL_loadfile(m_luaState, "/home/heero/dev/perso/TethysDefender/assets/elementGame/Cube.lua" ) ) {
EWOL_ERROR("LUA: " << lua_tostring(m_luaState, -1)); EWOL_ERROR("LUA: " << lua_tostring(m_luaState, -1));
return; return;
@ -899,8 +899,8 @@ void ewol::GameElementLua::Message(etk::UString control, etk::UString message)
if(!lua_isfunction(m_luaState,-1)) { if(!lua_isfunction(m_luaState,-1)) {
lua_pop(m_luaState,1); lua_pop(m_luaState,1);
} else { } else {
lua_pushstring(m_luaState, control.Utf8Data()); lua_pushstring(m_luaState, control.c_str());
lua_pushstring(m_luaState, message.Utf8Data()); lua_pushstring(m_luaState, message.c_str());
// do the call (2 arguments, 0 result) // do the call (2 arguments, 0 result)
if (lua_pcall(m_luaState, 2, 0, 0) != 0) { if (lua_pcall(m_luaState, 2, 0, 0) != 0) {
EWOL_ERROR("LUA: error running function 'Message':" << lua_tostring(m_luaState, -1)); EWOL_ERROR("LUA: error running function 'Message':" << lua_tostring(m_luaState, -1));

View File

@ -54,10 +54,10 @@ namespace ewol {
int32_t numberOfGroup; //!< curent scene number of group int32_t numberOfGroup; //!< curent scene number of group
etk::UString groupDescription[MAX_GROUP_NUMBER]; //!< name of all the groups etk::UString groupDescription[MAX_GROUP_NUMBER]; //!< name of all the groups
int32_t groupEnemy[MAX_GROUP_NUMBER][MAX_GROUP_NUMBER]; //!< list of the ennemy int32_t groupEnemy[MAX_GROUP_NUMBER][MAX_GROUP_NUMBER]; //!< list of the ennemy
etk::VectorType<ewol::Sprite*> animated; //!< element that must be display the second etk::Vector<ewol::Sprite*> animated; //!< element that must be display the second
etk::VectorType<ewol::GameElement*> listAnimatedElements[MAX_GROUP_NUMBER]; //!< generic element to display order in the diffferent group etk::Vector<ewol::GameElement*> listAnimatedElements[MAX_GROUP_NUMBER]; //!< generic element to display order in the diffferent group
etk::VectorType<ewol::GameElement*> listGarbage; //!< garbage of the old element allocated ==> prevent multiple alloc and free etk::Vector<ewol::GameElement*> listGarbage; //!< garbage of the old element allocated ==> prevent multiple alloc and free
etk::VectorType<listRegisteElement*> listCreatorElement; //!< list of all creatable elements etk::Vector<listRegisteElement*> listCreatorElement; //!< list of all creatable elements
int16_t GetUniqueId(void) { int16_t iddd = m_id; m_id++; return iddd; }; int16_t GetUniqueId(void) { int16_t iddd = m_id; m_id++; return iddd; };
void RegisterElementType(etk::UString name, creatorElement_tf * loadElement, etk::UString userString); void RegisterElementType(etk::UString name, creatorElement_tf * loadElement, etk::UString userString);
void RmElement(int32_t group, int32_t idElement); void RmElement(int32_t group, int32_t idElement);

View File

@ -26,10 +26,11 @@
#define __EWOL_O_OBJECT_H__ #define __EWOL_O_OBJECT_H__
#include <etk/Types.h> #include <etk/Types.h>
#include <etk/Color.h>
#include <etk/File.h> #include <etk/File.h>
#include <ewol/Debug.h> #include <ewol/Debug.h>
#include <ewol/Font.h> #include <ewol/Font.h>
#include <etk/VectorType.h> #include <etk/Vector.h>
namespace ewol { namespace ewol {
extern "C" { extern "C" {

View File

@ -80,7 +80,7 @@ void ewol::OObject2DColored::Clear(void)
} }
void generatePolyGone(etk::VectorType<Vector2D<float> > & input, etk::VectorType<Vector2D<float> > & output ) void generatePolyGone(etk::Vector<Vector2D<float> > & input, etk::Vector<Vector2D<float> > & output )
{ {
if (input.Size()<3) { if (input.Size()<3) {
return; return;
@ -94,7 +94,7 @@ void generatePolyGone(etk::VectorType<Vector2D<float> > & input, etk::VectorType
//EWOL_DEBUG("generate Plygone : " << input.Size() << " ==> " << output.Size() ); //EWOL_DEBUG("generate Plygone : " << input.Size() << " ==> " << output.Size() );
} }
void SutherlandHodgman(etk::VectorType<Vector2D<float> > & input, etk::VectorType<Vector2D<float> > & output, float sx, float sy, float ex, float ey) void SutherlandHodgman(etk::Vector<Vector2D<float> > & input, etk::Vector<Vector2D<float> > & output, float sx, float sy, float ex, float ey)
{ {
// with Sutherland-Hodgman-Algorithm // with Sutherland-Hodgman-Algorithm
if (input.Size() <0) { if (input.Size() <0) {
@ -298,7 +298,7 @@ void ewol::OObject2DColored::GenerateTriangle(void)
} }
void ewol::OObject2DColored::SetColor(color_ts color) void ewol::OObject2DColored::SetColor(etk::Color color)
{ {
if (m_triElement < 1) { if (m_triElement < 1) {
m_color[0] = color; m_color[0] = color;
@ -315,22 +315,13 @@ void ewol::OObject2DColored::SetColor(color_ts color)
void ewol::OObject2DColored::SetColor(float red, float green, float blue, float alpha) void ewol::OObject2DColored::SetColor(float red, float green, float blue, float alpha)
{ {
if (m_triElement < 1) { if (m_triElement < 1) {
m_color[0].red = red*255; m_color[0] = etk::Color(red, green, blue, alpha);
m_color[0].green = green*255;
m_color[0].blue = blue*255;
m_color[0].alpha = alpha*255;
} }
if (m_triElement < 2) { if (m_triElement < 2) {
m_color[1].red = red*255; m_color[1] = etk::Color(red, green, blue, alpha);
m_color[1].green = green*255;
m_color[1].blue = blue*255;
m_color[1].alpha = alpha*255;
} }
if (m_triElement < 3) { if (m_triElement < 3) {
m_color[2].red = red*255; m_color[2] = etk::Color(red, green, blue, alpha);
m_color[2].green = green*255;
m_color[2].blue = blue*255;
m_color[2].alpha = alpha*255;
} }
} }

View File

@ -36,18 +36,18 @@ namespace ewol {
public: public:
virtual void Draw(void); virtual void Draw(void);
protected: protected:
etk::VectorType<Vector2D<float> > m_coord; //!< internal coord of the object etk::Vector<Vector2D<float> > m_coord; //!< internal coord of the object
etk::VectorType<color_ts> m_coordColor; //!< internal color of the different point etk::Vector<etk::Color> m_coordColor; //!< internal color of the different point
//etk::VectorType<linkCoord_ts> m_linkCoord; //!< internal link between point to generate triangle //etk::Vector<linkCoord_ts> m_linkCoord; //!< internal link between point to generate triangle
int32_t m_triElement; int32_t m_triElement;
color_ts m_color[3]; etk::Color m_color[3];
Vector2D<float> m_triangle[3]; Vector2D<float> m_triangle[3];
void GenerateTriangle(void); void GenerateTriangle(void);
void ResetCount(void); void ResetCount(void);
public: public:
void Clear(void); void Clear(void);
void SetColor(float red, float green, float blue, float alpha = 1.0); void SetColor(float red, float green, float blue, float alpha = 1.0);
void SetColor(color_ts color); void SetColor(etk::Color color);
void SetPoint(Vector2D<float> point); void SetPoint(Vector2D<float> point);
void SetPoint(float x, float y); void SetPoint(float x, float y);
void Line(float sx, float sy, float ex, float ey, float thickness); void Line(float sx, float sy, float ex, float ey, float thickness);

View File

@ -29,7 +29,7 @@
#undef __class__ #undef __class__
#define __class__ "ewol::OObject2DText" #define __class__ "ewol::OObject2DText"
ewol::OObject2DText::OObject2DText(etk::UString FontName, int32_t size, color_ts textColorFg) ewol::OObject2DText::OObject2DText(etk::UString FontName, int32_t size, etk::Color textColorFg)
{ {
m_textColorFg = textColorFg; m_textColorFg = textColorFg;
if (FontName == "") { if (FontName == "") {
@ -44,10 +44,7 @@ ewol::OObject2DText::OObject2DText(etk::UString FontName, int32_t size, color_ts
// open with default font ... // open with default font ...
ewol::OObject2DText::OObject2DText(void) ewol::OObject2DText::OObject2DText(void)
{ {
m_textColorFg.red = 0; m_textColorFg = 0x000000FF;
m_textColorFg.green = 0;
m_textColorFg.blue = 0;
m_textColorFg.alpha = 0xFF;
m_FontId = GetDefaultFontId(); m_FontId = GetDefaultFontId();
} }

View File

@ -32,7 +32,7 @@ namespace ewol {
class OObject2DText :public ewol::OObject class OObject2DText :public ewol::OObject
{ {
public: public:
OObject2DText(etk::UString FontName, int32_t size, color_ts textColorFg); OObject2DText(etk::UString FontName, int32_t size, etk::Color textColorFg);
OObject2DText(void); OObject2DText(void);
virtual ~OObject2DText(void); virtual ~OObject2DText(void);
public: public:
@ -43,10 +43,10 @@ namespace ewol {
int32_t Text(Vector2D<float> textPos, clipping_ts drawClipping, const uniChar_t unicodeChar); int32_t Text(Vector2D<float> textPos, clipping_ts drawClipping, const uniChar_t unicodeChar);
protected: protected:
int32_t m_FontId; //!< font internal ID int32_t m_FontId; //!< font internal ID
color_ts m_textColorFg; //!< text color ... etk::Color m_textColorFg; //!< text color ...
int32_t m_FontTextureId; //!< font internal Texture ID int32_t m_FontTextureId; //!< font internal Texture ID
etk::VectorType<Vector2D<float> > m_coord; //!< internal coord of the object etk::Vector<Vector2D<float> > m_coord; //!< internal coord of the object
etk::VectorType<texCoord_ts> m_coordTex; //!< internal texture coordinate for every point etk::Vector<texCoord_ts> m_coordTex; //!< internal texture coordinate for every point
}; };
}; };

View File

@ -31,7 +31,7 @@
ewol::OObject2DTextColored::OObject2DTextColored(etk::UString FontName, int32_t size) ewol::OObject2DTextColored::OObject2DTextColored(etk::UString FontName, int32_t size)
{ {
m_color = etk::color::color_Black; m_color = etk::color::black;
if (FontName == "") { if (FontName == "") {
m_FontId = GetDefaultFontId(); m_FontId = GetDefaultFontId();
} else { } else {
@ -48,7 +48,7 @@ ewol::OObject2DTextColored::OObject2DTextColored(etk::UString FontName, int32_t
ewol::OObject2DTextColored::OObject2DTextColored(int32_t fontID) ewol::OObject2DTextColored::OObject2DTextColored(int32_t fontID)
{ {
m_color = etk::color::color_Black; m_color = etk::color::black;
if (fontID < 0) { if (fontID < 0) {
m_FontId = GetDefaultFontId(); m_FontId = GetDefaultFontId();
} else { } else {
@ -60,7 +60,7 @@ ewol::OObject2DTextColored::OObject2DTextColored(int32_t fontID)
// open with default font ... // open with default font ...
ewol::OObject2DTextColored::OObject2DTextColored(void) ewol::OObject2DTextColored::OObject2DTextColored(void)
{ {
m_color = etk::color::color_Black; m_color = etk::color::black;
m_FontId = GetDefaultFontId(); m_FontId = GetDefaultFontId();
} }
@ -140,7 +140,7 @@ int32_t ewol::OObject2DTextColored::Text(Vector2D<float> textPos, const uniChar_
} }
void ewol::OObject2DTextColored::SetColor(color_ts color) void ewol::OObject2DTextColored::SetColor(etk::Color color)
{ {
m_color = color; m_color = color;
} }
@ -148,7 +148,7 @@ void ewol::OObject2DTextColored::SetColor(color_ts color)
void ewol::OObject2DTextColored::SetColor(float red, float green, float blue, float alpha) void ewol::OObject2DTextColored::SetColor(float red, float green, float blue, float alpha)
{ {
m_color = etk::color::Create(red, green, blue, alpha); m_color = etk::Color(red, green, blue, alpha);
} }

View File

@ -38,18 +38,18 @@ namespace ewol {
public: public:
virtual void Draw(void); virtual void Draw(void);
void SetColor(float red, float green, float blue, float alpha = 1.0); void SetColor(float red, float green, float blue, float alpha = 1.0);
void SetColor(color_ts color); void SetColor(etk::Color color);
// set a specific text // set a specific text
void Clear(void); void Clear(void);
int32_t Text(Vector2D<float> textPos, const etk::UString& unicodeString); int32_t Text(Vector2D<float> textPos, const etk::UString& unicodeString);
int32_t Text(Vector2D<float> textPos, const uniChar_t unicodeChar); int32_t Text(Vector2D<float> textPos, const uniChar_t unicodeChar);
protected: protected:
int32_t m_FontId; //!< font internal ID int32_t m_FontId; //!< font internal ID
color_ts m_color; //!< tmp text color ... etk::Color m_color; //!< tmp text color ...
int32_t m_FontTextureId; //!< font internal Texture ID int32_t m_FontTextureId; //!< font internal Texture ID
etk::VectorType<Vector2D<float> > m_coord; //!< internal coord of the object etk::Vector<Vector2D<float> > m_coord; //!< internal coord of the object
etk::VectorType<texCoord_ts> m_coordTex; //!< internal texture coordinate for every point etk::Vector<texCoord_ts> m_coordTex; //!< internal texture coordinate for every point
etk::VectorType<color_ts> m_coordColor; //!< internal color of the different point etk::Vector<etk::Color> m_coordColor; //!< internal color of the different point
public: public:
void SetFontID(int32_t fontID) { m_FontId = fontID; }; void SetFontID(int32_t fontID) { m_FontId = fontID; };
int32_t GetFontID(void) { return m_FontId; }; int32_t GetFontID(void) { return m_FontId; };

View File

@ -84,12 +84,12 @@ void ewol::OObject2DTextured::Clear(void)
m_coordColor.Clear(); m_coordColor.Clear();
} }
void ewol::OObject2DTextured::Rectangle(float x, float y, float w, float h, color_ts tmpColor) void ewol::OObject2DTextured::Rectangle(float x, float y, float w, float h, etk::Color tmpColor)
{ {
Rectangle(x, y, w, h, 0.0, 0.0, 1.0, 1.0, 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, color_ts tmpColor) void ewol::OObject2DTextured::Rectangle(float x, float y, float w, float h, float texX, float texY, float texSX, float texSY, etk::Color tmpColor)
{ {
//EWOL_DEBUG("Add rectangle : ..."); //EWOL_DEBUG("Add rectangle : ...");
Vector2D<float> point; Vector2D<float> point;

View File

@ -37,13 +37,13 @@ namespace ewol {
public: public:
virtual void Draw(void); virtual void Draw(void);
void Clear(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, color_ts tmpColor=0xFFFFFFFF); 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, color_ts tmpColor); void Rectangle(float x, float y, float w, float h, etk::Color tmpColor);
protected: protected:
int32_t m_textureId; //!< texture internal ID int32_t m_textureId; //!< texture internal ID
etk::VectorType<Vector2D<float> > m_coord; //!< internal coord of the object etk::Vector<Vector2D<float> > m_coord; //!< internal coord of the object
etk::VectorType<texCoord_ts> m_coordTex; //!< internal texture coordinate for every point etk::Vector<texCoord_ts> m_coordTex; //!< internal texture coordinate for every point
etk::VectorType<color_ts> m_coordColor; //!< internal color of the different point etk::Vector<etk::Color> m_coordColor; //!< internal color of the different point
}; };
}; };

View File

@ -90,7 +90,7 @@ void ewol::Sprite::Clear(void)
void ewol::Sprite::Element(Vector2D<float> pos, float size, float angle) void ewol::Sprite::Element(Vector2D<float> pos, float size, float angle)
{ {
color_ts tmpColor(0xFFFFFFFF); etk::Color tmpColor(0xFFFFFFFF);
Vector3D<float> pos2; Vector3D<float> pos2;
pos2.x = pos.x; pos2.x = pos.x;
pos2.y = pos.y; pos2.y = pos.y;
@ -100,11 +100,11 @@ void ewol::Sprite::Element(Vector2D<float> pos, float size, float angle)
void ewol::Sprite::Element(Vector3D<float> pos, float size, float angle) void ewol::Sprite::Element(Vector3D<float> pos, float size, float angle)
{ {
color_ts tmpColor(0xFFFFFFFF); etk::Color tmpColor(0xFFFFFFFF);
Element(pos, size, angle, tmpColor); Element(pos, size, angle, tmpColor);
} }
void ewol::Sprite::Element(Vector2D<float> pos, float size, float angle, color_ts tmpColor) void ewol::Sprite::Element(Vector2D<float> pos, float size, float angle, etk::Color tmpColor)
{ {
Vector3D<float> pos2; Vector3D<float> pos2;
pos2.x = pos.x; pos2.x = pos.x;
@ -114,7 +114,7 @@ void ewol::Sprite::Element(Vector2D<float> pos, float size, float angle, color_t
} }
void ewol::Sprite::Element(Vector3D<float> pos, float size, float angle, color_ts tmpColor) void ewol::Sprite::Element(Vector3D<float> pos, float size, float angle, etk::Color tmpColor)
{ {
angle -= M_PI/4; angle -= M_PI/4;
size *= 0.7; size *= 0.7;

View File

@ -40,14 +40,14 @@ namespace ewol {
void Clear(void); void Clear(void);
void Element(Vector2D<float> pos, float size, float angle); void Element(Vector2D<float> pos, float size, float angle);
void Element(Vector3D<float> pos, float size, float angle); void Element(Vector3D<float> pos, float size, float angle);
void Element(Vector2D<float> pos, float size, float angle, color_ts tmpColor); void Element(Vector2D<float> pos, float size, float angle, etk::Color tmpColor);
void Element(Vector3D<float> pos, float size, float angle, color_ts tmpColor); void Element(Vector3D<float> pos, float size, float angle, etk::Color tmpColor);
bool HasName(etk::UString& name) { return name == m_name; }; bool HasName(etk::UString& name) { return name == m_name; };
protected: protected:
int32_t m_textureId; //!< texture internal ID int32_t m_textureId; //!< texture internal ID
etk::VectorType<Vector3D<float> > m_coord; //!< internal coord of the object etk::Vector<Vector3D<float> > m_coord; //!< internal coord of the object
etk::VectorType<texCoord_ts> m_coordTex; //!< internal texture coordinate for every point etk::Vector<texCoord_ts> m_coordTex; //!< internal texture coordinate for every point
etk::VectorType<color_ts> m_coordColor; //!< internal color of the different point etk::Vector<etk::Color> m_coordColor; //!< internal color of the different point
}; };
}; };

View File

@ -39,7 +39,7 @@ class EventShortCut {
uniChar_t UnicodeValue; uniChar_t UnicodeValue;
}; };
static etk::VectorType<EventShortCut *> l_inputShortCutEvent; //!< generic short-cut event static etk::Vector<EventShortCut *> l_inputShortCutEvent; //!< generic short-cut event
void ewol::shortCut::Add(bool shift, bool control, bool alt, bool meta, uniChar_t unicodeValue, const char * generateEventId, etk::UString data) void ewol::shortCut::Add(bool shift, bool control, bool alt, bool meta, uniChar_t unicodeValue, const char * generateEventId, etk::UString data)

View File

@ -53,7 +53,7 @@ class LoadedTexture
bool m_destroy; bool m_destroy;
}; };
//! List of all Texture loaded ... //! List of all Texture loaded ...
etk::VectorType<LoadedTexture*> l_listLoadedTexture; etk::Vector<LoadedTexture*> l_listLoadedTexture;
#undef __class__ #undef __class__
#define __class__ "texture" #define __class__ "texture"

View File

@ -31,7 +31,7 @@ namespace ewol {
class Widget; class Widget;
}; };
#include <etk/Types.h> #include <etk/Types.h>
#include <etk/VectorType.h> #include <etk/Vector.h>
#include <ewol/Debug.h> #include <ewol/Debug.h>
#include <ewol/OObject.h> #include <ewol/OObject.h>
#include <ewol/base/eventInputManagement.h> #include <ewol/base/eventInputManagement.h>

View File

@ -27,7 +27,7 @@
#include <ewol/widget/Button.h> #include <ewol/widget/Button.h>
#include <ewol/widget/ButtonColor.h> #include <ewol/widget/ButtonColor.h>
//#include <ewol/widget/Scene.h> //#include <ewol/widget/Scene.h>
#include <etk/VectorType.h> #include <etk/Vector.h>
#undef __class__ #undef __class__
#define __class__ "WidgetManager" #define __class__ "WidgetManager"
@ -37,7 +37,7 @@ static bool IsInit = false;
// For the focus Management // For the focus Management
static ewol::Widget * m_focusWidgetDefault = NULL; static ewol::Widget * m_focusWidgetDefault = NULL;
static ewol::Widget * m_focusWidgetCurrent = NULL; static ewol::Widget * m_focusWidgetCurrent = NULL;
static etk::VectorType<ewol::Widget*> l_listOfPeriodicWidget; static etk::Vector<ewol::Widget*> l_listOfPeriodicWidget;
static bool l_havePeriodic = false; static bool l_havePeriodic = false;
static bool l_haveRedraw = true; static bool l_haveRedraw = true;

View File

@ -28,7 +28,7 @@
#include <etk/Types.h> #include <etk/Types.h>
#include <ewol/Debug.h> #include <ewol/Debug.h>
#include <ewol/OObject.h> #include <ewol/OObject.h>
#include <etk/VectorType.h> #include <etk/Vector.h>
#include <ewol/Widget.h> #include <ewol/Widget.h>
namespace ewol { namespace ewol {

View File

@ -27,7 +27,7 @@
#include <etk/Types.h> #include <etk/Types.h>
#include <ewol/Debug.h> #include <ewol/Debug.h>
#include <etk/VectorType.h> #include <etk/Vector.h>
#include <ewol/Widget.h> #include <ewol/Widget.h>
namespace ewol { namespace ewol {
@ -79,7 +79,7 @@ namespace ewol {
} }
private: private:
ewol::Widget* m_subWidget; ewol::Widget* m_subWidget;
etk::VectorType<ewol::Widget*> m_popUpWidgetList; etk::Vector<ewol::Widget*> m_popUpWidgetList;
public: public:
void SetSubWidget(ewol::Widget * widget); void SetSubWidget(ewol::Widget * widget);
void PopUpWidgetPush(ewol::Widget * widget); void PopUpWidgetPush(ewol::Widget * widget);

View File

@ -171,15 +171,6 @@ void ewolProcessEvents(void)
} }
} }
} }
// pb here when dynamic widget ...
if (0 < nbEvent) {
//EWOL_DEBUG(" ******** Redraw");
if(true == ewol::threadMsg::HasDisplayDone(androidJniMsg)) {
int64_t localTime = GetCurrentTime();
ewol::widgetManager::PeriodicCall(localTime);
}
EWOL_NativeRegenerateDisplay();
}
} }
@ -370,6 +361,12 @@ void guiSystem::Draw(void)
{ {
if (true == isGlobalSystemInit) { if (true == isGlobalSystemInit) {
ewolProcessEvents(); ewolProcessEvents();
int64_t localTime = GetCurrentTime();
ewol::widgetManager::PeriodicCall(localTime);
EWOL_NativeRegenerateDisplay();
ewol::texture::UpdateContext(); ewol::texture::UpdateContext();
EWOL_NativeRender(); EWOL_NativeRender();
} }

View File

@ -281,7 +281,7 @@ static void local_SetTitle(etk::UString title)
EWOL_INFO("X11: Set Title (START)"); EWOL_INFO("X11: Set Title (START)");
#endif #endif
XTextProperty tp; XTextProperty tp;
tp.value = (unsigned char *)title.Utf8Data(); tp.value = (unsigned char *)title.c_str();
tp.encoding = XA_WM_NAME; tp.encoding = XA_WM_NAME;
tp.format = 8; tp.format = 8;
tp.nitems = strlen((const char*)tp.value); tp.nitems = strlen((const char*)tp.value);
@ -593,9 +593,9 @@ void X11_Run(void)
const char * magatTextToSend = NULL; const char * magatTextToSend = NULL;
if (req->selection == XAtomeSelection) { if (req->selection == XAtomeSelection) {
magatTextToSend = l_clipBoardPrimary.Utf8Data(); magatTextToSend = l_clipBoardPrimary.c_str();
} else if (req->selection == XAtomeClipBoard) { } else if (req->selection == XAtomeClipBoard) {
magatTextToSend = l_clipBoardStd.Utf8Data(); magatTextToSend = l_clipBoardStd.c_str();
} else { } else {
magatTextToSend = ""; magatTextToSend = "";
} }
@ -1182,7 +1182,7 @@ bool guiAbstraction::IsPressedInput(int32_t inputID)
#include <ewol/ewol.h> #include <ewol/ewol.h>
static etk::VectorType<etk::UString*> listArgs; static etk::Vector<etk::UString*> listArgs;
int32_t ewol::CmdLineNb(void) int32_t ewol::CmdLineNb(void)
{ {

View File

@ -53,7 +53,7 @@ namespace ewol {
bool isInit; bool isInit;
pthread_mutex_t mutex; pthread_mutex_t mutex;
pthread_cond_t condition; pthread_cond_t condition;
//etk::VectorType<threadMsgContent_ts> //etk::Vector<threadMsgContent_ts>
threadMsgContent_ts listOfMessages[MSG_PRIO_NUMBER][NUMBER_OF_ELEMENT_IN_THE_FIFO]; threadMsgContent_ts listOfMessages[MSG_PRIO_NUMBER][NUMBER_OF_ELEMENT_IN_THE_FIFO];
int32_t nbMessages[MSG_PRIO_NUMBER]; int32_t nbMessages[MSG_PRIO_NUMBER];
bool displayHasDone; bool displayHasDone;

View File

@ -68,9 +68,9 @@ void ewol::Button::Init(void)
m_padding.x = 4; m_padding.x = 4;
#endif #endif
m_textColorFg = etk::color::color_Black; m_textColorFg = etk::color::black;
m_textColorBg = etk::color::color_Black; m_textColorBg = etk::color::black;
m_textColorBg.alpha = 0x3F; m_textColorBg.alpha = 0x3F;
SetCanHaveFocus(true); SetCanHaveFocus(true);
} }

View File

@ -62,16 +62,16 @@ namespace ewol {
bool GetValue(void); bool GetValue(void);
void SetAlignement(textAlignement_te typeAlign); void SetAlignement(textAlignement_te typeAlign);
void SetPadding(Vector2D<float> newPadding); void SetPadding(Vector2D<float> newPadding);
void SetColorBg(color_ts newColor) { m_textColorBg = newColor; }; void SetColorBg(etk::Color newColor) { m_textColorBg = newColor; };
void SetColorFg(color_ts newColor) { m_textColorFg = newColor; }; void SetColorFg(etk::Color newColor) { m_textColorFg = newColor; };
private: private:
bool m_hasAnImage; bool m_hasAnImage;
etk::UString m_imageSelected; etk::UString m_imageSelected;
textAlignement_te m_alignement; textAlignement_te m_alignement;
Vector2D<float> m_padding; Vector2D<float> m_padding;
etk::UString m_label; etk::UString m_label;
color_ts m_textColorFg; //!< Text color etk::Color m_textColorFg; //!< Text color
color_ts m_textColorBg; //!< Background color etk::Color m_textColorBg; //!< Background color
public: public:
virtual void OnRegenerateDisplay(void); virtual void OnRegenerateDisplay(void);
/** /**

View File

@ -63,7 +63,7 @@ void ewol::ButtonColor::Init(void)
#endif #endif
m_textColorBg = etk::color::color_Black; m_textColorBg = etk::color::black;
m_textColorBg.alpha = 0x3F; m_textColorBg.alpha = 0x3F;
m_widgetContextMenu = NULL; m_widgetContextMenu = NULL;
SetCanHaveFocus(true); SetCanHaveFocus(true);
@ -160,15 +160,9 @@ void ewol::ButtonColor::OnRegenerateDisplay(void)
tmpSizeY -= 2*m_padding.y; tmpSizeY -= 2*m_padding.y;
if ((m_textColorBg.red>0.5) || (m_textColorBg.green>0.5) || (m_textColorBg.blue > 0.8) ) { if ((m_textColorBg.red>0.5) || (m_textColorBg.green>0.5) || (m_textColorBg.blue > 0.8) ) {
m_textColorFg.red = 0.0; m_textColorFg = etk::color::black;
m_textColorFg.green = 0.0;
m_textColorFg.blue = 0.0;
m_textColorFg.alpha = 1.0;
} else { } else {
m_textColorFg.red = 1.0; m_textColorFg = etk::color::white;
m_textColorFg.green = 1.0;
m_textColorFg.blue = 1.0;
m_textColorFg.alpha = 1.0;
} }
ewol::OObject2DText * tmpText = new ewol::OObject2DText("", -1, m_textColorFg); ewol::OObject2DText * tmpText = new ewol::OObject2DText("", -1, m_textColorFg);
/* /*
@ -247,16 +241,12 @@ bool ewol::ButtonColor::OnEventInput(ewol::inputType_te type, int32_t IdInput, e
} }
void ewol::ButtonColor::SetCurrentColor(color_ts color) void ewol::ButtonColor::SetCurrentColor(etk::Color color)
{ {
m_selectedColor = color; m_selectedColor = color;
m_textColorBg = m_selectedColor; m_textColorBg = m_selectedColor;
char colorText[256]; char colorText[256];
sprintf(colorText, "#%02X%02X%02X%02X", sprintf(colorText, "#%08X", color.Get());
(uint8_t)(color.red * 0xFF),
(uint8_t)(color.green * 0xFF),
(uint8_t)(color.blue * 0xFF),
(uint8_t)(color.alpha * 0xFF));
//set the new label ... //set the new label ...
SetLabel(colorText); SetLabel(colorText);
} }
@ -272,16 +262,12 @@ void ewol::ButtonColor::OnReceiveMessage(ewol::EObject * CallerObject, const cha
{ {
if (eventId == ewolEventColorChooserChange) { if (eventId == ewolEventColorChooserChange) {
// TODO : Parse the input color ... // TODO : Parse the input color ...
//color_ts tmpColor(data); //etk::Color tmpColor(data);
color_ts tmpColor; etk::Color tmpColor;
m_selectedColor = tmpColor; m_selectedColor = tmpColor;
m_textColorBg = m_selectedColor; m_textColorBg = m_selectedColor;
char colorText[256]; char colorText[256];
sprintf(colorText, "#%02X%02X%02X%02X", sprintf(colorText, "#%08X", tmpColor.Get());
(uint8_t)(tmpColor.red * 0xFF),
(uint8_t)(tmpColor.green * 0xFF),
(uint8_t)(tmpColor.blue * 0xFF),
(uint8_t)(tmpColor.alpha * 0xFF));
//set the new label ... //set the new label ...
SetLabel(colorText); SetLabel(colorText);
GenerateEventId(ewolEventButtonColorChange); GenerateEventId(ewolEventButtonColorChange);

View File

@ -59,9 +59,9 @@ namespace ewol {
textAlignement_te m_alignement; textAlignement_te m_alignement;
Vector2D<float> m_padding; Vector2D<float> m_padding;
etk::UString m_label; etk::UString m_label;
color_ts m_textColorFg; //!< Text color etk::Color m_textColorFg; //!< Text color
color_ts m_textColorBg; //!< Background color etk::Color m_textColorBg; //!< Background color
color_ts m_selectedColor; //!< user current selected Color etk::Color m_selectedColor; //!< user current selected Color
ewol::ContextMenu* m_widgetContextMenu; ewol::ContextMenu* m_widgetContextMenu;
public: public:
virtual void OnRegenerateDisplay(void); virtual void OnRegenerateDisplay(void);
@ -76,8 +76,8 @@ namespace ewol {
* @return false the event is not used * @return false the event is not used
*/ */
virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D<float> pos); virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D<float> pos);
color_ts GetCurrentColor(void) { return m_selectedColor; }; etk::Color GetCurrentColor(void) { return m_selectedColor; };
void SetCurrentColor(color_ts color); void SetCurrentColor(etk::Color color);
/** /**
* @brief Receive a message from an other EObject with a specific eventId and data * @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 * @param[in] CallerObject Pointer on the EObject that information came from

View File

@ -41,7 +41,7 @@ void ewol::WIDGET_ButtonImageInit(void)
#undef __class__ #undef __class__
#define __class__ "ButtonImage" #define __class__ "ButtonImage"
ewol::ButtonImage::ButtonImage(etk::UString imageName, color_ts col) ewol::ButtonImage::ButtonImage(etk::UString imageName, etk::Color col)
{ {
AddEventId(ewolEventButtonPressed); AddEventId(ewolEventButtonPressed);
AddEventId(ewolEventButtonDown); AddEventId(ewolEventButtonDown);
@ -68,7 +68,7 @@ ewol::ButtonImage::~ButtonImage(void)
} }
void ewol::ButtonImage::SetImage(etk::UString imageName, color_ts col) void ewol::ButtonImage::SetImage(etk::UString imageName, etk::Color col)
{ {
m_image = imageName; m_image = imageName;
m_color = col; m_color = col;
@ -76,7 +76,7 @@ void ewol::ButtonImage::SetImage(etk::UString imageName, color_ts col)
MarkToRedraw(); MarkToRedraw();
} }
void ewol::ButtonImage::SetImageBG(etk::UString imageName, color_ts col) void ewol::ButtonImage::SetImageBG(etk::UString imageName, etk::Color col)
{ {
m_imageBg1 = imageName; m_imageBg1 = imageName;
m_colorBg1 = col; m_colorBg1 = col;
@ -84,7 +84,7 @@ void ewol::ButtonImage::SetImageBG(etk::UString imageName, color_ts col)
MarkToRedraw(); MarkToRedraw();
} }
void ewol::ButtonImage::SetImageSelected(etk::UString imageName, color_ts col) void ewol::ButtonImage::SetImageSelected(etk::UString imageName, etk::Color col)
{ {
m_imageBg2 = imageName; m_imageBg2 = imageName;
m_colorBg2 = col; m_colorBg2 = col;

View File

@ -34,7 +34,7 @@ namespace ewol {
class ButtonImage :public ewol::Widget class ButtonImage :public ewol::Widget
{ {
public: public:
ButtonImage(etk::UString image, color_ts col=0xFFFFFFFF); ButtonImage(etk::UString image, etk::Color col=0xFFFFFFFF);
/** /**
* @brief Get the current Object type of the EObject * @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 * @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"; }; virtual const char * const GetObjectType(void) { return "EwolButtonImage"; };
void Init(void); void Init(void);
virtual ~ButtonImage(void); virtual ~ButtonImage(void);
void SetImage(etk::UString imageName, color_ts col=0xFFFFFFFF); void SetImage(etk::UString imageName, etk::Color col=0xFFFFFFFF);
void SetImageBG(etk::UString imageName, color_ts col=0xFFFFFFFF); void SetImageBG(etk::UString imageName, etk::Color col=0xFFFFFFFF);
void SetImageSelected(etk::UString imageName, color_ts col=0xFFFFFFFF); void SetImageSelected(etk::UString imageName, etk::Color col=0xFFFFFFFF);
void SetValue(bool val); void SetValue(bool val);
bool GetValue(void); bool GetValue(void);
void SetToggleMode(bool val); void SetToggleMode(bool val);
@ -55,15 +55,15 @@ namespace ewol {
etk::UString m_image; etk::UString m_image;
bool m_resetNeeded; bool m_resetNeeded;
ewol::OObject2DTextured* m_OOImage; ewol::OObject2DTextured* m_OOImage;
color_ts m_color; etk::Color m_color;
etk::UString m_imageBg1; etk::UString m_imageBg1;
ewol::OObject2DTextured* m_OOImageBg1; ewol::OObject2DTextured* m_OOImageBg1;
color_ts m_colorBg1; etk::Color m_colorBg1;
etk::UString m_imageBg2; etk::UString m_imageBg2;
ewol::OObject2DTextured* m_OOImageBG2; ewol::OObject2DTextured* m_OOImageBG2;
color_ts m_colorBg2; etk::Color m_colorBg2;
bool m_over; bool m_over;
bool m_down; bool m_down;

View File

@ -38,8 +38,8 @@ extern const char * const ewolEventCheckBoxClicked = "ewol CheckBox Clicked";
void ewol::CheckBox::Init(void) void ewol::CheckBox::Init(void)
{ {
AddEventId(ewolEventCheckBoxClicked); AddEventId(ewolEventCheckBoxClicked);
m_textColorFg = etk::color::color_Black; m_textColorFg = etk::color::black;
m_textColorBg = etk::color::color_White; m_textColorBg = etk::color::white;
m_value = false; m_value = false;
SetCanHaveFocus(true); SetCanHaveFocus(true);
SetMouseLimit(1); SetMouseLimit(1);

View File

@ -53,8 +53,8 @@ namespace ewol {
private: private:
etk::UString m_label; etk::UString m_label;
bool m_value; bool m_value;
color_ts m_textColorFg; //!< Text color etk::Color m_textColorFg; //!< Text color
color_ts m_textColorBg; //!< Background color etk::Color m_textColorBg; //!< Background color
public: public:
virtual void OnRegenerateDisplay(void); virtual void OnRegenerateDisplay(void);
public: public:

View File

@ -27,6 +27,7 @@
#include <ewol/OObject.h> #include <ewol/OObject.h>
#include <ewol/WidgetManager.h> #include <ewol/WidgetManager.h>
#include <etk/Color.h>
extern const char * const ewolEventColorBarChange = "ewol-color-bar-change"; extern const char * const ewolEventColorBarChange = "ewol-color-bar-change";
@ -48,7 +49,7 @@ ewol::ColorBar::ColorBar(void)
#endif #endif
m_currentUserPos.x=0; m_currentUserPos.x=0;
m_currentUserPos.y=0; m_currentUserPos.y=0;
m_currentColor = etk::color::color_Black; m_currentColor = etk::color::black;
SetCanHaveFocus(true); SetCanHaveFocus(true);
} }
@ -65,10 +66,10 @@ bool ewol::ColorBar::CalculateMinSize(void)
MarkToRedraw(); MarkToRedraw();
return true; return true;
} }
static color_ts s_listColorWhite(0xFFFFFFFF); static etk::Color s_listColorWhite(0xFFFFFFFF);
static color_ts s_listColorBlack(0x000000FF); static etk::Color s_listColorBlack(0x000000FF);
#define NB_BAND_COLOR (6) #define NB_BAND_COLOR (6)
static color_ts s_listColor[NB_BAND_COLOR+1] = { static etk::Color s_listColor[NB_BAND_COLOR+1] = {
0xFF0000FF, 0xFF0000FF,
0xFFFF00FF, 0xFFFF00FF,
0x00FF00FF, 0x00FF00FF,
@ -78,14 +79,14 @@ static color_ts s_listColor[NB_BAND_COLOR+1] = {
0xFF0000FF 0xFF0000FF
}; };
color_ts ewol::ColorBar::GetCurrentColor(void) etk::Color ewol::ColorBar::GetCurrentColor(void)
{ {
return m_currentColor; return m_currentColor;
} }
void ewol::ColorBar::SetCurrentColor(color_ts newOne) void ewol::ColorBar::SetCurrentColor(etk::Color newOne)
{ {
m_currentColor = newOne; m_currentColor = newOne;
m_currentColor.alpha = 1.0; m_currentColor.alpha = 0xFF;
// estimate the cursor position : // estimate the cursor position :
// TODO : Later when really needed ... // TODO : Later when really needed ...
} }
@ -192,17 +193,12 @@ void ewol::ColorBar::OnRegenerateDisplay(void)
tmpOObjects->SetPoint(tmpOriginX + (iii+0.5)*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY); tmpOObjects->SetPoint(tmpOriginX + (iii+0.5)*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY);
*/ */
} }
color_ts tmpColor; etk::Color tmpColor;
if (m_currentUserPos.y > 0.5) { if (m_currentUserPos.y > 0.5) {
tmpColor.red = 1.0; tmpColor = etk::color::white;
tmpColor.green = 1.0;
tmpColor.blue = 1.0;
} else { } else {
tmpColor.red = 0.0; tmpColor = etk::color::black;
tmpColor.green = 0.0;
tmpColor.blue = 0.0;
} }
tmpColor.alpha = 1.0;
tmpOObjects->SetColor(tmpColor); tmpOObjects->SetColor(tmpColor);
tmpOObjects->Circle(m_currentUserPos.x*m_size.x, m_currentUserPos.y*m_size.y, 3.0, 1.0); tmpOObjects->Circle(m_currentUserPos.x*m_size.x, m_currentUserPos.y*m_size.y, 3.0, 1.0);
@ -240,8 +236,7 @@ bool ewol::ColorBar::OnEventInput(ewol::inputType_te type, int32_t IdInput, even
float localPos = relativePos.x - (m_size.x/6) * bandID; float localPos = relativePos.x - (m_size.x/6) * bandID;
float poroportionnalPos = localPos/(m_size.x/6); float poroportionnalPos = localPos/(m_size.x/6);
EWOL_VERBOSE("bandId=" << bandID << " relative pos=" << localPos); EWOL_VERBOSE("bandId=" << bandID << " relative pos=" << localPos);
color_ts estimateColor; etk::Color estimateColor = etk::color::white;
estimateColor.alpha = 1.0;
if (s_listColor[bandID].red == s_listColor[bandID+1].red) { if (s_listColor[bandID].red == s_listColor[bandID+1].red) {
estimateColor.red = s_listColor[bandID].red; estimateColor.red = s_listColor[bandID].red;
} else if (s_listColor[bandID].red < s_listColor[bandID+1].red) { } else if (s_listColor[bandID].red < s_listColor[bandID+1].red) {
@ -286,10 +281,7 @@ bool ewol::ColorBar::OnEventInput(ewol::inputType_te type, int32_t IdInput, even
(uint8_t)(estimateColor.alpha * 0xFF)); (uint8_t)(estimateColor.alpha * 0xFF));
EWOL_DEBUG("new color : " << colorText); EWOL_DEBUG("new color : " << colorText);
*/ */
if( m_currentColor.red != estimateColor.red if( m_currentColor != estimateColor) {
|| m_currentColor.green != estimateColor.green
|| m_currentColor.blue != estimateColor.blue
|| m_currentColor.alpha != estimateColor.alpha) {
m_currentColor = estimateColor; m_currentColor = estimateColor;
GenerateEventId(ewolEventColorBarChange); GenerateEventId(ewolEventColorBarChange);
} }

View File

@ -45,10 +45,10 @@ namespace ewol {
*/ */
virtual const char * const GetObjectType(void) { return "EwolColorBar"; }; virtual const char * const GetObjectType(void) { return "EwolColorBar"; };
virtual bool CalculateMinSize(void); virtual bool CalculateMinSize(void);
color_ts GetCurrentColor(void); etk::Color GetCurrentColor(void);
void SetCurrentColor(color_ts newOne); void SetCurrentColor(etk::Color newOne);
private: private:
color_ts m_currentColor; etk::Color m_currentColor;
Vector2D<float> m_currentUserPos; Vector2D<float> m_currentUserPos;
Vector2D<float> m_padding; Vector2D<float> m_padding;
public: public:

View File

@ -40,9 +40,9 @@ ewol::ContextMenu::ContextMenu(void)
m_padding.y = 4; m_padding.y = 4;
m_offset = 20; m_offset = 20;
m_colorBackGroung = etk::color::color_White; m_colorBackGroung = etk::color::white;
m_colorBorder = etk::color::color_Black; m_colorBorder = etk::color::black;
m_colorBorder.alpha = 0x7F; m_colorBorder.alpha = 0x7F;
m_arrowPos.x = 0; m_arrowPos.x = 0;

View File

@ -57,8 +57,8 @@ namespace ewol {
virtual void SetExpendX(bool newExpend=false); virtual void SetExpendX(bool newExpend=false);
virtual void SetExpendY(bool newExpend=false); virtual void SetExpendY(bool newExpend=false);
private: private:
color_ts m_colorBackGroung; etk::Color m_colorBackGroung;
color_ts m_colorBorder; etk::Color m_colorBorder;
Vector2D<float> m_padding; Vector2D<float> m_padding;
Vector2D<float> m_arrowPos; Vector2D<float> m_arrowPos;
float m_offset; float m_offset;

View File

@ -44,7 +44,7 @@ namespace ewol {
virtual const char * const GetObjectType(void) { return "EwolDrawable"; }; virtual const char * const GetObjectType(void) { return "EwolDrawable"; };
private: private:
etk::VectorType<ewol::OObject*> m_listOObject; //!< generic element to display... etk::Vector<ewol::OObject*> m_listOObject; //!< generic element to display...
public: public:
void AddOObject(ewol::OObject* newObject, int32_t pos=-1); void AddOObject(ewol::OObject* newObject, int32_t pos=-1);
void ClearOObjectList(void); void ClearOObjectList(void);

View File

@ -51,9 +51,9 @@ void ewol::Entry::Init(void)
m_borderSize = 2; m_borderSize = 2;
m_paddingSize = 3; m_paddingSize = 3;
m_displayCursor = false; m_displayCursor = false;
m_textColorFg = etk::color::color_Black; m_textColorFg = etk::color::black;
m_textColorBg = etk::color::color_White; m_textColorBg = etk::color::white;
m_textColorBg.alpha = 0xAF; m_textColorBg.alpha = 0xAF;
SetCanHaveFocus(true); SetCanHaveFocus(true);
} }

View File

@ -57,8 +57,8 @@ namespace ewol {
} }
private: private:
etk::UString m_data; etk::UString m_data;
color_ts m_textColorFg; //!< Text color etk::Color m_textColorFg; //!< Text color
color_ts m_textColorBg; //!< Background color etk::Color m_textColorBg; //!< Background color
int32_t m_userSize; int32_t m_userSize;
int32_t m_displayStartPosition; int32_t m_displayStartPosition;
int32_t m_displayCursorPos; int32_t m_displayCursorPos;

View File

@ -58,7 +58,7 @@ void ewol::Image::Init(void)
m_padding.x = 4; m_padding.x = 4;
#endif #endif
m_textColorBg = etk::color::color_Black; m_textColorBg = etk::color::black;
m_textColorBg.alpha = 0x00; m_textColorBg.alpha = 0x00;
m_imageSize = 32; m_imageSize = 32;
} }

View File

@ -51,7 +51,7 @@ namespace ewol {
private: private:
etk::UString m_imageSelected; etk::UString m_imageSelected;
Vector2D<float> m_padding; Vector2D<float> m_padding;
color_ts m_textColorBg; //!< Background color etk::Color m_textColorBg; //!< Background color
int32_t m_imageSize; int32_t m_imageSize;
public: public:
virtual void OnRegenerateDisplay(void); virtual void OnRegenerateDisplay(void);

View File

@ -103,9 +103,9 @@ ewol::Joystick::Joystick(void)
m_lock = false; m_lock = false;
m_displayMode = ewol::JOYSTICK_NORMAL_MODE; m_displayMode = ewol::JOYSTICK_NORMAL_MODE;
m_colorFg = etk::color::color_Blue; m_colorFg = etk::color::blue;
m_colorBg = etk::color::color_Black; m_colorBg = etk::color::black;
m_colorBg.alpha = 0x3F; m_colorBg.alpha = 0x3F;
m_displayPos.x = 0.0; m_displayPos.x = 0.0;

View File

@ -41,8 +41,8 @@ namespace ewol {
class Joystick :public ewol::Drawable class Joystick :public ewol::Drawable
{ {
private: private:
color_ts m_colorFg; //!< Forground color etk::Color m_colorFg; //!< Forground color
color_ts m_colorBg; //!< Background color etk::Color m_colorBg; //!< Background color
Vector2D<float> m_displayPos; //!< direction of the cursor ... Vector2D<float> m_displayPos; //!< direction of the cursor ...
float m_distance; //!< dintance from the center float m_distance; //!< dintance from the center
float m_angle; //!< angle of the arraw (if < 0 : No arraw...) 0 is the TOP ... float m_angle; //!< angle of the arraw (if < 0 : No arraw...) 0 is the TOP ...

View File

@ -39,7 +39,7 @@ extern const char * const ewolEventLabelPressed = "ewol Label Pressed";
void ewol::Label::Init(void) void ewol::Label::Init(void)
{ {
AddEventId(ewolEventLabelPressed); AddEventId(ewolEventLabelPressed);
m_textColorFg = etk::color::color_Black; m_textColorFg = etk::color::black;
SetCanHaveFocus(false); SetCanHaveFocus(false);
} }

View File

@ -50,7 +50,7 @@ namespace ewol {
void SetLabel(etk::UString newLabel); void SetLabel(etk::UString newLabel);
private: private:
etk::UString m_label; etk::UString m_label;
color_ts m_textColorFg; //!< Text color etk::Color m_textColorFg; //!< Text color
public: public:
virtual void OnRegenerateDisplay(void); virtual void OnRegenerateDisplay(void);
public: public:

View File

@ -118,7 +118,7 @@ void ewol::Layer::LockExpendContamination(bool lockExpend)
m_lockExpendContamination = lockExpend; m_lockExpendContamination = lockExpend;
} }
//etk::VectorType<ewol::Widget*> m_SubWidget; //etk::Vector<ewol::Widget*> m_SubWidget;
void ewol::Layer::SubWidgetRemoveAll(void) void ewol::Layer::SubWidgetRemoveAll(void)
{ {

View File

@ -53,7 +53,7 @@ namespace ewol {
void LockExpendContamination(bool lockExpend=false); void LockExpendContamination(bool lockExpend=false);
private: private:
bool m_lockExpendContamination; bool m_lockExpendContamination;
etk::VectorType<ewol::Widget*> m_subWidget; etk::Vector<ewol::Widget*> m_subWidget;
public: public:
virtual void SubWidgetRemoveAll(void); virtual void SubWidgetRemoveAll(void);
virtual void SubWidgetAdd(ewol::Widget* newWidget); virtual void SubWidgetAdd(ewol::Widget* newWidget);

View File

@ -141,10 +141,10 @@ void ewol::List::OnRegenerateDisplay(void)
m_maxSize.y = (minHeight + 2*m_paddingSizeY) * nbRaw; m_maxSize.y = (minHeight + 2*m_paddingSizeY) * nbRaw;
etk::VectorType<int32_t> listSizeColomn; etk::Vector<int32_t> listSizeColomn;
ewol::OObject2DColored * BGOObjects = new ewol::OObject2DColored(); ewol::OObject2DColored * BGOObjects = new ewol::OObject2DColored();
color_ts basicBG = GetBasicBG(); etk::Color basicBG = GetBasicBG();
BGOObjects->SetColor(basicBG); BGOObjects->SetColor(basicBG);
BGOObjects->Rectangle(0, 0, m_size.x, m_size.y); BGOObjects->Rectangle(0, 0, m_size.x, m_size.y);
@ -172,8 +172,8 @@ void ewol::List::OnRegenerateDisplay(void)
for(int32_t iii=startRaw; iii<nbRaw && iii<(startRaw+displayableRaw); iii++) { for(int32_t iii=startRaw; iii<nbRaw && iii<(startRaw+displayableRaw); iii++) {
etk::UString myTextToWrite; etk::UString myTextToWrite;
color_ts fg; etk::Color fg;
color_ts bg; etk::Color bg;
GetElement(0, iii, myTextToWrite, fg, bg); GetElement(0, iii, myTextToWrite, fg, bg);
BGOObjects->SetColor(bg); BGOObjects->SetColor(bg);
BGOObjects->Rectangle(0, m_size.y - tmpOriginY, m_size.x, minHeight+2*m_paddingSizeY); BGOObjects->Rectangle(0, m_size.y - tmpOriginY, m_size.x, minHeight+2*m_paddingSizeY);

View File

@ -48,7 +48,7 @@ namespace ewol {
void SetLabel(etk::UString newLabel); void SetLabel(etk::UString newLabel);
// Drawing capabilities .... // Drawing capabilities ....
private: private:
etk::VectorType<ewol::OObject*> m_listOObject; //!< generic element to display... etk::Vector<ewol::OObject*> m_listOObject; //!< generic element to display...
public: public:
void AddOObject(ewol::OObject* newObject, int32_t pos=-1); void AddOObject(ewol::OObject* newObject, int32_t pos=-1);
void ClearOObjectList(void); void ClearOObjectList(void);
@ -74,21 +74,21 @@ namespace ewol {
virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D<float> pos); virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D<float> pos);
protected: protected:
// function call to display the list : // function call to display the list :
virtual color_ts GetBasicBG(void) { virtual etk::Color GetBasicBG(void) {
color_ts bg(0xFFFFFFFF); etk::Color bg(0xFFFFFFFF);
return bg; return bg;
} }
virtual uint32_t GetNuberOfColomn(void) { virtual uint32_t GetNuberOfColomn(void) {
return 0; return 0;
}; };
virtual bool GetTitle(int32_t colomn, etk::UString &myTitle, color_ts &fg, color_ts &bg) { virtual bool GetTitle(int32_t colomn, etk::UString &myTitle, etk::Color &fg, etk::Color &bg) {
myTitle = ""; myTitle = "";
return false; return false;
}; };
virtual uint32_t GetNuberOfRaw(void) { virtual uint32_t GetNuberOfRaw(void) {
return 0; return 0;
}; };
virtual bool GetElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, color_ts &fg, color_ts &bg) { virtual bool GetElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, etk::Color &fg, etk::Color &bg) {
myTextToWrite = ""; myTextToWrite = "";
bg = 0xFFFFFFFF; bg = 0xFFFFFFFF;
fg = 0x000000FF; fg = 0x000000FF;

View File

@ -38,9 +38,9 @@ extern const char * const ewolEventFSFileValidate = "ewol-event-file-system-fi
extern const char * const ewolEventFSFolderSelect = "ewol-event-file-system-folder-select"; extern const char * const ewolEventFSFolderSelect = "ewol-event-file-system-folder-select";
extern const char * const ewolEventFSFolderValidate = "ewol-event-file-system-folder-validate"; extern const char * const ewolEventFSFolderValidate = "ewol-event-file-system-folder-validate";
static void SortElementList(etk::VectorType<ewol::elementFS *> &list) static void SortElementList(etk::Vector<ewol::elementFS *> &list)
{ {
etk::VectorType<ewol::elementFS *> tmpList = list; etk::Vector<ewol::elementFS *> tmpList = list;
list.Clear(); list.Clear();
for(int32_t iii=0; iii<tmpList.Size(); iii++) { for(int32_t iii=0; iii<tmpList.Size(); iii++) {
if (NULL != tmpList[iii]) { if (NULL != tmpList[iii]) {
@ -86,8 +86,8 @@ ewol::ListFileSystem::~ListFileSystem(void)
} }
}; };
color_ts ewol::ListFileSystem::GetBasicBG(void) { etk::Color ewol::ListFileSystem::GetBasicBG(void) {
color_ts bg(0x00000010); etk::Color bg(0x00000010);
return bg; return bg;
} }
@ -126,7 +126,7 @@ void ewol::ListFileSystem::RegenerateView(void)
} }
DIR *dir = NULL; DIR *dir = NULL;
struct dirent *ent = NULL; struct dirent *ent = NULL;
dir = opendir(m_folder.Utf8Data()); dir = opendir(m_folder.c_str());
if (dir != NULL) { if (dir != NULL) {
// for each element in the drectory... // for each element in the drectory...
while ((ent = readdir(dir)) != NULL) { while ((ent = readdir(dir)) != NULL) {
@ -242,20 +242,20 @@ void ewol::ListFileSystem::SetSelect( etk::UString data) {
uint32_t ewol::ListFileSystem::GetNuberOfColomn(void) { uint32_t ewol::ListFileSystem::GetNuberOfColomn(void) {
return 1; return 1;
}; };
bool ewol::ListFileSystem::GetTitle(int32_t colomn, etk::UString &myTitle, color_ts &fg, color_ts &bg) { bool ewol::ListFileSystem::GetTitle(int32_t colomn, etk::UString &myTitle, etk::Color &fg, etk::Color &bg) {
myTitle = "title"; myTitle = "title";
return true; return true;
}; };
uint32_t ewol::ListFileSystem::GetNuberOfRaw(void) { uint32_t ewol::ListFileSystem::GetNuberOfRaw(void) {
return m_list.Size(); return m_list.Size();
}; };
bool ewol::ListFileSystem::GetElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, color_ts &fg, color_ts &bg) { bool ewol::ListFileSystem::GetElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, etk::Color &fg, etk::Color &bg) {
if (raw >= 0 && raw < m_list.Size() && NULL != m_list[raw]) { if (raw >= 0 && raw < m_list.Size() && NULL != m_list[raw]) {
myTextToWrite = m_list[raw]->m_name; myTextToWrite = m_list[raw]->m_name;
} else { } else {
myTextToWrite = "ERROR"; myTextToWrite = "ERROR";
} }
fg = etk::color::color_Black; fg = etk::color::black;
if (raw % 2) { if (raw % 2) {
bg = 0xFFFFFF00; bg = 0xFFFFFF00;
} else { } else {

View File

@ -55,7 +55,7 @@ namespace ewol {
class ListFileSystem : public ewol::List class ListFileSystem : public ewol::List
{ {
private: private:
etk::VectorType<ewol::elementFS *> m_list; etk::Vector<ewol::elementFS *> m_list;
etk::UString m_folder; etk::UString m_folder;
int32_t m_selectedLine; int32_t m_selectedLine;
bool m_showFile; bool m_showFile;
@ -66,11 +66,11 @@ namespace ewol {
ListFileSystem(void); ListFileSystem(void);
~ListFileSystem(void); ~ListFileSystem(void);
// display API : // display API :
virtual color_ts GetBasicBG(void); virtual etk::Color GetBasicBG(void);
uint32_t GetNuberOfColomn(void); uint32_t GetNuberOfColomn(void);
bool GetTitle(int32_t colomn, etk::UString &myTitle, color_ts &fg, color_ts &bg); bool GetTitle(int32_t colomn, etk::UString &myTitle, etk::Color &fg, etk::Color &bg);
uint32_t GetNuberOfRaw(void); uint32_t GetNuberOfRaw(void);
bool GetElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, color_ts &fg, color_ts &bg); bool GetElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, etk::Color &fg, etk::Color &bg);
bool OnItemEvent(int32_t IdInput, ewol::eventInputType_te typeEvent, int32_t colomn, int32_t raw, float x, float y); 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 * @brief Get the current Object type of the EObject

View File

@ -64,7 +64,7 @@ namespace ewol {
virtual void SubWidgetRemove(ewol::Widget* newWidget); virtual void SubWidgetRemove(ewol::Widget* newWidget);
virtual void SubWidgetUnLink(ewol::Widget* newWidget); virtual void SubWidgetUnLink(ewol::Widget* newWidget);
private: private:
etk::VectorType<MenuElement*> m_listElement; etk::Vector<MenuElement*> m_listElement;
int32_t m_staticId; // unique ID for every element of the menu ... int32_t m_staticId; // unique ID for every element of the menu ...
ewol::ContextMenu* m_widgetContextMenu; ewol::ContextMenu* m_widgetContextMenu;
public: public:

View File

@ -36,12 +36,12 @@ ewol::PopUp::PopUp(void) :
m_userExpendX = true; m_userExpendX = true;
m_userExpendY = true; m_userExpendY = true;
m_colorBackGroung = etk::color::color_White; m_colorBackGroung = etk::color::white;
m_colorEmptyArea = etk::color::color_Black; m_colorEmptyArea = etk::color::black;
m_colorEmptyArea.alpha = 0x7F; m_colorEmptyArea.alpha = 0x7F;
m_colorBorder = etk::color::color_Black; m_colorBorder = etk::color::black;
m_colorBorder.alpha = 0x7F; m_colorBorder.alpha = 0x7F;
m_subWidget = 0; m_subWidget = 0;

View File

@ -51,9 +51,9 @@ namespace ewol {
virtual void SetExpendY(bool newExpend=false); virtual void SetExpendY(bool newExpend=false);
void SetDisplayRatio(float ratio); void SetDisplayRatio(float ratio);
private: private:
color_ts m_colorBackGroung; etk::Color m_colorBackGroung;
color_ts m_colorBorder; etk::Color m_colorBorder;
color_ts m_colorEmptyArea; etk::Color m_colorEmptyArea;
ewol::Widget* m_subWidgetNext; ewol::Widget* m_subWidgetNext;
ewol::Widget* m_subWidget; ewol::Widget* m_subWidget;
float m_displayRatio; float m_displayRatio;

View File

@ -36,14 +36,11 @@ ewol::ProgressBar::ProgressBar(void)
{ {
m_value = 0.0; m_value = 0.0;
m_textColorFg = etk::color::color_Black; m_textColorFg = etk::color::black;
m_textColorBgOn.red = 0; m_textColorBgOn = 0x00FF00FF;
m_textColorBgOn.green = 0xFF;
m_textColorBgOn.blue = 0;
m_textColorBgOn.alpha = 0xFF;
m_textColorBgOff = etk::color::color_Black; m_textColorBgOff = etk::color::black;
m_textColorBgOff.alpha = 0x3F; m_textColorBgOff.alpha = 0x3F;
SetCanHaveFocus(true); SetCanHaveFocus(true);
} }

View File

@ -46,12 +46,12 @@ namespace ewol {
virtual bool CalculateMinSize(void); virtual bool CalculateMinSize(void);
void ValueSet(float val); void ValueSet(float val);
float ValueGet(void); float ValueGet(void);
void SetColor(color_ts newColor) { m_textColorFg = newColor; }; void SetColor(etk::Color newColor) { m_textColorFg = newColor; };
private: private:
float m_value; //!< % used float m_value; //!< % used
color_ts m_textColorFg; //!< forder bar color etk::Color m_textColorFg; //!< forder bar color
color_ts m_textColorBgOn; //!< bar color enable etk::Color m_textColorBgOn; //!< bar color enable
color_ts m_textColorBgOff; //!< bar color disable etk::Color m_textColorBgOff; //!< bar color disable
public: public:
virtual void OnRegenerateDisplay(void); virtual void OnRegenerateDisplay(void);
}; };

View File

@ -158,7 +158,7 @@ void ewol::SizerHori::LockExpendContamination(bool lockExpend)
m_lockExpendContamination = lockExpend; m_lockExpendContamination = lockExpend;
} }
//etk::VectorType<ewol::Widget*> m_subWidget[m_currentCreateId]; //etk::Vector<ewol::Widget*> m_subWidget[m_currentCreateId];
void ewol::SizerHori::SubWidgetRemoveAll(void) void ewol::SizerHori::SubWidgetRemoveAll(void)
{ {

View File

@ -54,7 +54,7 @@ namespace ewol {
void LockExpendContamination(bool lockExpend=false); void LockExpendContamination(bool lockExpend=false);
private: private:
bool m_lockExpendContamination; bool m_lockExpendContamination;
etk::VectorType<ewol::Widget*> m_subWidget; etk::Vector<ewol::Widget*> m_subWidget;
public: public:
virtual void SubWidgetRemoveAll(void); virtual void SubWidgetRemoveAll(void);
virtual void SubWidgetAdd(ewol::Widget* newWidget); virtual void SubWidgetAdd(ewol::Widget* newWidget);

View File

@ -161,7 +161,7 @@ void ewol::SizerVert::LockExpendContamination(bool lockExpend)
m_lockExpendContamination = lockExpend; m_lockExpendContamination = lockExpend;
} }
//etk::VectorType<ewol::Widget*> m_SubWidget; //etk::Vector<ewol::Widget*> m_SubWidget;
void ewol::SizerVert::SubWidgetRemoveAll(void) void ewol::SizerVert::SubWidgetRemoveAll(void)
{ {

View File

@ -53,7 +53,7 @@ namespace ewol {
void LockExpendContamination(bool lockExpend=false); void LockExpendContamination(bool lockExpend=false);
private: private:
bool m_lockExpendContamination; bool m_lockExpendContamination;
etk::VectorType<ewol::Widget*> m_subWidget; etk::Vector<ewol::Widget*> m_subWidget;
public: public:
virtual void SubWidgetRemoveAll(void); virtual void SubWidgetRemoveAll(void);
virtual void SubWidgetAdd(ewol::Widget* newWidget); virtual void SubWidgetAdd(ewol::Widget* newWidget);

View File

@ -45,11 +45,9 @@ ewol::Slider::Slider(void)
m_min = 0; m_min = 0;
m_max = 10; m_max = 10;
m_textColorFg = etk::color::color_Black; m_textColorFg = etk::color::black;
m_textColorBg.red = 0; m_textColorBg = etk::color::black;
m_textColorBg.green = 0;
m_textColorBg.blue = 0;
m_textColorBg.alpha = 0x3F; m_textColorBg.alpha = 0x3F;
SetCanHaveFocus(true); SetCanHaveFocus(true);
} }
@ -109,7 +107,7 @@ void ewol::Slider::OnRegenerateDisplay(void)
tmpOObjects->SetColor(m_textColorFg); tmpOObjects->SetColor(m_textColorFg);
// draw a line : // draw a line :
tmpOObjects->Line(dotRadius, m_size.y/2, m_size.x-dotRadius, m_size.y/2, 1); tmpOObjects->Line(dotRadius, m_size.y/2, m_size.x-dotRadius, m_size.y/2, 1);
color_ts borderDot = m_textColorFg; etk::Color borderDot = m_textColorFg;
borderDot.alpha /= 2; borderDot.alpha /= 2;
tmpOObjects->SetColor(borderDot); 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); tmpOObjects->Disc(4+((float)(m_value-m_min)/(float)(m_max-m_min))*(float)(m_size.x-2*dotRadius), m_size.y/2, dotRadius);

View File

@ -49,13 +49,13 @@ namespace ewol {
int32_t GetValue(void); int32_t GetValue(void);
void SetMin(int32_t val); void SetMin(int32_t val);
void SetMax(int32_t val); void SetMax(int32_t val);
void SetColor(color_ts newColor) { m_textColorFg = newColor; }; void SetColor(etk::Color newColor) { m_textColorFg = newColor; };
private: private:
int32_t m_value; int32_t m_value;
int32_t m_min; int32_t m_min;
int32_t m_max; int32_t m_max;
color_ts m_textColorFg; //!< Text color etk::Color m_textColorFg; //!< Text color
color_ts m_textColorBg; //!< Background color etk::Color m_textColorBg; //!< Background color
public: public:
virtual void OnRegenerateDisplay(void); virtual void OnRegenerateDisplay(void);
public: public:

View File

@ -53,10 +53,10 @@ namespace ewol {
*/ */
virtual ewol::Widget * GetWidgetAtPos(Vector2D<float> pos) { return NULL; }; virtual ewol::Widget * GetWidgetAtPos(Vector2D<float> pos) { return NULL; };
virtual void OnRegenerateDisplay(void); virtual void OnRegenerateDisplay(void);
void SetColor(color_ts newColor) { m_color = newColor; MarkToRedraw(); }; void SetColor(etk::Color newColor) { m_color = newColor; MarkToRedraw(); };
private: private:
float m_localSize; float m_localSize;
color_ts m_color; etk::Color m_color;
}; };
}; };

View File

@ -140,7 +140,7 @@ void ewol::WSlider::LockExpendContamination(bool lockExpend)
m_lockExpendContamination = lockExpend; m_lockExpendContamination = lockExpend;
} }
//etk::VectorType<ewol::Widget*> m_SubWidget; //etk::Vector<ewol::Widget*> m_SubWidget;
void ewol::WSlider::SubWidgetRemoveAll(void) void ewol::WSlider::SubWidgetRemoveAll(void)
{ {

View File

@ -53,7 +53,7 @@ namespace ewol {
void LockExpendContamination(bool lockExpend=false); void LockExpendContamination(bool lockExpend=false);
private: private:
bool m_lockExpendContamination; bool m_lockExpendContamination;
etk::VectorType<ewol::Widget*> m_subWidget; etk::Vector<ewol::Widget*> m_subWidget;
int32_t m_windowsSources; // widget source viewed int32_t m_windowsSources; // widget source viewed
int32_t m_windowsDestination; // widget destinated viewed int32_t m_windowsDestination; // widget destinated viewed
int32_t m_slidingProgress; // ratio progression of a sliding int32_t m_slidingProgress; // ratio progression of a sliding

View File

@ -47,7 +47,7 @@ namespace ewol {
class WidgetScrooled : public ewol::Widget class WidgetScrooled : public ewol::Widget
{ {
private: private:
etk::VectorType<ewol::OObject*> m_listOObject; //!< generic element to display... etk::Vector<ewol::OObject*> m_listOObject; //!< generic element to display...
void AddOObject(ewol::OObject* newObject, int32_t pos=-1); void AddOObject(ewol::OObject* newObject, int32_t pos=-1);
void ClearOObjectList(void); void ClearOObjectList(void);
protected: protected:

View File

@ -29,7 +29,7 @@
#include <ewol/widget/Spacer.h> #include <ewol/widget/Spacer.h>
#include <ewol/WidgetManager.h> #include <ewol/WidgetManager.h>
//#include <etk/Vector.h> //#include <etk/Vector.h>
#include <etk/VectorType.h> #include <etk/Vector.h>
extern "C" { extern "C" {
// file browsing ... // file browsing ...
@ -71,8 +71,8 @@ ewol::ColorChooser::ColorChooser(void)
*/ */
SubWidgetAdd(m_widgetColorBar); SubWidgetAdd(m_widgetColorBar);
color_ts sliderColor; etk::Color sliderColor;
sliderColor = etk::color::color_Black; sliderColor = etk::color::black;
m_widgetRed = new ewol::Slider(); m_widgetRed = new ewol::Slider();
m_widgetRed->RegisterOnEvent(this, ewolEventSliderChange, eventColorSpecificHasChange); m_widgetRed->RegisterOnEvent(this, ewolEventSliderChange, eventColorSpecificHasChange);
@ -80,18 +80,16 @@ ewol::ColorChooser::ColorChooser(void)
m_widgetRed->SetFillX(true); m_widgetRed->SetFillX(true);
m_widgetRed->SetMin(0); m_widgetRed->SetMin(0);
m_widgetRed->SetMax(255); m_widgetRed->SetMax(255);
sliderColor.red = 0xFF; sliderColor = 0xFF0000FF;
m_widgetRed->SetColor(sliderColor); m_widgetRed->SetColor(sliderColor);
sliderColor.red = 0;
SubWidgetAdd(m_widgetRed); SubWidgetAdd(m_widgetRed);
m_widgetGreen = new ewol::Slider(); m_widgetGreen = new ewol::Slider();
m_widgetGreen->RegisterOnEvent(this, ewolEventSliderChange, eventColorSpecificHasChange); m_widgetGreen->RegisterOnEvent(this, ewolEventSliderChange, eventColorSpecificHasChange);
m_widgetGreen->SetExpendX(true); m_widgetGreen->SetExpendX(true);
m_widgetGreen->SetFillX(true); m_widgetGreen->SetFillX(true);
m_widgetGreen->SetMin(0); m_widgetGreen->SetMin(0);
sliderColor.green = 0xFF; sliderColor = 0x00FF00FF;
m_widgetGreen->SetColor(sliderColor); m_widgetGreen->SetColor(sliderColor);
sliderColor.green = 0;
m_widgetGreen->SetMax(255); m_widgetGreen->SetMax(255);
SubWidgetAdd(m_widgetGreen); SubWidgetAdd(m_widgetGreen);
m_widgetBlue = new ewol::Slider(); m_widgetBlue = new ewol::Slider();
@ -99,9 +97,8 @@ ewol::ColorChooser::ColorChooser(void)
m_widgetBlue->SetExpendX(true); m_widgetBlue->SetExpendX(true);
m_widgetBlue->SetFillX(true); m_widgetBlue->SetFillX(true);
m_widgetBlue->SetMin(0); m_widgetBlue->SetMin(0);
sliderColor.blue = 0xFF; sliderColor = 0x0000FFFF;
m_widgetBlue->SetColor(sliderColor); m_widgetBlue->SetColor(sliderColor);
sliderColor.blue = 0;
m_widgetBlue->SetMax(255); m_widgetBlue->SetMax(255);
SubWidgetAdd(m_widgetBlue); SubWidgetAdd(m_widgetBlue);
m_widgetAlpha = new ewol::Slider(); m_widgetAlpha = new ewol::Slider();
@ -112,7 +109,7 @@ ewol::ColorChooser::ColorChooser(void)
m_widgetAlpha->SetMax(255); m_widgetAlpha->SetMax(255);
SubWidgetAdd(m_widgetAlpha); SubWidgetAdd(m_widgetAlpha);
m_currentColor = etk::color::color_White; m_currentColor = etk::color::white;
} }
@ -122,7 +119,7 @@ ewol::ColorChooser::~ColorChooser(void)
} }
void ewol::ColorChooser::SetColor(color_ts newColor) void ewol::ColorChooser::SetColor(etk::Color newColor)
{ {
m_currentColor = newColor; m_currentColor = newColor;
if (NULL != m_widgetRed) { if (NULL != m_widgetRed) {
@ -143,7 +140,7 @@ void ewol::ColorChooser::SetColor(color_ts newColor)
} }
color_ts ewol::ColorChooser::GetColor(void) etk::Color ewol::ColorChooser::GetColor(void)
{ {
return m_currentColor; return m_currentColor;
} }
@ -164,7 +161,7 @@ void ewol::ColorChooser::OnReceiveMessage(ewol::EObject * CallerObject, const ch
//EWOL_INFO("Receive Extern Event ... : widgetPointer=" << CallerObject << "\"" << eventId << "\" ==> data=\"" << data << "\"" ); //EWOL_INFO("Receive Extern Event ... : widgetPointer=" << CallerObject << "\"" << eventId << "\" ==> data=\"" << data << "\"" );
if (eventColorBarHasChange == eventId) { if (eventColorBarHasChange == eventId) {
//==> colorBar has change ... //==> colorBar has change ...
float tmpAlpha = m_currentColor.alpha; uint8_t tmpAlpha = m_currentColor.alpha;
// the colorbar has no notion of the alpha ==> keep it ... // the colorbar has no notion of the alpha ==> keep it ...
if (NULL != m_widgetColorBar) { if (NULL != m_widgetColorBar) {
m_currentColor = m_widgetColorBar->GetCurrentColor(); m_currentColor = m_widgetColorBar->GetCurrentColor();

View File

@ -66,15 +66,15 @@ namespace ewol {
*/ */
virtual void OnObjectRemove(ewol::EObject * removeObject); virtual void OnObjectRemove(ewol::EObject * removeObject);
void SetColor(color_ts newColor); void SetColor(etk::Color newColor);
color_ts GetColor(void); etk::Color GetColor(void);
private:; private:;
ewol::ColorBar* m_widgetColorBar; ewol::ColorBar* m_widgetColorBar;
ewol::Slider* m_widgetRed; ewol::Slider* m_widgetRed;
ewol::Slider* m_widgetGreen; ewol::Slider* m_widgetGreen;
ewol::Slider* m_widgetBlue; ewol::Slider* m_widgetBlue;
ewol::Slider* m_widgetAlpha; ewol::Slider* m_widgetAlpha;
color_ts m_currentColor; etk::Color m_currentColor;
}; };
}; };

View File

@ -30,7 +30,7 @@
#include <ewol/widget/Image.h> #include <ewol/widget/Image.h>
#include <ewol/WidgetManager.h> #include <ewol/WidgetManager.h>
//#include <etk/Vector.h> //#include <etk/Vector.h>
#include <etk/VectorType.h> #include <etk/Vector.h>
extern "C" { extern "C" {
// file browsing ... // file browsing ...
@ -354,7 +354,7 @@ void ewol::FileChooser::OnReceiveMessage(ewol::EObject * CallerObject, const cha
char * ok; char * ok;
EWOL_DEBUG("new PATH : \"" << m_folder << "\""); EWOL_DEBUG("new PATH : \"" << m_folder << "\"");
ok = realpath(m_folder.Utf8Data(), buf); ok = realpath(m_folder.c_str(), buf);
if (!ok) { if (!ok) {
EWOL_ERROR("Error to get the real path"); EWOL_ERROR("Error to get the real path");
m_folder = "/"; m_folder = "/";
@ -387,7 +387,7 @@ void ewol::FileChooser::OnReceiveMessage(ewol::EObject * CallerObject, const cha
char * ok; char * ok;
EWOL_DEBUG("new PATH : \"" << tmpUserFolder << "\""); EWOL_DEBUG("new PATH : \"" << tmpUserFolder << "\"");
ok = realpath(tmpUserFolder.Utf8Data(), buf); ok = realpath(tmpUserFolder.c_str(), buf);
if (!ok) { if (!ok) {
EWOL_ERROR("Error to get the real path"); EWOL_ERROR("Error to get the real path");
m_folder = "/"; m_folder = "/";

View File

@ -29,7 +29,7 @@
#include <ewol/widget/Spacer.h> #include <ewol/widget/Spacer.h>
#include <ewol/widget/Image.h> #include <ewol/widget/Image.h>
#include <ewol/WidgetManager.h> #include <ewol/WidgetManager.h>
#include <etk/VectorType.h> #include <etk/Vector.h>
#include <ewol/ewol.h> #include <ewol/ewol.h>
@ -203,7 +203,7 @@ void ewol::Parameter::OnReceiveMessage(ewol::EObject * CallerObject, const char
} else if (eventId == l_eventMenuSelected) { } else if (eventId == l_eventMenuSelected) {
if (NULL != m_wSlider) { if (NULL != m_wSlider) {
int32_t value = 0; int32_t value = 0;
sscanf(data.Utf8Data(), "%d", &value); sscanf(data.c_str(), "%d", &value);
EWOL_DEBUG("event on the parameter : " << eventId << " select ID=" << value << ""); EWOL_DEBUG("event on the parameter : " << eventId << " select ID=" << value << "");
m_wSlider->SubWidgetSelectSet(value); m_wSlider->SubWidgetSelectSet(value);
} }

View File

@ -148,7 +148,7 @@ void ewol::ParameterList::OnRegenerateDisplay(void)
m_maxSize.y = (minHeight + 2*m_paddingSizeY) * nbRaw; m_maxSize.y = (minHeight + 2*m_paddingSizeY) * nbRaw;
etk::VectorType<int32_t> listSizeColomn; etk::Vector<int32_t> listSizeColomn;
// set background color : // set background color :
ewol::OObject2DColored * BGOObjects = new ewol::OObject2DColored(); ewol::OObject2DColored * BGOObjects = new ewol::OObject2DColored();
@ -176,7 +176,7 @@ void ewol::ParameterList::OnRegenerateDisplay(void)
for(int32_t iii=startRaw; iii<nbRaw && iii<(startRaw+displayableRaw); iii++) { for(int32_t iii=startRaw; iii<nbRaw && iii<(startRaw+displayableRaw); iii++) {
etk::UString myTextToWrite = "???"; etk::UString myTextToWrite = "???";
color_ts fg(0x000000FF); etk::Color fg(0x000000FF);
if (m_list[iii] != NULL) { if (m_list[iii] != NULL) {
myTextToWrite = m_list[iii]->m_label; myTextToWrite = m_list[iii]->m_label;
} }

View File

@ -55,7 +55,7 @@ namespace ewol {
{ {
private: private:
int32_t m_idSelected; int32_t m_idSelected;
etk::VectorType<ewol::elementPL *> m_list; etk::Vector<ewol::elementPL *> m_list;
public: public:
ParameterList(void); ParameterList(void);
/** /**
@ -70,7 +70,7 @@ namespace ewol {
void SetLabel(etk::UString newLabel); void SetLabel(etk::UString newLabel);
// Drawing capabilities .... // Drawing capabilities ....
private: private:
etk::VectorType<ewol::OObject*> m_listOObject; //!< generic element to display... etk::Vector<ewol::OObject*> m_listOObject; //!< generic element to display...
public: public:
void AddOObject(ewol::OObject* newObject, int32_t pos=-1); void AddOObject(ewol::OObject* newObject, int32_t pos=-1);
void ClearOObjectList(void); void ClearOObjectList(void);

View File

@ -29,7 +29,7 @@
#include <ewol/widget/Spacer.h> #include <ewol/widget/Spacer.h>
#include <ewol/widget/Label.h> #include <ewol/widget/Label.h>
#include <ewol/WidgetManager.h> #include <ewol/WidgetManager.h>
#include <etk/VectorType.h> #include <etk/Vector.h>
#undef __class__ #undef __class__

@ -1 +1 @@
Subproject commit fa80d21d573ca2a349e9b23a5bc79f5e67bcf5f8 Subproject commit e2597ef3153d850c3f5e9f0b4a58e86141c56693