Commit 1317047d authored by Iulian Gheorghiu's avatar Iulian Gheorghiu

Fix the color mapping for microsontrollers that has the integer as 16 bit long,…

Fix the color mapping for microsontrollers that has the integer as 16 bit long, for example ATmega-ATxmega
parent ea8e1380
......@@ -97,6 +97,9 @@ typedef char* string;
* Graphic definitions.
*/
#define COLOR_CONVERSION_32_TO_16(COLOR_32) \
(unsigned short)(((((unsigned long)COLOR_32 >> 19) & 0x1F) << 11) | (((COLOR_32 >> 10) & 0x3F) << 5) | ((COLOR_32 >> 3) & 0x1F))
typedef struct {
struct {
gfx_s32 X;
......@@ -111,6 +114,7 @@ typedef struct {
class Color {
public:
enum {
#if (__SIZEOF_INT__ == 4)
AliceBlue = 0x00F0F8FF,
AntiqueWhite = 0x00FAEBD7,
Aqua = 0x0000FFFF,
......@@ -251,6 +255,148 @@ public:
WhiteSmoke = 0x00F5F5F5,
Yellow = 0x00FFFF00,
YellowGreen = 0x009ACD32,
#else
AliceBlue = COLOR_CONVERSION_32_TO_16(0x00F0F8FF),
AntiqueWhite = COLOR_CONVERSION_32_TO_16(0x00FAEBD7),
Aqua = COLOR_CONVERSION_32_TO_16(0x0000FFFF),
Aquamarine = COLOR_CONVERSION_32_TO_16(0x007FFFD4),
Azure = COLOR_CONVERSION_32_TO_16(0x00F0FFFF),
Beige = COLOR_CONVERSION_32_TO_16(0x00F5F5DC),
Bisque = COLOR_CONVERSION_32_TO_16(0x00FFE4C4),
Black = COLOR_CONVERSION_32_TO_16(0x00000000),
BlanchedAlmond = COLOR_CONVERSION_32_TO_16(0x00FFEBCD),
Blue = COLOR_CONVERSION_32_TO_16(0x000000FF),
BlueViolet = COLOR_CONVERSION_32_TO_16(0x008A2BE2),
Brown = COLOR_CONVERSION_32_TO_16(0x00A52A2A),
BurlyWood = COLOR_CONVERSION_32_TO_16(0x00DEB887),
CadetBlue = COLOR_CONVERSION_32_TO_16(0x005F9EA0),
Chartreuse = COLOR_CONVERSION_32_TO_16(0x007FFF00),
Chocolate = COLOR_CONVERSION_32_TO_16(0x00D2691E),
Coral = COLOR_CONVERSION_32_TO_16(0x00FF7F50),
CornflowerBlue = COLOR_CONVERSION_32_TO_16(0x006495ED),
Cornsilk = COLOR_CONVERSION_32_TO_16(0x00FFF8DC),
Crimson = COLOR_CONVERSION_32_TO_16(0x00DC143C),
Cyan = COLOR_CONVERSION_32_TO_16(0x0000FFFF),
DarkBlue = COLOR_CONVERSION_32_TO_16(0x0000008B),
DarkCyan = COLOR_CONVERSION_32_TO_16(0x00008B8B),
DarkGoldenrod = COLOR_CONVERSION_32_TO_16(0x00B8860B),
DarkGray = COLOR_CONVERSION_32_TO_16(0x00A9A9A9),
DarkGreen = COLOR_CONVERSION_32_TO_16(0x00006400),
DarkKhaki = COLOR_CONVERSION_32_TO_16(0x00BDB76B),
DarkMagenta = COLOR_CONVERSION_32_TO_16(0x008B008B),
DarkOliveGreen = COLOR_CONVERSION_32_TO_16(0x00556B2F),
DarkOrange = COLOR_CONVERSION_32_TO_16(0x00FF8C00),
DarkOrchid = COLOR_CONVERSION_32_TO_16(0x009932CC),
DarkRed = COLOR_CONVERSION_32_TO_16(0x008B0000),
DarkSalmon = COLOR_CONVERSION_32_TO_16(0x00E9967A),
DarkSeaGreen = COLOR_CONVERSION_32_TO_16(0x008FBC8F),
DarkSlateBlue = COLOR_CONVERSION_32_TO_16(0x00483D8B),
DarkSlateGray = COLOR_CONVERSION_32_TO_16(0x002F4F4F),
DarkTurquoise = COLOR_CONVERSION_32_TO_16(0x0000CED1),
DarkViolet = COLOR_CONVERSION_32_TO_16(0x009400D3),
DeepPink = COLOR_CONVERSION_32_TO_16(0x00FF1493),
DeepSkyBlue = COLOR_CONVERSION_32_TO_16(0x0000BFFF),
DimGray = COLOR_CONVERSION_32_TO_16(0x00696969),
DodgerBlue = COLOR_CONVERSION_32_TO_16(0x001E90FF),
FireBrick = COLOR_CONVERSION_32_TO_16(0x00B22222),
FloralWhite = COLOR_CONVERSION_32_TO_16(0x00FFFAF0),
ForestGreen = COLOR_CONVERSION_32_TO_16(0x00228B22),
Fuchsia = COLOR_CONVERSION_32_TO_16(0x00FF00FF),
Gainsboro = COLOR_CONVERSION_32_TO_16(0x00DCDCDC),
GhostWhite = COLOR_CONVERSION_32_TO_16(0x00F8F8FF),
Gold = COLOR_CONVERSION_32_TO_16(0x00FFD700),
Goldenrod = COLOR_CONVERSION_32_TO_16(0x00DAA520),
Gray = COLOR_CONVERSION_32_TO_16(0x00808080),
Green = COLOR_CONVERSION_32_TO_16(0x00008000),
GreenYellow = COLOR_CONVERSION_32_TO_16(0x00ADFF2F),
Honeydew = COLOR_CONVERSION_32_TO_16(0x00F0FFF0),
HotPink = COLOR_CONVERSION_32_TO_16(0x00FF69B4),
IndianRed = COLOR_CONVERSION_32_TO_16(0x00CD5C5C),
Indigo = COLOR_CONVERSION_32_TO_16(0x004B0082),
Ivory = COLOR_CONVERSION_32_TO_16(0x00FFFFF0),
Khaki = COLOR_CONVERSION_32_TO_16(0x00F0E68C),
Lavender = COLOR_CONVERSION_32_TO_16(0x00E6E6FA),
LavenderBlush = COLOR_CONVERSION_32_TO_16(0x00FFF0F5),
LawnGreen = COLOR_CONVERSION_32_TO_16(0x007CFC00),
LemonChiffon = COLOR_CONVERSION_32_TO_16(0x00FFFACD),
LightBlue = COLOR_CONVERSION_32_TO_16(0x00ADD8E6),
LightCoral = COLOR_CONVERSION_32_TO_16(0x00F08080),
LightCyan = COLOR_CONVERSION_32_TO_16(0x00E0FFFF),
LightGoldenrodYellow = COLOR_CONVERSION_32_TO_16(0x00FAFAD2),
LightGreen = COLOR_CONVERSION_32_TO_16(0x0090EE90),
LightGrey = COLOR_CONVERSION_32_TO_16(0x00D3D3D3),
LightPink = COLOR_CONVERSION_32_TO_16(0x00FFB6C1),
LightSalmon = COLOR_CONVERSION_32_TO_16(0x00FFA07A),
LightSeaGreen = COLOR_CONVERSION_32_TO_16(0x0020B2AA),
LightSkyBlue = COLOR_CONVERSION_32_TO_16(0x0087CEFA),
LightSlateGray = COLOR_CONVERSION_32_TO_16(0x00778899),
LightSteelBlue = COLOR_CONVERSION_32_TO_16(0x00B0C4DE),
LightYellow = COLOR_CONVERSION_32_TO_16(0x00FFFFE0),
Lime = COLOR_CONVERSION_32_TO_16(0x0000FF00),
LimeGreen = COLOR_CONVERSION_32_TO_16(0x0032CD32),
Linen = COLOR_CONVERSION_32_TO_16(0x00FAF0E6),
Magenta = COLOR_CONVERSION_32_TO_16(0x00FF00FF),
Maroon = COLOR_CONVERSION_32_TO_16(0x00800000),
MediumAquamarine = COLOR_CONVERSION_32_TO_16(0x0066CDAA),
MediumBlue = COLOR_CONVERSION_32_TO_16(0x000000CD),
MediumOrchid = COLOR_CONVERSION_32_TO_16(0x00BA55D3),
MediumPurple = COLOR_CONVERSION_32_TO_16(0x009370DB),
MediumSeaGreen = COLOR_CONVERSION_32_TO_16(0x003CB371),
MediumSlateBlue = COLOR_CONVERSION_32_TO_16(0x007B68EE),
MediumSpringGreen = COLOR_CONVERSION_32_TO_16(0x0000FA9A),
MediumTurquoise = COLOR_CONVERSION_32_TO_16(0x0048D1CC),
MediumVioletRed = COLOR_CONVERSION_32_TO_16(0x00C71585),
MidnightBlue = COLOR_CONVERSION_32_TO_16(0x00191970),
MintCream = COLOR_CONVERSION_32_TO_16(0x00F5FFFA),
MistyRose = COLOR_CONVERSION_32_TO_16(0x00FFE4E1),
Moccasin = COLOR_CONVERSION_32_TO_16(0x00FFE4B5),
NavajoWhite = COLOR_CONVERSION_32_TO_16(0x00FFDEAD),
Navy = COLOR_CONVERSION_32_TO_16(0x00000080),
OldLace = COLOR_CONVERSION_32_TO_16(0x00FDF5E6),
Olive = COLOR_CONVERSION_32_TO_16(0x00808000),
OliveDrab = COLOR_CONVERSION_32_TO_16(0x006B8E23),
Orange = COLOR_CONVERSION_32_TO_16(0x00FFA500),
OrangeRed = COLOR_CONVERSION_32_TO_16(0x00FF4500),
Orchid = COLOR_CONVERSION_32_TO_16(0x00DA70D6),
PaleGoldenrod = COLOR_CONVERSION_32_TO_16(0x00EEE8AA),
PaleGreen = COLOR_CONVERSION_32_TO_16(0x0098FB98),
PaleTurquoise = COLOR_CONVERSION_32_TO_16(0x00AFEEEE),
PaleVioletRed = COLOR_CONVERSION_32_TO_16(0x00DB7093),
PapayaWhip = COLOR_CONVERSION_32_TO_16(0x00FFEFD5),
PeachPuff = COLOR_CONVERSION_32_TO_16(0x00FFDAB9),
Peru = COLOR_CONVERSION_32_TO_16(0x00CD853F),
Pink = COLOR_CONVERSION_32_TO_16(0x00FFC0CB),
Plum = COLOR_CONVERSION_32_TO_16(0x00DDA0DD),
PowderBlue = COLOR_CONVERSION_32_TO_16(0x00B0E0E6),
Purple = COLOR_CONVERSION_32_TO_16(0x00800080),
Red = COLOR_CONVERSION_32_TO_16(0x00FF0000),
RosyBrown = COLOR_CONVERSION_32_TO_16(0x00BC8F8F),
RoyalBlue = COLOR_CONVERSION_32_TO_16(0x004169E1),
SaddleBrown = COLOR_CONVERSION_32_TO_16(0x008B4513),
Salmon = COLOR_CONVERSION_32_TO_16(0x00FA8072),
SandyBrown = COLOR_CONVERSION_32_TO_16(0x00F4A460),
SeaGreen = COLOR_CONVERSION_32_TO_16(0x002E8B57),
Seashell = COLOR_CONVERSION_32_TO_16(0x00FFF5EE),
Sienna = COLOR_CONVERSION_32_TO_16(0x00A0522D),
Silver = COLOR_CONVERSION_32_TO_16(0x00C0C0C0),
SkyBlue = COLOR_CONVERSION_32_TO_16(0x0087CEEB),
SlateBlue = COLOR_CONVERSION_32_TO_16(0x006A5ACD),
SlateGray = COLOR_CONVERSION_32_TO_16(0x00708090),
Snow = COLOR_CONVERSION_32_TO_16(0x00FFFAFA),
SpringGreen = COLOR_CONVERSION_32_TO_16(0x0000FF7F),
SteelBlue = COLOR_CONVERSION_32_TO_16(0x004682B4),
Tan = COLOR_CONVERSION_32_TO_16(0x00D2B48C),
Teal = COLOR_CONVERSION_32_TO_16(0x00008080),
Thistle = COLOR_CONVERSION_32_TO_16(0x00D8BFD8),
Tomato = COLOR_CONVERSION_32_TO_16(0x00FF6347),
Turquoise = COLOR_CONVERSION_32_TO_16(0x0040E0D0),
Violet = COLOR_CONVERSION_32_TO_16(0x00EE82EE),
Wheat = COLOR_CONVERSION_32_TO_16(0x00F5DEB3),
White = COLOR_CONVERSION_32_TO_16(0x00FFFFFF),
WhiteSmoke = COLOR_CONVERSION_32_TO_16(0x00F5F5F5),
Yellow = COLOR_CONVERSION_32_TO_16(0x00FFFF00),
YellowGreen = COLOR_CONVERSION_32_TO_16(0x009ACD32),
#endif
};
typedef union {
struct {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment