Flutter Impeller
color.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef FLUTTER_IMPELLER_GEOMETRY_COLOR_H_
6 #define FLUTTER_IMPELLER_GEOMETRY_COLOR_H_
7 
8 #include <stdint.h>
9 #include <algorithm>
10 #include <array>
11 #include <cstdint>
12 #include <cstdlib>
13 #include <ostream>
14 #include <type_traits>
15 
18 
19 #define IMPELLER_FOR_EACH_BLEND_MODE(V) \
20  V(Clear) \
21  V(Src) \
22  V(Dst) \
23  V(SrcOver) \
24  V(DstOver) \
25  V(SrcIn) \
26  V(DstIn) \
27  V(SrcOut) \
28  V(DstOut) \
29  V(SrcATop) \
30  V(DstATop) \
31  V(Xor) \
32  V(Plus) \
33  V(Modulate) \
34  V(Screen) \
35  V(Overlay) \
36  V(Darken) \
37  V(Lighten) \
38  V(ColorDodge) \
39  V(ColorBurn) \
40  V(HardLight) \
41  V(SoftLight) \
42  V(Difference) \
43  V(Exclusion) \
44  V(Multiply) \
45  V(Hue) \
46  V(Saturation) \
47  V(Color) \
48  V(Luminosity)
49 
50 namespace impeller {
51 
52 struct Vector4;
53 
55 
56 /// All blend modes assume that both the source (fragment output) and
57 /// destination (first color attachment) have colors with premultiplied alpha.
58 enum class BlendMode : uint8_t {
59  // The following blend modes are able to be used as pipeline blend modes or
60  // via `BlendFilterContents`.
61  kClear = 0,
62  kSrc,
63  kDst,
64  kSrcOver,
65  kDstOver,
66  kSrcIn,
67  kDstIn,
68  kSrcOut,
69  kDstOut,
70  kSrcATop,
71  kDstATop,
72  kXor,
73  kPlus,
74  kModulate,
75 
76  // The following blend modes use equations that are not available for
77  // pipelines on most graphics devices without extensions, and so they are
78  // only able to be used via `BlendFilterContents`.
79  kScreen,
80  kOverlay,
81  kDarken,
82  kLighten,
84  kColorBurn,
85  kHardLight,
86  kSoftLight,
88  kExclusion,
89  kMultiply,
90  kHue,
92  kColor,
94 
97 };
98 
99 const char* BlendModeToString(BlendMode blend_mode);
100 
101 /// 4x5 matrix for transforming the color and alpha components of a Bitmap.
102 ///
103 /// [ a, b, c, d, e,
104 /// f, g, h, i, j,
105 /// k, l, m, n, o,
106 /// p, q, r, s, t ]
107 ///
108 /// When applied to a color [R, G, B, A], the resulting color is computed as:
109 ///
110 /// R’ = a*R + b*G + c*B + d*A + e;
111 /// G’ = f*R + g*G + h*B + i*A + j;
112 /// B’ = k*R + l*G + m*B + n*A + o;
113 /// A’ = p*R + q*G + r*B + s*A + t;
114 ///
115 /// That resulting color [R’, G’, B’, A’] then has each channel clamped to the 0
116 /// to 1 range.
117 struct ColorMatrix {
119 };
120 
121 /**
122  * Represents a RGBA color
123  */
124 struct Color {
125  /**
126  * The red color component (0 to 1)
127  */
128  Scalar red = 0.0;
129 
130  /**
131  * The green color component (0 to 1)
132  */
133  Scalar green = 0.0;
134 
135  /**
136  * The blue color component (0 to 1)
137  */
138  Scalar blue = 0.0;
139 
140  /**
141  * The alpha component of the color (0 to 1)
142  */
143  Scalar alpha = 0.0;
144 
145  constexpr Color() {}
146 
147  explicit Color(const Vector4& value);
148 
149  constexpr Color(Scalar r, Scalar g, Scalar b, Scalar a)
150  : red(r), green(g), blue(b), alpha(a) {}
151 
152  static constexpr Color MakeRGBA8(uint8_t r, uint8_t g, uint8_t b, uint8_t a) {
153  return Color(
154  static_cast<Scalar>(r) / 255.0f, static_cast<Scalar>(g) / 255.0f,
155  static_cast<Scalar>(b) / 255.0f, static_cast<Scalar>(a) / 255.0f);
156  }
157 
158  /// @brief Convert this color to a 32-bit representation.
159  static inline uint32_t ToIColor(Color color) {
160  return (((std::lround(color.alpha * 255.0f) & 0xff) << 24) |
161  ((std::lround(color.red * 255.0f) & 0xff) << 16) |
162  ((std::lround(color.green * 255.0f) & 0xff) << 8) |
163  ((std::lround(color.blue * 255.0f) & 0xff) << 0)) &
164  0xFFFFFFFF;
165  }
166 
167  constexpr inline bool operator==(const Color& c) const {
168  return ScalarNearlyEqual(red, c.red) && ScalarNearlyEqual(green, c.green) &&
169  ScalarNearlyEqual(blue, c.blue) && ScalarNearlyEqual(alpha, c.alpha);
170  }
171 
172  constexpr inline Color operator+(const Color& c) const {
173  return {red + c.red, green + c.green, blue + c.blue, alpha + c.alpha};
174  }
175 
176  template <class T, class = std::enable_if_t<std::is_arithmetic_v<T>>>
177  constexpr inline Color operator+(T value) const {
178  auto v = static_cast<Scalar>(value);
179  return {red + v, green + v, blue + v, alpha + v};
180  }
181 
182  constexpr inline Color operator-(const Color& c) const {
183  return {red - c.red, green - c.green, blue - c.blue, alpha - c.alpha};
184  }
185 
186  template <class T, class = std::enable_if_t<std::is_arithmetic_v<T>>>
187  constexpr inline Color operator-(T value) const {
188  auto v = static_cast<Scalar>(value);
189  return {red - v, green - v, blue - v, alpha - v};
190  }
191 
192  constexpr inline Color operator*(const Color& c) const {
193  return {red * c.red, green * c.green, blue * c.blue, alpha * c.alpha};
194  }
195 
196  template <class T, class = std::enable_if_t<std::is_arithmetic_v<T>>>
197  constexpr inline Color operator*(T value) const {
198  auto v = static_cast<Scalar>(value);
199  return {red * v, green * v, blue * v, alpha * v};
200  }
201 
202  constexpr inline Color operator/(const Color& c) const {
203  return {red * c.red, green * c.green, blue * c.blue, alpha * c.alpha};
204  }
205 
206  template <class T, class = std::enable_if_t<std::is_arithmetic_v<T>>>
207  constexpr inline Color operator/(T value) const {
208  auto v = static_cast<Scalar>(value);
209  return {red / v, green / v, blue / v, alpha / v};
210  }
211 
212  constexpr Color Premultiply() const {
213  return {red * alpha, green * alpha, blue * alpha, alpha};
214  }
215 
216  constexpr Color Unpremultiply() const {
217  if (ScalarNearlyEqual(alpha, 0.0f)) {
218  return Color::BlackTransparent();
219  }
220  return {red / alpha, green / alpha, blue / alpha, alpha};
221  }
222 
223  /**
224  * @brief Return a color that is linearly interpolated between colors a
225  * and b, according to the value of t.
226  *
227  * @param a The lower color.
228  * @param b The upper color.
229  * @param t A value between 0.0f and 1.0f, inclusive.
230  * @return constexpr Color
231  */
232  constexpr static Color Lerp(Color a, Color b, Scalar t) {
233  return a + (b - a) * t;
234  }
235 
236  constexpr Color Clamp01() const {
237  return Color(std::clamp(red, 0.0f, 1.0f), std::clamp(green, 0.0f, 1.0f),
238  std::clamp(blue, 0.0f, 1.0f), std::clamp(alpha, 0.0f, 1.0f));
239  }
240 
241  /**
242  * @brief Convert to R8G8B8A8 representation.
243  *
244  * @return constexpr std::array<u_int8, 4>
245  */
246  inline std::array<uint8_t, 4> ToR8G8B8A8() const {
247  uint8_t r = std::round(red * 255.0f);
248  uint8_t g = std::round(green * 255.0f);
249  uint8_t b = std::round(blue * 255.0f);
250  uint8_t a = std::round(alpha * 255.0f);
251  return {r, g, b, a};
252  }
253 
254  /**
255  * @brief Convert to ARGB 32 bit color.
256  *
257  * @return constexpr uint32_t
258  */
259  inline uint32_t ToARGB() const {
260  std::array<uint8_t, 4> result = ToR8G8B8A8();
261  return result[3] << 24 | result[0] << 16 | result[1] << 8 | result[2];
262  }
263 
264  template <typename H>
265  friend H AbslHashValue(H h, const Color& c) {
266  return H::combine(std::move(h), c.ToARGB());
267  }
268 
269  static constexpr Color White() { return {1.0f, 1.0f, 1.0f, 1.0f}; }
270 
271  static constexpr Color Black() { return {0.0f, 0.0f, 0.0f, 1.0f}; }
272 
273  static constexpr Color WhiteTransparent() { return {1.0f, 1.0f, 1.0f, 0.0f}; }
274 
275  static constexpr Color BlackTransparent() { return {0.0f, 0.0f, 0.0f, 0.0f}; }
276 
277  static constexpr Color Red() { return {1.0f, 0.0f, 0.0f, 1.0f}; }
278 
279  static constexpr Color Green() { return {0.0f, 1.0f, 0.0f, 1.0f}; }
280 
281  static constexpr Color Blue() { return {0.0f, 0.0f, 1.0f, 1.0f}; }
282 
283  constexpr Color WithAlpha(Scalar new_alpha) const {
284  return {red, green, blue, new_alpha};
285  }
286 
287  static constexpr Color AliceBlue() {
288  return {240.0f / 255.0f, 248.0f / 255.0f, 255.0f / 255.0f, 1.0f};
289  }
290 
291  static constexpr Color AntiqueWhite() {
292  return {250.0f / 255.0f, 235.0f / 255.0f, 215.0f / 255.0f, 1.0f};
293  }
294 
295  static constexpr Color Aqua() {
296  return {0.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 1.0f};
297  }
298 
299  static constexpr Color AquaMarine() {
300  return {127.0f / 255.0f, 255.0f / 255.0f, 212.0f / 255.0f, 1.0f};
301  }
302 
303  static constexpr Color Azure() {
304  return {240.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 1.0f};
305  }
306 
307  static constexpr Color Beige() {
308  return {245.0f / 255.0f, 245.0f / 255.0f, 220.0f / 255.0f, 1.0f};
309  }
310 
311  static constexpr Color Bisque() {
312  return {255.0f / 255.0f, 228.0f / 255.0f, 196.0f / 255.0f, 1.0f};
313  }
314 
315  static constexpr Color BlanchedAlmond() {
316  return {255.0f / 255.0f, 235.0f / 255.0f, 205.0f / 255.0f, 1.0f};
317  }
318 
319  static constexpr Color BlueViolet() {
320  return {138.0f / 255.0f, 43.0f / 255.0f, 226.0f / 255.0f, 1.0f};
321  }
322 
323  static constexpr Color Brown() {
324  return {165.0f / 255.0f, 42.0f / 255.0f, 42.0f / 255.0f, 1.0f};
325  }
326 
327  static constexpr Color BurlyWood() {
328  return {222.0f / 255.0f, 184.0f / 255.0f, 135.0f / 255.0f, 1.0f};
329  }
330 
331  static constexpr Color CadetBlue() {
332  return {95.0f / 255.0f, 158.0f / 255.0f, 160.0f / 255.0f, 1.0f};
333  }
334 
335  static constexpr Color Chartreuse() {
336  return {127.0f / 255.0f, 255.0f / 255.0f, 0.0f / 255.0f, 1.0f};
337  }
338 
339  static constexpr Color Chocolate() {
340  return {210.0f / 255.0f, 105.0f / 255.0f, 30.0f / 255.0f, 1.0f};
341  }
342 
343  static constexpr Color Coral() {
344  return {255.0f / 255.0f, 127.0f / 255.0f, 80.0f / 255.0f, 1.0f};
345  }
346 
347  static constexpr Color CornflowerBlue() {
348  return {100.0f / 255.0f, 149.0f / 255.0f, 237.0f / 255.0f, 1.0f};
349  }
350 
351  static constexpr Color Cornsilk() {
352  return {255.0f / 255.0f, 248.0f / 255.0f, 220.0f / 255.0f, 1.0f};
353  }
354 
355  static constexpr Color Crimson() {
356  return {220.0f / 255.0f, 20.0f / 255.0f, 60.0f / 255.0f, 1.0f};
357  }
358 
359  static constexpr Color Cyan() {
360  return {0.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 1.0f};
361  }
362 
363  static constexpr Color DarkBlue() {
364  return {0.0f / 255.0f, 0.0f / 255.0f, 139.0f / 255.0f, 1.0f};
365  }
366 
367  static constexpr Color DarkCyan() {
368  return {0.0f / 255.0f, 139.0f / 255.0f, 139.0f / 255.0f, 1.0f};
369  }
370 
371  static constexpr Color DarkGoldenrod() {
372  return {184.0f / 255.0f, 134.0f / 255.0f, 11.0f / 255.0f, 1.0f};
373  }
374 
375  static constexpr Color DarkGray() {
376  return {169.0f / 255.0f, 169.0f / 255.0f, 169.0f / 255.0f, 1.0f};
377  }
378 
379  static constexpr Color DarkGreen() {
380  return {0.0f / 255.0f, 100.0f / 255.0f, 0.0f / 255.0f, 1.0f};
381  }
382 
383  static constexpr Color DarkGrey() {
384  return {169.0f / 255.0f, 169.0f / 255.0f, 169.0f / 255.0f, 1.0f};
385  }
386 
387  static constexpr Color DarkKhaki() {
388  return {189.0f / 255.0f, 183.0f / 255.0f, 107.0f / 255.0f, 1.0f};
389  }
390 
391  static constexpr Color DarkMagenta() {
392  return {139.0f / 255.0f, 0.0f / 255.0f, 139.0f / 255.0f, 1.0f};
393  }
394 
395  static constexpr Color DarkOliveGreen() {
396  return {85.0f / 255.0f, 107.0f / 255.0f, 47.0f / 255.0f, 1.0f};
397  }
398 
399  static constexpr Color DarkOrange() {
400  return {255.0f / 255.0f, 140.0f / 255.0f, 0.0f / 255.0f, 1.0f};
401  }
402 
403  static constexpr Color DarkOrchid() {
404  return {153.0f / 255.0f, 50.0f / 255.0f, 204.0f / 255.0f, 1.0f};
405  }
406 
407  static constexpr Color DarkRed() {
408  return {139.0f / 255.0f, 0.0f / 255.0f, 0.0f / 255.0f, 1.0f};
409  }
410 
411  static constexpr Color DarkSalmon() {
412  return {233.0f / 255.0f, 150.0f / 255.0f, 122.0f / 255.0f, 1.0f};
413  }
414 
415  static constexpr Color DarkSeagreen() {
416  return {143.0f / 255.0f, 188.0f / 255.0f, 143.0f / 255.0f, 1.0f};
417  }
418 
419  static constexpr Color DarkSlateBlue() {
420  return {72.0f / 255.0f, 61.0f / 255.0f, 139.0f / 255.0f, 1.0f};
421  }
422 
423  static constexpr Color DarkSlateGray() {
424  return {47.0f / 255.0f, 79.0f / 255.0f, 79.0f / 255.0f, 1.0f};
425  }
426 
427  static constexpr Color DarkSlateGrey() {
428  return {47.0f / 255.0f, 79.0f / 255.0f, 79.0f / 255.0f, 1.0f};
429  }
430 
431  static constexpr Color DarkTurquoise() {
432  return {0.0f / 255.0f, 206.0f / 255.0f, 209.0f / 255.0f, 1.0f};
433  }
434 
435  static constexpr Color DarkViolet() {
436  return {148.0f / 255.0f, 0.0f / 255.0f, 211.0f / 255.0f, 1.0f};
437  }
438 
439  static constexpr Color DeepPink() {
440  return {255.0f / 255.0f, 20.0f / 255.0f, 147.0f / 255.0f, 1.0f};
441  }
442 
443  static constexpr Color DeepSkyBlue() {
444  return {0.0f / 255.0f, 191.0f / 255.0f, 255.0f / 255.0f, 1.0f};
445  }
446 
447  static constexpr Color DimGray() {
448  return {105.0f / 255.0f, 105.0f / 255.0f, 105.0f / 255.0f, 1.0f};
449  }
450 
451  static constexpr Color DimGrey() {
452  return {105.0f / 255.0f, 105.0f / 255.0f, 105.0f / 255.0f, 1.0f};
453  }
454 
455  static constexpr Color DodgerBlue() {
456  return {30.0f / 255.0f, 144.0f / 255.0f, 255.0f / 255.0f, 1.0f};
457  }
458 
459  static constexpr Color Firebrick() {
460  return {178.0f / 255.0f, 34.0f / 255.0f, 34.0f / 255.0f, 1.0f};
461  }
462 
463  static constexpr Color FloralWhite() {
464  return {255.0f / 255.0f, 250.0f / 255.0f, 240.0f / 255.0f, 1.0f};
465  }
466 
467  static constexpr Color ForestGreen() {
468  return {34.0f / 255.0f, 139.0f / 255.0f, 34.0f / 255.0f, 1.0f};
469  }
470 
471  static constexpr Color Fuchsia() {
472  return {255.0f / 255.0f, 0.0f / 255.0f, 255.0f / 255.0f, 1.0f};
473  }
474 
475  static constexpr Color Gainsboro() {
476  return {220.0f / 255.0f, 220.0f / 255.0f, 220.0f / 255.0f, 1.0f};
477  }
478 
479  static constexpr Color Ghostwhite() {
480  return {248.0f / 255.0f, 248.0f / 255.0f, 255.0f / 255.0f, 1.0f};
481  }
482 
483  static constexpr Color Gold() {
484  return {255.0f / 255.0f, 215.0f / 255.0f, 0.0f / 255.0f, 1.0f};
485  }
486 
487  static constexpr Color Goldenrod() {
488  return {218.0f / 255.0f, 165.0f / 255.0f, 32.0f / 255.0f, 1.0f};
489  }
490 
491  static constexpr Color Gray() {
492  return {128.0f / 255.0f, 128.0f / 255.0f, 128.0f / 255.0f, 1.0f};
493  }
494 
495  static constexpr Color GreenYellow() {
496  return {173.0f / 255.0f, 255.0f / 255.0f, 47.0f / 255.0f, 1.0f};
497  }
498 
499  static constexpr Color Grey() {
500  return {128.0f / 255.0f, 128.0f / 255.0f, 128.0f / 255.0f, 1.0f};
501  }
502 
503  static constexpr Color Honeydew() {
504  return {240.0f / 255.0f, 255.0f / 255.0f, 240.0f / 255.0f, 1.0f};
505  }
506 
507  static constexpr Color HotPink() {
508  return {255.0f / 255.0f, 105.0f / 255.0f, 180.0f / 255.0f, 1.0f};
509  }
510 
511  static constexpr Color IndianRed() {
512  return {205.0f / 255.0f, 92.0f / 255.0f, 92.0f / 255.0f, 1.0f};
513  }
514 
515  static constexpr Color Indigo() {
516  return {75.0f / 255.0f, 0.0f / 255.0f, 130.0f / 255.0f, 1.0f};
517  }
518 
519  static constexpr Color Ivory() {
520  return {255.0f / 255.0f, 255.0f / 255.0f, 240.0f / 255.0f, 1.0f};
521  }
522 
523  static constexpr Color Khaki() {
524  return {240.0f / 255.0f, 230.0f / 255.0f, 140.0f / 255.0f, 1.0f};
525  }
526 
527  static constexpr Color Lavender() {
528  return {230.0f / 255.0f, 230.0f / 255.0f, 250.0f / 255.0f, 1.0f};
529  }
530 
531  static constexpr Color LavenderBlush() {
532  return {255.0f / 255.0f, 240.0f / 255.0f, 245.0f / 255.0f, 1.0f};
533  }
534 
535  static constexpr Color LawnGreen() {
536  return {124.0f / 255.0f, 252.0f / 255.0f, 0.0f / 255.0f, 1.0f};
537  }
538 
539  static constexpr Color LemonChiffon() {
540  return {255.0f / 255.0f, 250.0f / 255.0f, 205.0f / 255.0f, 1.0f};
541  }
542 
543  static constexpr Color LightBlue() {
544  return {173.0f / 255.0f, 216.0f / 255.0f, 230.0f / 255.0f, 1.0f};
545  }
546 
547  static constexpr Color LightCoral() {
548  return {240.0f / 255.0f, 128.0f / 255.0f, 128.0f / 255.0f, 1.0f};
549  }
550 
551  static constexpr Color LightCyan() {
552  return {224.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 1.0f};
553  }
554 
555  static constexpr Color LightGoldenrodYellow() {
556  return {50.0f / 255.0f, 250.0f / 255.0f, 210.0f / 255.0f, 1.0f};
557  }
558 
559  static constexpr Color LightGray() {
560  return {211.0f / 255.0f, 211.0f / 255.0f, 211.0f / 255.0f, 1.0f};
561  }
562 
563  static constexpr Color LightGreen() {
564  return {144.0f / 255.0f, 238.0f / 255.0f, 144.0f / 255.0f, 1.0f};
565  }
566 
567  static constexpr Color LightGrey() {
568  return {211.0f / 255.0f, 211.0f / 255.0f, 211.0f / 255.0f, 1.0f};
569  }
570 
571  static constexpr Color LightPink() {
572  return {255.0f / 255.0f, 182.0f / 255.0f, 193.0f / 255.0f, 1.0f};
573  }
574 
575  static constexpr Color LightSalmon() {
576  return {255.0f / 255.0f, 160.0f / 255.0f, 122.0f / 255.0f, 1.0f};
577  }
578 
579  static constexpr Color LightSeaGreen() {
580  return {32.0f / 255.0f, 178.0f / 255.0f, 170.0f / 255.0f, 1.0f};
581  }
582 
583  static constexpr Color LightSkyBlue() {
584  return {135.0f / 255.0f, 206.0f / 255.0f, 250.0f / 255.0f, 1.0f};
585  }
586 
587  static constexpr Color LightSlateGray() {
588  return {119.0f / 255.0f, 136.0f / 255.0f, 153.0f / 255.0f, 1.0f};
589  }
590 
591  static constexpr Color LightSlateGrey() {
592  return {119.0f / 255.0f, 136.0f / 255.0f, 153.0f / 255.0f, 1.0f};
593  }
594 
595  static constexpr Color LightSteelBlue() {
596  return {176.0f / 255.0f, 196.0f / 255.0f, 222.0f / 255.0f, 1.0f};
597  }
598 
599  static constexpr Color LightYellow() {
600  return {255.0f / 255.0f, 255.0f / 255.0f, 224.0f / 255.0f, 1.0f};
601  }
602 
603  static constexpr Color Lime() {
604  return {0.0f / 255.0f, 255.0f / 255.0f, 0.0f / 255.0f, 1.0f};
605  }
606 
607  static constexpr Color LimeGreen() {
608  return {50.0f / 255.0f, 205.0f / 255.0f, 50.0f / 255.0f, 1.0f};
609  }
610 
611  static constexpr Color Linen() {
612  return {250.0f / 255.0f, 240.0f / 255.0f, 230.0f / 255.0f, 1.0f};
613  }
614 
615  static constexpr Color Magenta() {
616  return {255.0f / 255.0f, 0.0f / 255.0f, 255.0f / 255.0f, 1.0f};
617  }
618 
619  static constexpr Color Maroon() {
620  return {128.0f / 255.0f, 0.0f / 255.0f, 0.0f / 255.0f, 1.0f};
621  }
622 
623  static constexpr Color MediumAquamarine() {
624  return {102.0f / 255.0f, 205.0f / 255.0f, 170.0f / 255.0f, 1.0f};
625  }
626 
627  static constexpr Color MediumBlue() {
628  return {0.0f / 255.0f, 0.0f / 255.0f, 205.0f / 255.0f, 1.0f};
629  }
630 
631  static constexpr Color MediumOrchid() {
632  return {186.0f / 255.0f, 85.0f / 255.0f, 211.0f / 255.0f, 1.0f};
633  }
634 
635  static constexpr Color MediumPurple() {
636  return {147.0f / 255.0f, 112.0f / 255.0f, 219.0f / 255.0f, 1.0f};
637  }
638 
639  static constexpr Color MediumSeagreen() {
640  return {60.0f / 255.0f, 179.0f / 255.0f, 113.0f / 255.0f, 1.0f};
641  }
642 
643  static constexpr Color MediumSlateBlue() {
644  return {123.0f / 255.0f, 104.0f / 255.0f, 238.0f / 255.0f, 1.0f};
645  }
646 
647  static constexpr Color MediumSpringGreen() {
648  return {0.0f / 255.0f, 250.0f / 255.0f, 154.0f / 255.0f, 1.0f};
649  }
650 
651  static constexpr Color MediumTurquoise() {
652  return {72.0f / 255.0f, 209.0f / 255.0f, 204.0f / 255.0f, 1.0f};
653  }
654 
655  static constexpr Color MediumVioletRed() {
656  return {199.0f / 255.0f, 21.0f / 255.0f, 133.0f / 255.0f, 1.0f};
657  }
658 
659  static constexpr Color MidnightBlue() {
660  return {25.0f / 255.0f, 25.0f / 255.0f, 112.0f / 255.0f, 1.0f};
661  }
662 
663  static constexpr Color MintCream() {
664  return {245.0f / 255.0f, 255.0f / 255.0f, 250.0f / 255.0f, 1.0f};
665  }
666 
667  static constexpr Color MistyRose() {
668  return {255.0f / 255.0f, 228.0f / 255.0f, 225.0f / 255.0f, 1.0f};
669  }
670 
671  static constexpr Color Moccasin() {
672  return {255.0f / 255.0f, 228.0f / 255.0f, 181.0f / 255.0f, 1.0f};
673  }
674 
675  static constexpr Color NavajoWhite() {
676  return {255.0f / 255.0f, 222.0f / 255.0f, 173.0f / 255.0f, 1.0f};
677  }
678 
679  static constexpr Color Navy() {
680  return {0.0f / 255.0f, 0.0f / 255.0f, 128.0f / 255.0f, 1.0f};
681  }
682 
683  static constexpr Color OldLace() {
684  return {253.0f / 255.0f, 245.0f / 255.0f, 230.0f / 255.0f, 1.0f};
685  }
686 
687  static constexpr Color Olive() {
688  return {128.0f / 255.0f, 128.0f / 255.0f, 0.0f / 255.0f, 1.0f};
689  }
690 
691  static constexpr Color OliveDrab() {
692  return {107.0f / 255.0f, 142.0f / 255.0f, 35.0f / 255.0f, 1.0f};
693  }
694 
695  static constexpr Color Orange() {
696  return {255.0f / 255.0f, 165.0f / 255.0f, 0.0f / 255.0f, 1.0f};
697  }
698 
699  static constexpr Color OrangeRed() {
700  return {255.0f / 255.0f, 69.0f / 255.0f, 0.0f / 255.0f, 1.0f};
701  }
702 
703  static constexpr Color Orchid() {
704  return {218.0f / 255.0f, 112.0f / 255.0f, 214.0f / 255.0f, 1.0f};
705  }
706 
707  static constexpr Color PaleGoldenrod() {
708  return {238.0f / 255.0f, 232.0f / 255.0f, 170.0f / 255.0f, 1.0f};
709  }
710 
711  static constexpr Color PaleGreen() {
712  return {152.0f / 255.0f, 251.0f / 255.0f, 152.0f / 255.0f, 1.0f};
713  }
714 
715  static constexpr Color PaleTurquoise() {
716  return {175.0f / 255.0f, 238.0f / 255.0f, 238.0f / 255.0f, 1.0f};
717  }
718 
719  static constexpr Color PaleVioletRed() {
720  return {219.0f / 255.0f, 112.0f / 255.0f, 147.0f / 255.0f, 1.0f};
721  }
722 
723  static constexpr Color PapayaWhip() {
724  return {255.0f / 255.0f, 239.0f / 255.0f, 213.0f / 255.0f, 1.0f};
725  }
726 
727  static constexpr Color Peachpuff() {
728  return {255.0f / 255.0f, 218.0f / 255.0f, 185.0f / 255.0f, 1.0f};
729  }
730 
731  static constexpr Color Peru() {
732  return {205.0f / 255.0f, 133.0f / 255.0f, 63.0f / 255.0f, 1.0f};
733  }
734 
735  static constexpr Color Pink() {
736  return {255.0f / 255.0f, 192.0f / 255.0f, 203.0f / 255.0f, 1.0f};
737  }
738 
739  static constexpr Color Plum() {
740  return {221.0f / 255.0f, 160.0f / 255.0f, 221.0f / 255.0f, 1.0f};
741  }
742 
743  static constexpr Color PowderBlue() {
744  return {176.0f / 255.0f, 224.0f / 255.0f, 230.0f / 255.0f, 1.0f};
745  }
746 
747  static constexpr Color Purple() {
748  return {128.0f / 255.0f, 0.0f / 255.0f, 128.0f / 255.0f, 1.0f};
749  }
750 
751  static constexpr Color RosyBrown() {
752  return {188.0f / 255.0f, 143.0f / 255.0f, 143.0f / 255.0f, 1.0f};
753  }
754 
755  static constexpr Color RoyalBlue() {
756  return {65.0f / 255.0f, 105.0f / 255.0f, 225.0f / 255.0f, 1.0f};
757  }
758 
759  static constexpr Color SaddleBrown() {
760  return {139.0f / 255.0f, 69.0f / 255.0f, 19.0f / 255.0f, 1.0f};
761  }
762 
763  static constexpr Color Salmon() {
764  return {250.0f / 255.0f, 128.0f / 255.0f, 114.0f / 255.0f, 1.0f};
765  }
766 
767  static constexpr Color SandyBrown() {
768  return {244.0f / 255.0f, 164.0f / 255.0f, 96.0f / 255.0f, 1.0f};
769  }
770 
771  static constexpr Color Seagreen() {
772  return {46.0f / 255.0f, 139.0f / 255.0f, 87.0f / 255.0f, 1.0f};
773  }
774 
775  static constexpr Color Seashell() {
776  return {255.0f / 255.0f, 245.0f / 255.0f, 238.0f / 255.0f, 1.0f};
777  }
778 
779  static constexpr Color Sienna() {
780  return {160.0f / 255.0f, 82.0f / 255.0f, 45.0f / 255.0f, 1.0f};
781  }
782 
783  static constexpr Color Silver() {
784  return {192.0f / 255.0f, 192.0f / 255.0f, 192.0f / 255.0f, 1.0f};
785  }
786 
787  static constexpr Color SkyBlue() {
788  return {135.0f / 255.0f, 206.0f / 255.0f, 235.0f / 255.0f, 1.0f};
789  }
790 
791  static constexpr Color SlateBlue() {
792  return {106.0f / 255.0f, 90.0f / 255.0f, 205.0f / 255.0f, 1.0f};
793  }
794 
795  static constexpr Color SlateGray() {
796  return {112.0f / 255.0f, 128.0f / 255.0f, 144.0f / 255.0f, 1.0f};
797  }
798 
799  static constexpr Color SlateGrey() {
800  return {112.0f / 255.0f, 128.0f / 255.0f, 144.0f / 255.0f, 1.0f};
801  }
802 
803  static constexpr Color Snow() {
804  return {255.0f / 255.0f, 250.0f / 255.0f, 250.0f / 255.0f, 1.0f};
805  }
806 
807  static constexpr Color SpringGreen() {
808  return {0.0f / 255.0f, 255.0f / 255.0f, 127.0f / 255.0f, 1.0f};
809  }
810 
811  static constexpr Color SteelBlue() {
812  return {70.0f / 255.0f, 130.0f / 255.0f, 180.0f / 255.0f, 1.0f};
813  }
814 
815  static constexpr Color Tan() {
816  return {210.0f / 255.0f, 180.0f / 255.0f, 140.0f / 255.0f, 1.0f};
817  }
818 
819  static constexpr Color Teal() {
820  return {0.0f / 255.0f, 128.0f / 255.0f, 128.0f / 255.0f, 1.0f};
821  }
822 
823  static constexpr Color Thistle() {
824  return {216.0f / 255.0f, 191.0f / 255.0f, 216.0f / 255.0f, 1.0f};
825  }
826 
827  static constexpr Color Tomato() {
828  return {255.0f / 255.0f, 99.0f / 255.0f, 71.0f / 255.0f, 1.0f};
829  }
830 
831  static constexpr Color Turquoise() {
832  return {64.0f / 255.0f, 224.0f / 255.0f, 208.0f / 255.0f, 1.0f};
833  }
834 
835  static constexpr Color Violet() {
836  return {238.0f / 255.0f, 130.0f / 255.0f, 238.0f / 255.0f, 1.0f};
837  }
838 
839  static constexpr Color Wheat() {
840  return {245.0f / 255.0f, 222.0f / 255.0f, 179.0f / 255.0f, 1.0f};
841  }
842 
843  static constexpr Color Whitesmoke() {
844  return {245.0f / 255.0f, 245.0f / 255.0f, 245.0f / 255.0f, 1.0f};
845  }
846 
847  static constexpr Color Yellow() {
848  return {255.0f / 255.0f, 255.0f / 255.0f, 0.0f / 255.0f, 1.0f};
849  }
850 
851  static constexpr Color YellowGreen() {
852  return {154.0f / 255.0f, 205.0f / 255.0f, 50.0f / 255.0f, 1.0f};
853  }
854 
855  static Color Random() {
856  return {
857  // This method is not used for cryptographic purposes.
858  // NOLINTBEGIN(clang-analyzer-security.insecureAPI.rand)
859  static_cast<Scalar>((std::rand() % 255) / 255.0f), //
860  static_cast<Scalar>((std::rand() % 255) / 255.0f), //
861  static_cast<Scalar>((std::rand() % 255) / 255.0f), //
862  // NOLINTEND(clang-analyzer-security.insecureAPI.rand)
863  1.0f //
864 
865  };
866  }
867 
868  /// @brief Blends an unpremultiplied destination color into a given
869  /// unpremultiplied source color to form a new unpremultiplied color.
870  ///
871  /// If either the source or destination are premultiplied, the result
872  /// will be incorrect.
873  Color Blend(Color source, BlendMode blend_mode) const;
874 
875  /// @brief A color filter that transforms colors through a 4x5 color matrix.
876  ///
877  /// This filter can be used to change the saturation of pixels, convert
878  /// from YUV to RGB, etc.
879  ///
880  /// Each channel of the output color is clamped to the 0 to 1 range.
881  ///
882  /// @see `ColorMatrix`
883  Color ApplyColorMatrix(const ColorMatrix& color_matrix) const;
884 
885  /// @brief Convert the color from linear space to sRGB space.
886  ///
887  /// The color is assumed to be unpremultiplied. If the color is
888  /// premultipled, the conversion output will be incorrect.
889  Color LinearToSRGB() const;
890 
891  /// @brief Convert the color from sRGB space to linear space.
892  ///
893  /// The color is assumed to be unpremultiplied. If the color is
894  /// premultipled, the conversion output will be incorrect.
895  Color SRGBToLinear() const;
896 
897  constexpr bool IsTransparent() const { return alpha == 0.0f; }
898 
899  constexpr bool IsOpaque() const { return alpha == 1.0f; }
900 };
901 
902 template <class T, class = std::enable_if_t<std::is_arithmetic_v<T>>>
903 constexpr inline Color operator+(T value, const Color& c) {
904  return c + static_cast<Scalar>(value);
905 }
906 
907 template <class T, class = std::enable_if_t<std::is_arithmetic_v<T>>>
908 constexpr inline Color operator-(T value, const Color& c) {
909  auto v = static_cast<Scalar>(value);
910  return {v - c.red, v - c.green, v - c.blue, v - c.alpha};
911 }
912 
913 template <class T, class = std::enable_if_t<std::is_arithmetic_v<T>>>
914 constexpr inline Color operator*(T value, const Color& c) {
915  return c * static_cast<Scalar>(value);
916 }
917 
918 template <class T, class = std::enable_if_t<std::is_arithmetic_v<T>>>
919 constexpr inline Color operator/(T value, const Color& c) {
920  auto v = static_cast<Scalar>(value);
921  return {v / c.red, v / c.green, v / c.blue, v / c.alpha};
922 }
923 
924 static_assert(sizeof(Color) == 4 * sizeof(Scalar));
925 
926 } // namespace impeller
927 
928 namespace std {
929 
930 inline std::ostream& operator<<(std::ostream& out, const impeller::Color& c) {
931  out << "(" << c.red << ", " << c.green << ", " << c.blue << ", " << c.alpha
932  << ")";
933  return out;
934 }
935 
936 inline std::ostream& operator<<(std::ostream& out,
937  const impeller::BlendMode& mode) {
938  out << "BlendMode::k" << BlendModeToString(mode);
939  return out;
940 }
941 
942 } // namespace std
943 
944 #endif // FLUTTER_IMPELLER_GEOMETRY_COLOR_H_
int32_t value
YUVColorSpace
Definition: color.h:54
constexpr Color operator-(T value, const Color &c)
Definition: color.h:908
float Scalar
Definition: scalar.h:19
constexpr Color operator/(T value, const Color &c)
Definition: color.h:919
constexpr Color operator+(T value, const Color &c)
Definition: color.h:903
const char * BlendModeToString(BlendMode blend_mode)
Definition: color.cc:45
BlendMode
Definition: color.h:58
constexpr Color operator*(T value, const Color &c)
Definition: color.h:914
constexpr bool ScalarNearlyEqual(Scalar x, Scalar y, Scalar tolerance=kEhCloseEnough)
Definition: scalar.h:36
Definition: comparable.h:93
std::ostream & operator<<(std::ostream &out, const impeller::Arc &a)
Definition: arc.h:141
static constexpr Color MidnightBlue()
Definition: color.h:659
static constexpr Color Crimson()
Definition: color.h:355
static constexpr Color SaddleBrown()
Definition: color.h:759
Scalar blue
Definition: color.h:138
static constexpr Color Gray()
Definition: color.h:491
static constexpr Color PapayaWhip()
Definition: color.h:723
std::array< uint8_t, 4 > ToR8G8B8A8() const
Convert to R8G8B8A8 representation.
Definition: color.h:246
static constexpr Color DarkCyan()
Definition: color.h:367
static constexpr Color Olive()
Definition: color.h:687
static constexpr Color DarkTurquoise()
Definition: color.h:431
static constexpr Color SlateGray()
Definition: color.h:795
static constexpr Color Moccasin()
Definition: color.h:671
static constexpr Color MediumSeagreen()
Definition: color.h:639
static constexpr Color MediumBlue()
Definition: color.h:627
static constexpr Color LemonChiffon()
Definition: color.h:539
static constexpr Color Cyan()
Definition: color.h:359
constexpr Color operator*(T value) const
Definition: color.h:197
static constexpr Color Bisque()
Definition: color.h:311
static constexpr Color LightGrey()
Definition: color.h:567
static uint32_t ToIColor(Color color)
Convert this color to a 32-bit representation.
Definition: color.h:159
static constexpr Color DarkOrchid()
Definition: color.h:403
static constexpr Color Lime()
Definition: color.h:603
static constexpr Color DarkSalmon()
Definition: color.h:411
static constexpr Color Grey()
Definition: color.h:499
uint32_t ToARGB() const
Convert to ARGB 32 bit color.
Definition: color.h:259
constexpr bool IsOpaque() const
Definition: color.h:899
static constexpr Color LightBlue()
Definition: color.h:543
static constexpr Color LimeGreen()
Definition: color.h:607
static constexpr Color SandyBrown()
Definition: color.h:767
static constexpr Color LightSalmon()
Definition: color.h:575
static constexpr Color DarkOliveGreen()
Definition: color.h:395
static constexpr Color PaleVioletRed()
Definition: color.h:719
static constexpr Color Azure()
Definition: color.h:303
static constexpr Color BlackTransparent()
Definition: color.h:275
static constexpr Color GreenYellow()
Definition: color.h:495
static constexpr Color Thistle()
Definition: color.h:823
static constexpr Color LightPink()
Definition: color.h:571
static constexpr Color MistyRose()
Definition: color.h:667
static constexpr Color MediumOrchid()
Definition: color.h:631
constexpr Color operator*(const Color &c) const
Definition: color.h:192
static constexpr Color DarkGoldenrod()
Definition: color.h:371
static constexpr Color Indigo()
Definition: color.h:515
static constexpr Color Khaki()
Definition: color.h:523
static constexpr Color OldLace()
Definition: color.h:683
static constexpr Color DarkKhaki()
Definition: color.h:387
static constexpr Color Honeydew()
Definition: color.h:503
static constexpr Color RoyalBlue()
Definition: color.h:755
static constexpr Color MintCream()
Definition: color.h:663
constexpr Color operator/(T value) const
Definition: color.h:207
static constexpr Color Chartreuse()
Definition: color.h:335
static constexpr Color Orchid()
Definition: color.h:703
Scalar alpha
Definition: color.h:143
constexpr Color operator/(const Color &c) const
Definition: color.h:202
static constexpr Color BlueViolet()
Definition: color.h:319
static constexpr Color BurlyWood()
Definition: color.h:327
static constexpr Color Turquoise()
Definition: color.h:831
static constexpr Color Fuchsia()
Definition: color.h:471
static constexpr Color Snow()
Definition: color.h:803
static constexpr Color LightSteelBlue()
Definition: color.h:595
constexpr bool operator==(const Color &c) const
Definition: color.h:167
static constexpr Color Seashell()
Definition: color.h:775
Color LinearToSRGB() const
Convert the color from linear space to sRGB space.
Definition: color.cc:309
static constexpr Color LightGray()
Definition: color.h:559
static constexpr Color DeepPink()
Definition: color.h:439
static constexpr Color Black()
Definition: color.h:271
static constexpr Color IndianRed()
Definition: color.h:511
static constexpr Color Ivory()
Definition: color.h:519
static constexpr Color DarkBlue()
Definition: color.h:363
static constexpr Color CornflowerBlue()
Definition: color.h:347
static constexpr Color LightSkyBlue()
Definition: color.h:583
constexpr Color operator+(T value) const
Definition: color.h:177
static constexpr Color Violet()
Definition: color.h:835
static constexpr Color Sienna()
Definition: color.h:779
static constexpr Color Chocolate()
Definition: color.h:339
static constexpr Color MediumTurquoise()
Definition: color.h:651
static constexpr Color White()
Definition: color.h:269
static constexpr Color Gold()
Definition: color.h:483
static constexpr Color Navy()
Definition: color.h:679
constexpr bool IsTransparent() const
Definition: color.h:897
static constexpr Color SlateBlue()
Definition: color.h:791
static constexpr Color Beige()
Definition: color.h:307
static constexpr Color LawnGreen()
Definition: color.h:535
static constexpr Color Magenta()
Definition: color.h:615
static constexpr Color PaleGreen()
Definition: color.h:711
static constexpr Color CadetBlue()
Definition: color.h:331
static constexpr Color DodgerBlue()
Definition: color.h:455
static constexpr Color LightCoral()
Definition: color.h:547
constexpr Color WithAlpha(Scalar new_alpha) const
Definition: color.h:283
static constexpr Color LavenderBlush()
Definition: color.h:531
static constexpr Color DarkGrey()
Definition: color.h:383
static constexpr Color PowderBlue()
Definition: color.h:743
Color ApplyColorMatrix(const ColorMatrix &color_matrix) const
A color filter that transforms colors through a 4x5 color matrix.
Definition: color.cc:299
static constexpr Color WhiteTransparent()
Definition: color.h:273
static constexpr Color HotPink()
Definition: color.h:507
constexpr Color(Scalar r, Scalar g, Scalar b, Scalar a)
Definition: color.h:149
static constexpr Color SkyBlue()
Definition: color.h:787
static constexpr Color SpringGreen()
Definition: color.h:807
static constexpr Color BlanchedAlmond()
Definition: color.h:315
static constexpr Color LightSlateGray()
Definition: color.h:587
constexpr Color operator+(const Color &c) const
Definition: color.h:172
static constexpr Color DimGrey()
Definition: color.h:451
static constexpr Color Maroon()
Definition: color.h:619
static constexpr Color Ghostwhite()
Definition: color.h:479
static constexpr Color OrangeRed()
Definition: color.h:699
static constexpr Color MediumAquamarine()
Definition: color.h:623
static constexpr Color DeepSkyBlue()
Definition: color.h:443
static constexpr Color DarkGreen()
Definition: color.h:379
static constexpr Color Orange()
Definition: color.h:695
static constexpr Color Teal()
Definition: color.h:819
static constexpr Color Purple()
Definition: color.h:747
Scalar red
Definition: color.h:128
static constexpr Color Wheat()
Definition: color.h:839
static constexpr Color Cornsilk()
Definition: color.h:351
static constexpr Color Aqua()
Definition: color.h:295
static constexpr Color Tan()
Definition: color.h:815
static constexpr Color Coral()
Definition: color.h:343
friend H AbslHashValue(H h, const Color &c)
Definition: color.h:265
static constexpr Color Red()
Definition: color.h:277
static constexpr Color PaleTurquoise()
Definition: color.h:715
constexpr Color Unpremultiply() const
Definition: color.h:216
constexpr Color()
Definition: color.h:145
static constexpr Color LightGoldenrodYellow()
Definition: color.h:555
static constexpr Color LightYellow()
Definition: color.h:599
static constexpr Color SteelBlue()
Definition: color.h:811
Scalar green
Definition: color.h:133
static constexpr Color DarkRed()
Definition: color.h:407
static constexpr Color MediumSpringGreen()
Definition: color.h:647
static constexpr Color MediumPurple()
Definition: color.h:635
constexpr Color Premultiply() const
Definition: color.h:212
static constexpr Color Firebrick()
Definition: color.h:459
static constexpr Color LightGreen()
Definition: color.h:563
static constexpr Color Pink()
Definition: color.h:735
static constexpr Color DarkOrange()
Definition: color.h:399
static constexpr Color ForestGreen()
Definition: color.h:467
static constexpr Color Silver()
Definition: color.h:783
static constexpr Color Brown()
Definition: color.h:323
static constexpr Color Gainsboro()
Definition: color.h:475
static constexpr Color Peachpuff()
Definition: color.h:727
static constexpr Color MediumSlateBlue()
Definition: color.h:643
static constexpr Color Seagreen()
Definition: color.h:771
static constexpr Color AliceBlue()
Definition: color.h:287
static constexpr Color Salmon()
Definition: color.h:763
static Color Random()
Definition: color.h:855
static constexpr Color MakeRGBA8(uint8_t r, uint8_t g, uint8_t b, uint8_t a)
Definition: color.h:152
static constexpr Color DarkSlateBlue()
Definition: color.h:419
static constexpr Color AquaMarine()
Definition: color.h:299
constexpr Color operator-(T value) const
Definition: color.h:187
static constexpr Color AntiqueWhite()
Definition: color.h:291
static constexpr Color Lavender()
Definition: color.h:527
static constexpr Color Plum()
Definition: color.h:739
static constexpr Color LightSeaGreen()
Definition: color.h:579
static constexpr Color DarkSeagreen()
Definition: color.h:415
static constexpr Color NavajoWhite()
Definition: color.h:675
constexpr Color Clamp01() const
Definition: color.h:236
static constexpr Color LightCyan()
Definition: color.h:551
static constexpr Color DimGray()
Definition: color.h:447
static constexpr Color Tomato()
Definition: color.h:827
static constexpr Color FloralWhite()
Definition: color.h:463
static constexpr Color Linen()
Definition: color.h:611
static constexpr Color YellowGreen()
Definition: color.h:851
static constexpr Color DarkSlateGrey()
Definition: color.h:427
constexpr static Color Lerp(Color a, Color b, Scalar t)
Return a color that is linearly interpolated between colors a and b, according to the value of t.
Definition: color.h:232
static constexpr Color DarkGray()
Definition: color.h:375
static constexpr Color DarkMagenta()
Definition: color.h:391
static constexpr Color Yellow()
Definition: color.h:847
static constexpr Color Goldenrod()
Definition: color.h:487
Color SRGBToLinear() const
Convert the color from sRGB space to linear space.
Definition: color.cc:320
static constexpr Color Peru()
Definition: color.h:731
static constexpr Color MediumVioletRed()
Definition: color.h:655
static constexpr Color SlateGrey()
Definition: color.h:799
Color Blend(Color source, BlendMode blend_mode) const
Blends an unpremultiplied destination color into a given unpremultiplied source color to form a new u...
Definition: color.cc:155
static constexpr Color LightSlateGrey()
Definition: color.h:591
constexpr Color operator-(const Color &c) const
Definition: color.h:182
static constexpr Color DarkViolet()
Definition: color.h:435
static constexpr Color OliveDrab()
Definition: color.h:691
static constexpr Color PaleGoldenrod()
Definition: color.h:707
static constexpr Color RosyBrown()
Definition: color.h:751
static constexpr Color Blue()
Definition: color.h:281
static constexpr Color Green()
Definition: color.h:279
static constexpr Color DarkSlateGray()
Definition: color.h:423
static constexpr Color Whitesmoke()
Definition: color.h:843
Scalar array[20]
Definition: color.h:118