Flutter Engine
 
Loading...
Searching...
No Matches
flutter::DlColor Struct Reference

#include <dl_color.h>

Public Member Functions

constexpr DlColor ()
 
constexpr DlColor (uint32_t argb)
 
constexpr DlColor (DlScalar alpha, DlScalar red, DlScalar green, DlScalar blue, DlColorSpace colorspace)
 
constexpr bool isOpaque () const
 
constexpr bool isTransparent () const
 
int getAlpha () const
 
int getRed () const
 
int getGreen () const
 
int getBlue () const
 
constexpr DlScalar getAlphaF () const
 
constexpr DlScalar getRedF () const
 
constexpr DlScalar getGreenF () const
 
constexpr DlScalar getBlueF () const
 
constexpr DlColorSpace getColorSpace () const
 
DlColor withAlpha (uint8_t alpha) const
 
DlColor withRed (uint8_t red) const
 
DlColor withGreen (uint8_t green) const
 
DlColor withBlue (uint8_t blue) const
 
constexpr DlColor withAlphaF (float alpha) const
 
constexpr DlColor withRedF (float red) const
 
constexpr DlColor withGreenF (float green) const
 
constexpr DlColor withBlueF (float blue) const
 
DlColor withColorSpace (DlColorSpace color_space) const
 
constexpr DlColor modulateOpacity (DlScalar opacity) const
 
uint32_t argb () const
 
bool isClose (DlColor const &other, DlScalar delta=1.0f/256.0f)
 
bool operator== (DlColor const &other) const
 

Static Public Member Functions

static constexpr DlColor RGBA (DlScalar r, DlScalar g, DlScalar b, DlScalar a)
 Construct a 32 bit color from floating point R, G, B, and A color channels.
 
static constexpr DlColor ARGB (DlScalar a, DlScalar r, DlScalar g, DlScalar b)
 Construct a 32 bit color from floating point A, R, G, and B color channels.
 
static uint8_t toAlpha (DlScalar opacity)
 
static constexpr DlScalar toOpacity (uint8_t alpha)
 
static constexpr DlColor kTransparent ()
 
static constexpr DlColor kBlack ()
 
static constexpr DlColor kWhite ()
 
static constexpr DlColor kRed ()
 
static constexpr DlColor kGreen ()
 
static constexpr DlColor kBlue ()
 
static constexpr DlColor kCyan ()
 
static constexpr DlColor kMagenta ()
 
static constexpr DlColor kYellow ()
 
static constexpr DlColor kDarkGrey ()
 
static constexpr DlColor kMidGrey ()
 
static constexpr DlColor kLightGrey ()
 
static constexpr DlColor kAliceBlue ()
 
static constexpr DlColor kFuchsia ()
 
static constexpr DlColor kMaroon ()
 
static constexpr DlColor kSkyBlue ()
 
static constexpr DlColor kCornflowerBlue ()
 
static constexpr DlColor kCrimson ()
 
static constexpr DlColor kAqua ()
 
static constexpr DlColor kOrange ()
 
static constexpr DlColor kPurple ()
 
static constexpr DlColor kLimeGreen ()
 
static constexpr DlColor kGreenYellow ()
 
static constexpr DlColor kDarkMagenta ()
 
static constexpr DlColor kOrangeRed ()
 
static constexpr DlColor kDarkGreen ()
 
static constexpr DlColor kChartreuse ()
 

Detailed Description

A representation of a color.

The color belongs to a DlColorSpace. Using deprecated integer data accessors on colors not in the kSRGB colorspace can lead to data loss. Using the floating point accessors and constructors that were added for wide-gamut support are preferred.

Definition at line 21 of file dl_color.h.

Constructor & Destructor Documentation

◆ DlColor() [1/3]

◆ DlColor() [2/3]

constexpr flutter::DlColor::DlColor ( uint32_t  argb)
inlineexplicitconstexpr

Definition at line 29 of file dl_color.h.

30 : alpha_(toF((argb >> 24) & 0xff)),
31 red_(toF((argb >> 16) & 0xff)),
32 green_(toF((argb >> 8) & 0xff)),
33 blue_(toF((argb >> 0) & 0xff)),
34 color_space_(DlColorSpace::kSRGB) {}
uint32_t argb() const
Definition dl_color.h:158

