Used to manage color data, independent of draw class/platform.
More...
#include <IGraphicsStructs.h>
|
| | IColor (int a=255, int r=0, int g=0, int b=0) |
| | Create an IColor from ARGB values. More...
|
| |
| bool | operator== (const IColor &rhs) |
| |
| bool | operator!= (const IColor &rhs) |
| |
| void | Set (int a=255, int r=0, int g=0, int b=0) |
| | Set the color parts. More...
|
| |
| bool | Empty () const |
| |
| void | Clamp () |
| | Keep the member int variables within the range 0-255. More...
|
| |
| void | Randomise (int alpha=255) |
| | Randomise the color parts, with optional alpha. More...
|
| |
| void | SetOpacity (float alpha) |
| | Set the color's opacity/alpha component with a float. More...
|
| |
| IColor | WithOpacity (float alpha) const |
| | Returns a new IColor with a different opacity. More...
|
| |
| void | Contrast (float c) |
| | Contrast the color. More...
|
| |
| IColor | WithContrast (float c) const |
| | Returns a new contrasted IColor based on this one. More...
|
| |
| void | GetRGBf (float *rgbf) const |
| | Get the color as a 3 float array. More...
|
| |
| void | GetRGBAf (float *rgbaf) const |
| | Get the color as a 4 float array. More...
|
| |
| void | GetHSLA (float &h, float &s, float &l, float &a) const |
| | Get the Hue, Saturation and Luminance of the color. More...
|
| |
| int | GetLuminosity () const |
| |
| int | ToColorCode () const |
| | Convert the IColor to a single int (no alpha) More...
|
| |
| void | ToColorCodeStr (WDL_String &str, bool withAlpha=true) const |
| | Convert the IColor to a hex string e.g. More...
|
| |
Used to manage color data, independent of draw class/platform.
Definition at line 222 of file IGraphicsStructs.h.
◆ IColor()
| IColor::IColor |
( |
int |
a = 255, |
|
|
int |
r = 0, |
|
|
int |
g = 0, |
|
|
int |
b = 0 |
|
) |
| |
|
inline |
Create an IColor from ARGB values.
- Parameters
-
| a | Alpha value (valid range 0-255) |
| r | Red value (valid range 0-255) |
| g | Green value (valid range 0-255) |
| b | Blue value (valid range 0-255) |
Definition at line 231 of file IGraphicsStructs.h.
◆ Clamp()
◆ Contrast()
| void IColor::Contrast |
( |
float |
c | ) |
|
|
inline |
◆ Empty()
| bool IColor::Empty |
( |
| ) |
const |
|
inline |
◆ FromColorCode()
| static IColor IColor::FromColorCode |
( |
int |
colorCode, |
|
|
int |
A = 0xFF |
|
) |
| |
|
inlinestatic |
Create an IColor from a color code.
Can be used to convert a hex code into an IColor object.
Used to manage color data, independent of draw class/platform.
static IColor FromColorCode(int colorCode, int A=0xFF)
Create an IColor from a color code.
- Parameters
-
| colorCode | Integer representation of the color. Use with hexadecimal numbers, e.g. 0xff38a2 |
| A | Integer representation of the alpha channel |
- Returns
- IColor A new IColor based on the color code provided
Definition at line 400 of file IGraphicsStructs.h.
Referenced by FromColorCodeStr().
◆ FromColorCodeStr()
| static IColor IColor::FromColorCodeStr |
( |
const char * |
hexStr | ) |
|
|
inlinestatic |
Create an IColor from a color code in a CString.
Can be used to convert a hex code into an IColor object.
- Parameters
-
| hexStr | CString representation of the color code (no alpha). Use with hex numbers, e.g. "#ff38a2". WARNING: This does very little error checking |
- Returns
- IColor A new IColor based on the color code provided
Definition at line 412 of file IGraphicsStructs.h.
References FromColorCode().
◆ FromHSLA()
| static IColor IColor::FromHSLA |
( |
float |
h, |
|
|
float |
s, |
|
|
float |
l, |
|
|
float |
a = 1.f |
|
) |
| |
|
inlinestatic |
◆ FromRGBAf()
| static IColor IColor::FromRGBAf |
( |
float * |
rgbaf | ) |
|
|
inlinestatic |
◆ FromRGBf()
| static IColor IColor::FromRGBf |
( |
float * |
rgbf | ) |
|
|
inlinestatic |
◆ GetHSLA()
| void IColor::GetHSLA |
( |
float & |
h, |
|
|
float & |
s, |
|
|
float & |
l, |
|
|
float & |
a |
|
) |
| const |
|
inline |
Get the Hue, Saturation and Luminance of the color.
- Parameters
-
| h | hue value to set, output in the range 0. to 1. |
| s | saturation value to set, output in the range 0. to 1. |
| l | luminance value to set, output in the range 0. to 1. |
| a | alpha value to set, output in the range 0. to 1. |
Definition at line 314 of file IGraphicsStructs.h.
◆ GetLuminosity()
| int IColor::GetLuminosity |
( |
| ) |
const |
|
inline |
◆ GetRandomColor()
| static IColor IColor::GetRandomColor |
( |
bool |
randomAlpha = false | ) |
|
|
inlinestatic |
◆ GetRGBAf()
| void IColor::GetRGBAf |
( |
float * |
rgbaf | ) |
const |
|
inline |
Get the color as a 4 float array.
- Parameters
-
| rgbaf | ptr to array of 4 floats |
Definition at line 301 of file IGraphicsStructs.h.
◆ GetRGBf()
| void IColor::GetRGBf |
( |
float * |
rgbf | ) |
const |
|
inline |
Get the color as a 3 float array.
- Parameters
-
| rgbf | ptr to array of 3 floats |
Definition at line 292 of file IGraphicsStructs.h.
◆ LinearInterpolateBetween()
| static IColor IColor::LinearInterpolateBetween |
( |
const IColor & |
start, |
|
|
const IColor & |
dest, |
|
|
float |
progress |
|
) |
| |
|
inlinestatic |
Helper function to linear interpolate between two IColors.
- Parameters
-
| start | Start IColor |
| dest | End IColor |
| progress | The normalized interpolation point |
Definition at line 482 of file IGraphicsStructs.h.
◆ operator!=()
| bool IColor::operator!= |
( |
const IColor & |
rhs | ) |
|
|
inline |
◆ operator==()
| bool IColor::operator== |
( |
const IColor & |
rhs | ) |
|
|
inline |
◆ Randomise()
| void IColor::Randomise |
( |
int |
alpha = 255 | ) |
|
|
inline |
Randomise the color parts, with optional alpha.
- Parameters
-
| alpha | Set the alpha of the new random color |
Definition at line 251 of file IGraphicsStructs.h.
◆ Set()
| void IColor::Set |
( |
int |
a = 255, |
|
|
int |
r = 0, |
|
|
int |
g = 0, |
|
|
int |
b = 0 |
|
) |
| |
|
inline |
Set the color parts.
- Parameters
-
| a | Alpha value (valid range 0-255) |
| r | Red value (valid range 0-255) |
| g | Green value (valid range 0-255) |
| b | Blue value (valid range 0-255) |
Definition at line 241 of file IGraphicsStructs.h.
◆ SetOpacity()
| void IColor::SetOpacity |
( |
float |
alpha | ) |
|
|
inline |
◆ ToColorCode()
| int IColor::ToColorCode |
( |
| ) |
const |
|
inline |
◆ ToColorCodeStr()
| void IColor::ToColorCodeStr |
( |
WDL_String & |
str, |
|
|
bool |
withAlpha = true |
|
) |
| const |
|
inline |
◆ WithContrast()
| IColor IColor::WithContrast |
( |
float |
c | ) |
const |
|
inline |
◆ WithOpacity()
| IColor IColor::WithOpacity |
( |
float |
alpha | ) |
const |
|
inline |
The documentation for this struct was generated from the following file: