Drag[en]gine Game Engine
1.21
|
4 Component Color. More...
#include <decColor.h>
Public Member Functions | |
Management | |
decColor | Normalized () const |
Normalized color with each component clamped to the range of 0 to 1. More... | |
void | Normalize () |
Normalize color. Each component is clamped to the range of 0 to 1. More... | |
decColor | Inverted () const |
Inverted color. Each component except alpha is 1-value. More... | |
void | Invert () |
Invert color. Each component except alpha is set to 1-value. More... | |
void | SetZero () |
Set red, green and blue to 0 and alpha to 1. More... | |
void | Set (float red, float green, float blue) |
Set values. More... | |
void | Set (float red, float green, float blue, float alpha) |
Sets values. More... | |
bool | IsEqualTo (const decColor &color, float threshold=COLOR_THRESHOLD) const |
Color is equal component wise to another color with respect to a threshold. More... | |
void | ToHSV (float &hue, float &saturation, float &value) const |
Convert to HSV. More... | |
void | ToHSL (float &hue, float &saturation, float &lightness) const |
Convert to HSL. More... | |
void | ToCMYK (float &cyan, float &magenta, float &yellow, float &black) const |
Convert to CMYK. More... | |
Operators | |
decColor & | operator= (const decColor &color) |
Copy color to this color. More... | |
decColor & | operator+= (const decColor &color) |
Add components of another color to this one. More... | |
decColor & | operator-= (const decColor &color) |
Subtract components of another color from this color. More... | |
decColor & | operator*= (float scalar) |
Multiply components of this color with a value k. More... | |
decColor & | operator*= (const decColor &color) |
Multiply components of this color component wise with another color. More... | |
decColor & | operator/= (float scalar) |
Divide components of this color by a scalar value. More... | |
decColor | operator+ (const decColor &color) const |
Color with the sum of this color with another one. More... | |
decColor | operator- (const decColor &color) const |
Color with the difference of this color to another one. More... | |
decColor | operator* (float scalar) const |
Color with this color scaled by a scalar. More... | |
decColor | operator* (const decColor &color) const |
Color with this color multiplied component wise with another one. More... | |
decColor | operator/ (float scalar) const |
Color with this color divided by a scalar. More... | |
Public Attributes | |
float | a |
Alpha Component of color. More... | |
float | b |
Blue Component of color. More... | |
float | g |
Green Component of color. More... | |
float | r |
Red Component of color. More... | |
Constructors and Destructors | |
decColor () | |
Create color initialized to (0,0,0,1). More... | |
decColor (float red, float green, float blue) | |
Create color with initial values. More... | |
decColor (float red, float green, float blue, float alpha) | |
Create color with the given values. More... | |
decColor (const decColor ©) | |
Creates copy of a color. More... | |
decColor (const decColor ©, float alpha) | |
Creates copy of a color with different alpha value. More... | |
static decColor | CreateHSV (float hue, float saturation, float value) |
Create color from HSV. More... | |
static decColor | CreateHSL (float hue, float saturation, float lightness) |
Create color from HSL. More... | |
static decColor | CreateCMYK (float cyan, float magenta, float yellow, float black) |
Create color from CMYK. More... | |
4 Component Color.
RGBA style color in decimal range. The value of 0 indicates no luminance in that color and 1 indicates full luminance. The color also contains an alpha component where 0 indicates completly transparent and 1 indicates completly opaque.
decColor::decColor | ( | ) |
Create color initialized to (0,0,0,1).
decColor::decColor | ( | float | red, |
float | green, | ||
float | blue | ||
) |
Create color with initial values.
decColor::decColor | ( | float | red, |
float | green, | ||
float | blue, | ||
float | alpha | ||
) |
Create color with the given values.
decColor::decColor | ( | const decColor & | copy | ) |
Creates copy of a color.
decColor::decColor | ( | const decColor & | copy, |
float | alpha | ||
) |
Creates copy of a color with different alpha value.
|
static |
Create color from CMYK.
[in] | cyan | Cyan in the range from 0 to 1. Value is clamped. |
[in] | magenta | Magenta in the range from 0 to 1. Value is clamped. |
[in] | yellow | Yellow in the range from 0 to 1. Value is clamped. |
[in] | black | Black in the range from 0 to 1. Value is clamped. |
|
static |
Create color from HSL.
[in] | hue | Hue in the range from 0 (0 degrees) to 1 (360 degrees). Values outside this range are normalized hence -0.2 is used as 0.8 for the calculation. |
[in] | saturation | Saturation in the range from 0 to 1. Value is clamped. |
[in] | lightness | Lightness in the range from 0 to 1. Value is clamped. |
|
static |
Create color from HSV.
[in] | hue | Hue in the range from 0 (0 degrees) to 1 (360 degrees). Values outside this range are normalized hence -0.2 is used as 0.8 for the calculation. |
[in] | saturation | Saturation in the range from 0 to 1. Value is clamped. |
[in] | value | Value in the range from 0 to 1. Value is clamped. |
void decColor::Invert | ( | ) |
Invert color. Each component except alpha is set to 1-value.
decColor decColor::Inverted | ( | ) | const |
Inverted color. Each component except alpha is 1-value.
bool decColor::IsEqualTo | ( | const decColor & | color, |
float | threshold = COLOR_THRESHOLD |
||
) | const |
Color is equal component wise to another color with respect to a threshold.
void decColor::Normalize | ( | ) |
Normalize color. Each component is clamped to the range of 0 to 1.
decColor decColor::Normalized | ( | ) | const |
Normalized color with each component clamped to the range of 0 to 1.
Color with this color multiplied component wise with another one.
decColor decColor::operator* | ( | float | scalar | ) | const |
Color with this color scaled by a scalar.
Multiply components of this color component wise with another color.
decColor& decColor::operator*= | ( | float | scalar | ) |
Multiply components of this color with a value k.
Color with the sum of this color with another one.
Add components of another color to this one.
Color with the difference of this color to another one.
Subtract components of another color from this color.
decColor decColor::operator/ | ( | float | scalar | ) | const |
Color with this color divided by a scalar.
deeDivisionByZero | Scalar is 0. |
decColor& decColor::operator/= | ( | float | scalar | ) |
Divide components of this color by a scalar value.
deeDivisionByZero | Scalar is 0. |
void decColor::Set | ( | float | red, |
float | green, | ||
float | blue | ||
) |
Set values.
void decColor::Set | ( | float | red, |
float | green, | ||
float | blue, | ||
float | alpha | ||
) |
Sets values.
void decColor::SetZero | ( | ) |
Set red, green and blue to 0 and alpha to 1.
void decColor::ToCMYK | ( | float & | cyan, |
float & | magenta, | ||
float & | yellow, | ||
float & | black | ||
) | const |
Convert to CMYK.
[out] | cyan | Cyan in the range from 0 to 1. |
[out] | magenta | Magenta in the range from 0 to 1. |
[out] | yellow | Yellow in the range from 0 to 1. |
[out] | black | Black in the range from 0 to 1. |
void decColor::ToHSL | ( | float & | hue, |
float & | saturation, | ||
float & | lightness | ||
) | const |
Convert to HSL.
[out] | hue | Hue in the range from 0 (0 degrees) to 1 (360 degrees). |
[out] | saturation | Saturation in the range from 0 to 1. |
[out] | lightness | Lightness in the range from 0 to 1. |
void decColor::ToHSV | ( | float & | hue, |
float & | saturation, | ||
float & | value | ||
) | const |
Convert to HSV.
[out] | hue | Hue in the range from 0 (0 degrees) to 1 (360 degrees). |
[out] | saturation | Saturation in the range from 0 to 1. |
[out] | value | Value in the range from 0 to 1. |
float decColor::a |
Alpha Component of color.
float decColor::b |
Blue Component of color.
float decColor::g |
Green Component of color.
float decColor::r |
Red Component of color.