Flutter Impeller
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 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 ( )
inlineconstexpr

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 
)
inlineconstexpr

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 ( )
inlinestaticconstexpr

Definition at line 274 of file color.h.

274  {
275  return {240.0f / 255.0f, 248.0f / 255.0f, 255.0f / 255.0f, 1.0f};
276  }

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

◆ AntiqueWhite()

static constexpr Color impeller::Color::AntiqueWhite ( )
inlinestaticconstexpr

Definition at line 278 of file color.h.

278  {
279  return {250.0f / 255.0f, 235.0f / 255.0f, 215.0f / 255.0f, 1.0f};
280  }

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

◆ 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 ( )
inlinestaticconstexpr

Definition at line 282 of file color.h.

282  {
283  return {0.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 1.0f};
284  }

◆ AquaMarine()

static constexpr Color impeller::Color::AquaMarine ( )
inlinestaticconstexpr

Definition at line 286 of file color.h.

286  {
287  return {127.0f / 255.0f, 255.0f / 255.0f, 212.0f / 255.0f, 1.0f};
288  }

◆ Azure()

static constexpr Color impeller::Color::Azure ( )
inlinestaticconstexpr

Definition at line 290 of file color.h.

290  {
291  return {240.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 1.0f};
292  }

◆ Beige()

static constexpr Color impeller::Color::Beige ( )
inlinestaticconstexpr

Definition at line 294 of file color.h.

294  {
295  return {245.0f / 255.0f, 245.0f / 255.0f, 220.0f / 255.0f, 1.0f};
296  }

◆ Bisque()

static constexpr Color impeller::Color::Bisque ( )
inlinestaticconstexpr

Definition at line 298 of file color.h.

298  {
299  return {255.0f / 255.0f, 228.0f / 255.0f, 196.0f / 255.0f, 1.0f};
300  }

◆ Black()

static constexpr Color impeller::Color::Black ( )
inlinestaticconstexpr

Definition at line 258 of file color.h.

258 { 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 ( )
inlinestaticconstexpr

◆ BlanchedAlmond()

static constexpr Color impeller::Color::BlanchedAlmond ( )
inlinestaticconstexpr

Definition at line 302 of file color.h.

302  {
303  return {255.0f / 255.0f, 235.0f / 255.0f, 205.0f / 255.0f, 1.0f};
304  }

◆ 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;
243  return dst;
245  // r = s + (1-sa)*d
246  return (src.Premultiply() + dst.Premultiply() * (1 - src.alpha))
247  .Unpremultiply();
249  // r = d + (1-da)*s
250  return (dst.Premultiply() + src.Premultiply() * (1 - dst.alpha))
251  .Unpremultiply();
253  // r = s * da
254  return (src.Premultiply() * dst.alpha).Unpremultiply();
256  // r = d * sa
257  return (dst.Premultiply() * src.alpha).Unpremultiply();
259  // r = s * ( 1- da)
260  return (src.Premultiply() * (1 - dst.alpha)).Unpremultiply();
262  // r = d * (1-sa)
263  return (dst.Premultiply() * (1 - src.alpha)).Unpremultiply();
265  // r = s*da + d*(1-sa)
266  return (src.Premultiply() * dst.alpha +
267  dst.Premultiply() * (1 - src.alpha))
268  .Unpremultiply();
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();
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); });
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  });
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  });
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  });
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  });
348  return DoColorBlend(dst, src, [](Vector3 d, Vector3 s) -> Vector3 {
349  return (d - s).Abs();
350  });
352  return DoColorBlend(dst, src, [](Vector3 d, Vector3 s) -> Vector3 {
353  return d + s - 2.0f * d * s;
354  });
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 {
361  });
362  }
364  return DoColorBlend(dst, src, [](Vector3 d, Vector3 s) -> Vector3 {
366  });
367  case BlendMode::kColor:
368  return DoColorBlend(dst, src, [](Vector3 d, Vector3 s) -> Vector3 {
369  return SetLuminosity(s, Luminosity(d));
370  });
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 ( )
inlinestaticconstexpr

Definition at line 268 of file color.h.

