omw
0.2.1-beta
|
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::Color & | operator+= (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 |
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.
omw::Color::Color | ( | int32_t | rgb | ) |
rgb | Integer representation of the color |
Format: 0x00RRGGBB
omw::Color::Color | ( | const std::string & | css | ) |
css | Hex string |
Format: "#RRGGBB"
or "#RGB"
, with or without a leading #
.
Exceptions
std::invalid_argument
if the string does not match the formatomw::hexstoi()
is called and may throw std::out_of_range
or std::invalid_argument
omw::Color::Color | ( | const char * | css | ) |
css | Hex string |
Format: "#RRGGBB"
or "#RGB"
, with or without a leading #
.
Exceptions
std::invalid_argument
if the string does not match the formatomw::hexstoi()
is called and may throw std::out_of_range
or std::invalid_argument
uint8_t omw::Color::a | ( | ) | const |
uint8_t omw::Color::b | ( | ) | const |
void omw::Color::clear | ( | ) |
Sets R, G and B to 0, alpha to 0xFF and invalidates the object.
void omw::Color::from_win | ( | uint32_t | winCol | ) |
void omw::Color::from_wxW_RGB | ( | uint32_t | wxWCol | ) |
Format: 0xBBGGRR
See wxColour Class Reference
void omw::Color::from_wxW_RGBA | ( | uint32_t | wxWCol | ) |
uint8_t omw::Color::g | ( | ) | const |
void omw::Color::invalidate | ( | ) |
Invalidates the object.
The color attributes keep their values.
void omw::Color::opaque | ( | ) |
Sets the alpha value to 0xFF. Does not change the validity.
omw::Color & omw::Color::operator+= | ( | const omw::Color & | operand | ) |
operand | A |
*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.
uint8_t omw::Color::r | ( | ) | const |
void omw::Color::set | ( | const char * | css | ) |
css | Hex string |
Format: "#RRGGBB"
or "#RGB"
, with or without a leading #
.
Exceptions
std::invalid_argument
if the string does not match the formatomw::hexstoi()
is called and may throw std::out_of_range
or std::invalid_argument
void omw::Color::set | ( | const std::string & | css | ) |
css | Hex string |
Format: "#RRGGBB"
or "#RGB"
, with or without a leading #
.
Exceptions
std::invalid_argument
if the string does not match the formatomw::hexstoi()
is called and may throw std::out_of_range
or std::invalid_argument
void omw::Color::set | ( | int32_t | rgb | ) |
rgb | Integer representation of the color |
Format: 0x00RRGGBB
void omw::Color::setARGB | ( | int32_t | argb | ) |
argb | Value |
Format: 0xAARRGGBB
uint32_t omw::Color::to_win | ( | ) | const |
uint32_t omw::Color::to_wxW | ( | ) | const |
Used to implicitly construct a wxColour
object.
See also to_wxW_RGB().
uint32_t omw::Color::to_wxW_RGB | ( | ) | const |
Format: 0xBBGGRR
uint32_t omw::Color::to_wxW_RGBA | ( | ) | const |
int32_t omw::Color::toARGB | ( | ) | const |
Format: 0xAARRGGBB
omw::string omw::Color::toCssStr | ( | ) | const |
Format: "#RRGGBB"
int32_t omw::Color::toRGB | ( | ) | const |
Format: 0x00RRGGBB
omw::string omw::Color::toString | ( | ) | const |
Format: "RRGGBB"
omw::string omw::Color::toStringARGB | ( | ) | const |
Format: "AARRGGBB"
void omw::Color::transparent | ( | ) |
Sets the alpha value to 0. Does not change the validity.
void omw::Color::validate | ( | bool | state = true | ) |
state | Validity |
Marks the object as valid or invalid. The color attributes keep their values.