◆ DlColor() [3/3]

constexpr flutter::DlColor::DlColor ( DlScalar  alpha,
DlScalar  red,
DlScalar  green,
DlScalar  blue,
DlColorSpace  colorspace 
)
inlineconstexpr

Definition at line 35 of file dl_color.h.

40 : alpha_(std::clamp(alpha, 0.0f, 1.0f)),
41 red_(red),
42 green_(green),
43 blue_(blue),
44 color_space_(colorspace) {}

Member Function Documentation

◆ argb()

uint32_t flutter::DlColor::argb ( ) const
inline

Definition at line 158 of file dl_color.h.

158 {
159 if (color_space_ != DlColorSpace::kSRGB) {
161 }
162 return toC(alpha_) << 24 | //
163 toC(red_) << 16 | //
164 toC(green_) << 8 | //
165 toC(blue_) << 0;
166 }
DlColor withColorSpace(DlColorSpace color_space) const
Definition dl_color.cc:40

References argb(), flutter::kSRGB, and withColorSpace().

Referenced by argb(), flutter::testing::CanvasCompareTester::checkGroupOpacity(), flutter::DlPaint::getAlpha(), flutter::testing::MakeTestImage(), flutter::testing::CanvasCompareTester::RenderWithAttributes(), flutter::testing::TEST_F(), flutter::ToSkColor(), withAlpha(), withBlue(), withGreen(), and withRed().

◆ ARGB()

◆ getAlpha()

int flutter::DlColor::getAlpha ( ) const
inline

Definition at line 102 of file dl_color.h.

102{ return toC(alpha_); }

Referenced by flutter::DlSkCanvasDispatcher::DrawShadow(), modulateOpacity(), and flutter::testing::TEST().

◆ getAlphaF()

◆ getBlue()

int flutter::DlColor::getBlue ( ) const
inline

Definition at line 111 of file dl_color.h.

111{ return toC(blue_); }

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

◆ getBlueF()

◆ getColorSpace()

constexpr DlColorSpace flutter::DlColor::getColorSpace ( ) const
inlineconstexpr

Definition at line 118 of file dl_color.h.

118{ return color_space_; }

Referenced by std::operator<<(), flutter::testing::TEST(), impeller::skia_conversions::ToColor(), and flutter::ToSkColor4f().

◆ getGreen()

int flutter::DlColor::getGreen ( ) const
inline

Definition at line 108 of file dl_color.h.

108{ return toC(green_); }

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

◆ getGreenF()

◆ getRed()

int flutter::DlColor::getRed ( ) const
inline

Definition at line 105 of file dl_color.h.

105{ return toC(red_); }

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

◆ getRedF()

◆ isClose()

bool flutter::DlColor::isClose ( DlColor const &  other,
DlScalar  delta = 1.0f / 256.0f 
)
inline

Checks that no difference in color components exceeds the delta.

This doesn't check against the actual distance between the colors in some space.

Definition at line 172 of file dl_color.h.

172 {
173 return color_space_ == other.color_space_ &&
174 std::abs(alpha_ - other.alpha_) < delta &&
175 std::abs(red_ - other.red_) < delta &&
176 std::abs(green_ - other.green_) < delta &&
177 std::abs(blue_ - other.blue_) < delta;
178 }

◆ isOpaque()

constexpr bool flutter::DlColor::isOpaque ( ) const
inlineconstexpr

Definition at line 97 of file dl_color.h.

97{ return alpha_ >= 1.f; }

Referenced by flutter::testing::MakeTestImage().

◆ isTransparent()

constexpr bool flutter::DlColor::isTransparent ( ) const
inlineconstexpr

◆ kAliceBlue()

static constexpr DlColor flutter::DlColor::kAliceBlue ( )
inlinestaticconstexpr

Definition at line 80 of file dl_color.h.

80{return DlColor(0xFFF0F8FF);};

References DlColor().

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

◆ kAqua()

static constexpr DlColor flutter::DlColor::kAqua ( )
inlinestaticconstexpr

Definition at line 86 of file dl_color.h.

86{return DlColor(0xFF00FFFF);};

References DlColor().

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

◆ kBlack()