268 { 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 ( )
inlinestaticconstexpr

Definition at line 306 of file color.h.

306  {
307  return {138.0f / 255.0f, 43.0f / 255.0f, 226.0f / 255.0f, 1.0f};
308  }

◆ Brown()

static constexpr Color impeller::Color::Brown ( )
inlinestaticconstexpr

Definition at line 310 of file color.h.

310  {
311  return {165.0f / 255.0f, 42.0f / 255.0f, 42.0f / 255.0f, 1.0f};
312  }

◆ BurlyWood()

static constexpr Color impeller::Color::BurlyWood ( )
inlinestaticconstexpr

Definition at line 314 of file color.h.

314  {
315  return {222.0f / 255.0f, 184.0f / 255.0f, 135.0f / 255.0f, 1.0f};
316  }

◆ CadetBlue()

static constexpr Color impeller::Color::CadetBlue ( )
inlinestaticconstexpr

Definition at line 318 of file color.h.

318  {
319  return {95.0f / 255.0f, 158.0f / 255.0f, 160.0f / 255.0f, 1.0f};
320  }

◆ Chartreuse()

static constexpr Color impeller::Color::Chartreuse ( )
inlinestaticconstexpr

Definition at line 322 of file color.h.

322  {
323  return {127.0f / 255.0f, 255.0f / 255.0f, 0.0f / 255.0f, 1.0f};
324  }

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

◆ Chocolate()

static constexpr Color impeller::Color::Chocolate ( )
inlinestaticconstexpr

Definition at line 326 of file color.h.

326  {
327  return {210.0f / 255.0f, 105.0f / 255.0f, 30.0f / 255.0f, 1.0f};
328  }

◆ Clamp01()

constexpr Color impeller::Color::Clamp01 ( ) const
inlineconstexpr

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 ( )
inlinestaticconstexpr

Definition at line 330 of file color.h.

330  {
331  return {255.0f / 255.0f, 127.0f / 255.0f, 80.0f / 255.0f, 1.0f};
332  }

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

◆ CornflowerBlue()

static constexpr Color impeller::Color::CornflowerBlue ( )
inlinestaticconstexpr

Definition at line 334 of file color.h.

334  {
335  return {100.0f / 255.0f, 149.0f / 255.0f, 237.0f / 255.0f, 1.0f};
336  }

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

◆ Cornsilk()

static constexpr Color impeller::Color::Cornsilk ( )
inlinestaticconstexpr

Definition at line 338 of file color.h.

338  {
339  return {255.0f / 255.0f, 248.0f / 255.0f, 220.0f / 255.0f, 1.0f};
340  }

◆ Crimson()

static constexpr Color impeller::Color::Crimson ( )
inlinestaticconstexpr

Definition at line 342 of file color.h.

342  {
343  return {220.0f / 255.0f, 20.0f / 255.0f, 60.0f / 255.0f, 1.0f};
344  }

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

◆ Cyan()

static constexpr Color impeller::Color::Cyan ( )
inlinestaticconstexpr

Definition at line 346 of file color.h.

346  {
347  return {0.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 1.0f};
348  }

◆ DarkBlue()

static constexpr Color impeller::Color::DarkBlue ( )
inlinestaticconstexpr

Definition at line 350 of file color.h.

350  {
351  return {0.0f / 255.0f, 0.0f / 255.0f, 139.0f / 255.0f, 1.0f};
352  }

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

◆ DarkCyan()

static constexpr Color impeller::Color::DarkCyan ( )
inlinestaticconstexpr

Definition at line 354 of file color.h.

354  {
355  return {0.0f / 255.0f, 139.0f / 255.0f, 139.0f / 255.0f, 1.0f};
356  }

◆ DarkGoldenrod()

static constexpr Color impeller::Color::DarkGoldenrod ( )
inlinestaticconstexpr

Definition at line 358 of file color.h.

358  {
359  return {184.0f / 255.0f, 134.0f / 255.0f, 11.0f / 255.0f, 1.0f};
360  }

◆ DarkGray()

static constexpr Color impeller::Color::DarkGray ( )
inlinestaticconstexpr

Definition at line 362 of file color.h.

362  {
363  return {169.0f / 255.0f, 169.0f / 255.0f, 169.0f / 255.0f, 1.0f};
364  }

◆ DarkGreen()

static constexpr Color impeller::Color::DarkGreen ( )
inlinestaticconstexpr

Definition at line 366 of file color.h.

366  {
367  return {0.0f / 255.0f, 100.0f / 255.0f, 0.0f / 255.0f, 1.0f};
368  }

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

◆ DarkGrey()

static constexpr Color impeller::Color::DarkGrey ( )
inlinestaticconstexpr

Definition at line 370 of file color.h.

370  {
371  return {169.0f / 255.0f, 169.0f / 255.0f, 169.0f / 255.0f, 1.0f};
372  }

◆ DarkKhaki()

static constexpr Color impeller::Color::DarkKhaki ( )
inlinestaticconstexpr

Definition at line 374 of file color.h.

374  {
375  return {189.0f / 255.0f, 183.0f / 255.0f, 107.0f / 255.0f, 1.0f};
376  }

◆ DarkMagenta()

static constexpr Color impeller::Color::DarkMagenta ( )
inlinestaticconstexpr

Definition at line 378 of file color.h.

378  {
379  return {139.0f / 255.0f, 0.0f / 255.0f, 139.0f / 255.0f, 1.0f};
380  }

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

◆ DarkOliveGreen()

static constexpr Color impeller::Color::DarkOliveGreen ( )
inlinestaticconstexpr

Definition at line 382 of file color.h.

382  {
383  return {85.0f / 255.0f, 107.0f / 255.0f, 47.0f / 255.0f, 1.0f};
384  }

◆ DarkOrange()

static constexpr Color impeller::Color::DarkOrange ( )
inlinestaticconstexpr

Definition at line 386 of file color.h.

386  {
387  return {255.0f / 255.0f, 140.0f / 255.0f, 0.0f / 255.0f, 1.0f};
388  }

◆ DarkOrchid()

static constexpr Color impeller::Color::DarkOrchid ( )
inlinestaticconstexpr

Definition at line 390 of file color.h.

390  {
391  return {153.0f / 255.0f, 50.0f / 255.0f, 204.0f / 255.0f, 1.0f};
392  }

◆ DarkRed()

static constexpr Color impeller::Color::DarkRed ( )
inlinestaticconstexpr

Definition at line 394 of file color.h.

394  {
395  return {139.0f / 255.0f, 0.0f / 255.0f, 0.0f / 255.0f, 1.0f};
396  }

◆ DarkSalmon()

static constexpr Color impeller::Color::DarkSalmon ( )
inlinestaticconstexpr

Definition at line 398 of file color.h.

398  {
399  return {233.0f / 255.0f, 150.0f / 255.0f, 122.0f / 255.0f, 1.0f};
400  }

◆ DarkSeagreen()

static constexpr Color impeller::Color::DarkSeagreen ( )
inlinestaticconstexpr

Definition at line 402 of file color.h.

402  {
403  return {143.0f / 255.0f, 188.0f / 255.0f, 143.0f / 255.0f, 1.0f};
404  }

◆ DarkSlateBlue()

static constexpr Color impeller::Color::DarkSlateBlue ( )
inlinestaticconstexpr

Definition at line 406 of file color.h.

406  {
407  return {72.0f / 255.0f, 61.0f / 255.0f, 139.0f / 255.0f, 1.0f};
408  }

◆ DarkSlateGray()

static constexpr Color impeller::Color::DarkSlateGray ( )
inlinestaticconstexpr

Definition at line 410 of file color.h.

410  {
411  return {47.0f / 255.0f, 79.0f / 255.0f, 79.0f / 255.0f, 1.0f};
412  }

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

◆ DarkSlateGrey()

static constexpr Color impeller::Color::DarkSlateGrey ( )
inlinestaticconstexpr

Definition at line 414 of file color.h.

414  {
415  return {47.0f / 255.0f, 79.0f / 255.0f, 79.0f / 255.0f, 1.0f};
416  }

◆ DarkTurquoise()

static constexpr Color impeller::Color::DarkTurquoise ( )
inlinestaticconstexpr

Definition at line 418 of file color.h.

418  {
419  return {0.0f / 255.0f, 206.0f / 255.0f, 209.0f / 255.0f, 1.0f};
420  }

◆ DarkViolet()

static constexpr Color impeller::Color::DarkViolet ( )
inlinestaticconstexpr

Definition at line 422 of file color.h.

422  {
423  return {148.0f / 255.0f, 0.0f / 255.0f, 211.0f / 255.0f, 1.0f};
424  }

◆ DeepPink()

static constexpr Color impeller::Color::DeepPink ( )
inlinestaticconstexpr

Definition at line 426 of file color.h.

426  {
427  return {255.0f / 255.0f, 20.0f / 255.0f, 147.0f / 255.0f, 1.0f};
428  }

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

◆ DeepSkyBlue()

static constexpr Color impeller::Color::DeepSkyBlue ( )
inlinestaticconstexpr

Definition at line 430 of file color.h.

430  {
431  return {0.0f / 255.0f, 191.0f / 255.0f, 255.0f / 255.0f, 1.0f};
432  }

◆ DimGray()

static constexpr Color impeller::Color::DimGray ( )
inlinestaticconstexpr

Definition at line 434 of file color.h.

434  {
435  return {105.0f / 255.0f, 105.0f / 255.0f, 105.0f / 255.0f, 1.0f};
436  }

◆ DimGrey()

static constexpr Color impeller::Color::DimGrey ( )
inlinestaticconstexpr

Definition at line 438 of file color.h.

438  {
439  return {105.0f / 255.0f, 105.0f / 255.0f, 105.0f / 255.0f, 1.0f};
440  }

◆ DodgerBlue()

static constexpr Color impeller::Color::DodgerBlue ( )
inlinestaticconstexpr

Definition at line 442 of file color.h.

442  {
443  return {30.0f / 255.0f, 144.0f / 255.0f, 255.0f / 255.0f, 1.0f};
444  }

◆ Firebrick()

static constexpr Color impeller::Color::Firebrick ( )
inlinestaticconstexpr

Definition at line 446 of file color.h.

446  {
447  return {178.0f / 255.0f, 34.0f / 255.0f, 34.0f / 255.0f, 1.0f};
448  }

◆ FloralWhite()

static constexpr Color impeller::Color::FloralWhite ( )
inlinestaticconstexpr

Definition at line 450 of file color.h.

450  {
451  return {255.0f / 255.0f, 250.0f / 255.0f, 240.0f / 255.0f, 1.0f};
452  }

◆ ForestGreen()

static constexpr Color impeller::Color::ForestGreen ( )
inlinestaticconstexpr

Definition at line 454 of file color.h.

454  {
455  return {34.0f / 255.0f, 139.0f / 255.0f, 34.0f / 255.0f, 1.0f};
456  }

◆ Fuchsia()

static constexpr Color impeller::Color::Fuchsia ( )
inlinestaticconstexpr

Definition at line 458 of file color.h.

458  {
459  return {255.0f / 255.0f, 0.0f / 255.0f, 255.0f / 255.0f, 1.0f};
460  }

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

◆ Gainsboro()

static constexpr Color impeller::Color::Gainsboro ( )
inlinestaticconstexpr

Definition at line 462 of file color.h.

462  {
463  return {220.0f / 255.0f, 220.0f / 255.0f, 220.0f / 255.0f, 1.0f};
464  }

◆ Ghostwhite()

static constexpr Color impeller::Color::Ghostwhite ( )
inlinestaticconstexpr

Definition at line 466 of file color.h.

466  {
467  return {248.0f / 255.0f, 248.0f / 255.0f, 255.0f / 255.0f, 1.0f};
468  }

◆ Gold()

static constexpr Color impeller::Color::Gold ( )
inlinestaticconstexpr

Definition at line 470 of file color.h.

470  {
471  return {255.0f / 255.0f, 215.0f / 255.0f, 0.0f / 255.0f, 1.0f};
472  }

◆ Goldenrod()

static constexpr Color impeller::Color::Goldenrod ( )
inlinestaticconstexpr

Definition at line 474 of file color.h.

474  {
475  return {218.0f / 255.0f, 165.0f / 255.0f, 32.0f / 255.0f, 1.0f};
476  }

◆ Gray()

static constexpr Color impeller::Color::Gray ( )
inlinestaticconstexpr

Definition at line 478 of file color.h.

478  {
479  return {128.0f / 255.0f, 128.0f / 255.0f, 128.0f / 255.0f, 1.0f};
480  }

◆ Green()

static constexpr Color impeller::Color::Green ( )
inlinestaticconstexpr

Definition at line 266 of file color.h.

266 { 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 ( )
inlinestaticconstexpr

Definition at line 482 of file color.h.

482  {
483  return {173.0f / 255.0f, 255.0f / 255.0f, 47.0f / 255.0f, 1.0f};
484  }

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

◆ Grey()

static constexpr Color impeller::Color::Grey ( )
inlinestaticconstexpr

Definition at line 486 of file color.h.

486  {
487  return {128.0f / 255.0f, 128.0f / 255.0f, 128.0f / 255.0f, 1.0f};
488  }

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

◆ Honeydew()

static constexpr Color impeller::Color::Honeydew ( )
inlinestaticconstexpr

Definition at line 490 of file color.h.

490  {
491  return {240.0f / 255.0f, 255.0f / 255.0f, 240.0f / 255.0f, 1.0f};
492  }

◆ HotPink()

static constexpr Color impeller::Color::HotPink ( )
inlinestaticconstexpr

Definition at line 494 of file color.h.

494  {
495  return {255.0f / 255.0f, 105.0f / 255.0f, 180.0f / 255.0f, 1.0f};
496  }

◆ IndianRed()

static constexpr Color impeller::Color::IndianRed ( )
inlinestaticconstexpr

Definition at line 498 of file color.h.

498  {
499  return {205.0f / 255.0f, 92.0f / 255.0f, 92.0f / 255.0f, 1.0f};
500  }

◆ Indigo()

static constexpr Color impeller::Color::Indigo ( )
inlinestaticconstexpr

Definition at line 502 of file color.h.

502  {
503  return {75.0f / 255.0f, 0.0f / 255.0f, 130.0f / 255.0f, 1.0f};
504  }

◆ IsOpaque()

constexpr bool impeller::Color::IsOpaque ( ) const
inlineconstexpr

Definition at line 886 of file color.h.

886 { return alpha == 1.0f; }

References alpha.

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

◆ IsTransparent()

constexpr bool impeller::Color::IsTransparent ( ) const
inlineconstexpr

Definition at line 884 of file color.h.

884 { return alpha == 0.0f; }

References alpha.

◆ Ivory()

static constexpr Color impeller::Color::Ivory ( )
inlinestaticconstexpr

Definition at line 506 of file color.h.

506  {
507  return {255.0f / 255.0f, 255.0f / 255.0f, 240.0f / 255.0f, 1.0f};
508  }

◆ Khaki()

static constexpr Color impeller::Color::Khaki ( )
inlinestaticconstexpr

Definition at line 510 of file color.h.

510  {
511  return {240.0f / 255.0f, 230.0f / 255.0f, 140.0f / 255.0f, 1.0f};
512  }

◆ Lavender()

static constexpr Color impeller::Color::Lavender ( )
inlinestaticconstexpr

Definition at line 514 of file color.h.

514  {
515  return {230.0f / 255.0f, 230.0f / 255.0f, 250.0f / 255.0f, 1.0f};
516  }

◆ LavenderBlush()

static constexpr Color impeller::Color::LavenderBlush ( )
inlinestaticconstexpr

Definition at line 518 of file color.h.

518  {
519  return {255.0f / 255.0f, 240.0f / 255.0f, 245.0f / 255.0f, 1.0f};
520  }

◆ LawnGreen()

static constexpr Color impeller::Color::LawnGreen ( )
inlinestaticconstexpr

Definition at line 522 of file color.h.

522  {
523  return {124.0f / 255.0f, 252.0f / 255.0f, 0.0f / 255.0f, 1.0f};
524  }

◆ LemonChiffon()

static constexpr Color impeller::Color::LemonChiffon ( )
inlinestaticconstexpr

Definition at line 526 of file color.h.

526  {
527  return {255.0f / 255.0f, 250.0f / 255.0f, 205.0f / 255.0f, 1.0f};
528  }

◆ Lerp()

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

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

Parameters
aThe lower color.
bThe upper color.
tA 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 ( )
inlinestaticconstexpr

Definition at line 530 of file color.h.

530  {
531  return {173.0f / 255.0f, 216.0f / 255.0f, 230.0f / 255.0f, 1.0f};
532  }

◆ LightCoral()

static constexpr Color impeller::Color::LightCoral ( )
inlinestaticconstexpr

Definition at line 534 of file color.h.

534  {
535  return {240.0f / 255.0f, 128.0f / 255.0f, 128.0f / 255.0f, 1.0f};
536  }

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

◆ LightCyan()

static constexpr Color impeller::Color::LightCyan ( )
inlinestaticconstexpr

Definition at line 538 of file color.h.

538  {
539  return {224.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 1.0f};
540  }

◆ LightGoldenrodYellow()

static constexpr Color impeller::Color::LightGoldenrodYellow ( )
inlinestaticconstexpr

Definition at line 542 of file color.h.

542  {
543  return {50.0f / 255.0f, 250.0f / 255.0f, 210.0f / 255.0f, 1.0f};
544  }

◆ LightGray()

static constexpr Color impeller::Color::LightGray ( )
inlinestaticconstexpr

Definition at line 546 of file color.h.

546  {
547  return {211.0f / 255.0f, 211.0f / 255.0f, 211.0f / 255.0f, 1.0f};
548  }

◆ LightGreen()

static constexpr Color impeller::Color::LightGreen ( )
inlinestaticconstexpr

Definition at line 550 of file color.h.

550  {
551  return {144.0f / 255.0f, 238.0f / 255.0f, 144.0f / 255.0f, 1.0f};
552  }

◆ LightGrey()

static constexpr Color impeller::Color::LightGrey ( )
inlinestaticconstexpr

Definition at line 554 of file color.h.

554  {
555  return {211.0f / 255.0f, 211.0f / 255.0f, 211.0f / 255.0f, 1.0f};
556  }

◆ LightPink()

static constexpr Color impeller::Color::LightPink ( )
inlinestaticconstexpr

Definition at line 558 of file color.h.

558  {
559  return {255.0f / 255.0f, 182.0f / 255.0f, 193.0f / 255.0f, 1.0f};
560  }

◆ LightSalmon()

static constexpr Color impeller::Color::LightSalmon ( )
inlinestaticconstexpr

Definition at line 562 of file color.h.

562  {
563  return {255.0f / 255.0f, 160.0f / 255.0f, 122.0f / 255.0f, 1.0f};
564  }

◆ LightSeaGreen()

static constexpr Color impeller::Color::LightSeaGreen ( )
inlinestaticconstexpr

Definition at line 566 of file color.h.

566  {
567  return {32.0f / 255.0f, 178.0f / 255.0f, 170.0f / 255.0f, 1.0f};
568  }

◆ LightSkyBlue()

static constexpr Color impeller::Color::LightSkyBlue ( )
inlinestaticconstexpr

Definition at line 570 of file color.h.

570  {
571  return {135.0f / 255.0f, 206.0f / 255.0f, 250.0f / 255.0f, 1.0f};
572  }

◆ LightSlateGray()

static constexpr Color impeller::Color::LightSlateGray ( )
inlinestaticconstexpr

Definition at line 574 of file color.h.

574  {
575  return {119.0f / 255.0f, 136.0f / 255.0f, 153.0f / 255.0f, 1.0f};
576  }

◆ LightSlateGrey()

static constexpr Color impeller::Color::LightSlateGrey ( )
inlinestaticconstexpr

Definition at line 578 of file color.h.

578  {
579  return {119.0f / 255.0f, 136.0f / 255.0f, 153.0f / 255.0f, 1.0f};
580  }

◆ LightSteelBlue()

static constexpr Color impeller::Color::LightSteelBlue ( )
inlinestaticconstexpr

Definition at line 582 of file color.h.

582  {
583  return {176.0f / 255.0f, 196.0f / 255.0f, 222.0f / 255.0f, 1.0f};
584  }

◆ LightYellow()

static constexpr Color impeller::Color::LightYellow ( )
inlinestaticconstexpr

Definition at line 586 of file color.h.

586  {
587  return {255.0f / 255.0f, 255.0f / 255.0f, 224.0f / 255.0f, 1.0f};
588  }

◆ Lime()

static constexpr Color impeller::Color::Lime ( )
inlinestaticconstexpr

Definition at line 590 of file color.h.

590  {
591  return {0.0f / 255.0f, 255.0f / 255.0f, 0.0f / 255.0f, 1.0f};
592  }

◆ LimeGreen()

static constexpr Color impeller::Color::LimeGreen ( )
inlinestaticconstexpr

Definition at line 594 of file color.h.

594  {
595  return {50.0f / 255.0f, 205.0f / 255.0f, 50.0f / 255.0f, 1.0f};
596  }

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 ( )
inlinestaticconstexpr

Definition at line 598 of file color.h.

598  {
599  return {250.0f / 255.0f, 240.0f / 255.0f, 230.0f / 255.0f, 1.0f};
600  }

◆ Magenta()

static constexpr Color impeller::Color::Magenta ( )
inlinestaticconstexpr

Definition at line 602 of file color.h.

602  {
603  return {255.0f / 255.0f, 0.0f / 255.0f, 255.0f / 255.0f, 1.0f};
604  }

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 
)
inlinestaticconstexpr

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 ( )
inlinestaticconstexpr

Definition at line 606 of file color.h.

606  {
607  return {128.0f / 255.0f, 0.0f / 255.0f, 0.0f / 255.0f, 1.0f};
608  }

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

◆ MediumAquamarine()

static constexpr Color impeller::Color::MediumAquamarine ( )
inlinestaticconstexpr

Definition at line 610 of file color.h.

610  {
611  return {102.0f / 255.0f, 205.0f / 255.0f, 170.0f / 255.0f, 1.0f};
612  }

◆ MediumBlue()

static constexpr Color impeller::Color::MediumBlue ( )
inlinestaticconstexpr

Definition at line 614 of file color.h.

614  {
615  return {0.0f / 255.0f, 0.0f / 255.0f, 205.0f / 255.0f, 1.0f};
616  }

◆ MediumOrchid()

static constexpr Color impeller::Color::MediumOrchid ( )
inlinestaticconstexpr

Definition at line 618 of file color.h.

618  {
619  return {186.0f / 255.0f, 85.0f / 255.0f, 211.0f / 255.0f, 1.0f};
620  }

◆ MediumPurple()

static constexpr Color impeller::Color::MediumPurple ( )
inlinestaticconstexpr

Definition at line 622 of file color.h.

622  {
623  return {147.0f / 255.0f, 112.0f / 255.0f, 219.0f / 255.0f, 1.0f};
624  }

◆ MediumSeagreen()

static constexpr Color impeller::Color::MediumSeagreen ( )
inlinestaticconstexpr

Definition at line 626 of file color.h.

626  {
627  return {60.0f / 255.0f, 179.0f / 255.0f, 113.0f / 255.0f, 1.0f};
628  }

◆ MediumSlateBlue()

static constexpr Color impeller::Color::MediumSlateBlue ( )
inlinestaticconstexpr

Definition at line 630 of file color.h.

630  {
631  return {123.0f / 255.0f, 104.0f / 255.0f, 238.0f / 255.0f, 1.0f};
632  }

◆ MediumSpringGreen()

static constexpr Color impeller::Color::MediumSpringGreen ( )
inlinestaticconstexpr

Definition at line 634 of file color.h.

634  {
635  return {0.0f / 255.0f, 250.0f / 255.0f, 154.0f / 255.0f, 1.0f};
636  }

◆ MediumTurquoise()

static constexpr Color impeller::Color::MediumTurquoise ( )
inlinestaticconstexpr

Definition at line 638 of file color.h.

638  {
639  return {72.0f / 255.0f, 209.0f / 255.0f, 204.0f / 255.0f, 1.0f};
640  }

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

◆ MediumVioletRed()

static constexpr Color impeller::Color::MediumVioletRed ( )
inlinestaticconstexpr

Definition at line 642 of file color.h.

642  {
643  return {199.0f / 255.0f, 21.0f / 255.0f, 133.0f / 255.0f, 1.0f};
644  }

◆ MidnightBlue()

static constexpr Color impeller::Color::MidnightBlue ( )
inlinestaticconstexpr

Definition at line 646 of file color.h.

646  {
647  return {25.0f / 255.0f, 25.0f / 255.0f, 112.0f / 255.0f, 1.0f};
648  }

◆ MintCream()

static constexpr Color impeller::Color::MintCream ( )
inlinestaticconstexpr

Definition at line 650 of file color.h.

650  {
651  return {245.0f / 255.0f, 255.0f / 255.0f, 250.0f / 255.0f, 1.0f};
652  }

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

◆ MistyRose()

static constexpr Color impeller::Color::MistyRose ( )
inlinestaticconstexpr

Definition at line 654 of file color.h.

654  {
655  return {255.0f / 255.0f, 228.0f / 255.0f, 225.0f / 255.0f, 1.0f};
656  }

◆ Moccasin()

static constexpr Color impeller::Color::Moccasin ( )
inlinestaticconstexpr

Definition at line 658 of file color.h.

658  {
659  return {255.0f / 255.0f, 228.0f / 255.0f, 181.0f / 255.0f, 1.0f};
660  }

◆ NavajoWhite()

static constexpr Color impeller::Color::NavajoWhite ( )
inlinestaticconstexpr

Definition at line 662 of file color.h.

662  {
663  return {255.0f / 255.0f, 222.0f / 255.0f, 173.0f / 255.0f, 1.0f};
664  }

◆ Navy()

static constexpr Color impeller::Color::Navy ( )
inlinestaticconstexpr

Definition at line 666 of file color.h.

666  {
667  return {0.0f / 255.0f, 0.0f / 255.0f, 128.0f / 255.0f, 1.0f};
668  }

◆ OldLace()

static constexpr Color impeller::Color::OldLace ( )
inlinestaticconstexpr

Definition at line 670 of file color.h.

670  {
671  return {253.0f / 255.0f, 245.0f / 255.0f, 230.0f / 255.0f, 1.0f};
672  }

◆ Olive()

static constexpr Color impeller::Color::Olive ( )
inlinestaticconstexpr

Definition at line 674 of file color.h.

674  {
675  return {128.0f / 255.0f, 128.0f / 255.0f, 0.0f / 255.0f, 1.0f};
676  }

◆ OliveDrab()

static constexpr Color impeller::Color::OliveDrab ( )
inlinestaticconstexpr

Definition at line 678 of file color.h.

678  {
679  return {107.0f / 255.0f, 142.0f / 255.0f, 35.0f / 255.0f, 1.0f};
680  }

◆ operator*() [1/2]

constexpr Color impeller::Color::operator* ( const Color c) const
inlineconstexpr

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* ( value) const
inlineconstexpr

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
inlineconstexpr

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+ ( value) const
inlineconstexpr

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
inlineconstexpr

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- ( value) const
inlineconstexpr

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
inlineconstexpr

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/ ( value) const
inlineconstexpr

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
inlineconstexpr

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 ( )
inlinestaticconstexpr

Definition at line 682 of file color.h.

682  {
683  return {255.0f / 255.0f, 165.0f / 255.0f, 0.0f / 255.0f, 1.0f};
684  }

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

◆ OrangeRed()

static constexpr Color impeller::Color::OrangeRed ( )
inlinestaticconstexpr

Definition at line 686 of file color.h.

686  {
687  return {255.0f / 255.0f, 69.0f / 255.0f, 0.0f / 255.0f, 1.0f};
688  }

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

◆ Orchid()

static constexpr Color impeller::Color::Orchid ( )
inlinestaticconstexpr

Definition at line 690 of file color.h.

690  {
691  return {218.0f / 255.0f, 112.0f / 255.0f, 214.0f / 255.0f, 1.0f};
692  }

◆ PaleGoldenrod()

static constexpr Color impeller::Color::PaleGoldenrod ( )
inlinestaticconstexpr

Definition at line 694 of file color.h.

694  {
695  return {238.0f / 255.0f, 232.0f / 255.0f, 170.0f / 255.0f, 1.0f};
696  }

◆ PaleGreen()

static constexpr Color impeller::Color::PaleGreen ( )
inlinestaticconstexpr

Definition at line 698 of file color.h.

698  {
699  return {152.0f / 255.0f, 251.0f / 255.0f, 152.0f / 255.0f, 1.0f};
700  }

◆ PaleTurquoise()

static constexpr Color impeller::Color::PaleTurquoise ( )
inlinestaticconstexpr

Definition at line 702 of file color.h.

702  {
703  return {175.0f / 255.0f, 238.0f / 255.0f, 238.0f / 255.0f, 1.0f};
704  }

◆ PaleVioletRed()

static constexpr Color impeller::Color::PaleVioletRed ( )
inlinestaticconstexpr

Definition at line 706 of file color.h.

706  {
707  return {219.0f / 255.0f, 112.0f / 255.0f, 147.0f / 255.0f, 1.0f};
708  }

◆ PapayaWhip()

static constexpr Color impeller::Color::PapayaWhip ( )
inlinestaticconstexpr

Definition at line 710 of file color.h.

710  {
711  return {255.0f / 255.0f, 239.0f / 255.0f, 213.0f / 255.0f, 1.0f};
712  }

◆ Peachpuff()

static constexpr Color impeller::Color::Peachpuff ( )
inlinestaticconstexpr

Definition at line 714 of file color.h.

714  {
715  return {255.0f / 255.0f, 218.0f / 255.0f, 185.0f / 255.0f, 1.0f};
716  }

◆ Peru()

static constexpr Color impeller::Color::Peru ( )
inlinestaticconstexpr

Definition at line 718 of file color.h.

718  {
719  return {205.0f / 255.0f, 133.0f / 255.0f, 63.0f / 255.0f, 1.0f};
720  }

◆ Pink()

static constexpr Color impeller::Color::Pink ( )
inlinestaticconstexpr

Definition at line 722 of file color.h.

722  {
723  return {255.0f / 255.0f, 192.0f / 255.0f, 203.0f / 255.0f, 1.0f};
724  }

◆ Plum()

static constexpr Color impeller::Color::Plum ( )
inlinestaticconstexpr

Definition at line 726 of file color.h.

726  {
727  return {221.0f / 255.0f, 160.0f / 255.0f, 221.0f / 255.0f, 1.0f};
728  }

◆ PowderBlue()

static constexpr Color impeller::Color::PowderBlue ( )
inlinestaticconstexpr

Definition at line 730 of file color.h.

730  {
731  return {176.0f / 255.0f, 224.0f / 255.0f, 230.0f / 255.0f, 1.0f};
732  }

◆ Premultiply()

constexpr Color impeller::Color::Premultiply ( ) const
inlineconstexpr

◆ Purple()

static constexpr Color impeller::Color::Purple ( )
inlinestaticconstexpr

Definition at line 734 of file color.h.

734  {
735  return {128.0f / 255.0f, 0.0f / 255.0f, 128.0f / 255.0f, 1.0f};
736  }

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

◆ Random()

static Color impeller::Color::Random ( )
inlinestatic

Definition at line 842 of file color.h.

842  {
843  return {
844  // This method is not used for cryptographic purposes.
845  // NOLINTBEGIN(clang-analyzer-security.insecureAPI.rand)
846  static_cast<Scalar>((std::rand() % 255) / 255.0f), //
847  static_cast<Scalar>((std::rand() % 255) / 255.0f), //
848  static_cast<Scalar>((std::rand() % 255) / 255.0f), //
849  // NOLINTEND(clang-analyzer-security.insecureAPI.rand)
850  1.0f //
851 
852  };
853  }

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

◆ Red()

static constexpr Color impeller::Color::Red ( )
inlinestaticconstexpr

Definition at line 264 of file color.h.

264 { 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 ( )
inlinestaticconstexpr

Definition at line 738 of file color.h.

738  {
739  return {188.0f / 255.0f, 143.0f / 255.0f, 143.0f / 255.0f, 1.0f};
740  }

◆ RoyalBlue()

static constexpr Color impeller::Color::RoyalBlue ( )
inlinestaticconstexpr

Definition at line 742 of file color.h.

742  {
743  return {65.0f / 255.0f, 105.0f / 255.0f, 225.0f / 255.0f, 1.0f};
744  }

◆ SaddleBrown()

static constexpr Color impeller::Color::SaddleBrown ( )
inlinestaticconstexpr

Definition at line 746 of file color.h.

746  {
747  return {139.0f / 255.0f, 69.0f / 255.0f, 19.0f / 255.0f, 1.0f};
748  }

◆ Salmon()

static constexpr Color impeller::Color::Salmon ( )
inlinestaticconstexpr

Definition at line 750 of file color.h.

750  {
751  return {250.0f / 255.0f, 128.0f / 255.0f, 114.0f / 255.0f, 1.0f};
752  }

◆ SandyBrown()

static constexpr Color impeller::Color::SandyBrown ( )
inlinestaticconstexpr

Definition at line 754 of file color.h.

754  {
755  return {244.0f / 255.0f, 164.0f / 255.0f, 96.0f / 255.0f, 1.0f};
756  }

◆ Seagreen()

static constexpr Color impeller::Color::Seagreen ( )
inlinestaticconstexpr

Definition at line 758 of file color.h.

758  {
759  return {46.0f / 255.0f, 139.0f / 255.0f, 87.0f / 255.0f, 1.0f};
760  }

◆ Seashell()

static constexpr Color impeller::Color::Seashell ( )
inlinestaticconstexpr

Definition at line 762 of file color.h.

762  {
763  return {255.0f / 255.0f, 245.0f / 255.0f, 238.0f / 255.0f, 1.0f};
764  }

◆ Sienna()

static constexpr Color impeller::Color::Sienna ( )
inlinestaticconstexpr

Definition at line 766 of file color.h.

766  {
767  return {160.0f / 255.0f, 82.0f / 255.0f, 45.0f / 255.0f, 1.0f};
768  }

◆ Silver()

static constexpr Color impeller::Color::Silver ( )
inlinestaticconstexpr

Definition at line 770 of file color.h.

770  {
771  return {192.0f / 255.0f, 192.0f / 255.0f, 192.0f / 255.0f, 1.0f};
772  }

◆ SkyBlue()

static constexpr Color impeller::Color::SkyBlue ( )
inlinestaticconstexpr

Definition at line 774 of file color.h.

774  {
775  return {135.0f / 255.0f, 206.0f / 255.0f, 235.0f / 255.0f, 1.0f};
776  }

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

◆ SlateBlue()

static constexpr Color impeller::Color::SlateBlue ( )
inlinestaticconstexpr

Definition at line 778 of file color.h.

778  {
779  return {106.0f / 255.0f, 90.0f / 255.0f, 205.0f / 255.0f, 1.0f};
780  }

◆ SlateGray()

static constexpr Color impeller::Color::SlateGray ( )
inlinestaticconstexpr

Definition at line 782 of file color.h.

782  {
783  return {112.0f / 255.0f, 128.0f / 255.0f, 144.0f / 255.0f, 1.0f};
784  }

◆ SlateGrey()

static constexpr Color impeller::Color::SlateGrey ( )
inlinestaticconstexpr

Definition at line 786 of file color.h.

786  {
787  return {112.0f / 255.0f, 128.0f / 255.0f, 144.0f / 255.0f, 1.0f};
788  }

◆ Snow()

static constexpr Color impeller::Color::Snow ( )
inlinestaticconstexpr

Definition at line 790 of file color.h.

790  {
791  return {255.0f / 255.0f, 250.0f / 255.0f, 250.0f / 255.0f, 1.0f};
792  }

◆ SpringGreen()

static constexpr Color impeller::Color::SpringGreen ( )
inlinestaticconstexpr

Definition at line 794 of file color.h.

794  {
795  return {0.0f / 255.0f, 255.0f / 255.0f, 127.0f / 255.0f, 1.0f};
796  }

◆ 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 ( )
inlinestaticconstexpr

Definition at line 798 of file color.h.

798  {
799  return {70.0f / 255.0f, 130.0f / 255.0f, 180.0f / 255.0f, 1.0f};
800  }

◆ Tan()

static constexpr Color impeller::Color::Tan ( )
inlinestaticconstexpr

Definition at line 802 of file color.h.

802  {
803  return {210.0f / 255.0f, 180.0f / 255.0f, 140.0f / 255.0f, 1.0f};
804  }

◆ Teal()

static constexpr Color impeller::Color::Teal ( )
inlinestaticconstexpr

Definition at line 806 of file color.h.

806  {
807  return {0.0f / 255.0f, 128.0f / 255.0f, 128.0f / 255.0f, 1.0f};
808  }

◆ Thistle()

static constexpr Color impeller::Color::Thistle ( )
inlinestaticconstexpr

Definition at line 810 of file color.h.

810  {
811  return {216.0f / 255.0f, 191.0f / 255.0f, 216.0f / 255.0f, 1.0f};
812  }

◆ ToIColor()

static constexpr uint32_t impeller::Color::ToIColor ( Color  color)
inlinestaticconstexpr

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 alpha, blue, green, and red.

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

◆ Tomato()

static constexpr Color impeller::Color::Tomato ( )
inlinestaticconstexpr

Definition at line 814 of file color.h.

814  {
815  return {255.0f / 255.0f, 99.0f / 255.0f, 71.0f / 255.0f, 1.0f};
816  }

◆ ToR8G8B8A8()

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

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::AppendColor(), and impeller::testing::TEST().

◆ Turquoise()

static constexpr Color impeller::Color::Turquoise ( )
inlinestaticconstexpr

Definition at line 818 of file color.h.

818  {
819  return {64.0f / 255.0f, 224.0f / 255.0f, 208.0f / 255.0f, 1.0f};
820  }

◆ Unpremultiply()

constexpr Color impeller::Color::Unpremultiply ( ) const
inlineconstexpr

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 ( )
inlinestaticconstexpr

Definition at line 822 of file color.h.

822  {
823  return {238.0f / 255.0f, 130.0f / 255.0f, 238.0f / 255.0f, 1.0f};
824  }

◆ Wheat()

static constexpr Color impeller::Color::Wheat ( )
inlinestaticconstexpr

Definition at line 826 of file color.h.

826  {
827  return {245.0f / 255.0f, 222.0f / 255.0f, 179.0f / 255.0f, 1.0f};
828  }

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

◆ White()

◆ Whitesmoke()

static constexpr Color impeller::Color::Whitesmoke ( )
inlinestaticconstexpr

Definition at line 830 of file color.h.

830  {
831  return {245.0f / 255.0f, 245.0f / 255.0f, 245.0f / 255.0f, 1.0f};
832  }

◆ WhiteTransparent()

static constexpr Color impeller::Color::WhiteTransparent ( )
inlinestaticconstexpr

Definition at line 260 of file color.h.

260 { 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
inlineconstexpr

◆ Yellow()

static constexpr Color impeller::Color::Yellow ( )
inlinestaticconstexpr

Definition at line 834 of file color.h.

834  {
835  return {255.0f / 255.0f, 255.0f / 255.0f, 0.0f / 255.0f, 1.0f};
836  }

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

◆ YellowGreen()

static constexpr Color impeller::Color::YellowGreen ( )
inlinestaticconstexpr

Definition at line 838 of file color.h.

838  {
839  return {154.0f / 255.0f, 205.0f / 255.0f, 50.0f / 255.0f, 1.0f};
840  }

Member Data Documentation

◆ alpha

◆ blue

◆ green

◆ red


The documentation for this struct was generated from the following files:
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::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:262
impeller::BlendMode::kSourceIn
@ kSourceIn
impeller::BlendMode::kScreen
@ kScreen
impeller::ScalarNearlyEqual
constexpr bool ScalarNearlyEqual(Scalar x, Scalar y, Scalar tolerance=kEhCloseEnough)
Definition: scalar.h:30
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