VEE_Rgba Class Reference
Simple floating point RGBA color class.
More...
#include <vee_color.h>
Collaboration diagram for VEE_Rgba:
[legend]List of all members.Public Member Functions
- VEE_Rgba ()
- Empty constructor (does not initialize any values).
- VEE_Rgba (float r, float g, float b, float a=1.0, float t=0.5)
- ~VEE_Rgba ()
- void set (float r, float g, float b, float a=1.0, float t=0.5)
- template<class S> void copy (const S *c, int n)
- float red () const
- float green () const
- float blue () const
- float alpha () const
- float theta () const
- unsigned getARGB () const
- Returns the color coded into a 32-bit integer.
- void setRed (float r)
- void setGreen (float g)
- void setBlue (float b)
- void setAlpha (float a)
- void setTheta (float t)
- float * data ()
- Returns pointer to the data area.
- const float * data () const
- void clampNth (unsigned index, float minVal, float maxVal)
- Limit the nth componeent to soecified range.
- void clampRgb (float minVal, float maxVal)
- Clamp (limit) the RGB -components to a given range.
- void clampRgba (float minVal, float maxVal)
- Clamp (limit) the RGB and A -components to a given range.
- VEE_Rgba farColor () const
- Calculates a color that is as far as possible from the original in the RGB cube.
- void normalize ()
- Normalize all components between zero and one.
- VEE_Rgba mulRgba (float mul) const
- Multiplication operator.
- VEE_Rgba mulRgb (float mul) const
- Multiplication operator.
- VEE_Rgba addRgba (const VEE_Rgba &rgb) const
- VEE_Rgba operator * (float mul) const
- Multiplication operator.
- VEE_Rgba operator+ (const VEE_Rgba &rgb) const
- Addition operator.
- VEE_Rgba operator- (const VEE_Rgba &rgb) const
- Subtraction operator.
- float & operator[] (int n)
- const float & operator[] (int n) const
Static Public Attributes
Protected Attributes
Detailed Description
Simple floating point RGBA color class.
The color is defined by five variables:
-
Red
-
Green
-
Blue
-
Alpha
-
Theta
All the components can have any values. Note that for most of the existing displays the only range 0.0-1.0 is useful.
A couple of example colors:
-
Solid black = 0 0 0 1 0
-
Additive solid white = 1 1 1 1 1
-
Covering Solid white = 1 1 1 1 0
-
Half-opaque additive white = 1 1 1 0.5 1
-
Half-opaque covering white = 1 1 1 0.5 0
-
Half-opaque additive gray = 0.5 0.5 0.5 0.5 1.0
-
Half-opaque covering gray = 0.5 0.5 0.5 0.5 0.0
-
Half-opaque half-covering gray = 0.5 0.5 0.5 0.5 0.5
Note: Alpha-blending is always a tricky question. There are many different possibilities for alpha-blending. The exact blending mode you are after may be something that this class does not provide. So, if you use alpha-blending, be more careful with your operations -- especially operators.
- Author:
- Tommi Ilmonen
Constructor & Destructor Documentation
VEE_Rgba::VEE_Rgba |
( |
|
) |
[inline] |
|
|
Empty constructor (does not initialize any values).
|
VEE_Rgba::VEE_Rgba |
( |
float |
r, |
|
|
float |
g, |
|
|
float |
b, |
|
|
float |
a = 1.0 , |
|
|
float |
t = 0.5 |
|
) |
[inline] |
|
VEE_Rgba::~VEE_Rgba |
( |
|
) |
[inline] |
|
Member Function Documentation
void VEE_Rgba::set |
( |
float |
r, |
|
|
float |
g, |
|
|
float |
b, |
|
|
float |
a = 1.0 , |
|
|
float |
t = 0.5 |
|
) |
[inline] |
|
template<class S> |
void VEE_Rgba::copy |
( |
const S * |
c, |
|
|
int |
n |
|
) |
[inline] |
|
float VEE_Rgba::red |
( |
|
) |
const [inline] |
|
float VEE_Rgba::green |
( |
|
) |
const [inline] |
|
float VEE_Rgba::blue |
( |
|
) |
const [inline] |
|
float VEE_Rgba::alpha |
( |
|
) |
const [inline] |
|
float VEE_Rgba::theta |
( |
|
) |
const [inline] |
|
unsigned VEE_Rgba::getARGB |
( |
|
) |
const |
|
|
Returns the color coded into a 32-bit integer.
Each color component has 8 bits. The components are ordered from MSB: alpha, red, green, blue. |
void VEE_Rgba::setRed |
( |
float |
r |
) |
[inline] |
|
void VEE_Rgba::setGreen |
( |
float |
g |
) |
[inline] |
|
void VEE_Rgba::setBlue |
( |
float |
b |
) |
[inline] |
|
void VEE_Rgba::setAlpha |
( |
float |
a |
) |
[inline] |
|
void VEE_Rgba::setTheta |
( |
float |
t |
) |
[inline] |
|
float* VEE_Rgba::data |
( |
|
) |
[inline] |
|
|
Returns pointer to the data area.
|
const float* VEE_Rgba::data |
( |
|
) |
const [inline] |
|
void VEE_Rgba::clampNth |
( |
unsigned |
index, |
|
|
float |
minVal, |
|
|
float |
maxVal |
|
) |
[inline] |
|
|
Limit the nth componeent to soecified range.
- index The index of the component, range: 0-3.
|
void VEE_Rgba::clampRgb |
( |
float |
minVal, |
|
|
float |
maxVal |
|
) |
|
|
|
Clamp (limit) the RGB -components to a given range.
This method does not modify the alpha value. |
void VEE_Rgba::clampRgba |
( |
float |
minVal, |
|
|
float |
maxVal |
|
) |
|
|
|
Clamp (limit) the RGB and A -components to a given range.
|
VEE_Rgba VEE_Rgba::farColor |
( |
|
) |
const [inline] |
|
|
Calculates a color that is as far as possible from the original in the RGB cube.
|
void VEE_Rgba::normalize |
( |
|
) |
[inline] |
|
|
Normalize all components between zero and one.
|
VEE_Rgba VEE_Rgba::mulRgba |
( |
float |
mul |
) |
const [inline] |
|
|
Multiplication operator.
This operator multiplies the RGBA components. |
VEE_Rgba VEE_Rgba::mulRgb |
( |
float |
mul |
) |
const [inline] |
|
|
Multiplication operator.
This operator multiplies the RGBA components. |
VEE_Rgba VEE_Rgba::operator * |
( |
float |
mul |
) |
const [inline] |
|
|
Multiplication operator.
This operator multiplies all components. |
|
Addition operator.
This operator adds the RGB components and averages the alpha components of the two colors. |
|
Subtraction operator.
This operator subtracts the RGB components and averages the alpha components of the two colors. |
float& VEE_Rgba::operator[] |
( |
int |
n |
) |
[inline] |
|
const float& VEE_Rgba::operator[] |
( |
int |
n |
) |
const [inline] |
|
Member Data Documentation
The documentation for this class was generated from the following files:
Generated on Mon Mar 12 21:09:36 2007 for VEE - The Visual Effects Engine by
1.4.6