| Flutter Impeller |

Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
impeller::Color Struct Reference

`#include <color.h>`

## Public Member Functions
constexpr | Color ()
| Color (const ColorHSB &hsbColor)
| Color (const Vector4 &value)
constexpr | Color (Scalar r, Scalar g, Scalar b, Scalar a)
constexpr bool | operator== (const Color &c) const
constexpr Color | operator+ (const Color &c) const
template<class T , class = std::enable_if_t<std::is_arithmetic_v<T>>>
constexpr Color | operator+ (T value) const
constexpr Color | operator- (const Color &c) const
template<class T , class = std::enable_if_t<std::is_arithmetic_v<T>>>
constexpr Color | operator- (T value) const
constexpr Color | operator* (const Color &c) const
template<class T , class = std::enable_if_t<std::is_arithmetic_v<T>>>
constexpr Color | operator* (T value) const
constexpr Color | operator/ (const Color &c) const
template<class T , class = std::enable_if_t<std::is_arithmetic_v<T>>>
constexpr Color | operator/ (T value) const
constexpr Color | Premultiply () const
constexpr Color | Unpremultiply () const
constexpr Color | Clamp01 () const
constexpr std::array< uint8_t, 4 > | ToR8G8B8A8 () const
| Convert to R8G8B8A8 representation. More...
constexpr uint32_t | ToARGB () const
| Convert to ARGB 32 bit color. More...
constexpr Color | WithAlpha (Scalar new_alpha) const
Color | Blend (Color source, BlendMode blend_mode) const
| Blends an unpremultiplied destination color into a given unpremultiplied source color to form a new unpremultiplied color. More...
Color | ApplyColorMatrix (const ColorMatrix &color_matrix) const
| A color filter that transforms colors through a 4x5 color matrix. More...
Color | LinearToSRGB () const
| Convert the color from linear space to sRGB space. More...
Color | SRGBToLinear () const
| Convert the color from sRGB space to linear space. More...
constexpr bool | IsTransparent () const
constexpr bool | IsOpaque () const

## Static Public Member Functions
static constexpr Color | MakeRGBA8 (uint8_t r, uint8_t g, uint8_t b, uint8_t a)
static constexpr uint32_t | ToIColor (Color color)
| Convert this color to a 32-bit representation. More...
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. More...
static constexpr Color | White ()
static constexpr Color | Black ()
static constexpr Color | WhiteTransparent ()
static constexpr Color | BlackTransparent ()
static constexpr Color | Red ()
static constexpr Color | Green ()
static constexpr Color | Blue ()
static constexpr Color | AliceBlue ()
static constexpr Color | AntiqueWhite ()
static constexpr Color | Aqua ()
static constexpr Color | AquaMarine ()
static constexpr Color | Azure ()
static constexpr Color | Beige ()
static constexpr Color | Bisque ()
static constexpr Color | BlanchedAlmond ()
static constexpr Color | BlueViolet ()
static constexpr Color | Brown ()
static constexpr Color | BurlyWood ()
static constexpr Color | CadetBlue ()
static constexpr Color | Chartreuse ()
static constexpr Color | Chocolate ()
static constexpr Color | Coral ()
static constexpr Color | CornflowerBlue ()
static constexpr Color | Cornsilk ()
static constexpr Color | Crimson ()
static constexpr Color | Cyan ()
static constexpr Color | DarkBlue ()
static constexpr Color | DarkCyan ()
static constexpr Color | DarkGoldenrod ()
static constexpr Color | DarkGray ()
static constexpr Color | DarkGreen ()
static constexpr Color | DarkGrey ()
static constexpr Color | DarkKhaki ()
static constexpr Color | DarkMagenta ()
static constexpr Color | DarkOliveGreen ()
static constexpr Color | DarkOrange ()
static constexpr Color | DarkOrchid ()
static constexpr Color | DarkRed ()
static constexpr Color | DarkSalmon ()
static constexpr Color | DarkSeagreen ()
static constexpr Color | DarkSlateBlue ()
static constexpr Color | DarkSlateGray ()
static constexpr Color | DarkSlateGrey ()
static constexpr Color | DarkTurquoise ()
static constexpr Color | DarkViolet ()
static constexpr Color | DeepPink ()
static constexpr Color | DeepSkyBlue ()
static constexpr Color | DimGray ()
static constexpr Color | DimGrey ()
static constexpr Color | DodgerBlue ()
static constexpr Color | Firebrick ()
static constexpr Color | FloralWhite ()
static constexpr Color | ForestGreen ()
static constexpr Color | Fuchsia ()
static constexpr Color | Gainsboro ()
static constexpr Color | Ghostwhite ()
static constexpr Color | Gold ()
static constexpr Color | Goldenrod ()
static constexpr Color | Gray ()
static constexpr Color | GreenYellow ()
static constexpr Color | Grey ()
static constexpr Color | Honeydew ()
static constexpr Color | HotPink ()
static constexpr Color | IndianRed ()
static constexpr Color | Indigo ()
static constexpr Color | Ivory ()
static constexpr Color | Khaki ()
static constexpr Color | Lavender ()
static constexpr Color | LavenderBlush ()
static constexpr Color | LawnGreen ()
static constexpr Color | LemonChiffon ()
static constexpr Color | LightBlue ()
static constexpr Color | LightCoral ()
static constexpr Color | LightCyan ()
static constexpr Color | LightGoldenrodYellow ()
static constexpr Color | LightGray ()
static constexpr Color | LightGreen ()
static constexpr Color | LightGrey ()
static constexpr Color | LightPink ()
static constexpr Color | LightSalmon ()
static constexpr Color | LightSeaGreen ()
static constexpr Color | LightSkyBlue ()
static constexpr Color | LightSlateGray ()
static constexpr Color | LightSlateGrey ()
static constexpr Color | LightSteelBlue ()
static constexpr Color | LightYellow ()
static constexpr Color | Lime ()
static constexpr Color | LimeGreen ()
static constexpr Color | Linen ()
static constexpr Color | Magenta ()
static constexpr Color | Maroon ()
static constexpr Color | MediumAquamarine ()
static constexpr Color | MediumBlue ()
static constexpr Color | MediumOrchid ()
static constexpr Color | MediumPurple ()
static constexpr Color | MediumSeagreen ()
static constexpr Color | MediumSlateBlue ()
static constexpr Color | MediumSpringGreen ()
static constexpr Color | MediumTurquoise ()
static constexpr Color | MediumVioletRed ()
static constexpr Color | MidnightBlue ()
static constexpr Color | MintCream ()
static constexpr Color | MistyRose ()
static constexpr Color | Moccasin ()
static constexpr Color | NavajoWhite ()
static constexpr Color | Navy ()
static constexpr Color | OldLace ()
static constexpr Color | Olive ()
static constexpr Color | OliveDrab ()
static constexpr Color | Orange ()
static constexpr Color | OrangeRed ()
static constexpr Color | Orchid ()
static constexpr Color | PaleGoldenrod ()
static constexpr Color | PaleGreen ()
static constexpr Color | PaleTurquoise ()
static constexpr Color | PaleVioletRed ()
static constexpr Color | PapayaWhip ()
static constexpr Color | Peachpuff ()
static constexpr Color | Peru ()
static constexpr Color | Pink ()
static constexpr Color | Plum ()
static constexpr Color | PowderBlue ()
static constexpr Color | Purple ()
static constexpr Color | RosyBrown ()
static constexpr Color | RoyalBlue ()
static constexpr Color | SaddleBrown ()
static constexpr Color | Salmon ()
static constexpr Color | SandyBrown ()
static constexpr Color | Seagreen ()
static constexpr Color | Seashell ()
static constexpr Color | Sienna ()
static constexpr Color | Silver ()
static constexpr Color | SkyBlue ()
static constexpr Color | SlateBlue ()
static constexpr Color | SlateGray ()
static constexpr Color | SlateGrey ()
static constexpr Color | Snow ()
static constexpr Color | SpringGreen ()
static constexpr Color | SteelBlue ()
static constexpr Color | Tan ()
static constexpr Color | Teal ()
static constexpr Color | Thistle ()
static constexpr Color | Tomato ()
static constexpr Color | Turquoise ()
static constexpr Color | Violet ()
static constexpr Color | Wheat ()
static constexpr Color | Whitesmoke ()
static constexpr Color | Yellow ()
static constexpr Color | YellowGreen ()
static Color | Random ()

## Public Attributes
Scalar | red = 0.0
Scalar | green = 0.0
Scalar | blue = 0.0
Scalar | alpha = 0.0

## Detailed Description

Represents a RGBA color

Definition at line 124 of file color.h.

## Constructor & Destructor Documentation

## ◆ Color() [1/4]

constexpr impeller::Color::Color | ( |  | ) |
| inline constexpr

Definition at line 145 of file color.h.

145 {}

Referenced by ApplyColorMatrix(), Clamp01(), LinearToSRGB(), MakeRGBA8(), and SRGBToLinear().

## ◆ Color() [2/4]

impeller::Color::Color | ( | const ColorHSB & | hsbColor | ) |
| explicit

Definition at line 127 of file color.cc.

127 : Color(hsbColor.ToRGBA()) {}

## ◆ Color() [3/4]

impeller::Color::Color | ( | const Vector4 & | value | ) |
| explicit

Definition at line 129 of file color.cc.

130 : red(value.x), green(value.y), blue(value.z), alpha(value.w) {}

## ◆ Color() [4/4]

constexpr impeller::Color::Color | ( | Scalar | r,
|  | Scalar | g,
|  | Scalar | b,
|  | Scalar | a
| ) |  |
| inline constexpr

Definition at line 151 of file color.h.

152 : red(r), green(g), blue(b), alpha(a) {}

## Member Function Documentation

## ◆ AliceBlue()

static constexpr Color impeller::Color::AliceBlue | ( |  | ) |
| inline static constexpr

Definition at line 284 of file color.h.

284 {
285 return {240.0f / 255.0f, 248.0f / 255.0f, 255.0f / 255.0f, 1.0f};
286 }

## ◆ AntiqueWhite()

static constexpr Color impeller::Color::AntiqueWhite | ( |  | ) |
| inline static constexpr

Definition at line 288 of file color.h.

288 {
289 return {250.0f / 255.0f, 235.0f / 255.0f, 215.0f / 255.0f, 1.0f};
290 }

