Class representing a 32 bit ARGB color. More...
#include <SColor.h>
Public Member Functions | |
SColor () | |
Constructor of the Color. Does nothing. More... | |
SColor (u32 a, u32 r, u32 g, u32 b) | |
Constructs the color from 4 values representing the alpha, red, green and blue component. More... | |
SColor (u32 clr) | |
Constructs the color from a 32 bit value. Could be another color. More... | |
u32 | getAlpha () const |
Returns the alpha component of the color. More... | |
u32 | getAverage () const |
Get average intensity of the color in the range [0,255]. More... | |
u32 | getBlue () const |
Returns the blue component of the color. More... | |
void | getData (void *data, ECOLOR_FORMAT format) |
Write the color to data in the defined format. More... | |
u32 | getGreen () const |
Returns the green component of the color. More... | |
SColor | getInterpolated (const SColor &other, f32 d) const |
Interpolates the color with a f32 value to another color. More... | |
SColor | getInterpolated_quadratic (const SColor &c1, const SColor &c2, f32 d) const |
Returns interpolated color. ( quadratic ) More... | |
f32 | getLightness () const |
Get lightness of the color in the range [0,255]. More... | |
f32 | getLuminance () const |
Get luminance of the color in the range [0,255]. More... | |
u32 | getRed () const |
Returns the red component of the color. More... | |
bool | operator!= (const SColor &other) const |
Compares the color to another color. More... | |
SColor | operator+ (const SColor &other) const |
Adds two colors, result is clamped to 0..255 values. More... | |
bool | operator< (const SColor &other) const |
comparison operator More... | |
bool | operator== (const SColor &other) const |
Compares the color to another color. More... | |
void | set (u32 a, u32 r, u32 g, u32 b) |
Sets all four components of the color at once. More... | |
void | set (u32 col) |
void | setAlpha (u32 a) |
Sets the alpha component of the Color. More... | |
void | setBlue (u32 b) |
Sets the blue component of the Color. More... | |
void | setData (const void *data, ECOLOR_FORMAT format) |
set the color by expecting data in the given format More... | |
void | setGreen (u32 g) |
Sets the green component of the Color. More... | |
void | setRed (u32 r) |
Sets the red component of the Color. More... | |
u16 | toA1R5G5B5 () const |
Calculates a 16 bit A1R5G5B5 value of this color. More... | |
void | toOpenGLColor (u8 *dest) const |
Converts color to OpenGL color format. More... | |
Public Attributes | |
u32 | color |
color in A8R8G8B8 Format More... | |
Class representing a 32 bit ARGB color.
The color values for alpha, red, green, and blue are stored in a single u32. So all four values may be between 0 and 255. Alpha in Irrlicht is opacity, so 0 is fully transparent, 255 is fully opaque (solid). This class is used by most parts of the Irrlicht Engine to specify a color. Another way is using the class SColorf, which stores the color values in 4 floats. This class must consist of only one u32 and must not use virtual functions.
|
inline |
Constructor of the Color. Does nothing.
The color value is not initialized to save time.
Definition at line 207 of file SColor.h.
Referenced by getInterpolated(), getInterpolated_quadratic(), operator+(), and irr::video::SColorf::toSColor().
|
inline |
|
inline |
Returns the alpha component of the color.
The alpha component defines how opaque a color is.
Definition at line 221 of file SColor.h.
References color.
Referenced by getInterpolated(), getInterpolated_quadratic(), operator+(), irr::video::SColorf::SColorf(), and toOpenGLColor().
|
inline |
Get average intensity of the color in the range [0,255].
Definition at line 251 of file SColor.h.
References getBlue(), getGreen(), and getRed().
Referenced by irr::scene::SVertexColorThresholdManipulator::operator()(), and irr::scene::SVertexColorDesaturateToAverageManipulator::operator()().
|
inline |
Returns the blue component of the color.
Definition at line 236 of file SColor.h.
References color.
Referenced by getAverage(), getData(), getInterpolated(), getInterpolated_quadratic(), getLightness(), getLuminance(), irr::scene::SVertexColorInvertManipulator::operator()(), irr::scene::SVertexColorBrightnessManipulator::operator()(), irr::scene::SVertexColorContrastManipulator::operator()(), irr::scene::SVertexColorContrastBrightnessManipulator::operator()(), irr::scene::SVertexColorGammaManipulator::operator()(), irr::scene::SVertexColorScaleManipulator::operator()(), operator+(), irr::video::SColorf::SColorf(), and toOpenGLColor().
|
inline |
Write the color to data in the defined format.
data | target to write the color. Must contain sufficiently large memory to receive the number of bytes neede for format |
format | tells the format used to write the color into data |
Definition at line 407 of file SColor.h.
References irr::video::A8R8G8B8toA1R5G5B5(), irr::video::A8R8G8B8toR5G6B5(), color, irr::video::ECF_A1R5G5B5, irr::video::ECF_A8R8G8B8, irr::video::ECF_R5G6B5, irr::video::ECF_R8G8B8, getBlue(), getGreen(), and getRed().
|
inline |
Returns the green component of the color.
Definition at line 231 of file SColor.h.
References color.
Referenced by getAverage(), getData(), getInterpolated(), getInterpolated_quadratic(), getLightness(), getLuminance(), irr::scene::SVertexColorInvertManipulator::operator()(), irr::scene::SVertexColorBrightnessManipulator::operator()(), irr::scene::SVertexColorContrastManipulator::operator()(), irr::scene::SVertexColorContrastBrightnessManipulator::operator()(), irr::scene::SVertexColorGammaManipulator::operator()(), irr::scene::SVertexColorScaleManipulator::operator()(), operator+(), irr::video::SColorf::SColorf(), and toOpenGLColor().
Interpolates the color with a f32 value to another color.
other | Other color |
d | value between 0.0f and 1.0f |
Definition at line 340 of file SColor.h.
References irr::core::clamp(), getAlpha(), getBlue(), getGreen(), getRed(), irr::core::round32(), and SColor().
Referenced by irr::video::S3DVertex::getInterpolated(), irr::video::S3DVertex2TCoords::getInterpolated(), irr::video::S3DVertexTangents::getInterpolated(), and irr::scene::SVertexColorInterpolateLinearManipulator::operator()().
|
inline |
Returns interpolated color. ( quadratic )
c1 | first color to interpolate with |
c2 | second color to interpolate with |
d | value between 0.0f and 1.0f. |
Definition at line 354 of file SColor.h.
References irr::core::clamp(), irr::core::floor32(), getAlpha(), getBlue(), getGreen(), getRed(), and SColor().
Referenced by irr::scene::SVertexColorInterpolateQuadraticManipulator::operator()().
|
inline |
Get lightness of the color in the range [0,255].
Definition at line 239 of file SColor.h.
References getBlue(), getGreen(), getRed(), irr::core::max_(), and irr::core::min_().
Referenced by irr::scene::SVertexColorDesaturateToLightnessManipulator::operator()().
|
inline |
Get luminance of the color in the range [0,255].
Definition at line 245 of file SColor.h.
References getBlue(), getGreen(), and getRed().
Referenced by irr::scene::SVertexColorDesaturateToLuminanceManipulator::operator()().
|
inline |
Returns the red component of the color.
Definition at line 226 of file SColor.h.
References color.
Referenced by getAverage(), getData(), getInterpolated(), getInterpolated_quadratic(), getLightness(), getLuminance(), irr::scene::SVertexColorInvertManipulator::operator()(), irr::scene::SVertexColorBrightnessManipulator::operator()(), irr::scene::SVertexColorContrastManipulator::operator()(), irr::scene::SVertexColorContrastBrightnessManipulator::operator()(), irr::scene::SVertexColorGammaManipulator::operator()(), irr::scene::SVertexColorScaleManipulator::operator()(), operator+(), irr::video::SColorf::SColorf(), and toOpenGLColor().
|
inline |
Adds two colors, result is clamped to 0..255 values.
other | Color to add to this color |
Definition at line 328 of file SColor.h.
References getAlpha(), getBlue(), getGreen(), getRed(), irr::core::min_(), and SColor().
|
inline |
|
inline |
Sets all four components of the color at once.
Constructs the color from 4 values representing the alpha, red, green and blue components of the color. Must be values between 0 and 255.
a | Alpha component of the color. The alpha component defines how transparent a color should be. Has to be a value between 0 and 255. 255 means not transparent (opaque), 0 means fully transparent. |
r | Sets the red component of the Color. Has to be a value between 0 and 255. 0 means no red, 255 means full red. |
g | Sets the green component of the Color. Has to be a value between 0 and 255. 0 means no green, 255 means full green. |
b | Sets the blue component of the Color. Has to be a value between 0 and 255. 0 means no blue, 255 means full blue. |
Definition at line 307 of file SColor.h.
References color.
|
inline |
|
inline |
Sets the alpha component of the Color.
The alpha component defines how transparent a color should be.
a | The alpha value of the color. 0 is fully transparent, 255 is fully opaque. |
Definition at line 259 of file SColor.h.
References color.
Referenced by irr::scene::SVertexColorSetAlphaManipulator::operator()().
|
inline |
Sets the blue component of the Color.
b | Has to be a value between 0 and 255. 0 means no blue, 255 means full blue. |
Definition at line 274 of file SColor.h.
References color.
Referenced by irr::scene::SVertexColorInvertManipulator::operator()(), irr::scene::SVertexColorBrightnessManipulator::operator()(), irr::scene::SVertexColorContrastManipulator::operator()(), irr::scene::SVertexColorContrastBrightnessManipulator::operator()(), irr::scene::SVertexColorGammaManipulator::operator()(), and irr::scene::SVertexColorScaleManipulator::operator()().
|
inline |
set the color by expecting data in the given format
data | must point to valid memory containing color information in the given format |
format | tells the format in which data is available |
Definition at line 378 of file SColor.h.
References irr::video::A1R5G5B5toA8R8G8B8(), color, irr::video::ECF_A1R5G5B5, irr::video::ECF_A8R8G8B8, irr::video::ECF_R5G6B5, irr::video::ECF_R8G8B8, and irr::video::R5G6B5toA8R8G8B8().
|
inline |
Sets the green component of the Color.
g | Has to be a value between 0 and 255. 0 means no green, 255 means full green. |
Definition at line 269 of file SColor.h.
References color.
Referenced by irr::scene::SVertexColorInvertManipulator::operator()(), irr::scene::SVertexColorBrightnessManipulator::operator()(), irr::scene::SVertexColorContrastManipulator::operator()(), irr::scene::SVertexColorContrastBrightnessManipulator::operator()(), irr::scene::SVertexColorGammaManipulator::operator()(), and irr::scene::SVertexColorScaleManipulator::operator()().
|
inline |
Sets the red component of the Color.
r | Has to be a value between 0 and 255. 0 means no red, 255 means full red. |
Definition at line 264 of file SColor.h.
References color.
Referenced by irr::scene::SVertexColorInvertManipulator::operator()(), irr::scene::SVertexColorBrightnessManipulator::operator()(), irr::scene::SVertexColorContrastManipulator::operator()(), irr::scene::SVertexColorContrastBrightnessManipulator::operator()(), irr::scene::SVertexColorGammaManipulator::operator()(), and irr::scene::SVertexColorScaleManipulator::operator()().
|
inline |
Calculates a 16 bit A1R5G5B5 value of this color.
Definition at line 278 of file SColor.h.
References irr::video::A8R8G8B8toA1R5G5B5(), and color.
|
inline |
Converts color to OpenGL color format.
From ARGB to RGBA in 4 byte components for endian aware passing to OpenGL
dest | address where the 4x8 bit OpenGL color is stored. |
Definition at line 284 of file SColor.h.
References getAlpha(), getBlue(), getGreen(), and getRed().
u32 irr::video::SColor::color |
color in A8R8G8B8 Format
Definition at line 447 of file SColor.h.
Referenced by getAlpha(), getBlue(), getData(), getGreen(), getRed(), operator!=(), operator<(), operator==(), irr::video::SColorHSL::SColorHSL(), set(), setAlpha(), setBlue(), setData(), setGreen(), setRed(), and toA1R5G5B5().