Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Member Functions | List of all members
flutter::DlColor Struct Reference

#include <dl_color.h>

Public Member Functions

constexpr DlColor ()
 
constexpr DlColor (uint32_t argb)
 
constexpr bool isOpaque () const
 
constexpr bool isTransparent () const
 
constexpr int getAlpha () const
 
constexpr int getRed () const
 
constexpr int getGreen () const
 
constexpr int getBlue () const
 
constexpr float getAlphaF () const
 
constexpr float getRedF () const
 
constexpr float getGreenF () const
 
constexpr float getBlueF () const
 
constexpr uint32_t premultipliedArgb () const
 
constexpr DlColor withAlpha (uint8_t alpha) const
 
constexpr DlColor withRed (uint8_t red) const
 
constexpr DlColor withGreen (uint8_t green) const
 
constexpr DlColor withBlue (uint8_t blue) const
 
constexpr DlColor modulateOpacity (float opacity) const
 
constexpr uint32_t argb () const
 
bool operator== (DlColor const &other) const
 
bool operator!= (DlColor const &other) const
 
bool operator== (uint32_t const &other) const
 
bool operator!= (uint32_t const &other) const
 

Static Public Member Functions

static constexpr uint8_t toAlpha (SkScalar opacity)
 
static constexpr SkScalar 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 ()
 

Detailed Description

Definition at line 12 of file dl_color.h.

Constructor & Destructor Documentation

◆ DlColor() [1/2]

constexpr flutter::DlColor::DlColor ( )
inlineconstexpr

Definition at line 14 of file dl_color.h.

14: argb_(0xFF000000) {}

◆ DlColor() [2/2]

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

Definition at line 15 of file dl_color.h.

15: argb_(argb) {}
constexpr uint32_t argb() const
Definition: dl_color.h:82

Member Function Documentation

◆ argb()

constexpr uint32_t flutter::DlColor::argb ( ) const
inlineconstexpr

Definition at line 82 of file dl_color.h.

82{ return argb_; }

◆ getAlpha()

constexpr int flutter::DlColor::getAlpha ( ) const
inlineconstexpr

Definition at line 42 of file dl_color.h.

42{ return argb_ >> 24; }

◆ getAlphaF()

constexpr float flutter::DlColor::getAlphaF ( ) const
inlineconstexpr

Definition at line 47 of file dl_color.h.

47{ return toF(getAlpha()); }
constexpr int getAlpha() const
Definition: dl_color.h:42

◆ getBlue()

constexpr int flutter::DlColor::getBlue ( ) const
inlineconstexpr

Definition at line 45 of file dl_color.h.

45{ return argb_ & 0xFF; }

◆ getBlueF()

constexpr float flutter::DlColor::getBlueF ( ) const
inlineconstexpr

Definition at line 50 of file dl_color.h.

50{ return toF(getBlue()); }
constexpr int getBlue() const
Definition: dl_color.h:45

◆ getGreen()

constexpr int flutter::DlColor::getGreen ( ) const
inlineconstexpr

Definition at line 44 of file dl_color.h.

44{ return (argb_ >> 8) & 0xFF; }

◆ getGreenF()

constexpr float flutter::DlColor::getGreenF ( ) const
inlineconstexpr

Definition at line 49 of file dl_color.h.

49{ return toF(getGreen()); }
constexpr int getGreen() const
Definition: dl_color.h:44

◆ getRed()

constexpr int flutter::DlColor::getRed ( ) const
inlineconstexpr

Definition at line 43 of file dl_color.h.

43{ return (argb_ >> 16) & 0xFF; }

◆ getRedF()

constexpr float flutter::DlColor::getRedF ( ) const
inlineconstexpr

Definition at line 48 of file dl_color.h.

48{ return toF(getRed()); }
constexpr int getRed() const
Definition: dl_color.h:43

◆ isOpaque()

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

Definition at line 39 of file dl_color.h.

39{ return getAlpha() == 0xFF; }

◆ isTransparent()

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

Definition at line 40 of file dl_color.h.

40{ return getAlpha() == 0; }

◆ kAliceBlue()

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

Definition at line 33 of file dl_color.h.

33{return DlColor(0xFFF0F8FF);};
constexpr DlColor()
Definition: dl_color.h:14

◆ kBlack()

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

Definition at line 22 of file dl_color.h.

22{return DlColor(0xFF000000);};

◆ kBlue()

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

Definition at line 26 of file dl_color.h.

26{return DlColor(0xFF0000FF);};

◆ kCyan()

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

Definition at line 27 of file dl_color.h.

27{return DlColor(0xFF00FFFF);};