Referenced by impeller::testing::MaskBlurVariantTest().

## ◆ ApplyColorMatrix()

Color impeller::Color::ApplyColorMatrix | ( | const ColorMatrix & | color_matrix | ) | const

A color filter that transforms colors through a 4x5 color matrix.

       This filter can be used to change the saturation of pixels, convert
       from YUV to RGB, etc.

       Each channel of the output color is clamped to the 0 to 1 range.

See also
  `ColorMatrix`

Definition at line 378 of file color.cc.

378 {
379 auto* c = color_matrix.array;
380 return Color(
381 c[0] * red + c[1] * green + c[2] * blue + c[3] * alpha + c[4],
382 c[5] * red + c[6] * green + c[7] * blue + c[8] * alpha + c[9],
383 c[10] * red + c[11] * green + c[12] * blue + c[13] * alpha + c[14],
384 c[15] * red + c[16] * green + c[17] * blue + c[18] * alpha + c[19])
385 .Clamp01();
386 }

References alpha, impeller::ColorMatrix::array, blue, Color(), green, and red.

Referenced by impeller::testing::TEST().

## ◆ Aqua()

static constexpr Color impeller::Color::Aqua | ( |  | ) |
| inline static constexpr

Definition at line 292 of file color.h.

292 {
293 return {0.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 1.0f};
294 }

## ◆ AquaMarine()

static constexpr Color impeller::Color::AquaMarine | ( |  | ) |
| inline static constexpr

Definition at line 296 of file color.h.

296 {
297 return {127.0f / 255.0f, 255.0f / 255.0f, 212.0f / 255.0f, 1.0f};
298 }

## ◆ Azure()

static constexpr Color impeller::Color::Azure | ( |  | ) |
| inline static constexpr

Definition at line 300 of file color.h.

300 {
301 return {240.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 1.0f};
302 }

## ◆ Beige()

static constexpr Color impeller::Color::Beige | ( |  | ) |
| inline static constexpr

Definition at line 304 of file color.h.

304 {
305 return {245.0f / 255.0f, 245.0f / 255.0f, 220.0f / 255.0f, 1.0f};
306 }

## ◆ Bisque()

static constexpr Color impeller::Color::Bisque | ( |  | ) |
| inline static constexpr

Definition at line 308 of file color.h.

308 {
309 return {255.0f / 255.0f, 228.0f / 255.0f, 196.0f / 255.0f, 1.0f};
310 }

## ◆ Black()

static constexpr Color impeller::Color::Black | ( |  | ) |
| inline static constexpr

Definition at line 268 of file color.h.

268 { return {0.0f, 0.0f, 0.0f, 1.0f}; }

Referenced by impeller::testing::BlendModeTest(), impeller::testing::TEST(), and impeller::testing::TEST_P().

## ◆ BlackTransparent()

static constexpr Color impeller::Color::BlackTransparent | ( |  | ) |
| inline static constexpr

Definition at line 272 of file color.h.

272 { return {0.0f, 0.0f, 0.0f, 0.0f}; }

Referenced by Blend(), impeller::ContentContext::ContentContext(), impeller::EntityPass::GetClearColor(), impeller::EntityPass::GetClearColorOrDefault(), impeller::VerticesGeometry::GetPositionUVColorBuffer(), impeller::AtlasContents::Render(), impeller::ExperimentalCanvas::SaveLayer(), impeller::testing::TEST(), impeller::testing::TEST_P(), and Unpremultiply().

## ◆ BlanchedAlmond()

static constexpr Color impeller::Color::BlanchedAlmond | ( |  | ) |
| inline static constexpr

Definition at line 312 of file color.h.

312 {
313 return {255.0f / 255.0f, 235.0f / 255.0f, 205.0f / 255.0f, 1.0f};
314 }

## ◆ Blend()

Color impeller::Color::Blend | ( | Color | source,
|  | BlendMode | blend_mode
| ) |  | const

Blends an unpremultiplied destination color into a given unpremultiplied source color to form a new unpremultiplied color.

If either the source or destination are premultiplied, the result will be incorrect.

Definition at line 234 of file color.cc.

234 {
235 Color dst = *this;
236
237 switch (blend_mode) {
238 case BlendMode::kClear:
239 return Color::BlackTransparent();
240 case BlendMode::kSource:
241 return src;
242 case BlendMode::kDestination:
243 return dst;
244 case BlendMode::kSourceOver:
245 // r = s + (1-sa)*d
246 return (src.Premultiply() + dst.Premultiply() * (1 - src.alpha))
247 .Unpremultiply();
248 case BlendMode::kDestinationOver:
249 // r = d + (1-da)*s
250 return (dst.Premultiply() + src.Premultiply() * (1 - dst.alpha))
251 .Unpremultiply();
252 case BlendMode::kSourceIn:
253 // r = s * da
254 return (src.Premultiply() * dst.alpha).Unpremultiply();
255 case BlendMode::kDestinationIn:
256 // r = d * sa
257 return (dst.Premultiply() * src.alpha).Unpremultiply();
258 case BlendMode::kSourceOut:
259 // r = s * ( 1- da)
260 return (src.Premultiply() * (1 - dst.alpha)).Unpremultiply();
261 case BlendMode::kDestinationOut:
262 // r = d * (1-sa)
263 return (dst.Premultiply() * (1 - src.alpha)).Unpremultiply();
264 case BlendMode::kSourceATop:
265 // r = s*da + d*(1-sa)
266 return (src.Premultiply() * dst.alpha +
267 dst.Premultiply() * (1 - src.alpha))
268 .Unpremultiply();
269 case BlendMode::kDestinationATop:
270 // r = d*sa + s*(1-da)
271 return (dst.Premultiply() * src.alpha +
272 src.Premultiply() * (1 - dst.alpha))
273 .Unpremultiply();
274 case BlendMode::kXor:
275 // r = s*(1-da) + d*(1-sa)
276 return (src.Premultiply() * (1 - dst.alpha) +
277 dst.Premultiply() * (1 - src.alpha))
278 .Unpremultiply();
279 case BlendMode::kPlus:
280 // r = min(s + d, 1)
281 return (Min(src.Premultiply() + dst.Premultiply(), 1)).Unpremultiply();
282 case BlendMode::kModulate:
283 // r = s*d
284 return (src.Premultiply() * dst.Premultiply()).Unpremultiply();
285 case BlendMode::kScreen: {
286 return DoColorBlend(dst, src, [](Vector3 d, Vector3 s) -> Vector3 {
287 return s + d - s * d;
288 });
289 }
290 case BlendMode::kOverlay:
291 return DoColorBlend(dst, src, [](Vector3 d, Vector3 s) -> Vector3 {
292 // The same as HardLight, but with the source and destination reversed.
293 Vector3 screen_src = 2.0 * d - 1.0;
294 Vector3 screen = screen_src + s - screen_src * s;
295 return ComponentChoose(s * (2.0 * d), //
296 screen, //
297 d, //
298 0.5);
299 });
300 case BlendMode::kDarken:
301 return DoColorBlend(
302 dst, src, [](Vector3 d, Vector3 s) -> Vector3 { return d.Min(s); });
303 case BlendMode::kLighten:
304 return DoColorBlend(
305 dst, src, [](Vector3 d, Vector3 s) -> Vector3 { return d.Max(s); });
306 case BlendMode::kColorDodge:
307 return DoColorBlendComponents(dst, src, [](Scalar d, Scalar s) -> Scalar {
308 if (d < kEhCloseEnough) {
309 return 0.0f;
310 }
311 if (1.0 - s < kEhCloseEnough) {
312 return 1.0f;
313 }
314 return std::min(1.0f, d / (1.0f - s));
315 });
316 case BlendMode::kColorBurn:
317 return DoColorBlendComponents(dst, src, [](Scalar d, Scalar s) -> Scalar {
318 if (1.0 - d < kEhCloseEnough) {
319 return 1.0f;
320 }
321 if (s < kEhCloseEnough) {
322 return 0.0f;
323 }
324 return 1.0f - std::min(1.0f, (1.0f - d) / s);
325 });
326 case BlendMode::kHardLight:
327 return DoColorBlend(dst, src, [](Vector3 d, Vector3 s) -> Vector3 {
328 Vector3 screen_src = 2.0 * s - 1.0;
329 Vector3 screen = screen_src + d - screen_src * d;
330 return ComponentChoose(d * (2.0 * s), //
331 screen, //
332 s, //
333 0.5);
334 });
335 case BlendMode::kSoftLight:
336 return DoColorBlend(dst, src, [](Vector3 d, Vector3 s) -> Vector3 {
337 Vector3 D = ComponentChoose(((16.0 * d - 12.0) * d + 4.0) * d, //
338 Vector3(std::sqrt(d.x), std::sqrt(d.y),
339 std::sqrt(d.z)), //
340 d, //
341 0.25);
342 return ComponentChoose(d - (1.0 - 2.0 * s) * d * (1.0 - d), //
343 d + (2.0 * s - 1.0) * (D - d), //
344 s, //
345 0.5);
346 });
347 case BlendMode::kDifference:
348 return DoColorBlend(dst, src, [](Vector3 d, Vector3 s) -> Vector3 {
349 return (d - s).Abs();
350 });
351 case BlendMode::kExclusion:
352 return DoColorBlend(dst, src, [](Vector3 d, Vector3 s) -> Vector3 {
353 return d + s - 2.0f * d * s;
354 });
355 case BlendMode::kMultiply:
356 return DoColorBlend(
357 dst, src, [](Vector3 d, Vector3 s) -> Vector3 { return d * s; });
358 case BlendMode::kHue: {
359 return DoColorBlend(dst, src, [](Vector3 d, Vector3 s) -> Vector3 {
360 return SetLuminosity(SetSaturation(s, Saturation(d)), Luminosity(d));
361 });
362 }
363 case BlendMode::kSaturation:
364 return DoColorBlend(dst, src, [](Vector3 d, Vector3 s) -> Vector3 {
365 return SetLuminosity(SetSaturation(d, Saturation(s)), Luminosity(d));
366 });
367 case BlendMode::kColor:
368 return DoColorBlend(dst, src, [](Vector3 d, Vector3 s) -> Vector3 {
369 return SetLuminosity(s, Luminosity(d));
370 });
371 case BlendMode::kLuminosity:
372 return DoColorBlend(dst, src, [](Vector3 d, Vector3 s) -> Vector3 {
373 return SetLuminosity(d, Luminosity(s));
374 });
375 }
376 }

