6 * This file is part of the w32api package.
\r
9 * Created by Markus Koenig <markus@stber-koenig.de>
\r
11 * THIS SOFTWARE IS NOT COPYRIGHTED
\r
13 * This source code is offered for use in the public domain. You may
\r
14 * use, modify or distribute it freely.
\r
16 * This code is distributed in the hope that it will be useful but
\r
17 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
\r
18 * DISCLAIMED. This includes but is not limited to warranties of
\r
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
\r
23 #ifndef __GDIPLUS_COLOR_H
\r
24 #define __GDIPLUS_COLOR_H
\r
26 #pragma GCC system_header
\r
29 typedef enum ColorChannelFlags {
\r
30 ColorChannelFlagsC = 0,
\r
31 ColorChannelFlagsM = 1,
\r
32 ColorChannelFlagsY = 2,
\r
33 ColorChannelFlagsK = 3,
\r
34 ColorChannelFlagsLast = 4
\r
35 } ColorChannelFlags;
\r
37 typedef struct Color
\r
46 friend class Bitmap;
\r
47 friend class Graphics;
\r
48 friend class HatchBrush;
\r
49 friend class PathGradientBrush;
\r
51 friend class SolidBrush;
\r
53 static ARGB MakeARGB(BYTE a, BYTE r, BYTE g, BYTE b)
\r
55 return (ARGB) ((((DWORD) a) << 24) | (((DWORD) r) << 16)
\r
56 | (((DWORD) g) << 8) | ((DWORD) b));
\r
59 static const ARGB AlphaMask = 0xFF000000UL;
\r
61 static const ARGB AliceBlue = 0xFFF0F8FFUL;
\r
62 static const ARGB AntiqueWhite = 0xFFFAEBD7UL;
\r
63 static const ARGB Aqua = 0xFF00FFFFUL;
\r
64 static const ARGB Aquamarine = 0xFF7FFFD4UL;
\r
65 static const ARGB Azure = 0xFFF0FFFFUL;
\r
66 static const ARGB Beige = 0xFFF5F5DCUL;
\r
67 static const ARGB Bisque = 0xFFFFE4C4UL;
\r
68 static const ARGB Black = 0xFF000000UL;
\r
69 static const ARGB BlanchedAlmond = 0xFFFFEBCDUL;
\r
70 static const ARGB Blue = 0xFF0000FFUL;
\r
71 static const ARGB BlueViolet = 0xFF8A2BE2UL;
\r
72 static const ARGB Brown = 0xFFA52A2AUL;
\r
73 static const ARGB BurlyWood = 0xFFDEB887UL;
\r
74 static const ARGB CadetBlue = 0xFF5F9EA0UL;
\r
75 static const ARGB Chartreuse = 0xFF7FFF00UL;
\r
76 static const ARGB Chocolate = 0xFFD2691EUL;
\r
77 static const ARGB Coral = 0xFFFF7F50UL;
\r
78 static const ARGB CornflowerBlue = 0xFF6495EDUL;
\r
79 static const ARGB Cornsilk = 0xFFFFF8DCUL;
\r
80 static const ARGB Crimson = 0xFFDC143CUL;
\r
81 static const ARGB Cyan = 0xFF00FFFFUL;
\r
82 static const ARGB DarkBlue = 0xFF00008BUL;
\r
83 static const ARGB DarkCyan = 0xFF008B8BUL;
\r
84 static const ARGB DarkGoldenrod = 0xFFB8860BUL;
\r
85 static const ARGB DarkGray = 0xFFA9A9A9UL;
\r
86 static const ARGB DarkGreen = 0xFF006400UL;
\r
87 static const ARGB DarkKhaki = 0xFFBDB76BUL;
\r
88 static const ARGB DarkMagenta = 0xFF8B008BUL;
\r
89 static const ARGB DarkOliveGreen = 0xFF556B2FUL;
\r
90 static const ARGB DarkOrange = 0xFFFF8C00UL;
\r
91 static const ARGB DarkOrchid = 0xFF9932CCUL;
\r
92 static const ARGB DarkRed = 0xFF8B0000UL;
\r
93 static const ARGB DarkSalmon = 0xFFE9967AUL;
\r
94 static const ARGB DarkSeaGreen = 0xFF8FBC8FUL;
\r
95 static const ARGB DarkSlateBlue = 0xFF483D8BUL;
\r
96 static const ARGB DarkSlateGray = 0xFF2F4F4FUL;
\r
97 static const ARGB DarkTurquoise = 0xFF00CED1UL;
\r
98 static const ARGB DarkViolet = 0xFF9400D3UL;
\r
99 static const ARGB DeepPink = 0xFFFF1493UL;
\r
100 static const ARGB DeepSkyBlue = 0xFF00BFFFUL;
\r
101 static const ARGB DimGray = 0xFF696969UL;
\r
102 static const ARGB DodgerBlue = 0xFF1E90FFUL;
\r
103 static const ARGB Firebrick = 0xFFB22222UL;
\r
104 static const ARGB FloralWhite = 0xFFFFFAF0UL;
\r
105 static const ARGB ForestGreen = 0xFF228B22UL;
\r
106 static const ARGB Fuchsia = 0xFFFF00FFUL;
\r
107 static const ARGB Gainsboro = 0xFFDCDCDCUL;
\r
108 static const ARGB GhostWhite = 0xFFF8F8FFUL;
\r
109 static const ARGB Gold = 0xFFFFD700UL;
\r
110 static const ARGB Goldenrod = 0xFFDAA520UL;
\r
111 static const ARGB Gray = 0xFF808080UL;
\r
112 static const ARGB Green = 0xFF008000UL;
\r
113 static const ARGB GreenYellow = 0xFFADFF2FUL;
\r
114 static const ARGB Honeydew = 0xFFF0FFF0UL;
\r
115 static const ARGB HotPink = 0xFFFF69B4UL;
\r
116 static const ARGB IndianRed = 0xFFCD5C5CUL;
\r
117 static const ARGB Indigo = 0xFF4B0082UL;
\r
118 static const ARGB Ivory = 0xFFFFFFF0UL;
\r
119 static const ARGB Khaki = 0xFFF0E68CUL;
\r
120 static const ARGB Lavender = 0xFFE6E6FAUL;
\r
121 static const ARGB LavenderBlush = 0xFFFFF0F5UL;
\r
122 static const ARGB LawnGreen = 0xFF7CFC00UL;
\r
123 static const ARGB LemonChiffon = 0xFFFFFACDUL;
\r
124 static const ARGB LightBlue = 0xFFADD8E6UL;
\r
125 static const ARGB LightCoral = 0xFFF08080UL;
\r
126 static const ARGB LightCyan = 0xFFE0FFFFUL;
\r
127 static const ARGB LightGoldenrodYellow = 0xFFFAFAD2UL;
\r
128 static const ARGB LightGray = 0xFFD3D3D3UL;
\r
129 static const ARGB LightGreen = 0xFF90EE90UL;
\r
130 static const ARGB LightPink = 0xFFFFB6C1UL;
\r
131 static const ARGB LightSalmon = 0xFFFFA07AUL;
\r
132 static const ARGB LightSeaGreen = 0xFF20B2AAUL;
\r
133 static const ARGB LightSkyBlue = 0xFF87CEFAUL;
\r
134 static const ARGB LightSlateGray = 0xFF778899UL;
\r
135 static const ARGB LightSteelBlue = 0xFFB0C4DEUL;
\r
136 static const ARGB LightYellow = 0xFFFFFFE0UL;
\r
137 static const ARGB Lime = 0xFF00FF00UL;
\r
138 static const ARGB LimeGreen = 0xFF32CD32UL;
\r
139 static const ARGB Linen = 0xFFFAF0E6UL;
\r
140 static const ARGB Magenta = 0xFFFF00FFUL;
\r
141 static const ARGB Maroon = 0xFF800000UL;
\r
142 static const ARGB MediumAquamarine = 0xFF66CDAAUL;
\r
143 static const ARGB MediumBlue = 0xFF0000CDUL;
\r
144 static const ARGB MediumOrchid = 0xFFBA55D3UL;
\r
145 static const ARGB MediumPurple = 0xFF9370DBUL;
\r
146 static const ARGB MediumSeaGreen = 0xFF3CB371UL;
\r
147 static const ARGB MediumSlateBlue = 0xFF7B68EEUL;
\r
148 static const ARGB MediumSpringGreen = 0xFF00FA9AUL;
\r
149 static const ARGB MediumTurquoise = 0xFF48D1CCUL;
\r
150 static const ARGB MediumVioletRed = 0xFFC71585UL;
\r
151 static const ARGB MidnightBlue = 0xFF191970UL;
\r
152 static const ARGB MintCream = 0xFFF5FFFAUL;
\r
153 static const ARGB MistyRose = 0xFFFFE4E1UL;
\r
154 static const ARGB Moccasin = 0xFFFFE4B5UL;
\r
155 static const ARGB NavajoWhite = 0xFFFFDEADUL;
\r
156 static const ARGB Navy = 0xFF000080UL;
\r
157 static const ARGB OldLace = 0xFFFDF5E6UL;
\r
158 static const ARGB Olive = 0xFF808000UL;
\r
159 static const ARGB OliveDrab = 0xFF6B8E23UL;
\r
160 static const ARGB Orange = 0xFFFFA500UL;
\r
161 static const ARGB OrangeRed = 0xFFFF4500UL;
\r
162 static const ARGB Orchid = 0xFFDA70D6UL;
\r
163 static const ARGB PaleGoldenrod = 0xFFEEE8AAUL;
\r
164 static const ARGB PaleGreen = 0xFF98FB98UL;
\r
165 static const ARGB PaleTurquoise = 0xFFAFEEEEUL;
\r
166 static const ARGB PaleVioletRed = 0xFFDB7093UL;
\r
167 static const ARGB PapayaWhip = 0xFFFFEFD5UL;
\r
168 static const ARGB PeachPuff = 0xFFFFDAB9UL;
\r
169 static const ARGB Peru = 0xFFCD853FUL;
\r
170 static const ARGB Pink = 0xFFFFC0CBUL;
\r
171 static const ARGB Plum = 0xFFDDA0DDUL;
\r
172 static const ARGB PowderBlue = 0xFFB0E0E6UL;
\r
173 static const ARGB Purple = 0xFF800080UL;
\r
174 static const ARGB Red = 0xFFFF0000UL;
\r
175 static const ARGB RosyBrown = 0xFFBC8F8FUL;
\r
176 static const ARGB RoyalBlue = 0xFF4169E1UL;
\r
177 static const ARGB SaddleBrown = 0xFF8B4513UL;
\r
178 static const ARGB Salmon = 0xFFFA8072UL;
\r
179 static const ARGB SandyBrown = 0xFFF4A460UL;
\r
180 static const ARGB SeaGreen = 0xFF2E8B57UL;
\r
181 static const ARGB SeaShell = 0xFFFFF5EEUL;
\r
182 static const ARGB Sienna = 0xFFA0522DUL;
\r
183 static const ARGB Silver = 0xFFC0C0C0UL;
\r
184 static const ARGB SkyBlue = 0xFF87CEEBUL;
\r
185 static const ARGB SlateBlue = 0xFF6A5ACDUL;
\r
186 static const ARGB SlateGray = 0xFF708090UL;
\r
187 static const ARGB Snow = 0xFFFFFAFAUL;
\r
188 static const ARGB SpringGreen = 0xFF00FF7FUL;
\r
189 static const ARGB SteelBlue = 0xFF4682B4UL;
\r
190 static const ARGB Tan = 0xFFD2B48CUL;
\r
191 static const ARGB Teal = 0xFF008080UL;
\r
192 static const ARGB Thistle = 0xFFD8BFD8UL;
\r
193 static const ARGB Tomato = 0xFFFF6347UL;
\r
194 static const ARGB Transparent = 0x00FFFFFFUL;
\r
195 static const ARGB Turquoise = 0xFF40E0D0UL;
\r
196 static const ARGB Violet = 0xFFEE82EEUL;
\r
197 static const ARGB Wheat = 0xFFF5DEB3UL;
\r
198 static const ARGB White = 0xFFFFFFFFUL;
\r
199 static const ARGB WhiteSmoke = 0xFFF5F5F5UL;
\r
200 static const ARGB Yellow = 0xFFFFFF00UL;
\r
201 static const ARGB YellowGreen = 0xFF9ACD32UL;
\r
203 Color(): Value(0xFF000000) {}
\r
204 Color(ARGB argb): Value(argb) {}
\r
205 Color(BYTE r, BYTE g, BYTE b): Value(MakeARGB(0xFF, r, g, b)) {}
\r
206 Color(BYTE a, BYTE r, BYTE g, BYTE b): Value(MakeARGB(a, r, g, b)) {}
\r
210 return (BYTE) (Value >> 24);
\r
212 BYTE GetAlpha() const
\r
214 return (BYTE) (Value >> 24);
\r
218 return (BYTE) Value;
\r
220 BYTE GetBlue() const
\r
222 return (BYTE) Value;
\r
226 return (BYTE) (Value >> 8);
\r
228 BYTE GetGreen() const
\r
230 return (BYTE) (Value >> 8);
\r
234 return (BYTE) (Value >> 16);
\r
236 BYTE GetRed() const
\r
238 return (BYTE) (Value >> 16);
\r
240 ARGB GetValue() const
\r
244 VOID SetFromCOLORREF(COLORREF rgb)
\r
246 BYTE r = (BYTE) rgb;
\r
247 BYTE g = (BYTE) (rgb >> 8);
\r
248 BYTE b = (BYTE) (rgb >> 16);
\r
249 Value = MakeARGB(0xFF, r, g, b);
\r
251 VOID SetValue(ARGB argb)
\r
255 COLORREF ToCOLORREF() const
\r
257 return RGB(GetRed(), GetGreen(), GetBlue());
\r
259 #endif /* __cplusplus */
\r
262 #endif /* __GDIPLUS_COLOR_H */
\r