AUI Framework  master
Cross-platform base for C++ UI apps
Loading...
Searching...
No Matches
AColor Class Reference

Represents a 4-component floating point color (RGBA). More...

#include <AUI/Common/AColor.h>

Public Member Functions#

constexpr AColor (const glm::vec4 &v)
 
API_AUI_CORE AColor (const AString &s)
 
constexpr AColor (float scalar)
 
constexpr AColor (float r, float g, float b)
 
constexpr AColor (float r, float g, float b, float a)
 
constexpr AColor (unsigned int color)
 Construct with hex integer.
 
constexpr AColor operator* (float other) const
 
API_AUI_CORE AString toString () const
 
API_AUI_CORE float readabilityOfForegroundColor (const AColor &foreground)
 
AColor opacify (float alpha) const noexcept
 Increases the alpha channel by the given value.
 
AColor transparentize (float alpha) const noexcept
 Decreases the alpha channel by the given value.
 
constexpr AColor mul (float d) const
 Multiply all color components except alpha channel (rgb * d, a)
 
constexpr AColor darker (float d) const
 
constexpr AColor lighter (float d) const
 
bool isFullyTransparent () const
 
bool isFullyOpaque () const
 
AColor readableBlackOrWhite () const
 
AColor opacify (float d)
 

Static Public Member Functions#

static constexpr AColor fromAARRGGBB (unsigned int color)
 Construct with hex integer.
 
static constexpr AColor fromRRGGBB (unsigned int color)
 Construct with hex integer.
 

Static Public Attributes#

static const AColor BLACK = { 0.f, 0.f, 0.f, 1.f }
 
static const AColor WHITE = { 1.f, 1.f, 1.f, 1.f }
 
static const AColor RED = { 1.f, 0.f, 0.f, 1.f }
 
static const AColor GREEN = { 0.f, 1.f, 0.f, 1.f }
 
static const AColor BLUE = { 0.f, 0.f, 1.f, 1.f }
 
static const AColor GRAY = { 0.5f, 0.5f, 0.5f, 1.f }
 
static const AColor TRANSPARENT_BLACK = { 0.f, 0.f, 0.f, 0.f }
 
static const AColor TRANSPARENT_WHITE = { 0.f, 0.f, 0.f, 1.f }
 

Detailed Description#

Examples
examples/ui/views/src/ExampleWindow.cpp.

Constructor & Destructor Documentation#

◆ AColor()#

AColor::AColor ( unsigned int color)
inlineconstexpr
Parameters
colorinteger representing color in 0xRRGGBBAA

AColor(0xff0000ff) will represent opaque bright red

Member Function Documentation#

◆ fromAARRGGBB()#

static constexpr AColor AColor::fromAARRGGBB ( unsigned int color)
inlinestaticconstexpr
Parameters
colorinteger representing color in 0xAARRGGBB

AColor(0xff0000ff) will represent opaque bright blue

◆ fromRRGGBB()#

static constexpr AColor AColor::fromRRGGBB ( unsigned int color)
inlinestaticconstexpr
Parameters
colorinteger representing color in 0xRRGGBB

AColor(0x00ff00) will represent opaque bright green

◆ mul()#

AColor AColor::mul ( float d) const
inlineconstexpr
Parameters
dmultiplier
Returns
multiplied color