References alpha, BlackTransparent(), impeller::ComponentChoose(), impeller::DoColorBlend(), impeller::DoColorBlendComponents(), impeller::kClear, impeller::kColor, impeller::kColorBurn, impeller::kColorDodge, impeller::kDarken, impeller::kDestination, impeller::kDestinationATop, impeller::kDestinationIn, impeller::kDestinationOut, impeller::kDestinationOver, impeller::kDifference, impeller::kEhCloseEnough, impeller::kExclusion, impeller::kHardLight, impeller::kHue, impeller::kLighten, impeller::kLuminosity, impeller::kModulate, impeller::kMultiply, impeller::kOverlay, impeller::kPlus, impeller::kSaturation, impeller::kScreen, impeller::kSoftLight, impeller::kSource, impeller::kSourceATop, impeller::kSourceIn, impeller::kSourceOut, impeller::kSourceOver, impeller::kXor, impeller::Luminosity(), impeller::Vector3::Max(), impeller::Vector3::Min(), impeller::Min(), Premultiply(), impeller::Saturation(), impeller::SetLuminosity(), impeller::SetSaturation(), impeller::Vector3::x, impeller::Vector3::y, and impeller::Vector3::z.

Referenced by impeller::testing::BlendModeTest(), and impeller::testing::TEST_P().

## ◆ Blue()

static constexpr Color impeller::Color::Blue | ( |  | ) |
| inline static constexpr

Definition at line 278 of file color.h.

278 { return {0.0f, 0.0f, 1.0f, 1.0f}; }

Referenced by impeller::testing::MaskBlurVariantTest(), impeller::testing::TEST(), and impeller::testing::TEST_P().

## ◆ BlueViolet()

static constexpr Color impeller::Color::BlueViolet | ( |  | ) |
| inline static constexpr

Definition at line 316 of file color.h.

316 {
317 return {138.0f / 255.0f, 43.0f / 255.0f, 226.0f / 255.0f, 1.0f};
318 }

## ◆ Brown()

static constexpr Color impeller::Color::Brown | ( |  | ) |
| inline static constexpr

Definition at line 320 of file color.h.

320 {
321 return {165.0f / 255.0f, 42.0f / 255.0f, 42.0f / 255.0f, 1.0f};
322 }

## ◆ BurlyWood()

static constexpr Color impeller::Color::BurlyWood | ( |  | ) |
| inline static constexpr

Definition at line 324 of file color.h.

324 {
325 return {222.0f / 255.0f, 184.0f / 255.0f, 135.0f / 255.0f, 1.0f};
326 }

## ◆ CadetBlue()

static constexpr Color impeller::Color::CadetBlue | ( |  | ) |
| inline static constexpr

Definition at line 328 of file color.h.

328 {
329 return {95.0f / 255.0f, 158.0f / 255.0f, 160.0f / 255.0f, 1.0f};
330 }

## ◆ Chartreuse()

static constexpr Color impeller::Color::Chartreuse | ( |  | ) |
| inline static constexpr

Definition at line 332 of file color.h.

332 {
333 return {127.0f / 255.0f, 255.0f / 255.0f, 0.0f / 255.0f, 1.0f};
334 }

Referenced by impeller::testing::TEST_P().

## ◆ Chocolate()

static constexpr Color impeller::Color::Chocolate | ( |  | ) |
| inline static constexpr

Definition at line 336 of file color.h.

336 {
337 return {210.0f / 255.0f, 105.0f / 255.0f, 30.0f / 255.0f, 1.0f};
338 }

## ◆ Clamp01()

constexpr Color impeller::Color::Clamp01 | ( |  | ) | const
| inline constexpr

Definition at line 238 of file color.h.

238 {
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 }

References alpha, blue, Color(), green, and red.

Referenced by impeller::testing::TEST().

## ◆ Coral()

static constexpr Color impeller::Color::Coral | ( |  | ) |
| inline static constexpr

Definition at line 340 of file color.h.

340 {
341 return {255.0f / 255.0f, 127.0f / 255.0f, 80.0f / 255.0f, 1.0f};
342 }

Referenced by impeller::testing::TEST_P().

## ◆ CornflowerBlue()

static constexpr Color impeller::Color::CornflowerBlue | ( |  | ) |
| inline static constexpr

Definition at line 344 of file color.h.

344 {
345 return {100.0f / 255.0f, 149.0f / 255.0f, 237.0f / 255.0f, 1.0f};
346 }

Referenced by impeller::testing::BlendModeTest(), and impeller::testing::TEST_P().

## ◆ Cornsilk()

static constexpr Color impeller::Color::Cornsilk | ( |  | ) |
| inline static constexpr

Definition at line 348 of file color.h.

348 {
349 return {255.0f / 255.0f, 248.0f / 255.0f, 220.0f / 255.0f, 1.0f};
350 }

## ◆ Crimson()

static constexpr Color impeller::Color::Crimson | ( |  | ) |
| inline static constexpr

Definition at line 352 of file color.h.

352 {
353 return {220.0f / 255.0f, 20.0f / 255.0f, 60.0f / 255.0f, 1.0f};
354 }

Referenced by impeller::testing::MaskBlurVariantTest(), and impeller::testing::TEST_P().

## ◆ Cyan()

static constexpr Color impeller::Color::Cyan | ( |  | ) |
| inline static constexpr

Definition at line 356 of file color.h.

356 {
357 return {0.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 1.0f};
358 }

## ◆ DarkBlue()

static constexpr Color impeller::Color::DarkBlue | ( |  | ) |
| inline static constexpr

Definition at line 360 of file color.h.

360 {
361 return {0.0f / 255.0f, 0.0f / 255.0f, 139.0f / 255.0f, 1.0f};
362 }

## ◆ DarkCyan()

static constexpr Color impeller::Color::DarkCyan | ( |  | ) |
| inline static constexpr

Definition at line 364 of file color.h.

364 {
365 return {0.0f / 255.0f, 139.0f / 255.0f, 139.0f / 255.0f, 1.0f};
366 }

## ◆ DarkGoldenrod()

static constexpr Color impeller::Color::DarkGoldenrod | ( |  | ) |
| inline static constexpr

Definition at line 368 of file color.h.

368 {
369 return {184.0f / 255.0f, 134.0f / 255.0f, 11.0f / 255.0f, 1.0f};
370 }

## ◆ DarkGray()

static constexpr Color impeller::Color::DarkGray | ( |  | ) |
| inline static constexpr

Definition at line 372 of file color.h.

372 {
373 return {169.0f / 255.0f, 169.0f / 255.0f, 169.0f / 255.0f, 1.0f};
374 }

Referenced by impeller::testing::TEST_P().

## ◆ DarkGreen()

static constexpr Color impeller::Color::DarkGreen | ( |  | ) |
| inline static constexpr

Definition at line 376 of file color.h.

376 {
377 return {0.0f / 255.0f, 100.0f / 255.0f, 0.0f / 255.0f, 1.0f};
378 }

Referenced by impeller::testing::TEST_P().

## ◆ DarkGrey()

static constexpr Color impeller::Color::DarkGrey | ( |  | ) |
| inline static constexpr

Definition at line 380 of file color.h.

380 {
381 return {169.0f / 255.0f, 169.0f / 255.0f, 169.0f / 255.0f, 1.0f};
382 }

## ◆ DarkKhaki()

static constexpr Color impeller::Color::DarkKhaki | ( |  | ) |
| inline static constexpr

Definition at line 384 of file color.h.

384 {
385 return {189.0f / 255.0f, 183.0f / 255.0f, 107.0f / 255.0f, 1.0f};
386 }

## ◆ DarkMagenta()

static constexpr Color impeller::Color::DarkMagenta | ( |  | ) |
| inline static constexpr

Definition at line 388 of file color.h.

388 {
389 return {139.0f / 255.0f, 0.0f / 255.0f, 139.0f / 255.0f, 1.0f};
390 }

Referenced by impeller::testing::TEST_P().

## ◆ DarkOliveGreen()

static constexpr Color impeller::Color::DarkOliveGreen | ( |  | ) |
| inline static constexpr

Definition at line 392 of file color.h.

392 {
393 return {85.0f / 255.0f, 107.0f / 255.0f, 47.0f / 255.0f, 1.0f};
394 }

## ◆ DarkOrange()

static constexpr Color impeller::Color::DarkOrange | ( |  | ) |
| inline static constexpr

Definition at line 396 of file color.h.

396 {
397 return {255.0f / 255.0f, 140.0f / 255.0f, 0.0f / 255.0f, 1.0f};
398 }

## ◆ DarkOrchid()

static constexpr Color impeller::Color::DarkOrchid | ( |  | ) |
| inline static constexpr

Definition at line 400 of file color.h.

400 {
401 return {153.0f / 255.0f, 50.0f / 255.0f, 204.0f / 255.0f, 1.0f};
402 }

## ◆ DarkRed()

static constexpr Color impeller::Color::DarkRed | ( |  | ) |
| inline static constexpr

Definition at line 404 of file color.h.

404 {
405 return {139.0f / 255.0f, 0.0f / 255.0f, 0.0f / 255.0f, 1.0f};
406 }

## ◆ DarkSalmon()

static constexpr Color impeller::Color::DarkSalmon | ( |  | ) |
| inline static constexpr

Definition at line 408 of file color.h.

408 {
409 return {233.0f / 255.0f, 150.0f / 255.0f, 122.0f / 255.0f, 1.0f};
410 }

## ◆ DarkSeagreen()

static constexpr Color impeller::Color::DarkSeagreen | ( |  | ) |
| inline static constexpr

Definition at line 412 of file color.h.

412 {
413 return {143.0f / 255.0f, 188.0f / 255.0f, 143.0f / 255.0f, 1.0f};
414 }

## ◆ DarkSlateBlue()

static constexpr Color impeller::Color::DarkSlateBlue | ( |  | ) |
| inline static constexpr

Definition at line 416 of file color.h.

416 {
417 return {72.0f / 255.0f, 61.0f / 255.0f, 139.0f / 255.0f, 1.0f};
418 }

## ◆ DarkSlateGray()

static constexpr Color impeller::Color::DarkSlateGray | ( |  | ) |
| inline static constexpr

Definition at line 420 of file color.h.

