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