Thea
|
A color with three byte-sized channels: red, green and blue, each in [0, 255]. More...
#include <ColorRgb8.hpp>
Public Types | |
typedef uint8 | value_type |
The numerical type of each channel. More... | |
Public Member Functions | |
uint32 | asUInt32 () const |
Get the color packed into a 32-bit unsigned integer. More... | |
uint8 | b () const |
The value of the blue channel. More... | |
uint8 & | b () |
A reference to the blue channel. More... | |
ColorRgb8 | bgr () const |
Swap the red and blue channels. More... | |
ColorRgb8 () | |
Default constructor. More... | |
ColorRgb8 (uint8 r_, uint8 g_, uint8 b_) | |
Construct from red, green and blue components. More... | |
ColorRgb8 (uint8 v) | |
Initialize all channels to the same value. More... | |
ColorRgb8 (uint8 const *v) | |
Construct a color from three components in an array. More... | |
ColorRgb8 (ColorRgba const &other) | |
Initialize from a 32-bit RGBA color. More... | |
ColorRgb8 (ColorRgb const &src) | |
Construct from a color with floating-point channels, with automatic scaling from [0, 1] to [0, 255]. More... | |
uint8 const * | data () const |
Get the address of the array storing color channel values in RGB order. More... | |
uint8 * | data () |
Get the address of the array storing color channel values in RGB order. More... | |
void | fill (uint8 v) |
Set all channels to the same value. More... | |
uint8 | g () const |
The value of the green channel. More... | |
uint8 & | g () |
A reference to the green channel. More... | |
ColorRgb8 | max (ColorRgb8 const &rhs) const |
Get the per-component maximum of two colors. More... | |
uint8 | max () const |
Get the largest component. More... | |
ColorRgb8 | min (ColorRgb8 const &rhs) const |
Get the per-component minimum of two colors. More... | |
uint8 | min () const |
Get the smallest component. More... | |
ColorRgb8 | operator* (Real s) const |
Multiplication by a scalar. More... | |
ColorRgb8 & | operator*= (Real s) |
Multiply by a scalar and assign. More... | |
ColorRgb8 | operator+ (ColorRgb8 const &rhs) const |
Addition. More... | |
ColorRgb8 & | operator+= (ColorRgb8 const &rhs) |
Add and assign. More... | |
ColorRgb8 | operator- (ColorRgb8 const &rhs) const |
Subtraction. More... | |
ColorRgb8 & | operator-= (ColorRgb8 const &rhs) |
Subtract and assign. More... | |
ColorRgb8 | operator/ (Real s) const |
Division by a scalar. More... | |
ColorRgb8 & | operator/= (Real s) |
Divide by a scalar and assign. More... | |
template<typename IntegerT > | |
uint8 const & | operator[] (IntegerT channel) const |
Array-style channel access. More... | |
template<typename IntegerT > | |
uint8 & | operator[] (IntegerT channel) |
Array-style channel access. More... | |
uint8 | r () const |
The value of the red channel. More... | |
uint8 & | r () |
A reference to the red channel. More... | |
void | set (uint8 r_, uint8 g_, uint8 b_) |
Set all channels simultaneously. More... | |
std::string | toString () const |
Get a string representation of the color. More... | |
Static Public Member Functions | |
static ColorRgb8 | fromARGB (uint32 argb) |
Initialize from an HTML-style color (e.g. More... | |
A color with three byte-sized channels: red, green and blue, each in [0, 255].
Derived from the G3D library: http://g3d.sourceforge.net
Definition at line 47 of file ColorRgb8.hpp.
typedef uint8 value_type |
The numerical type of each channel.
Definition at line 53 of file ColorRgb8.hpp.
ColorRgb8 | ( | ) |
ColorRgb8 | ( | uint8 | r_, |
uint8 | g_, | ||
uint8 | b_ | ||
) |
Construct from red, green and blue components.
Definition at line 59 of file ColorRgb8.hpp.
|
explicit |
Initialize all channels to the same value.
Definition at line 62 of file ColorRgb8.hpp.
|
explicit |
Construct a color from three components in an array.
Definition at line 65 of file ColorRgb8.hpp.
Initialize from a 32-bit RGBA color.
For conversion from a consistent source type.
Definition at line 40 of file ColorRgb8.cpp.
Construct from a color with floating-point channels, with automatic scaling from [0, 1] to [0, 255].
Definition at line 33 of file ColorRgb8.cpp.
uint32 asUInt32 | ( | ) | const |
Get the color packed into a 32-bit unsigned integer.
The most significant byte is 0xFF, the next byte is red, then green, then blue. Note that the actual memory ordering of the bytes depends upon the endianness of the system.
Definition at line 219 of file ColorRgb8.hpp.
uint8 b | ( | ) | const |
The value of the blue channel.
Definition at line 89 of file ColorRgb8.hpp.
uint8& b | ( | ) |
A reference to the blue channel.
Definition at line 92 of file ColorRgb8.hpp.
ColorRgb8 bgr | ( | ) | const |
Swap the red and blue channels.
Definition at line 210 of file ColorRgb8.hpp.
uint8 const* data | ( | ) | const |
Get the address of the array storing color channel values in RGB order.
Definition at line 95 of file ColorRgb8.hpp.
uint8* data | ( | ) |
Get the address of the array storing color channel values in RGB order.
Definition at line 98 of file ColorRgb8.hpp.
void fill | ( | uint8 | v | ) |
Set all channels to the same value.
Definition at line 123 of file ColorRgb8.hpp.
|
static |
Initialize from an HTML-style color (e.g.
0xFF0000 == RED)
Definition at line 46 of file ColorRgb8.cpp.
uint8 g | ( | ) | const |
The value of the green channel.
Definition at line 83 of file ColorRgb8.hpp.
uint8& g | ( | ) |
A reference to the green channel.
Definition at line 86 of file ColorRgb8.hpp.
Get the per-component maximum of two colors.
Definition at line 186 of file ColorRgb8.hpp.
uint8 max | ( | ) | const |
Get the largest component.
Definition at line 198 of file ColorRgb8.hpp.
Get the per-component minimum of two colors.
Definition at line 192 of file ColorRgb8.hpp.
uint8 min | ( | ) | const |
Get the smallest component.
Definition at line 204 of file ColorRgb8.hpp.
ColorRgb8 operator* | ( | Real | s | ) | const |
Multiplication by a scalar.
Channels are rounded to the nearest byte values.
Definition at line 142 of file ColorRgb8.hpp.
ColorRgb8& operator*= | ( | Real | s | ) |
Multiply by a scalar and assign.
Channels are rounded to the nearest byte values.
Definition at line 172 of file ColorRgb8.hpp.
ColorRgb8 operator/ | ( | Real | s | ) | const |
Division by a scalar.
Channels are rounded to the nearest byte values.
Definition at line 150 of file ColorRgb8.hpp.
ColorRgb8& operator/= | ( | Real | s | ) |
Divide by a scalar and assign.
Channels are rounded to the nearest byte values.
Definition at line 179 of file ColorRgb8.hpp.
uint8 const& operator[] | ( | IntegerT | channel | ) | const |
Array-style channel access.
Definition at line 101 of file ColorRgb8.hpp.
uint8& operator[] | ( | IntegerT | channel | ) |
Array-style channel access.
Definition at line 108 of file ColorRgb8.hpp.
uint8 r | ( | ) | const |
The value of the red channel.
Definition at line 77 of file ColorRgb8.hpp.
uint8& r | ( | ) |
A reference to the red channel.
Definition at line 80 of file ColorRgb8.hpp.
void set | ( | uint8 | r_, |
uint8 | g_, | ||
uint8 | b_ | ||
) |
Set all channels simultaneously.
Definition at line 115 of file ColorRgb8.hpp.
std::string toString | ( | ) | const |
Get a string representation of the color.
Definition at line 54 of file ColorRgb8.cpp.