420 {
421 return {47.0f / 255.0f, 79.0f / 255.0f, 79.0f / 255.0f, 1.0f};
422 }

Referenced by impeller::SurfaceGLES::WrapFBO(), impeller::SurfaceVK::WrapSwapchainImage(), and impeller::WrapTextureWithRenderTarget().

## ◆ DarkSlateGrey()

static constexpr Color impeller::Color::DarkSlateGrey | ( |  | ) |
| inline static constexpr

Definition at line 424 of file color.h.

424 {
425 return {47.0f / 255.0f, 79.0f / 255.0f, 79.0f / 255.0f, 1.0f};
426 }

## ◆ DarkTurquoise()

static constexpr Color impeller::Color::DarkTurquoise | ( |  | ) |
| inline static constexpr

Definition at line 428 of file color.h.

428 {
429 return {0.0f / 255.0f, 206.0f / 255.0f, 209.0f / 255.0f, 1.0f};
430 }

## ◆ DarkViolet()

static constexpr Color impeller::Color::DarkViolet | ( |  | ) |
| inline static constexpr

Definition at line 432 of file color.h.

432 {
433 return {148.0f / 255.0f, 0.0f / 255.0f, 211.0f / 255.0f, 1.0f};
434 }

## ◆ DeepPink()

static constexpr Color impeller::Color::DeepPink | ( |  | ) |
| inline static constexpr

Definition at line 436 of file color.h.

436 {
437 return {255.0f / 255.0f, 20.0f / 255.0f, 147.0f / 255.0f, 1.0f};
438 }

Referenced by impeller::testing::TEST_P().

## ◆ DeepSkyBlue()

static constexpr Color impeller::Color::DeepSkyBlue | ( |  | ) |
| inline static constexpr

Definition at line 440 of file color.h.

440 {
441 return {0.0f / 255.0f, 191.0f / 255.0f, 255.0f / 255.0f, 1.0f};
442 }

## ◆ DimGray()

static constexpr Color impeller::Color::DimGray | ( |  | ) |
| inline static constexpr

Definition at line 444 of file color.h.

444 {
445 return {105.0f / 255.0f, 105.0f / 255.0f, 105.0f / 255.0f, 1.0f};
446 }

## ◆ DimGrey()

static constexpr Color impeller::Color::DimGrey | ( |  | ) |
| inline static constexpr

Definition at line 448 of file color.h.

448 {
449 return {105.0f / 255.0f, 105.0f / 255.0f, 105.0f / 255.0f, 1.0f};
450 }

## ◆ DodgerBlue()

static constexpr Color impeller::Color::DodgerBlue | ( |  | ) |
| inline static constexpr

Definition at line 452 of file color.h.

452 {
453 return {30.0f / 255.0f, 144.0f / 255.0f, 255.0f / 255.0f, 1.0f};
454 }

## ◆ Firebrick()

static constexpr Color impeller::Color::Firebrick | ( |  | ) |
| inline static constexpr

Definition at line 456 of file color.h.

456 {
457 return {178.0f / 255.0f, 34.0f / 255.0f, 34.0f / 255.0f, 1.0f};
458 }

## ◆ FloralWhite()

static constexpr Color impeller::Color::FloralWhite | ( |  | ) |
| inline static constexpr

Definition at line 460 of file color.h.

460 {
461 return {255.0f / 255.0f, 250.0f / 255.0f, 240.0f / 255.0f, 1.0f};
462 }

## ◆ ForestGreen()

static constexpr Color impeller::Color::ForestGreen | ( |  | ) |
| inline static constexpr

Definition at line 464 of file color.h.

464 {
465 return {34.0f / 255.0f, 139.0f / 255.0f, 34.0f / 255.0f, 1.0f};
466 }

## ◆ Fuchsia()

static constexpr Color impeller::Color::Fuchsia | ( |  | ) |
| inline static constexpr

Definition at line 468 of file color.h.

468 {
469 return {255.0f / 255.0f, 0.0f / 255.0f, 255.0f / 255.0f, 1.0f};
470 }

Referenced by impeller::testing::TEST_P().

## ◆ Gainsboro()

static constexpr Color impeller::Color::Gainsboro | ( |  | ) |
| inline static constexpr

Definition at line 472 of file color.h.

472 {
473 return {220.0f / 255.0f, 220.0f / 255.0f, 220.0f / 255.0f, 1.0f};
474 }

## ◆ Ghostwhite()

static constexpr Color impeller::Color::Ghostwhite | ( |  | ) |
| inline static constexpr

Definition at line 476 of file color.h.

476 {
477 return {248.0f / 255.0f, 248.0f / 255.0f, 255.0f / 255.0f, 1.0f};
478 }

## ◆ Gold()

static constexpr Color impeller::Color::Gold | ( |  | ) |
| inline static constexpr

Definition at line 480 of file color.h.

480 {
481 return {255.0f / 255.0f, 215.0f / 255.0f, 0.0f / 255.0f, 1.0f};
482 }

## ◆ Goldenrod()

static constexpr Color impeller::Color::Goldenrod | ( |  | ) |
| inline static constexpr

Definition at line 484 of file color.h.

484 {
485 return {218.0f / 255.0f, 165.0f / 255.0f, 32.0f / 255.0f, 1.0f};
486 }

## ◆ Gray()

static constexpr Color impeller::Color::Gray | ( |  | ) |
| inline static constexpr

Definition at line 488 of file color.h.

488 {
489 return {128.0f / 255.0f, 128.0f / 255.0f, 128.0f / 255.0f, 1.0f};
490 }

## ◆ Green()

static constexpr Color impeller::Color::Green | ( |  | ) |
| inline static constexpr

Definition at line 276 of file color.h.

276 { return {0.0f, 1.0f, 0.0f, 1.0f}; }

Referenced by impeller::testing::MaskBlurVariantTest(), impeller::testing::TEST(), and impeller::testing::TEST_P().

## ◆ GreenYellow()

static constexpr Color impeller::Color::GreenYellow | ( |  | ) |
| inline static constexpr

Definition at line 492 of file color.h.

492 {
493 return {173.0f / 255.0f, 255.0f / 255.0f, 47.0f / 255.0f, 1.0f};
494 }

Referenced by impeller::testing::TEST_P().

## ◆ Grey()

static constexpr Color impeller::Color::Grey | ( |  | ) |
| inline static constexpr

Definition at line 496 of file color.h.

496 {
497 return {128.0f / 255.0f, 128.0f / 255.0f, 128.0f / 255.0f, 1.0f};
498 }

Referenced by impeller::testing::TEST_P().

## ◆ Honeydew()

static constexpr Color impeller::Color::Honeydew | ( |  | ) |
| inline static constexpr

Definition at line 500 of file color.h.

500 {
501 return {240.0f / 255.0f, 255.0f / 255.0f, 240.0f / 255.0f, 1.0f};
502 }

## ◆ HotPink()

static constexpr Color impeller::Color::HotPink | ( |  | ) |
| inline static constexpr

Definition at line 504 of file color.h.

504 {
505 return {255.0f / 255.0f, 105.0f / 255.0f, 180.0f / 255.0f, 1.0f};
506 }

## ◆ IndianRed()

static constexpr Color impeller::Color::IndianRed | ( |  | ) |
| inline static constexpr

Definition at line 508 of file color.h.

508 {
509 return {205.0f / 255.0f, 92.0f / 255.0f, 92.0f / 255.0f, 1.0f};
510 }

## ◆ Indigo()

static constexpr Color impeller::Color::Indigo | ( |  | ) |
| inline static constexpr

Definition at line 512 of file color.h.

512 {
513 return {75.0f / 255.0f, 0.0f / 255.0f, 130.0f / 255.0f, 1.0f};
514 }

## ◆ IsOpaque()

constexpr bool impeller::Color::IsOpaque | ( |  | ) | const
| inline constexpr

Definition at line 896 of file color.h.

896 { return alpha == 1.0f; }

References alpha.

Referenced by impeller::SolidColorContents::IsOpaque().

## ◆ IsTransparent()

constexpr bool impeller::Color::IsTransparent | ( |  | ) | const
| inline constexpr

Definition at line 894 of file color.h.

894 { return alpha == 0.0f; }

References alpha.

## ◆ Ivory()

static constexpr Color impeller::Color::Ivory | ( |  | ) |
| inline static constexpr

Definition at line 516 of file color.h.

516 {
517 return {255.0f / 255.0f, 255.0f / 255.0f, 240.0f / 255.0f, 1.0f};
518 }

## ◆ Khaki()

static constexpr Color impeller::Color::Khaki | ( |  | ) |
| inline static constexpr

Definition at line 520 of file color.h.

520 {
521 return {240.0f / 255.0f, 230.0f / 255.0f, 140.0f / 255.0f, 1.0f};
522 }

## ◆ Lavender()

static constexpr Color impeller::Color::Lavender | ( |  | ) |
| inline static constexpr

Definition at line 524 of file color.h.

524 {
525 return {230.0f / 255.0f, 230.0f / 255.0f, 250.0f / 255.0f, 1.0f};
526 }

## ◆ LavenderBlush()

static constexpr Color impeller::Color::LavenderBlush | ( |  | ) |
| inline static constexpr

Definition at line 528 of file color.h.

528 {
529 return {255.0f / 255.0f, 240.0f / 255.0f, 245.0f / 255.0f, 1.0f};
530 }

## ◆ LawnGreen()

static constexpr Color impeller::Color::LawnGreen | ( |  | ) |
| inline static constexpr

Definition at line 532 of file color.h.

532 {
533 return {124.0f / 255.0f, 252.0f / 255.0f, 0.0f / 255.0f, 1.0f};
534 }

## ◆ LemonChiffon()

static constexpr Color impeller::Color::LemonChiffon | ( |  | ) |
| inline static constexpr

Definition at line 536 of file color.h.

536 {
537 return {255.0f / 255.0f, 250.0f / 255.0f, 205.0f / 255.0f, 1.0f};
538 }

## ◆ Lerp()

constexpr static Color impeller::Color::Lerp | ( | Color | a,
|  | Color | b,
|  | Scalar | t
| ) |  |
| inline static constexpr

Return a color that is linearly interpolated between colors a and b, according to the value of t.

Parameters

  a | The lower color.
  b | The upper color.
  t | A value between 0.0f and 1.0f, inclusive.

Returns
  constexpr Color

Definition at line 234 of file color.h.

