Color description class. More...
#include <color.h>
Inheritance diagram for clan::Color:Public Member Functions | |
| Color () | |
| Constructs a color. | |
| Color (const Colorf &) | |
| Color (const std::string &hexstr) | |
| Constructs a color. | |
| Color (unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha=255) | |
| Constructs a color. | |
| unsigned int | get_abgr8 () const |
| Returns the color in ABGR8888 format. | |
| unsigned char | get_alpha () const |
| Returns the alpha color component, in the range 0-255. | |
| float | get_alpha_f () const |
| Returns the alpha color component, in the range 0-1. | |
| unsigned int | get_argb8 () const |
| Returns the color in ARGB8888 format. | |
| unsigned int | get_bgr8 () const |
| Returns the color in 0BGR8888 format. | |
| unsigned int | get_bgra8 () const |
| Returns the color in BGRA8888 format. | |
| unsigned char | get_blue () const |
| Returns the blue color component, in the range 0-255. | |
| float | get_blue_f () const |
| Returns the blue color component, in the range 0-1. | |
| unsigned char | get_green () const |
| Returns the green color component, in the range 0-255. | |
| float | get_green_f () const |
| Returns the green color component, in the range 0-1. | |
| unsigned char | get_red () const |
| Returns the red color component, in the range 0-255. | |
| float | get_red_f () const |
| Returns the red color component, in the range 0-1. | |
| unsigned int | get_rgba8 () const |
| Returns the color in RGBA8888 format. | |
| bool | operator!= (const Color &c) const |
| Color != Color operator (deep compare) | |
| bool | operator== (const Color &c) const |
| Color == Color operator (deep compare) | |
| void | set_alpha (unsigned char value) |
| Set alpha color component, in the range 0-255. | |
| void | set_alpha_f (float value) |
| Set alpha color component, in the range 0-1. | |
| void | set_argb8 (unsigned int color) |
| Set color based on argb color components. | |
| void | set_bgra8 (unsigned int color) |
| Set color based on rgba color components. | |
| void | set_blue (unsigned char value) |
| Set blue color component, in the range 0-255. | |
| void | set_blue_f (float value) |
| Set blue color component, in the range 0-1. | |
| void | set_color (unsigned char new_red, unsigned char new_green, unsigned char new_blue, unsigned char new_alpha=255) |
| Set color based on rgba color components in the range 0-255. | |
| void | set_colorf (float new_red, float new_green, float new_blue, float new_alpha=1.0f) |
| Set color based on rgba color components in the range 0-1. | |
| void | set_green (unsigned char value) |
| Set green color component, in the range 0-255. | |
| void | set_green_f (float value) |
| Set green color component, in the range 0-1. | |
| void | set_red (unsigned char value) |
| Set red color component, in the range 0-255. | |
| void | set_red_f (float value) |
| Set red color component, in the range 0-1. | |
| void | set_rgb8 (unsigned int color) |
| Set color based on rgb color components. Alpha is set to 255. | |
| void | set_rgba8 (unsigned int color) |
| Set color based on rgba color components. | |
Public Member Functions inherited from clan::Vec4< Type > | |
| Vec4 () | |
| Vec4 (const Type &p1, const Type &p2, const Type &p3, const Type &p4) | |
| Vec4 (const Type &p1, const Type &p2, const Vec2< Type > ©34) | |
| Vec4 (const Type &scalar) | |
| Vec4 (const Type *array_xyzw) | |
| Vec4 (const Vec2< Type > ©, const Type &p3, const Type &p4) | |
| Vec4 (const Vec2< Type > ©, const Vec2< Type > ©34) | |
| Vec4 (const Vec3< Type > ©, const Type &p4) | |
| Angle | angle3 (const Vec4< Type > &vector) const |
| Calculate the angle between this vector and an other vector (not taking into account the w ordinate). | |
| Vec4< Type > & | cross3 (const Vec4< Type > &vector) |
| Calculate the cross product between this vector and an other vector (not taking into account the w ordinate). | |
| Type | distance3 (const Vec4< Type > &vector) const |
| Calculate the distance between this vector and an other vector (not taking into account the w ordinate). | |
| Type | distance4 (const Vec4< Type > &vector) const |
| Calculate the distance between this vector and an other vector (taking into account the w ordinate). | |
| Type | dot3 (const Vec4< Type > &vector) const |
| Dot products this vector with an other vector (not taking into account the w ordinate). | |
| Type | dot4 (const Vec4< Type > &vector) const |
| Dot products this vector with an other vector (taking into account the w ordinate). | |
| bool | is_equal (const Vec4< Type > &other, Type epsilon) const |
| Returns true if equal within the bounds of an epsilon. | |
| Type | length3 () const |
| Returns the length (magnitude) of this vector (not taking into account the w ordinate). | |
| double | length3 () const |
| float | length3 () const |
| Type | length4 () const |
| Returns the length (magnitude) of this vector (taking into account the w ordinate). | |
| double | length4 () const |
| float | length4 () const |
| Vec4< Type > & | normalize3 () |
| Normalizes this vector (not taking into account the w ordinate) | |
| Vec4< Type > & | normalize4 () |
| Normalizes this vector (taking into account the w ordinate) | |
| bool | operator!= (const Vec4< Type > &vector) const |
| != operator. | |
| void | operator*= (const Vec4< Type > &vector) |
| *= operator. | |
| void | operator*= (Type value) |
| *= operator. | |
| void | operator+= (const Vec4< Type > &vector) |
| += operator. | |
| void | operator+= (Type value) |
| += operator. | |
| Vec4< Type > | operator- () const |
| |
| void | operator-= (const Vec4< Type > &vector) |
| -= operator. | |
| void | operator-= (Type value) |
| -= operator. | |
| void | operator/= (const Vec4< Type > &vector) |
| /= operator. | |
| void | operator/= (Type value) |
| /= operator. | |
| bool | operator< (const Vec4< Type > &vector) const |
| < operator. | |
| Vec4< Type > & | operator= (const Vec4< Type > &vector) |
| = operator. | |
| bool | operator== (const Vec4< Type > &vector) const |
| == operator. | |
| Vec4< Type > & | rotate3 (const Angle &angle, const Vec4< Type > &axis) |
| Rotate this vector around an axis. Same as glRotate[f|d](angle, a);. | |
| Vec4< Type > & | round () |
| Rounds all components on this vector. | |
| void | set_xy (const Vec2< Type > &new_v) |
| void | set_zw (const Vec2< Type > &new_v) |
Additional Inherited Members | ||
Public Types inherited from clan::Vec4< Type > | ||
| typedef Type | datatype | |
Static Public Member Functions inherited from clan::Vec4< Type > | ||
| static Vec4< Type > | cross3 (const Vec4< Type > &vector1, const Vec4< Type > &vector2) | |
| Calculate the cross product between two vectors (not taking into account the w ordinate). | ||
| static Type | dot3 (const Vec4< Type > &vector1, const Vec4< Type > &vector2) | |
| Dot products between two vectors (not taking into account the w ordinate). | ||
| static Type | dot4 (const Vec4< Type > &vector1, const Vec4< Type > &vector2) | |
| Dot products between two vectors (taking into account the w ordinate). | ||
| static bool | is_equal (const Vec4< Type > &first, const Vec4< Type > &second, Type epsilon) | |
| Returns true if equal within the bounds of an epsilon. | ||
| static Vec4< Type > | normalize3 (const Vec4< Type > &vector) | |
| Normalizes a vector (not taking into account the w ordinate) | ||
| static Vec4< Type > | normalize4 (const Vec4< Type > &vector) | |
| Normalizes a vector (taking into account the w ordinate) | ||
| static Vec4< Type > | rotate3 (const Vec4< Type > &vector, const Angle &angle, const Vec4< Type > &axis) | |
| Rotate a vector around an axis. Same as glRotate[f|d](angle, a);. | ||
| static Vec4< Type > | round (const Vec4< Type > &vector) | |
| Rounds all components on a vector. | ||
Public Attributes inherited from clan::Vec4< Type > | ||
| union { | ||
| Type r | ||
| Type s | ||
| Type x | ||
| }; | ||
| union { | ||
| Type g | ||
| Type t | ||
| Type y | ||
| }; | ||
| union { | ||
| Type b | ||
| Type u | ||
| Type z | ||
| }; | ||
| union { | ||
| Type a | ||
| Type v | ||
| Type w | ||
| }; | ||
Color description class.
|
inline |
Constructs a color.
|
explicit |
|
inline |
Constructs a color.
Color components are specified in the range 0 to 255.
An alpha value of 0 means complete transparency, while 255 means completely opaque (solid).
| red | Red color component. |
| green | Green color component. |
| blue | Blue color component. |
| alpha | Alpha (transparency) color component. |
| clan::Color::Color | ( | const std::string & | hexstr | ) |
Constructs a color.
Color components are specified in the range 0 to 255.
An alpha value of 0 means complete transparency, while 255 means completely opaque (solid).
| hexstr | The colors rgba components as a hexadecimal string of the format "#rrggbbaa", where the '#' and "aa" parts are optional. |
|
inline |
Returns the color in ABGR8888 format.
References clan::Vec4< Type >::a, clan::Vec4< Type >::b, clan::Vec4< Type >::g, and clan::Vec4< Type >::r.
|
inline |
Returns the alpha color component, in the range 0-255.
References clan::Vec4< Type >::a.
|
inline |
Returns the alpha color component, in the range 0-1.
References clan::Vec4< Type >::a.
|
inline |
Returns the color in ARGB8888 format.
References clan::Vec4< Type >::a, clan::Vec4< Type >::b, clan::Vec4< Type >::g, and clan::Vec4< Type >::r.
|
inline |
Returns the color in 0BGR8888 format.
References clan::Vec4< Type >::b, clan::Vec4< Type >::g, and clan::Vec4< Type >::r.
|
inline |
Returns the color in BGRA8888 format.
References clan::Vec4< Type >::a, clan::Vec4< Type >::b, clan::Vec4< Type >::g, and clan::Vec4< Type >::r.
|
inline |
Returns the blue color component, in the range 0-255.
References clan::Vec4< Type >::b.
|
inline |
Returns the blue color component, in the range 0-1.
References clan::Vec4< Type >::b.
|
inline |
Returns the green color component, in the range 0-255.
References clan::Vec4< Type >::g.
|
inline |
Returns the green color component, in the range 0-1.
References clan::Vec4< Type >::g.
|
inline |
Returns the red color component, in the range 0-255.
References clan::Vec4< Type >::r.
|
inline |
Returns the red color component, in the range 0-1.
References clan::Vec4< Type >::r.
|
inline |
Returns the color in RGBA8888 format.
References clan::Vec4< Type >::a, clan::Vec4< Type >::b, clan::Vec4< Type >::g, and clan::Vec4< Type >::r.
|
inline |
Color != Color operator (deep compare)
References clan::Vec4< Type >::a, clan::Vec4< Type >::b, clan::c, clan::Vec4< Type >::g, and clan::Vec4< Type >::r.
|
inline |
Color == Color operator (deep compare)
References clan::Vec4< Type >::a, clan::Vec4< Type >::b, clan::c, clan::Vec4< Type >::g, and clan::Vec4< Type >::r.
|
inline |
Set alpha color component, in the range 0-255.
References clan::Vec4< Type >::a.
|
inline |
Set alpha color component, in the range 0-1.
References clan::Vec4< Type >::a.
| void clan::Color::set_argb8 | ( | unsigned int | color | ) |
Set color based on argb color components.
| void clan::Color::set_bgra8 | ( | unsigned int | color | ) |
Set color based on rgba color components.
|
inline |
Set blue color component, in the range 0-255.
References clan::Vec4< Type >::b.
|
inline |
Set blue color component, in the range 0-1.
References clan::Vec4< Type >::b.
|
inline |
Set color based on rgba color components in the range 0-255.
References clan::Vec4< Type >::a, clan::Vec4< Type >::b, clan::Vec4< Type >::g, and clan::Vec4< Type >::r.
|
inline |
Set color based on rgba color components in the range 0-1.
References clan::Vec4< Type >::a, clan::Vec4< Type >::b, clan::Vec4< Type >::g, and clan::Vec4< Type >::r.
|
inline |
Set green color component, in the range 0-255.
References clan::Vec4< Type >::g.
|
inline |
Set green color component, in the range 0-1.
References clan::Vec4< Type >::g.
|
inline |
Set red color component, in the range 0-255.
References clan::Vec4< Type >::r.
|
inline |
Set red color component, in the range 0-1.
References clan::Vec4< Type >::r.
| void clan::Color::set_rgb8 | ( | unsigned int | color | ) |
Set color based on rgb color components. Alpha is set to 255.
| void clan::Color::set_rgba8 | ( | unsigned int | color | ) |
Set color based on rgba color components.
|
static |
rgb(240, 248, 255).
|
static |
rgb(250, 235, 215).
|
static |
rgb( 0, 255, 255).
|
static |
rgb(127, 255, 212).
|
static |
rgb(240, 255, 255).
|
static |
rgb(245, 245, 220).
|
static |
rgb(255, 228, 196).
|
static |
rgb( 0, 0, 0).
|
static |
rgb(255, 235, 205).
|
static |
rgb( 0, 0, 255).
|
static |
rgb(138, 43, 226).
|
static |
rgb(165, 42, 42).
|
static |
rgb(222, 184, 135).
|
static |
rgb( 95, 158, 160).
|
static |
rgb(127, 255, 0).
|
static |
rgb(210, 105, 30).
|
static |
rgb(255, 127, 80).
|
static |
rgb(100, 149, 237).
|
static |
rgb(255, 248, 220).
|
static |
rgb(220, 20, 60).
|
static |
rgb( 0, 255, 255).
|
static |
rgb( 0, 0, 139).
|
static |
rgb( 0, 139, 139).
|
static |
rgb(184, 134, 11).
|
static |
rgb(169, 169, 169).
|
static |
rgb( 0, 100, 0).
|
static |
rgb(169, 169, 169).
|
static |
rgb(189, 183, 107).
|
static |
rgb(139, 0, 139).
|
static |
rgb( 85, 107, 47).
|
static |
rgb(255, 140, 0).
|
static |
rgb(153, 50, 204).
|
static |
rgb(139, 0, 0).
|
static |
rgb(233, 150, 122).
|
static |
rgb(143, 188, 143).
|
static |
rgb( 72, 61, 139).
|
static |
rgb( 47, 79, 79).
|
static |
rgb( 47, 79, 79).
|
static |
rgb( 0, 206, 209).
|
static |
rgb(148, 0, 211).
|
static |
rgb(255, 20, 147).
|
static |
rgb( 0, 191, 255).
|
static |
rgb(105, 105, 105).
|
static |
rgb(105, 105, 105).
|
static |
rgb( 30, 144, 255).
|
static |
rgb(178, 34, 34).
|
static |
rgb(255, 250, 240).
|
static |
rgb( 34, 139, 34).
|
static |
rgb(255, 0, 255).
|
static |
rgb(220, 220, 220).
|
static |
rgb(248, 248, 255).
|
static |
rgb(255, 215, 0).
|
static |
rgb(218, 165, 32).
|
static |
rgb(128, 128, 128).
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
rgb( 0, 128, 0).
|
static |
rgb(173, 255, 47).
|
static |
rgb(128, 128, 128).
|
static |
rgb(240, 255, 240).
|
static |
rgb(255, 105, 180).
|
static |
rgb(205, 92, 92).
|
static |
rgb( 75, 0, 130).
|
static |
rgb(255, 255, 240).
|
static |
rgb(240, 230, 140).
|
static |
rgb(230, 230, 250).
|
static |
rgb(255, 240, 245).
|
static |
rgb(124, 252, 0).
|
static |
rgb(255, 250, 205).
|
static |
rgb(173, 216, 230).
|
static |
rgb(240, 128, 128).
|
static |
rgb(224, 255, 255).
|
static |
rgb(250, 250, 210).
|
static |
rgb(211, 211, 211).
|
static |
rgb(144, 238, 144).
|
static |
rgb(211, 211, 211).
|
static |
rgb(255, 182, 193).
|
static |
rgb(255, 160, 122).
|
static |
rgb( 32, 178, 170).
|
static |
rgb(135, 206, 250).
|
static |
rgb(119, 136, 153).
|
static |
rgb(119, 136, 153).
|
static |
rgb(176, 196, 222).
|
static |
rgb(255, 255, 224).
|
static |
rgb( 0, 255, 0).
|
static |
rgb( 50, 205, 50).
|
static |
rgb(250, 240, 230).
|
static |
rgb(255, 0, 255).
|
static |
rgb(128, 0, 0).
|
static |
rgb(102, 205, 170).
|
static |
rgb( 0, 0, 205).
|
static |
rgb(186, 85, 211).
|
static |
rgb(147, 112, 219).
|
static |
rgb( 60, 179, 113).
|
static |
rgb(123, 104, 238).
|
static |
rgb( 0, 250, 154).
|
static |
rgb( 72, 209, 204).
|
static |
rgb(199, 21, 133).
|
static |
rgb( 25, 25, 112).
|
static |
rgb(245, 255, 250).
|
static |
rgb(255, 228, 225).
|
static |
rgb(255, 228, 181).
|
static |
rgb(255, 222, 173).
|
static |
rgb( 0, 0, 128).
|
static |
rgb(253, 245, 230).
|
static |
rgb(128, 128, 0).
|
static |
rgb(107, 142, 35).
|
static |
rgb(255, 165, 0).
|
static |
rgb(255, 69, 0).
|
static |
rgb(218, 112, 214).
|
static |
rgb(238, 232, 170).
|
static |
rgb(152, 251, 152).
|
static |
rgb(175, 238, 238).
|
static |
rgb(219, 112, 147).
|
static |
rgb(255, 239, 213).
|
static |
rgb(255, 218, 185).
|
static |
rgb(205, 133, 63).
|
static |
rgb(255, 192, 203).
|
static |
rgb(221, 160, 221).
|
static |
rgb(176, 224, 230).
|
static |
rgb(128, 0, 128).
|
static |
rgb(255, 0, 0).
|
static |
rgb(188, 143, 143).
|
static |
rgb( 65, 105, 225).
|
static |
rgb(139, 69, 19).
|
static |
rgb(250, 128, 114).
|
static |
rgb(244, 164, 96).
|
static |
rgb( 46, 139, 87).
|
static |
rgb(255, 245, 238).
|
static |
rgb(160, 82, 45).
|
static |
rgb(192, 192, 192).
|
static |
rgb(135, 206, 235).
|
static |
rgb(106, 90, 205).
|
static |
rgb(112, 128, 144).
|
static |
rgb(112, 128, 144).
|
static |
rgb(255, 250, 250).
|
static |
rgb( 0, 255, 127).
|
static |
rgb( 70, 130, 180).
|
static |
rgb(210, 180, 140).
|
static |
rgb( 0, 128, 128).
|
static |
rgb(216, 191, 216).
|
static |
rgb(255, 99, 71).
|
static |
rgba(0, 0, 0, 0).
|
static |
rgb( 64, 224, 208).
|
static |
rgb(238, 130, 238).
|
static |
rgb(245, 222, 179).
|
static |
rgb(255, 255, 255).
|
static |
rgb(245, 245, 245).
|
static |
rgb(255, 255, 0).
|
static |
rgb(154, 205, 50).