Color3< T > Class Template Reference
Detailed Description
template<typename T>
class cy::Color3< T >
class cy::Color3< T >
RGB color class with 3 components.
#include <cyColor.h>
Public Member Functions | |
Constructors | |
| Color3 (T _r, T _g, T _b) | |
| Color3 (T const *c) | |
| Color3 (T rgb) | |
| Color3 (Color4< T > const &c) | |
| Color3 (Color24 const &c) | |
| Color3 (Color32 const &c) | |
| template<typename S > | |
| Color3 (Color3< S > const &c) | |
| template<typename S > | |
| Color3 (Color4< S > const &c) | |
Set & Get value methods | |
| void | SetBlack () |
| Sets r, g and b components as zero. | |
| void | SetWhite () |
| Sets r, g and b components as one. | |
| void | Set (T _r, T _g, T _b) |
| Sets r, g and b components as given. | |
| void | Set (T const *v) |
| Sets r, g and b components using the values in the given array. | |
| void | GetValue (T *v) const |
| Puts r, g and b values into the array. | |
Gray-scale methods | |
| T | Sum () const |
| T | Gray () const |
| T | Luma1 () const |
| T | Luma2 () const |
| T | Min () const |
| T | Max () const |
General methods | |
| bool | IsNegative () const |
| Returns true if any component is negative. | |
| bool | IsBlack () const |
| Returns true if all components are exactly zero. | |
| bool | IsFinite () const |
| Returns true if all components are finite real numbers. | |
| Color3< T > | Linear2sRGB () const |
| Converts linear RGB to sRGB. | |
| Color3< T > | sRGB2Linear () const |
| Converts sRGB to linear RGB. | |
Generic template methods | |
| template<typename F = T(*)(T)> | |
| void | Apply (F func) |
| Applies the given function to all color components. | |
| template<typename F = T(*)(T)> | |
| Color3< T > | GetApplied (F func) const |
| Returns the resulting color after applying the given function to all color components. | |
Limit methods | |
| void | Clamp (T limitMin=0, T limitMax=1) |
| void | ClampMin (T limitMin=0) |
| void | ClampMax (T limitMax=1) |
| void | Abs () |
Unary operators | |
| Color3< T > | operator- () const |
Binary operators | |
| Color3< T > | operator+ (Color3< T > const &c) const |
| Color3< T > | operator- (Color3< T > const &c) const |
| Color3< T > | operator* (Color3< T > const &c) const |
| Color3< T > | operator/ (Color3< T > const &c) const |
| Color3< T > | operator+ (T v) const |
| Color3< T > | operator- (T v) const |
| Color3< T > | operator* (T v) const |
| Color3< T > | operator/ (T v) const |
Assignment operators | |
| Color3< T > & | operator+= (Color3< T > const &c) |
| Color3< T > & | operator-= (Color3< T > const &c) |
| Color3< T > & | operator*= (Color3< T > const &c) |
| Color3< T > & | operator/= (Color3< T > const &c) |
| Color3< T > & | operator+= (T v) |
| Color3< T > & | operator-= (T v) |
| Color3< T > & | operator*= (T v) |
| Color3< T > & | operator/= (T v) |
Comparison operators | |
| bool | operator== (Color3< T > const &c) const |
| bool | operator!= (Color3< T > const &c) const |
| bool | operator< (Color3< T > const &c) const |
| bool | operator<= (Color3< T > const &c) const |
| bool | operator> (Color3< T > const &c) const |
| bool | operator>= (Color3< T > const &c) const |
Access operators | |
| T & | operator[] (int i) |
| T | operator[] (int i) const |
Static Public Member Functions | |
Static methods | |
| static Color3< T > | Black () |
| Returns a black color. | |
| static Color3< T > | White () |
| Returns a white color. | |
Public Attributes | |
Color components | |
| T | r |
| T | g |
| T | b |
Friends | |
| Color3< T > | operator+ (T v, Color3< T > const &c) |
| Addition with a constant. | |
| Color3< T > | operator- (T v, Color3< T > const &c) |
| Subtraction from a constant. | |
| Color3< T > | operator* (T v, Color3< T > const &c) |
| Multiplication with a constant. | |