234 {
235 return a + (b - a) * t;
236 }

References impeller::saturated::b.

Referenced by impeller::CreateGradientBuffer(), and impeller::testing::TEST().

## ◆ LightBlue()

static constexpr Color impeller::Color::LightBlue | ( |  | ) |
| inline static constexpr

Definition at line 540 of file color.h.

540 {
541 return {173.0f / 255.0f, 216.0f / 255.0f, 230.0f / 255.0f, 1.0f};
542 }

## ◆ LightCoral()

static constexpr Color impeller::Color::LightCoral | ( |  | ) |
| inline static constexpr

Definition at line 544 of file color.h.

544 {
545 return {240.0f / 255.0f, 128.0f / 255.0f, 128.0f / 255.0f, 1.0f};
546 }

## ◆ LightCyan()

static constexpr Color impeller::Color::LightCyan | ( |  | ) |
| inline static constexpr

Definition at line 548 of file color.h.

548 {
549 return {224.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 1.0f};
550 }

## ◆ LightGoldenrodYellow()

static constexpr Color impeller::Color::LightGoldenrodYellow | ( |  | ) |
| inline static constexpr

Definition at line 552 of file color.h.

552 {
553 return {50.0f / 255.0f, 250.0f / 255.0f, 210.0f / 255.0f, 1.0f};
554 }

## ◆ LightGray()

static constexpr Color impeller::Color::LightGray | ( |  | ) |
| inline static constexpr

Definition at line 556 of file color.h.

556 {
557 return {211.0f / 255.0f, 211.0f / 255.0f, 211.0f / 255.0f, 1.0f};
558 }

## ◆ LightGreen()

static constexpr Color impeller::Color::LightGreen | ( |  | ) |
| inline static constexpr

Definition at line 560 of file color.h.

560 {
561 return {144.0f / 255.0f, 238.0f / 255.0f, 144.0f / 255.0f, 1.0f};
562 }

## ◆ LightGrey()

static constexpr Color impeller::Color::LightGrey | ( |  | ) |
| inline static constexpr

Definition at line 564 of file color.h.

564 {
565 return {211.0f / 255.0f, 211.0f / 255.0f, 211.0f / 255.0f, 1.0f};
566 }

## ◆ LightPink()

static constexpr Color impeller::Color::LightPink | ( |  | ) |
| inline static constexpr

Definition at line 568 of file color.h.

568 {
569 return {255.0f / 255.0f, 182.0f / 255.0f, 193.0f / 255.0f, 1.0f};
570 }

## ◆ LightSalmon()

static constexpr Color impeller::Color::LightSalmon | ( |  | ) |
| inline static constexpr

Definition at line 572 of file color.h.

572 {
573 return {255.0f / 255.0f, 160.0f / 255.0f, 122.0f / 255.0f, 1.0f};
574 }

## ◆ LightSeaGreen()

static constexpr Color impeller::Color::LightSeaGreen | ( |  | ) |
| inline static constexpr

Definition at line 576 of file color.h.

576 {
577 return {32.0f / 255.0f, 178.0f / 255.0f, 170.0f / 255.0f, 1.0f};
578 }

## ◆ LightSkyBlue()

static constexpr Color impeller::Color::LightSkyBlue | ( |  | ) |
| inline static constexpr

Definition at line 580 of file color.h.

580 {
581 return {135.0f / 255.0f, 206.0f / 255.0f, 250.0f / 255.0f, 1.0f};
582 }

## ◆ LightSlateGray()

static constexpr Color impeller::Color::LightSlateGray | ( |  | ) |
| inline static constexpr

Definition at line 584 of file color.h.

584 {
585 return {119.0f / 255.0f, 136.0f / 255.0f, 153.0f / 255.0f, 1.0f};
586 }

## ◆ LightSlateGrey()

static constexpr Color impeller::Color::LightSlateGrey | ( |  | ) |
| inline static constexpr

Definition at line 588 of file color.h.

588 {
589 return {119.0f / 255.0f, 136.0f / 255.0f, 153.0f / 255.0f, 1.0f};
590 }

## ◆ LightSteelBlue()

static constexpr Color impeller::Color::LightSteelBlue | ( |  | ) |
| inline static constexpr

Definition at line 592 of file color.h.

592 {
593 return {176.0f / 255.0f, 196.0f / 255.0f, 222.0f / 255.0f, 1.0f};
594 }

## ◆ LightYellow()

static constexpr Color impeller::Color::LightYellow | ( |  | ) |
| inline static constexpr

Definition at line 596 of file color.h.

596 {
597 return {255.0f / 255.0f, 255.0f / 255.0f, 224.0f / 255.0f, 1.0f};
598 }

## ◆ Lime()

static constexpr Color impeller::Color::Lime | ( |  | ) |
| inline static constexpr

Definition at line 600 of file color.h.

600 {
601 return {0.0f / 255.0f, 255.0f / 255.0f, 0.0f / 255.0f, 1.0f};
602 }

## ◆ LimeGreen()

static constexpr Color impeller::Color::LimeGreen | ( |  | ) |
| inline static constexpr

Definition at line 604 of file color.h.

604 {
605 return {50.0f / 255.0f, 205.0f / 255.0f, 50.0f / 255.0f, 1.0f};
606 }

Referenced by impeller::testing::BlendModeTest(), and impeller::testing::TEST_P().

## ◆ LinearToSRGB()

Color impeller::Color::LinearToSRGB | ( |  | ) | const

Convert the color from linear space to sRGB space.

       The color is assumed to be unpremultiplied. If the color is
       premultipled, the conversion output will be incorrect.

Definition at line 388 of file color.cc.

388 {
389 static auto conversion = [](Scalar component) {
390 if (component <= 0.0031308) {
391 return component * 12.92;
392 }
393 return 1.055 * pow(component, (1.0 / 2.4)) - 0.055;
394 };
395
396 return Color(conversion(red), conversion(green), conversion(blue), alpha);
397 }

References alpha, blue, Color(), green, and red.

Referenced by impeller::testing::TEST().

## ◆ Linen()

static constexpr Color impeller::Color::Linen | ( |  | ) |
| inline static constexpr

Definition at line 608 of file color.h.

608 {
609 return {250.0f / 255.0f, 240.0f / 255.0f, 230.0f / 255.0f, 1.0f};
610 }

## ◆ Magenta()

static constexpr Color impeller::Color::Magenta | ( |  | ) |
| inline static constexpr

Definition at line 612 of file color.h.

612 {
613 return {255.0f / 255.0f, 0.0f / 255.0f, 255.0f / 255.0f, 1.0f};
614 }

Referenced by impeller::testing::TEST_P().

## ◆ MakeRGBA8()

static constexpr Color impeller::Color::MakeRGBA8 | ( | uint8_t | r,
|  | uint8_t | g,
|  | uint8_t | b,
|  | uint8_t | a
| ) |  |
| inline static constexpr

Definition at line 154 of file color.h.

154 {
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 }

References impeller::saturated::b, and Color().

Referenced by impeller::testing::BlendModeTest(), impeller::testing::TEST(), and impeller::testing::TEST_P().

## ◆ Maroon()

static constexpr Color impeller::Color::Maroon | ( |  | ) |
| inline static constexpr

Definition at line 616 of file color.h.

616 {
617 return {128.0f / 255.0f, 0.0f / 255.0f, 0.0f / 255.0f, 1.0f};
618 }

Referenced by impeller::testing::MaskBlurVariantTest().

## ◆ MediumAquamarine()

static constexpr Color impeller::Color::MediumAquamarine | ( |  | ) |
| inline static constexpr

Definition at line 620 of file color.h.

620 {
621 return {102.0f / 255.0f, 205.0f / 255.0f, 170.0f / 255.0f, 1.0f};
622 }

## ◆ MediumBlue()

static constexpr Color impeller::Color::MediumBlue | ( |  | ) |
| inline static constexpr

Definition at line 624 of file color.h.

624 {
625 return {0.0f / 255.0f, 0.0f / 255.0f, 205.0f / 255.0f, 1.0f};
626 }

## ◆ MediumOrchid()

static constexpr Color impeller::Color::MediumOrchid | ( |  | ) |
| inline static constexpr

Definition at line 628 of file color.h.

628 {
629 return {186.0f / 255.0f, 85.0f / 255.0f, 211.0f / 255.0f, 1.0f};
630 }

## ◆ MediumPurple()

static constexpr Color impeller::Color::MediumPurple | ( |  | ) |
| inline static constexpr

Definition at line 632 of file color.h.

632 {
633 return {147.0f / 255.0f, 112.0f / 255.0f, 219.0f / 255.0f, 1.0f};
634 }

## ◆ MediumSeagreen()

static constexpr Color impeller::Color::MediumSeagreen | ( |  | ) |
| inline static constexpr

Definition at line 636 of file color.h.

636 {
637 return {60.0f / 255.0f, 179.0f / 255.0f, 113.0f / 255.0f, 1.0f};
638 }

## ◆ MediumSlateBlue()

static constexpr Color impeller::Color::MediumSlateBlue | ( |  | ) |
| inline static constexpr

Definition at line 640 of file color.h.

640 {
641 return {123.0f / 255.0f, 104.0f / 255.0f, 238.0f / 255.0f, 1.0f};
642 }

## ◆ MediumSpringGreen()

static constexpr Color impeller::Color::MediumSpringGreen | ( |  | ) |
| inline static constexpr

Definition at line 644 of file color.h.

644 {
645 return {0.0f / 255.0f, 250.0f / 255.0f, 154.0f / 255.0f, 1.0f};
646 }

## ◆ MediumTurquoise()

static constexpr Color impeller::Color::MediumTurquoise | ( |  | ) |
| inline static constexpr

Definition at line 648 of file color.h.

648 {
649 return {72.0f / 255.0f, 209.0f / 255.0f, 204.0f / 255.0f, 1.0f};
650 }

Referenced by impeller::testing::TEST_P().

## ◆ MediumVioletRed()

static constexpr Color impeller::Color::MediumVioletRed | ( |  | ) |
| inline static constexpr

Definition at line 652 of file color.h.

652 {
653 return {199.0f / 255.0f, 21.0f / 255.0f, 133.0f / 255.0f, 1.0f};
654 }

## ◆ MidnightBlue()

static constexpr Color impeller::Color::MidnightBlue | ( |  | ) |
| inline static constexpr

Definition at line 656 of file color.h.

