Color4< T > Class Template Reference
Detailed Description
template<typename T>
class cy::Color4< T >
class cy::Color4< T >
RGBA color class with 4 components.
#include <cyColor.h>
Public Member Functions | |
Constructors | |
| Color4 (T _r, T _g, T _b, T _a=1) | |
| Color4 (T const *c) | |
| Color4 (T rgb, T _a=1) | |
| Color4 (Color3< T > const &c, T _a=1) | |
| Color4 (Color24 const &c, T _a=1) | |
| Color4 (Color32 const &c) | |
| template<typename S > | |
| Color4 (Color3< S > const &c, T _a=1) | |
| template<typename S > | |
| Color4 (Color4< S > const &c) | |
Set & Get value methods | |
| void | SetBlack (T alpha=1) |
| Sets r, g, and b components as zero and a component as given. | |
| void | SetWhite (T alpha=1) |
| Sets r, g, and b components as one and a component as given. | |
| void | Set (T _r, T _g, T _b, T _a=1) |
| Sets r, g, b and a components as given. | |
| void | Set (T const *v) |
| Sets r, g, b and a components using the values in the given array. | |
| void | GetValue (T *v) const |
| Puts r, g, b and a 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 the r, g, and b components are exactly zero. | |
| bool | IsFinite () const |
| Returns true if all components are finite real numbers. | |
| Color4< T > | Linear2sRGB () const |
| Converts linear RGB to sRGB. | |
| Color4< 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)> | |
| Color4< 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 | |
| Color4< T > | operator- () const |
Binary operators | |
| Color4< T > | operator+ (Color4< T > const &c) const |
| Color4< T > | operator- (Color4< T > const &c) const |
| Color4< T > | operator* (Color4< T > const &c) const |
| Color4< T > | operator/ (Color4< T > const &c) const |
| Color4< T > | operator+ (T v) const |
| Color4< T > | operator- (T v) const |
| Color4< T > | operator* (T v) const |
| Color4< T > | operator/ (T v) const |
Assignment operators | |
| Color4< T > & | operator+= (Color4< T > const &c) |
| Color4< T > & | operator-= (Color4< T > const &c) |
| Color4< T > & | operator*= (Color4< T > const &c) |
| Color4< T > & | operator/= (Color4< T > const &c) |
| Color4< T > & | operator+= (T v) |
| Color4< T > & | operator-= (T v) |
| Color4< T > & | operator*= (T v) |
| Color4< T > & | operator/= (T v) |
Comparison operators | |
| bool | operator== (Color4< T > const &c) const |
| bool | operator!= (Color4< T > const &c) const |
| bool | operator< (Color4< T > const &c) const |
| bool | operator<= (Color4< T > const &c) const |
| bool | operator> (Color4< T > const &c) const |
| bool | operator>= (Color4< T > const &c) const |
Access operators | |
| T & | operator[] (int i) |
| T | operator[] (int i) const |
Static Public Member Functions | |
Static methods | |
| static Color4< T > | Black (T alpha=1) |
| Returns a black color. | |
| static Color4< T > | White (T alpha=1) |
| Returns a white color. | |
Public Attributes | |
Color components | |
| T | r |
| T | g |
| T | b |
| T | a |
Friends | |
| Color4< T > | operator+ (T v, Color4< T > const &c) |
| Addition with a constant. | |
| Color4< T > | operator- (T v, Color4< T > const &c) |
| Subtraction from a constant. | |
| Color4< T > | operator* (T v, Color4< T > const &c) |
| Multiplication with a constant. | |