static constexpr DlColor flutter::DlColor::kBlack ( )
inlinestaticconstexpr

Definition at line 69 of file dl_color.h.

69{return DlColor(0xFF000000);};

References DlColor().

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

◆ kBlue()

static constexpr DlColor flutter::DlColor::kBlue ( )
inlinestaticconstexpr

Definition at line 73 of file dl_color.h.

73{return DlColor(0xFF0000FF);};

References DlColor().

Referenced by flutter::testing::CreateAllRenderingOps(), flutter::testing::DisplayListNopTest::DisplayListNopTest(), impeller::testing::DoGradientOvalStrokeMaskBlur(), flutter::testing::DrawCheckerboard(), flutter::testing::MakeTestImage(), impeller::testing::MaskBlurVariantTest(), flutter::testing::CanvasCompareTester::RenderWithAttributes(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), flutter::testing::TEST_P(), flutter::testing::TEST_P(), and flutter::testing::TEST_P().

◆ kChartreuse()

static constexpr DlColor flutter::DlColor::kChartreuse ( )
inlinestaticconstexpr

Definition at line 94 of file dl_color.h.

94{return DlColor(0xFF7FFF00);};

References DlColor().

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

◆ kCornflowerBlue()

static constexpr DlColor flutter::DlColor::kCornflowerBlue ( )
inlinestaticconstexpr

◆ kCrimson()

static constexpr DlColor flutter::DlColor::kCrimson ( )
inlinestaticconstexpr

Definition at line 85 of file dl_color.h.

85{return DlColor(0xFFFF5733);};

References DlColor().

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

◆ kCyan()

◆ kDarkGreen()

static constexpr DlColor flutter::DlColor::kDarkGreen ( )
inlinestaticconstexpr

Definition at line 93 of file dl_color.h.

93{return DlColor(0xFF006400);};

References DlColor().

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

◆ kDarkGrey()

static constexpr DlColor flutter::DlColor::kDarkGrey ( )
inlinestaticconstexpr

◆ kDarkMagenta()

static constexpr DlColor flutter::DlColor::kDarkMagenta ( )
inlinestaticconstexpr

Definition at line 91 of file dl_color.h.

91{return DlColor(0xFF8B008B);};

References DlColor().

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

◆ kFuchsia()

static constexpr DlColor flutter::DlColor::kFuchsia ( )
inlinestaticconstexpr

Definition at line 81 of file dl_color.h.

81{return DlColor(0xFFFF00FF);};

References DlColor().

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

◆ kGreen()

static constexpr DlColor flutter::DlColor::kGreen ( )
inlinestaticconstexpr

Definition at line 72 of file dl_color.h.

72{return DlColor(0xFF00FF00);};

References DlColor().

Referenced by flutter::testing::CreateAllRenderingOps(), flutter::testing::DisplayListNopTest::DisplayListNopTest(), flutter::testing::MakeTestImage(), impeller::testing::MaskBlurVariantTest(), flutter::testing::CanvasCompareTester::RenderWithAttributes(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter_runner::testing::TEST_F(), flutter_runner::testing::TEST_F(), flutter_runner::testing::TEST_F(), flutter_runner::testing::TEST_F(), flutter_runner::testing::TEST_F(), flutter_runner::testing::TEST_F(), flutter_runner::testing::TEST_F(), flutter_runner::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), flutter::testing::TEST_P(), flutter::testing::TEST_P(), and flutter::DlStopwatchVisualizer::Visualize().

◆ kGreenYellow()

static constexpr DlColor flutter::DlColor::kGreenYellow ( )
inlinestaticconstexpr

◆ kLightGrey()

static constexpr DlColor flutter::DlColor::kLightGrey ( )
inlinestaticconstexpr

Definition at line 79 of file dl_color.h.

79{return DlColor(0xFFC0C0C0);};

References DlColor().

Referenced by flutter::testing::DisplayListNopTest::DisplayListNopTest(), and impeller::testing::TEST_P().

◆ kLimeGreen()

static constexpr DlColor flutter::DlColor::kLimeGreen ( )
inlinestaticconstexpr

Definition at line 89 of file dl_color.h.

89{return DlColor(0xFF32CD32);};

References DlColor().

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

◆ kMagenta()

◆ kMaroon()