656 {
657 return {25.0f / 255.0f, 25.0f / 255.0f, 112.0f / 255.0f, 1.0f};
658 }

## ◆ MintCream()

static constexpr Color impeller::Color::MintCream | ( |  | ) |
| inline static constexpr

Definition at line 660 of file color.h.

660 {
661 return {245.0f / 255.0f, 255.0f / 255.0f, 250.0f / 255.0f, 1.0f};
662 }

Referenced by impeller::testing::TEST_P().

## ◆ MistyRose()

static constexpr Color impeller::Color::MistyRose | ( |  | ) |
| inline static constexpr

Definition at line 664 of file color.h.

664 {
665 return {255.0f / 255.0f, 228.0f / 255.0f, 225.0f / 255.0f, 1.0f};
666 }

## ◆ Moccasin()

static constexpr Color impeller::Color::Moccasin | ( |  | ) |
| inline static constexpr

Definition at line 668 of file color.h.

668 {
669 return {255.0f / 255.0f, 228.0f / 255.0f, 181.0f / 255.0f, 1.0f};
670 }

## ◆ NavajoWhite()

static constexpr Color impeller::Color::NavajoWhite | ( |  | ) |
| inline static constexpr

Definition at line 672 of file color.h.

672 {
673 return {255.0f / 255.0f, 222.0f / 255.0f, 173.0f / 255.0f, 1.0f};
674 }

## ◆ Navy()

static constexpr Color impeller::Color::Navy | ( |  | ) |
| inline static constexpr

Definition at line 676 of file color.h.

676 {
677 return {0.0f / 255.0f, 0.0f / 255.0f, 128.0f / 255.0f, 1.0f};
678 }

## ◆ OldLace()

static constexpr Color impeller::Color::OldLace | ( |  | ) |
| inline static constexpr

Definition at line 680 of file color.h.

680 {
681 return {253.0f / 255.0f, 245.0f / 255.0f, 230.0f / 255.0f, 1.0f};
682 }

## ◆ Olive()

static constexpr Color impeller::Color::Olive | ( |  | ) |
| inline static constexpr

Definition at line 684 of file color.h.

684 {
685 return {128.0f / 255.0f, 128.0f / 255.0f, 0.0f / 255.0f, 1.0f};
686 }

## ◆ OliveDrab()

static constexpr Color impeller::Color::OliveDrab | ( |  | ) |
| inline static constexpr

Definition at line 688 of file color.h.

688 {
689 return {107.0f / 255.0f, 142.0f / 255.0f, 35.0f / 255.0f, 1.0f};
690 }

## ◆ operator*() [1/2]

constexpr Color impeller::Color::operator* | ( | const Color & | c | ) | const
| inline constexpr

Definition at line 194 of file color.h.

194 {
195 return {red * c.red, green * c.green, blue * c.blue, alpha * c.alpha};
196 }

References alpha, blue, green, and red.

## ◆ operator*() [2/2]

template<class T , class = std::enable_if_t<std::is_arithmetic_v<T>>>

constexpr Color impeller::Color::operator* | ( | T | value | ) | const
| inline constexpr

Definition at line 199 of file color.h.

199 {
200 auto v = static_cast<Scalar>(value);
201 return {red * v, green * v, blue * v, alpha * v};
202 }

References alpha, blue, green, and red.

## ◆ operator+() [1/2]

constexpr Color impeller::Color::operator+ | ( | const Color & | c | ) | const
| inline constexpr

Definition at line 174 of file color.h.

174 {
175 return {red + c.red, green + c.green, blue + c.blue, alpha + c.alpha};
176 }

References alpha, blue, green, and red.

## ◆ operator+() [2/2]

template<class T , class = std::enable_if_t<std::is_arithmetic_v<T>>>

constexpr Color impeller::Color::operator+ | ( | T | value | ) | const
| inline constexpr

Definition at line 179 of file color.h.

179 {
180 auto v = static_cast<Scalar>(value);
181 return {red + v, green + v, blue + v, alpha + v};
182 }

References alpha, blue, green, and red.

## ◆ operator-() [1/2]

constexpr Color impeller::Color::operator- | ( | const Color & | c | ) | const
| inline constexpr

Definition at line 184 of file color.h.

184 {
185 return {red - c.red, green - c.green, blue - c.blue, alpha - c.alpha};
186 }

References alpha, blue, green, and red.

## ◆ operator-() [2/2]

template<class T , class = std::enable_if_t<std::is_arithmetic_v<T>>>

constexpr Color impeller::Color::operator- | ( | T | value | ) | const
| inline constexpr

Definition at line 189 of file color.h.

189 {
190 auto v = static_cast<Scalar>(value);
191 return {red - v, green - v, blue - v, alpha - v};
192 }

References alpha, blue, green, and red.

## ◆ operator/() [1/2]

constexpr Color impeller::Color::operator/ | ( | const Color & | c | ) | const
| inline constexpr

Definition at line 204 of file color.h.

204 {
205 return {red * c.red, green * c.green, blue * c.blue, alpha * c.alpha};
206 }

References alpha, blue, green, and red.

## ◆ operator/() [2/2]

template<class T , class = std::enable_if_t<std::is_arithmetic_v<T>>>

constexpr Color impeller::Color::operator/ | ( | T | value | ) | const
| inline constexpr

Definition at line 209 of file color.h.

209 {
210 auto v = static_cast<Scalar>(value);
211 return {red / v, green / v, blue / v, alpha / v};
212 }

References alpha, blue, green, and red.

## ◆ operator==()

constexpr bool impeller::Color::operator== | ( | const Color & | c | ) | const
| inline constexpr

Definition at line 169 of file color.h.

169 {
170 return ScalarNearlyEqual(red, c.red) && ScalarNearlyEqual(green, c.green) &&
171 ScalarNearlyEqual(blue, c.blue) && ScalarNearlyEqual(alpha, c.alpha);
172 }

References alpha, blue, green, red, and impeller::ScalarNearlyEqual().

## ◆ Orange()

static constexpr Color impeller::Color::Orange | ( |  | ) |
| inline static constexpr

Definition at line 692 of file color.h.

692 {
693 return {255.0f / 255.0f, 165.0f / 255.0f, 0.0f / 255.0f, 1.0f};
694 }

Referenced by impeller::testing::MaskBlurVariantTest(), and impeller::testing::TEST_P().

## ◆ OrangeRed()

static constexpr Color impeller::Color::OrangeRed | ( |  | ) |
| inline static constexpr

Definition at line 696 of file color.h.

696 {
697 return {255.0f / 255.0f, 69.0f / 255.0f, 0.0f / 255.0f, 1.0f};
698 }

Referenced by impeller::testing::TEST_P().

## ◆ Orchid()

static constexpr Color impeller::Color::Orchid | ( |  | ) |
| inline static constexpr

Definition at line 700 of file color.h.

700 {
701 return {218.0f / 255.0f, 112.0f / 255.0f, 214.0f / 255.0f, 1.0f};
702 }

## ◆ PaleGoldenrod()

static constexpr Color impeller::Color::PaleGoldenrod | ( |  | ) |
| inline static constexpr

Definition at line 704 of file color.h.

704 {
705 return {238.0f / 255.0f, 232.0f / 255.0f, 170.0f / 255.0f, 1.0f};
706 }

## ◆ PaleGreen()

static constexpr Color impeller::Color::PaleGreen | ( |  | ) |
| inline static constexpr

Definition at line 708 of file color.h.

708 {
709 return {152.0f / 255.0f, 251.0f / 255.0f, 152.0f / 255.0f, 1.0f};
710 }

## ◆ PaleTurquoise()

static constexpr Color impeller::Color::PaleTurquoise | ( |  | ) |
| inline static constexpr

Definition at line 712 of file color.h.

712 {
713 return {175.0f / 255.0f, 238.0f / 255.0f, 238.0f / 255.0f, 1.0f};
714 }

## ◆ PaleVioletRed()

static constexpr Color impeller::Color::PaleVioletRed | ( |  | ) |
| inline static constexpr

Definition at line 716 of file color.h.

716 {
717 return {219.0f / 255.0f, 112.0f / 255.0f, 147.0f / 255.0f, 1.0f};
718 }

## ◆ PapayaWhip()

static constexpr Color impeller::Color::PapayaWhip | ( |  | ) |
| inline static constexpr

Definition at line 720 of file color.h.

720 {
721 return {255.0f / 255.0f, 239.0f / 255.0f, 213.0f / 255.0f, 1.0f};
722 }

## ◆ Peachpuff()

static constexpr Color impeller::Color::Peachpuff | ( |  | ) |
| inline static constexpr

Definition at line 724 of file color.h.

724 {
725 return {255.0f / 255.0f, 218.0f / 255.0f, 185.0f / 255.0f, 1.0f};
726 }

## ◆ Peru()

static constexpr Color impeller::Color::Peru | ( |  | ) |
| inline static constexpr

Definition at line 728 of file color.h.

728 {
729 return {205.0f / 255.0f, 133.0f / 255.0f, 63.0f / 255.0f, 1.0f};
730 }

## ◆ Pink()

static constexpr Color impeller::Color::Pink | ( |  | ) |
| inline static constexpr

Definition at line 732 of file color.h.

732 {
733 return {255.0f / 255.0f, 192.0f / 255.0f, 203.0f / 255.0f, 1.0f};
734 }

## ◆ Plum()

static constexpr Color impeller::Color::Plum | ( |  | ) |
| inline static constexpr

Definition at line 736 of file color.h.

736 {
737 return {221.0f / 255.0f, 160.0f / 255.0f, 221.0f / 255.0f, 1.0f};
738 }

## ◆ PowderBlue()

static constexpr Color impeller::Color::PowderBlue | ( |  | ) |
| inline static constexpr

Definition at line 740 of file color.h.

740 {
741 return {176.0f / 255.0f, 224.0f / 255.0f, 230.0f / 255.0f, 1.0f};
742 }

## ◆ Premultiply()

constexpr Color impeller::Color::Premultiply | ( |  | ) | const
| inline constexpr

Definition at line 214 of file color.h.

214 {
215 return {red * alpha, green * alpha, blue * alpha, alpha};
216 }

References alpha, blue, green, and red.

Referenced by impeller::ApplyBlendedColor(), Blend(), impeller::MakeVertices(), impeller::SolidColorContents::Render(), impeller::testing::TEST(), and impeller::testing::TEST_P().

