Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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 ()
 

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:78

Member Function Documentation

◆ argb()

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

Definition at line 78 of file dl_color.h.

78{ return argb_; }

◆ getAlpha()

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

Definition at line 38 of file dl_color.h.

38{ return argb_ >> 24; }

◆ getAlphaF()

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

Definition at line 43 of file dl_color.h.

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

◆ getBlue()

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

Definition at line 41 of file dl_color.h.

41{ return argb_ & 0xFF; }

◆ getBlueF()

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

Definition at line 46 of file dl_color.h.

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

◆ getGreen()

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

Definition at line 40 of file dl_color.h.

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

◆ getGreenF()

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

Definition at line 45 of file dl_color.h.

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

◆ getRed()

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

Definition at line 39 of file dl_color.h.

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

◆ getRedF()

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

Definition at line 44 of file dl_color.h.

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

◆ isOpaque()

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

Definition at line 35 of file dl_color.h.

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

◆ isTransparent()

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

Definition at line 36 of file dl_color.h.

36{ return getAlpha() == 0; }

◆ kBlack()

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

Definition at line 22 of file dl_color.h.

22{return DlColor(0xFF000000);};
constexpr DlColor()
Definition dl_color.h:14

◆ 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);};

◆ 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);};

◆ 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);};

◆ 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 72 of file dl_color.h.

72 {
73 return opacity <= 0 ? withAlpha(0)
74 : opacity >= 1 ? *this
75 : withAlpha(round(getAlpha() * opacity));
76 }
static void round(SkPoint *p)
constexpr DlColor withAlpha(uint8_t alpha) const
Definition dl_color.h:59

◆ operator!=() [1/2]

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

Definition at line 81 of file dl_color.h.

81{ return argb_ != other.argb_; }

◆ operator!=() [2/2]

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

Definition at line 83 of file dl_color.h.

83{ return argb_ != other; }

◆ operator==() [1/2]

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

Definition at line 80 of file dl_color.h.

80{ return argb_ == other.argb_; }

◆ operator==() [2/2]

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

Definition at line 82 of file dl_color.h.

82{ return argb_ == other; }

◆ premultipliedArgb()

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

Definition at line 48 of file dl_color.h.

48 {
49 if (isOpaque()) {
50 return argb_;
51 }
52 float f = getAlphaF();
53 return (argb_ & 0xFF000000) | //
54 toC(getRedF() * f) << 16 | //
55 toC(getGreenF() * f) << 8 | //
56 toC(getBlueF() * f);
57 }
constexpr float getAlphaF() const
Definition dl_color.h:43
constexpr float getRedF() const
Definition dl_color.h:44
constexpr float getBlueF() const
Definition dl_color.h:46
constexpr float getGreenF() const
Definition dl_color.h:45
constexpr bool isOpaque() const
Definition dl_color.h:35

◆ 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 59 of file dl_color.h.

59 { //
60 return DlColor((argb_ & 0x00FFFFFF) | (alpha << 24));
61 }

◆ withBlue()

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

Definition at line 68 of file dl_color.h.

68 { //
69 return DlColor((argb_ & 0xFFFFFF00) | (blue << 0));
70 }

◆ withGreen()

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

Definition at line 65 of file dl_color.h.

65 { //
66 return DlColor((argb_ & 0xFFFF00FF) | (green << 8));
67 }

◆ withRed()

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

Definition at line 62 of file dl_color.h.

62 { //
63 return DlColor((argb_ & 0xFF00FFFF) | (red << 16));
64 }

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