omw  0.2.1-beta
Public Member Functions | List of all members
omw::Color Class Reference

Public Member Functions

 Color (int32_t rgb)
 
 Color (uint8_t r, uint8_t g, uint8_t b, uint8_t a=0xFF)
 
 Color (const std::string &css)
 
 Color (const char *css)
 
bool isValid () const
 
void validate (bool state=true)
 
void invalidate ()
 Invalidates the object. More...
 
void clear ()
 
void opaque ()
 
void transparent ()
 
void set (int32_t rgb)
 
void set (uint8_t r, uint8_t g, uint8_t b, uint8_t a=0xFF)
 
void set (const omw::Color &color)
 
void set (const std::string &css)
 
void set (const char *css)
 
void setARGB (int32_t argb)
 
void setR (uint8_t value)
 
void setG (uint8_t value)
 
void setB (uint8_t value)
 
void setA (uint8_t value)
 
uint8_t r () const
 
uint8_t g () const
 
uint8_t b () const
 
uint8_t a () const
 
int32_t toRGB () const
 
int32_t toARGB () const
 
omw::string toString () const
 
omw::string toStringARGB () const
 
omw::string toCssStr () const
 
omw::Coloroperator+= (const omw::Color &operand)
 
Windows API Support
void from_win (uint32_t winCol)
 
uint32_t to_win () const
 
wxWidgets API Support
void from_wxW_RGB (uint32_t wxWCol)
 
void from_wxW_RGBA (uint32_t wxWCol)
 
uint32_t to_wxW () const
 
uint32_t to_wxW_RGB () const
 
uint32_t to_wxW_RGBA () const
 

Detailed Description

TODO: insert description.

A color object is considered valid when any value was set. Either with one of the set() or set..() functions or with one of the constructors. However the default constructor creates an invalid object.

Constructor & Destructor Documentation

◆ Color() [1/3]

omw::Color::Color ( int32_t  rgb)
Parameters
rgbInteger representation of the color

Format: 0x00RRGGBB

◆ Color() [2/3]

omw::Color::Color ( const std::string css)
Parameters
cssHex string

Format: "#RRGGBB" or "#RGB", with or without a leading #.

Exceptions

◆ Color() [3/3]

omw::Color::Color ( const char *  css)
Parameters
cssHex string

Format: "#RRGGBB" or "#RGB", with or without a leading #.

Exceptions

Member Function Documentation

◆ a()

uint8_t omw::Color::a ( ) const
Returns
The alpha value of the color

◆ b()

uint8_t omw::Color::b ( ) const
Returns
The blue value of the color

◆ clear()

void omw::Color::clear ( )

Sets R, G and B to 0, alpha to 0xFF and invalidates the object.

◆ from_win()

void omw::Color::from_win ( uint32_t  winCol)

◆ from_wxW_RGB()

void omw::Color::from_wxW_RGB ( uint32_t  wxWCol)

Format: 0xBBGGRR See wxColour Class Reference

◆ from_wxW_RGBA()

void omw::Color::from_wxW_RGBA ( uint32_t  wxWCol)

◆ g()

uint8_t omw::Color::g ( ) const
Returns
The green value of the color

◆ invalidate()

void omw::Color::invalidate ( )

Invalidates the object.

The color attributes keep their values.

◆ opaque()

void omw::Color::opaque ( )

Sets the alpha value to 0xFF. Does not change the validity.

◆ operator+=()

omw::Color & omw::Color::operator+= ( const omw::Color operand)
Parameters
operandA
Returns
*this

Calculates the alpha composit of A over B, where *this is B and the operand is A.

If one of the colors is invalid, the result is also invalid. However all color values are computed anyway.

◆ r()

uint8_t omw::Color::r ( ) const
Returns
The red value of the color

◆ set() [1/3]

void omw::Color::set ( const char *  css)
Parameters
cssHex string

Format: "#RRGGBB" or "#RGB", with or without a leading #.

Exceptions

◆ set() [2/3]

void omw::Color::set ( const std::string css)
Parameters
cssHex string

Format: "#RRGGBB" or "#RGB", with or without a leading #.

Exceptions

◆ set() [3/3]

void omw::Color::set ( int32_t  rgb)
Parameters
rgbInteger representation of the color

Format: 0x00RRGGBB

◆ setARGB()

void omw::Color::setARGB ( int32_t  argb)
Parameters
argbValue

Format: 0xAARRGGBB

◆ to_win()

uint32_t omw::Color::to_win ( ) const

◆ to_wxW()

uint32_t omw::Color::to_wxW ( ) const

Used to implicitly construct a wxColour object.

See also to_wxW_RGB().

◆ to_wxW_RGB()

uint32_t omw::Color::to_wxW_RGB ( ) const

Format: 0xBBGGRR

◆ to_wxW_RGBA()

uint32_t omw::Color::to_wxW_RGBA ( ) const

◆ toARGB()

int32_t omw::Color::toARGB ( ) const
Returns
An integer ARGB representation of the color

Format: 0xAARRGGBB

◆ toCssStr()

omw::string omw::Color::toCssStr ( ) const
Returns
A CSS string representation of the color

Format: "#RRGGBB"

◆ toRGB()

int32_t omw::Color::toRGB ( ) const
Returns
An integer RGB representation of the color

Format: 0x00RRGGBB

◆ toString()

omw::string omw::Color::toString ( ) const
Returns
A string representation of the color

Format: "RRGGBB"

◆ toStringARGB()

omw::string omw::Color::toStringARGB ( ) const
Returns
A string representation of the color

Format: "AARRGGBB"

◆ transparent()

void omw::Color::transparent ( )

Sets the alpha value to 0. Does not change the validity.

◆ validate()

void omw::Color::validate ( bool  state = true)
Parameters
stateValidity

Marks the object as valid or invalid. The color attributes keep their values.


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