## ◆ Purple()

static constexpr Color impeller::Color::Purple | ( |  | ) |
| inline static constexpr

Definition at line 744 of file color.h.

744 {
745 return {128.0f / 255.0f, 0.0f / 255.0f, 128.0f / 255.0f, 1.0f};
746 }

Referenced by impeller::testing::MaskBlurVariantTest(), and impeller::testing::TEST_P().

## ◆ Random()

static Color impeller::Color::Random | ( |  | ) |
| inline static

Definition at line 852 of file color.h.

852 {
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 }

Referenced by impeller::testing::TEST_P().

## ◆ Red()

static constexpr Color impeller::Color::Red | ( |  | ) |
| inline static constexpr

Definition at line 274 of file color.h.

274 { return {1.0f, 0.0f, 0.0f, 1.0f}; }

Referenced by impeller::testing::CreatePassWithRectPath(), impeller::testing::TEST(), impeller::scene::testing::TEST_P(), and impeller::testing::TEST_P().

## ◆ RosyBrown()

static constexpr Color impeller::Color::RosyBrown | ( |  | ) |
| inline static constexpr

Definition at line 748 of file color.h.

748 {
749 return {188.0f / 255.0f, 143.0f / 255.0f, 143.0f / 255.0f, 1.0f};
750 }

## ◆ RoyalBlue()

static constexpr Color impeller::Color::RoyalBlue | ( |  | ) |
| inline static constexpr

Definition at line 752 of file color.h.

752 {
753 return {65.0f / 255.0f, 105.0f / 255.0f, 225.0f / 255.0f, 1.0f};
754 }

## ◆ SaddleBrown()

static constexpr Color impeller::Color::SaddleBrown | ( |  | ) |
| inline static constexpr

Definition at line 756 of file color.h.

756 {
757 return {139.0f / 255.0f, 69.0f / 255.0f, 19.0f / 255.0f, 1.0f};
758 }

## ◆ Salmon()

static constexpr Color impeller::Color::Salmon | ( |  | ) |
| inline static constexpr

Definition at line 760 of file color.h.

760 {
761 return {250.0f / 255.0f, 128.0f / 255.0f, 114.0f / 255.0f, 1.0f};
762 }

## ◆ SandyBrown()

static constexpr Color impeller::Color::SandyBrown | ( |  | ) |
| inline static constexpr

Definition at line 764 of file color.h.

764 {
765 return {244.0f / 255.0f, 164.0f / 255.0f, 96.0f / 255.0f, 1.0f};
766 }

## ◆ Seagreen()

static constexpr Color impeller::Color::Seagreen | ( |  | ) |
| inline static constexpr

Definition at line 768 of file color.h.

768 {
769 return {46.0f / 255.0f, 139.0f / 255.0f, 87.0f / 255.0f, 1.0f};
770 }

## ◆ Seashell()

static constexpr Color impeller::Color::Seashell | ( |  | ) |
| inline static constexpr

Definition at line 772 of file color.h.

772 {
773 return {255.0f / 255.0f, 245.0f / 255.0f, 238.0f / 255.0f, 1.0f};
774 }

## ◆ Sienna()

static constexpr Color impeller::Color::Sienna | ( |  | ) |
| inline static constexpr

Definition at line 776 of file color.h.

776 {
777 return {160.0f / 255.0f, 82.0f / 255.0f, 45.0f / 255.0f, 1.0f};
778 }

## ◆ Silver()

static constexpr Color impeller::Color::Silver | ( |  | ) |
| inline static constexpr

Definition at line 780 of file color.h.

780 {
781 return {192.0f / 255.0f, 192.0f / 255.0f, 192.0f / 255.0f, 1.0f};
782 }

## ◆ SkyBlue()

static constexpr Color impeller::Color::SkyBlue | ( |  | ) |
| inline static constexpr

Definition at line 784 of file color.h.

784 {
785 return {135.0f / 255.0f, 206.0f / 255.0f, 235.0f / 255.0f, 1.0f};
786 }

## ◆ SlateBlue()

static constexpr Color impeller::Color::SlateBlue | ( |  | ) |
| inline static constexpr

Definition at line 788 of file color.h.

788 {
789 return {106.0f / 255.0f, 90.0f / 255.0f, 205.0f / 255.0f, 1.0f};
790 }

## ◆ SlateGray()

static constexpr Color impeller::Color::SlateGray | ( |  | ) |
| inline static constexpr

Definition at line 792 of file color.h.

792 {
793 return {112.0f / 255.0f, 128.0f / 255.0f, 144.0f / 255.0f, 1.0f};
794 }

## ◆ SlateGrey()

static constexpr Color impeller::Color::SlateGrey | ( |  | ) |
| inline static constexpr

Definition at line 796 of file color.h.

796 {
797 return {112.0f / 255.0f, 128.0f / 255.0f, 144.0f / 255.0f, 1.0f};
798 }

## ◆ Snow()

static constexpr Color impeller::Color::Snow | ( |  | ) |
| inline static constexpr

Definition at line 800 of file color.h.

800 {
801 return {255.0f / 255.0f, 250.0f / 255.0f, 250.0f / 255.0f, 1.0f};
802 }

## ◆ SpringGreen()

static constexpr Color impeller::Color::SpringGreen | ( |  | ) |
| inline static constexpr

Definition at line 804 of file color.h.

804 {
805 return {0.0f / 255.0f, 255.0f / 255.0f, 127.0f / 255.0f, 1.0f};
806 }

## ◆ SRGBToLinear()

Color impeller::Color::SRGBToLinear | ( |  | ) | const

Convert the color from sRGB space to linear space.

       The color is assumed to be unpremultiplied. If the color is
       premultipled, the conversion output will be incorrect.

Definition at line 399 of file color.cc.

399 {
400 static auto conversion = [](Scalar component) {
401 if (component <= 0.04045) {
402 return component / 12.92;
403 }
404 return pow((component + 0.055) / 1.055, 2.4);
405 };
406
407 return Color(conversion(red), conversion(green), conversion(blue), alpha);
408 }

References alpha, blue, Color(), green, and red.

Referenced by impeller::testing::TEST().

## ◆ SteelBlue()

static constexpr Color impeller::Color::SteelBlue | ( |  | ) |
| inline static constexpr

Definition at line 808 of file color.h.

808 {
809 return {70.0f / 255.0f, 130.0f / 255.0f, 180.0f / 255.0f, 1.0f};
810 }

## ◆ Tan()

static constexpr Color impeller::Color::Tan | ( |  | ) |
| inline static constexpr

Definition at line 812 of file color.h.

812 {
813 return {210.0f / 255.0f, 180.0f / 255.0f, 140.0f / 255.0f, 1.0f};
814 }

## ◆ Teal()

static constexpr Color impeller::Color::Teal | ( |  | ) |
| inline static constexpr

Definition at line 816 of file color.h.

816 {
817 return {0.0f / 255.0f, 128.0f / 255.0f, 128.0f / 255.0f, 1.0f};
818 }

## ◆ Thistle()

static constexpr Color impeller::Color::Thistle | ( |  | ) |
| inline static constexpr

Definition at line 820 of file color.h.

820 {
821 return {216.0f / 255.0f, 191.0f / 255.0f, 216.0f / 255.0f, 1.0f};
822 }

## ◆ ToARGB()

constexpr uint32_t impeller::Color::ToARGB | ( |  | ) | const
| inline constexpr

Convert to ARGB 32 bit color.

Returns
  constexpr uint32_t

Definition at line 261 of file color.h.

261 {
262 std::array<uint8_t, 4> result = ToR8G8B8A8();
263 return result[3] << 24 | result[0] << 16 | result[1] << 8 | result[2];
264 }

References ToR8G8B8A8().

Referenced by impeller::testing::CanRenderConicalGradientWithDithering(), impeller::testing::CanRenderRadialGradientWithDithering(), impeller::testing::CanRenderSweepGradientWithDithering(), impeller::DrawGlyph(), std::hash< impeller::SubpixelGlyph >::operator()(), std::equal_to< impeller::SubpixelGlyph >::operator()(), and impeller::testing::TEST_P().

## ◆ ToIColor()

static constexpr uint32_t impeller::Color::ToIColor | ( | Color | color | ) |
| inline static constexpr

Convert this color to a 32-bit representation.

Definition at line 161 of file color.h.

161 {
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 }

References color.

Referenced by impeller::testing::TEST(), and impeller::testing::toColor().

## ◆ Tomato()

static constexpr Color impeller::Color::Tomato | ( |  | ) |
| inline static constexpr

Definition at line 824 of file color.h.

824 {
825 return {255.0f / 255.0f, 99.0f / 255.0f, 71.0f / 255.0f, 1.0f};
826 }

## ◆ ToR8G8B8A8()

constexpr std::array<uint8_t, 4> impeller::Color::ToR8G8B8A8 | ( |  | ) | const
| inline constexpr

Convert to R8G8B8A8 representation.

Returns
  constexpr std::array<u_int8, 4>

Definition at line 248 of file color.h.

248 {
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 }

References alpha, impeller::saturated::b, blue, green, and red.

Referenced by impeller::ContentContext::ContentContext(), impeller::testing::TEST(), and ToARGB().

## ◆ Turquoise()

static constexpr Color impeller::Color::Turquoise | ( |  | ) |
| inline static constexpr

Definition at line 828 of file color.h.

828 {
829 return {64.0f / 255.0f, 224.0f / 255.0f, 208.0f / 255.0f, 1.0f};
830 }

## ◆ Unpremultiply()

constexpr Color impeller::Color::Unpremultiply | ( |  | ) | const
| inline constexpr

Definition at line 218 of file color.h.

218 {
219 if (ScalarNearlyEqual(alpha, 0.0f)) {
220 return Color::BlackTransparent();
221 }
222 return {red / alpha, green / alpha, blue / alpha, alpha};
223 }

References alpha, BlackTransparent(), blue, green, red, and impeller::ScalarNearlyEqual().

Referenced by impeller::DoColorBlend(), impeller::DoColorBlendComponents(), and impeller::testing::TEST().

## ◆ Violet()

static constexpr Color impeller::Color::Violet | ( |  | ) |
| inline static constexpr

Definition at line 832 of file color.h.

832 {
833 return {238.0f / 255.0f, 130.0f / 255.0f, 238.0f / 255.0f, 1.0f};
834 }