◆ kDarkGrey()

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

Definition at line 30 of file dl_color.h.

30{return DlColor(0xFF3F3F3F);};

◆ kFuchsia()

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

Definition at line 34 of file dl_color.h.

34{return DlColor(0xFFFF00FF);};

◆ kGreen()

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

Definition at line 25 of file dl_color.h.

25{return DlColor(0xFF00FF00);};

◆ kLightGrey()

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

Definition at line 32 of file dl_color.h.

32{return DlColor(0xFFC0C0C0);};

◆ kMagenta()

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

Definition at line 28 of file dl_color.h.

28{return DlColor(0xFFFF00FF);};

◆ kMaroon()

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

Definition at line 35 of file dl_color.h.

35{return DlColor(0xFF800000);}

◆ kMidGrey()

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

Definition at line 31 of file dl_color.h.

31{return DlColor(0xFF808080);};

◆ kRed()

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

Definition at line 24 of file dl_color.h.

24{return DlColor(0xFFFF0000);};

◆ kSkyBlue()

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

Definition at line 36 of file dl_color.h.

36{return DlColor(0xFF87CEEB);}

◆ kTransparent()

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

Definition at line 21 of file dl_color.h.

21{return DlColor(0x00000000);};

◆ kWhite()

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

Definition at line 23 of file dl_color.h.

23{return DlColor(0xFFFFFFFF);};

◆ kYellow()

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

Definition at line 29 of file dl_color.h.

29{return DlColor(0xFFFFFF00);};

◆ modulateOpacity()

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

Definition at line 76 of file dl_color.h.

76 {
77 return opacity <= 0 ? withAlpha(0)
78 : opacity >= 1 ? *this
79 : withAlpha(round(getAlpha() * opacity));
80 }
static void round(SkPoint *p)
constexpr DlColor withAlpha(uint8_t alpha) const
Definition: dl_color.h:63

◆ operator!=() [1/2]

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

Definition at line 85 of file dl_color.h.

85{ return argb_ != other.argb_; }

◆ operator!=() [2/2]

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

Definition at line 87 of file dl_color.h.

87{ return argb_ != other; }

◆ operator==() [1/2]

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

Definition at line 84 of file dl_color.h.

84{ return argb_ == other.argb_; }

◆ operator==() [2/2]

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

Definition at line 86 of file dl_color.h.

86{ return argb_ == other; }

◆ premultipliedArgb()

constexpr uint32_t flutter::DlColor::premultipliedArgb ( ) const
inlineconstexpr

Definition at line 52 of file dl_color.h.

52 {
53 if (isOpaque()) {
54 return argb_;
55 }
56 float f = getAlphaF();
57 return (argb_ & 0xFF000000) | //
58 toC(getRedF() * f) << 16 | //
59 toC(getGreenF() * f) << 8 | //
60 toC(getBlueF() * f);
61 }
constexpr float getAlphaF() const
Definition: dl_color.h:47
constexpr float getRedF() const
Definition: dl_color.h:48
constexpr float getBlueF() const
Definition: dl_color.h:50
constexpr float getGreenF() const
Definition: dl_color.h:49
constexpr bool isOpaque() const
Definition: dl_color.h:39

◆ toAlpha()

static constexpr uint8_t flutter::DlColor::toAlpha ( SkScalar  opacity)
inlinestaticconstexpr

Definition at line 17 of file dl_color.h.

17{ return toC(opacity); }

◆ toOpacity()

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

Definition at line 18 of file dl_color.h.

18{ return toF(alpha); }

◆ withAlpha()

constexpr DlColor flutter::DlColor::withAlpha ( uint8_t  alpha) const
inlineconstexpr

Definition at line 63 of file dl_color.h.

63 { //
64 return DlColor((argb_ & 0x00FFFFFF) | (alpha << 24));
65 }

◆ withBlue()

constexpr DlColor flutter::DlColor::withBlue ( uint8_t  blue) const
inlineconstexpr

Definition at line 72 of file dl_color.h.

72 { //
73 return DlColor((argb_ & 0xFFFFFF00) | (blue << 0));
74 }

◆ withGreen()

constexpr DlColor flutter::DlColor::withGreen ( uint8_t  green) const
inlineconstexpr

Definition at line 69 of file dl_color.h.

69 { //
70 return DlColor((argb_ & 0xFFFF00FF) | (green << 8));
71 }

◆ withRed()

constexpr DlColor flutter::DlColor::withRed ( uint8_t  red) const
inlineconstexpr

Definition at line 66 of file dl_color.h.

66 { //
67 return DlColor((argb_ & 0xFF00FFFF) | (red << 16));
68 }

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