Audacity 3.2.0
|
Class for storing color in 32-bit format. More...
#include <Color.h>
Public Member Functions | |
constexpr | Color () noexcept |
Constructs a transparent black color. More... | |
constexpr | Color (const Color &) noexcept=default |
constexpr | Color (Color &&) noexcept=default |
Color & | operator= (const Color &) noexcept=default |
Color & | operator= (Color &&) noexcept=default |
constexpr | Color (uint8_t rr, uint8_t gg, uint8_t bb, uint8_t aa=255) noexcept |
Constructs a color from individual components. More... | |
constexpr Color | WithOpacity (float opacity) const noexcept |
Returns a copy of this color with alpha component scaled by opacity. More... | |
constexpr Color | WithFloatAlpha (float alpha) const noexcept |
Returns a copy of this color with a new alpha value. Value is clamped to [0, 1]. More... | |
constexpr Color | WithAlpha (uint8_t alpha) const noexcept |
Returns a copy of this color with a new alpha value. More... | |
constexpr Color | WithoutAlpha () const noexcept |
Returns a copy of this color with the alpha set to the max. More... | |
constexpr uint8_t | GetRed () const noexcept |
Returns red component of this color. More... | |
constexpr uint8_t | GetGreen () const noexcept |
Returns green component of this color. More... | |
constexpr uint8_t | GetBlue () const noexcept |
Returns blue component of this color. More... | |
constexpr uint8_t | GetAlpha () const noexcept |
Returns alpha component of this color. More... | |
constexpr uint32_t | GetRGBA () const noexcept |
Returns color value as RGBA 32-bit integer. More... | |
constexpr uint32_t | GetABGR () const noexcept |
Returns color value as ABGR 32-bit integer. More... | |
constexpr uint32_t | GetRGB () const noexcept |
Returns color value as RGB integer. More... | |
Color & | operator+= (Color rhs) noexcept |
Color & | operator-= (Color rhs) noexcept |
Color & | operator*= (Color rhs) noexcept |
bool | operator== (const Color &rhs) const noexcept |
bool | operator!= (const Color &rhs) const noexcept |
Static Public Member Functions | |
static constexpr Color | FromABGR (uint32_t abgr) noexcept |
Constructs a color from ABGR 32-bit integer value. More... | |
static constexpr Color | FromFloatRGBA (float r, float g, float b, float a) noexcept |
Constructs a color from individual floating point components. This value is clamped to [0, 1]. More... | |
Private Member Functions | |
constexpr | Color (uint32_t abgr) noexcept |
Static Private Member Functions | |
static constexpr uint8_t | Add (uint8_t a, uint8_t b) noexcept |
static constexpr uint8_t | Sub (uint8_t a, uint8_t b) noexcept |
static constexpr uint8_t | Mul (uint8_t a, uint8_t b) noexcept |
static constexpr uint8_t | Scale (uint8_t a, float s) noexcept |
template<typename ScaleType > | |
static constexpr uint8_t | Lerp (uint8_t a, uint8_t b, ScaleType t) |
Private Attributes | |
union { | |
uint32_t mABGR | |
struct { | |
uint8_t mRed | |
uint8_t mGreen | |
uint8_t mBlue | |
uint8_t mAlpha | |
} | |
}; | |
Friends | |
constexpr Color | operator+ (Color lhs, Color rhs) noexcept |
constexpr Color | operator- (Color lhs, Color rhs) noexcept |
constexpr Color | operator* (Color lhs, Color rhs) noexcept |
template<typename ScaleType > | |
constexpr Color | lerp (Color lhs, Color rhs, ScaleType t) |
Performs linear interpolation between two colors. More... | |
Class for storing color in 32-bit format.
This class is used to store color in 32-bit ABGR format. It allows to munipulate individual color components and to convert to/from other formats.
Additionally, it provides fixed-point arithmetic for color components.
|
inlineconstexprnoexcept |
Constructs a transparent black color.
Definition at line 32 of file Color.h.
Referenced by FromABGR(), FromFloatRGBA(), WithAlpha(), WithFloatAlpha(), WithOpacity(), and WithoutAlpha().
|
constexprdefaultnoexcept |
|
constexprdefaultnoexcept |
|
inlineconstexprnoexcept |
|
inlineexplicitconstexprprivatenoexcept |
|
inlinestaticconstexprprivatenoexcept |
|
inlinestaticconstexprnoexcept |
Constructs a color from ABGR 32-bit integer value.
Definition at line 49 of file Color.h.
References Color().
Referenced by graphics::ColorFromABGR().
|
inlinestaticconstexprnoexcept |
Constructs a color from individual floating point components. This value is clamped to [0, 1].
Definition at line 55 of file Color.h.
References Color(), and Scale().
Referenced by graphics::ColorFromFloatRGBA().
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
Returns blue component of this color.
Definition at line 99 of file Color.h.
References mBlue.
Referenced by Triplet::SetColor().
|
inlineconstexprnoexcept |
Returns green component of this color.
Definition at line 93 of file Color.h.
References mGreen.
Referenced by Triplet::SetColor().
|
inlineconstexprnoexcept |
Returns red component of this color.
Definition at line 87 of file Color.h.
References mRed.
Referenced by Triplet::SetColor().
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlinestaticconstexprprivate |
Definition at line 200 of file Color.h.
References min().
|
inlinestaticconstexprprivatenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinestaticconstexprprivatenoexcept |
Definition at line 194 of file Color.h.
References min().
Referenced by FromFloatRGBA(), WithFloatAlpha(), and WithOpacity().
|
inlinestaticconstexprprivatenoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
Performs linear interpolation between two colors.
Definition at line 233 of file Color.h.
union { ... } graphics::Color::@111 |
uint32_t graphics::Color::mABGR |
Definition at line 223 of file Color.h.
Referenced by GetABGR(), operator!=(), and operator==().
uint8_t graphics::Color::mAlpha |
Definition at line 226 of file Color.h.
Referenced by GetAlpha(), GetRGBA(), and WithOpacity().
uint8_t graphics::Color::mBlue |
Definition at line 226 of file Color.h.
Referenced by GetBlue(), GetRGB(), GetRGBA(), WithAlpha(), WithFloatAlpha(), WithOpacity(), and WithoutAlpha().
uint8_t graphics::Color::mGreen |
Definition at line 226 of file Color.h.
Referenced by GetGreen(), GetRGB(), GetRGBA(), WithAlpha(), WithFloatAlpha(), WithOpacity(), and WithoutAlpha().
uint8_t graphics::Color::mRed |
Definition at line 226 of file Color.h.
Referenced by GetRed(), GetRGB(), GetRGBA(), WithAlpha(), WithFloatAlpha(), WithOpacity(), and WithoutAlpha().