static constexpr DlColor flutter::DlColor::kMaroon ( )
inlinestaticconstexpr

◆ kMidGrey()

◆ kOrange()

static constexpr DlColor flutter::DlColor::kOrange ( )
inlinestaticconstexpr

Definition at line 87 of file dl_color.h.

87{return DlColor(0xFFFFA500);};

References DlColor().

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

◆ kOrangeRed()

static constexpr DlColor flutter::DlColor::kOrangeRed ( )
inlinestaticconstexpr

Definition at line 92 of file dl_color.h.

92{return DlColor(0xFFFF4500);};

References DlColor().

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

◆ kPurple()

static constexpr DlColor flutter::DlColor::kPurple ( )
inlinestaticconstexpr

Definition at line 88 of file dl_color.h.

88{return DlColor(0xFF800080);};

References DlColor().

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

◆ kRed()

static constexpr DlColor flutter::DlColor::kRed ( )
inlinestaticconstexpr

Definition at line 71 of file dl_color.h.

71{return DlColor(0xFFFF0000);};

References DlColor().

Referenced by flutter::testing::DisplayListNopTest::DisplayListNopTest(), impeller::testing::DoGradientOvalStrokeMaskBlur(), flutter::testing::GetSampleDisplayList(), flutter::testing::GetSampleDisplayList(), flutter::testing::MakeSizedDisplayList(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter_runner::testing::TEST_F(), flutter_runner::testing::TEST_F(), flutter_runner::testing::TEST_F(), flutter_runner::testing::TEST_F(), flutter_runner::testing::TEST_F(), flutter::testing::TEST_F(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), flutter::testing::TEST_P(), flutter::testing::TEST_P(), flutter::testing::TEST_P(), and flutter::DlStopwatchVisualizer::Visualize().

◆ kSkyBlue()

static constexpr DlColor flutter::DlColor::kSkyBlue ( )
inlinestaticconstexpr

Definition at line 83 of file dl_color.h.

83{return DlColor(0xFF87CEEB);};

References DlColor().

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

◆ kTransparent()

◆ kWhite()

static constexpr DlColor flutter::DlColor::kWhite ( )
inlinestaticconstexpr

Definition at line 70 of file dl_color.h.

70{return DlColor(0xFFFFFFFF);};

References DlColor().

Referenced by impeller::testing::BlendModeTest(), flutter::testing::DisplayListNopTest::DisplayListNopTest(), impeller::testing::DoGradientOvalStrokeMaskBlur(), flutter::testing::CanvasCompareTester::RenderWithAttributes(), flutter::testing::TEST(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), flutter::testing::TEST_P(), flutter::testing::TEST_P(), and flutter::testing::TEST_P().

◆ kYellow()

static constexpr DlColor flutter::DlColor::kYellow ( )
inlinestaticconstexpr

Definition at line 76 of file dl_color.h.

76{return DlColor(0xFFFFFF00);};

References DlColor().

Referenced by flutter::testing::CanvasCompareTester::RenderWithAttributes(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), flutter::testing::TEST_P(), and flutter::testing::TEST_P().

◆ modulateOpacity()

constexpr DlColor flutter::DlColor::modulateOpacity ( DlScalar  opacity) const
inlineconstexpr

Definition at line 150 of file dl_color.h.

150 {
151 return opacity <= 0 ? withAlpha(0)
152 : opacity >= 1 ? *this
153 : withAlpha(round(getAlpha() * opacity));
154 }
int getAlpha() const
Definition dl_color.h:102
DlColor withAlpha(uint8_t alpha) const
Definition dl_color.h:120

References getAlpha(), and withAlpha().

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

◆ operator==()

bool flutter::DlColor::operator== ( DlColor const &  other) const
inline

Definition at line 179 of file dl_color.h.

179 {
180 return alpha_ == other.alpha_ && red_ == other.red_ &&
181 green_ == other.green_ && blue_ == other.blue_ &&
182 color_space_ == other.color_space_;
183 }

◆ RGBA()

static constexpr DlColor flutter::DlColor::RGBA ( DlScalar  r,
DlScalar  g,
DlScalar  b,
DlScalar  a 
)
inlinestaticconstexpr

Construct a 32 bit color from floating point R, G, B, and A color channels.

Definition at line 48 of file dl_color.h.

51 {
52 return ARGB(a, r, g, b);
53 }
static constexpr DlColor ARGB(DlScalar a, DlScalar r, DlScalar g, DlScalar b)
Construct a 32 bit color from floating point A, R, G, and B color channels.
Definition dl_color.h:57

References ARGB().

Referenced by impeller::testing::BlendModeTest(), impeller::testing::MaskBlurVariantTest(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), impeller::testing::TEST_F(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), and impeller::interop::ToDisplayListType().

◆ toAlpha()

static uint8_t flutter::DlColor::toAlpha ( DlScalar  opacity)
inlinestatic

◆ toOpacity()

static constexpr DlScalar flutter::DlColor::toOpacity ( uint8_t  alpha)
inlinestaticconstexpr

◆ withAlpha()

◆ withAlphaF()

constexpr DlColor flutter::DlColor::withAlphaF ( float  alpha) const
inlineconstexpr

Definition at line 132 of file dl_color.h.

132 { //
133 return DlColor(alpha, red_, green_, blue_, color_space_);
134 }

References DlColor().

◆ withBlue()

DlColor flutter::DlColor::withBlue ( uint8_t  blue) const
inline

Definition at line 129 of file dl_color.h.

129 { //
130 return DlColor((argb() & 0xFFFFFF00) | (blue << 0));
131 }

References argb(), and DlColor().

◆ withBlueF()

constexpr DlColor flutter::DlColor::withBlueF ( float  blue) const
inlineconstexpr

Definition at line 141 of file dl_color.h.

141 { //
142 return DlColor(alpha_, red_, green_, blue, color_space_);
143 }

References DlColor().

◆ withColorSpace()

DlColor flutter::DlColor::withColorSpace ( DlColorSpace  color_space) const

Performs a colorspace transformation.

This isn't just a replacement of the color space field, the new color components are calculated.

Definition at line 40 of file dl_color.cc.

40 {
41 switch (color_space_) {
43 switch (color_space) {
45 return *this;
47 return DlColor(alpha_, red_, green_, blue_,
50 FML_CHECK(false) << "not implemented";
51 return *this;
52 }
54 switch (color_space) {
56 return DlColor(alpha_, std::clamp(red_, 0.0f, 1.0f),
57 std::clamp(green_, 0.0f, 1.0f),
58 std::clamp(blue_, 0.0f, 1.0f), DlColorSpace::kSRGB);
60 return *this;
62 FML_CHECK(false) << "not implemented";
63 return *this;
64 }
66 switch (color_space) {
68 return transform(*this, kP3ToSrgb, DlColorSpace::kExtendedSRGB)
69 .withColorSpace(DlColorSpace::kSRGB);
71 return transform(*this, kP3ToSrgb, DlColorSpace::kExtendedSRGB);
73 return *this;
74 }
75 }
76}
#define FML_CHECK(condition)
Definition logging.h:104

References DlColor(), FML_CHECK, flutter::kDisplayP3, flutter::kExtendedSRGB, flutter::kSRGB, and transform.

Referenced by argb(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), and flutter::ToSkColor4f().

◆ withGreen()

DlColor flutter::DlColor::withGreen ( uint8_t  green) const
inline

Definition at line 126 of file dl_color.h.

126 { //
127 return DlColor((argb() & 0xFFFF00FF) | (green << 8));
128 }

References argb(), and DlColor().

◆ withGreenF()

constexpr DlColor flutter::DlColor::withGreenF ( float  green) const
inlineconstexpr

Definition at line 138 of file dl_color.h.

138 { //
139 return DlColor(alpha_, red_, green, blue_, color_space_);
140 }

References DlColor().

◆ withRed()

DlColor flutter::DlColor::withRed ( uint8_t  red) const
inline

Definition at line 123 of file dl_color.h.

123 { //
124 return DlColor((argb() & 0xFF00FFFF) | (red << 16));
125 }

References argb(), and DlColor().

◆ withRedF()

constexpr DlColor flutter::DlColor::withRedF ( float  red) const
inlineconstexpr

Definition at line 135 of file dl_color.h.

135 { //
136 return DlColor(alpha_, red, green_, blue_, color_space_);
137 }

References DlColor().


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