## ◆ Wheat()

static constexpr Color impeller::Color::Wheat | ( |  | ) |
| inline static constexpr

Definition at line 836 of file color.h.

836 {
837 return {245.0f / 255.0f, 222.0f / 255.0f, 179.0f / 255.0f, 1.0f};
838 }

Referenced by impeller::testing::TEST_P().

## ◆ White()

static constexpr Color impeller::Color::White | ( |  | ) |
| inline static constexpr

Definition at line 266 of file color.h.

266 { return {1.0f, 1.0f, 1.0f, 1.0f}; }

Referenced by impeller::testing::BlendModeTest(), impeller::Paint::MaskBlurDescriptor::CreateMaskBlur(), impeller::scene::CuboidGeometry::GetVertexBuffer(), impeller::scene::PhysicallyBasedMaterial::MakeFromFlatbuffer(), impeller::SolidRRectBlurContents::Render(), impeller::testing::TEST(), and impeller::testing::TEST_P().

## ◆ Whitesmoke()

static constexpr Color impeller::Color::Whitesmoke | ( |  | ) |
| inline static constexpr

Definition at line 840 of file color.h.

840 {
841 return {245.0f / 255.0f, 245.0f / 255.0f, 245.0f / 255.0f, 1.0f};
842 }

## ◆ WhiteTransparent()

static constexpr Color impeller::Color::WhiteTransparent | ( |  | ) |
| inline static constexpr

Definition at line 270 of file color.h.

270 { return {1.0f, 1.0f, 1.0f, 0.0f}; }

Referenced by impeller::testing::TEST_P().

## ◆ WithAlpha()

constexpr Color impeller::Color::WithAlpha | ( | Scalar | new_alpha | ) | const
| inline constexpr

Definition at line 280 of file color.h.

280 {
281 return {red, green, blue, new_alpha};
282 }

References blue, green, and red.

Referenced by impeller::testing::BlendModeTest(), impeller::SolidColorContents::GetColor(), impeller::TextContents::GetColor(), impeller::testing::MaskBlurVariantTest(), and impeller::testing::TEST_P().

## ◆ Yellow()

static constexpr Color impeller::Color::Yellow | ( |  | ) |
| inline static constexpr

Definition at line 844 of file color.h.

844 {
845 return {255.0f / 255.0f, 255.0f / 255.0f, 0.0f / 255.0f, 1.0f};
846 }

Referenced by impeller::testing::TEST(), and impeller::testing::TEST_P().

## ◆ YellowGreen()

static constexpr Color impeller::Color::YellowGreen | ( |  | ) |
| inline static constexpr

Definition at line 848 of file color.h.

848 {
849 return {154.0f / 255.0f, 205.0f / 255.0f, 50.0f / 255.0f, 1.0f};
850 }

## Member Data Documentation

## ◆ alpha

Scalar impeller::Color::alpha = 0.0

The alpha component of the color (0 to 1)

Definition at line 143 of file color.h.

Referenced by impeller::ApplyBlendedColor(), ApplyColorMatrix(), Blend(), Clamp01(), ColorNear(), impeller::PaintPassDelegate::CreateContentsForSubpassTarget(), impeller::DlDispatcherBase::drawShadow(), impeller::EncodeCommandsInReactor(), impeller::ColorHSB::FromRGB(), impeller::SolidColorContents::GetColor(), impeller::TextContents::GetColor(), IsOpaque(), IsTransparent(), LinearToSRGB(), impeller::Min(), operator*(), operator+(), operator-(), impeller::operator-(), operator/(), impeller::operator/(), std::operator<<(), operator==(), Premultiply(), impeller::ExperimentalCanvas::SaveLayer(), impeller::Canvas::SaveLayer(), SRGBToLinear(), impeller::testing::TEST_P(), impeller::scene::importer::ToFBColor(), ToR8G8B8A8(), and Unpremultiply().

## ◆ blue

Scalar impeller::Color::blue = 0.0

The blue color component (0 to 1)

Definition at line 138 of file color.h.

Referenced by ApplyColorMatrix(), Clamp01(), ColorNear(), impeller::DoColorBlendComponents(), impeller::DrawPlaygroundLine(), impeller::DrawPlaygroundPoint(), impeller::DlDispatcherBase::drawShadow(), impeller::EncodeCommandsInReactor(), impeller::ColorHSB::FromRGB(), LinearToSRGB(), impeller::Min(), operator*(), operator+(), operator-(), impeller::operator-(), operator/(), impeller::operator/(), std::operator<<(), operator==(), Premultiply(), SRGBToLinear(), impeller::scene::importer::ToFBColor(), ToR8G8B8A8(), Unpremultiply(), and WithAlpha().

## ◆ green

Scalar impeller::Color::green = 0.0

The green color component (0 to 1)

Definition at line 133 of file color.h.

Referenced by ApplyColorMatrix(), Clamp01(), ColorNear(), impeller::DoColorBlendComponents(), impeller::DrawPlaygroundLine(), impeller::DrawPlaygroundPoint(), impeller::DlDispatcherBase::drawShadow(), impeller::EncodeCommandsInReactor(), impeller::ColorHSB::FromRGB(), LinearToSRGB(), impeller::Min(), operator*(), operator+(), operator-(), impeller::operator-(), operator/(), impeller::operator/(), std::operator<<(), operator==(), Premultiply(), SRGBToLinear(), impeller::scene::importer::ToFBColor(), ToR8G8B8A8(), Unpremultiply(), and WithAlpha().

## ◆ red

Scalar impeller::Color::red = 0.0

The red color component (0 to 1)

Definition at line 128 of file color.h.

Referenced by ApplyColorMatrix(), Clamp01(), ColorNear(), impeller::DoColorBlendComponents(), impeller::DrawPlaygroundLine(), impeller::DrawPlaygroundPoint(), impeller::DlDispatcherBase::drawShadow(), impeller::EncodeCommandsInReactor(), impeller::ColorHSB::FromRGB(), LinearToSRGB(), impeller::Min(), operator*(), operator+(), operator-(), impeller::operator-(), operator/(), impeller::operator/(), std::operator<<(), operator==(), Premultiply(), SRGBToLinear(), impeller::scene::importer::ToFBColor(), ToR8G8B8A8(), Unpremultiply(), and WithAlpha().

The documentation for this struct was generated from the following files:

- impeller/geometry/color.h
- impeller/geometry/color.cc

impeller::BlendMode::kDestinationATop
@ kDestinationATop
impeller::Scalar
float Scalar
Definition: scalar.h:18
impeller::Color::Color
constexpr Color()
Definition: color.h:145
impeller::ComponentChoose
static constexpr Vector3 ComponentChoose(Vector3 a, Vector3 b, Vector3 value, Scalar cutoff)
Definition: color.cc:178
impeller::kEhCloseEnough
constexpr float kEhCloseEnough
Definition: constants.h:56
impeller::BlendMode::kLuminosity
@ kLuminosity
impeller::BlendMode::kSource
@ kSource
impeller::BlendMode::kColorDodge
@ kColorDodge
impeller::BlendMode::kDestination
@ kDestination
impeller::BlendMode::kDarken
@ kDarken
impeller::BlendMode::kColor
@ kColor
impeller::Color::alpha
Scalar alpha
Definition: color.h:143
impeller::BlendMode::kDestinationOver
@ kDestinationOver
impeller::BlendMode::kPlus
@ kPlus
impeller::BlendMode::kOverlay
@ kOverlay
impeller::DoColorBlendComponents
static constexpr Color DoColorBlendComponents(Color dst, Color src, const std::function< Scalar(Scalar, Scalar)> &blend_func)
Definition: color.cc:224
impeller::Color::green
Scalar green
Definition: color.h:133
impeller::BlendMode::kModulate
@ kModulate
impeller::Min
static constexpr Color Min(Color c, float threshold)
Definition: color.cc:132
impeller::BlendMode::kSourceOut
@ kSourceOut
impeller::BlendMode::kSaturation
@ kSaturation
impeller::BlendMode::kDifference
@ kDifference
impeller::BlendMode::kLighten
@ kLighten
impeller::BlendMode::kSoftLight
@ kSoftLight
impeller::BlendMode::kColorBurn
@ kColorBurn
impeller::BlendMode::kHardLight
@ kHardLight
impeller::DoColorBlend
static constexpr Color DoColorBlend(Color dst, Color src, const std::function< Vector3(Vector3, Vector3)> &blend_rgb_func)
Definition: color.cc:216
impeller::BlendMode::kClear
@ kClear
impeller::SetSaturation
static constexpr Vector3 SetSaturation(Vector3 color, Scalar saturation)
Definition: color.cc:171
impeller::SetLuminosity
static constexpr Vector3 SetLuminosity(Vector3 color, Scalar luminosity)
Definition: color.cc:160
impeller::Color::ToR8G8B8A8
constexpr std::array< uint8_t, 4 > ToR8G8B8A8() const
Convert to R8G8B8A8 representation.
Definition: color.h:248
impeller::Color::red
Scalar red
Definition: color.h:128
impeller::Luminosity
static constexpr Scalar Luminosity(Vector3 color)
Definition: color.cc:140
impeller::BlendMode::kDestinationIn
@ kDestinationIn
impeller::BlendMode::kExclusion
@ kExclusion
impeller::BlendMode::kDestinationOut
@ kDestinationOut
impeller::saturated::b
SI b
Definition: saturated_math.h:87
impeller::Color::BlackTransparent
static constexpr Color BlackTransparent()
Definition: color.h:272
impeller::BlendMode::kSourceIn
@ kSourceIn
impeller::BlendMode::kScreen
@ kScreen
impeller::ScalarNearlyEqual
constexpr bool ScalarNearlyEqual(Scalar x, Scalar y, Scalar tolerance=kEhCloseEnough)
Definition: scalar.h:30
color
DlColor color
Definition: dl_golden_blur_unittests.cc:23
impeller::BlendMode::kHue
@ kHue
impeller::BlendMode::kXor
@ kXor
impeller::Color::blue
Scalar blue
Definition: color.h:138
impeller::BlendMode::kSourceATop
@ kSourceATop
impeller::BlendMode::kMultiply
@ kMultiply
impeller::BlendMode::kSourceOver
@ kSourceOver
impeller::Saturation
static constexpr Scalar Saturation(Vector3 color)
Definition: color.cc:166