last update 20 Sep 2009 |
#include <cvrRGBPixel.h>
Public Types | |
typedef T | value_type |
typedef int | size_type |
Public Member Functions | |
rgbPixel () | |
rgbPixel (const T r, const T g, const T b) | |
rgbPixel (const rgbaPixel &other) | |
template<class U > | |
rgbPixel (const rgbPixel< U > &other) | |
template<class U > | |
void | set (const U r, const U g, const U blue) |
void | setRed (const T r) |
void | setGreen (const T g) |
void | setBlue (const T b) |
template<class U > | |
void | get (U &r, U &g, U &b) const |
const T & | getRed () const |
const T & | getGreen () const |
const T & | getBlue () const |
T & | getRed () |
T & | getGreen () |
T & | getBlue () |
T & | at (const int x) |
const T & | at (const int x) const |
T & | operator[] (const int x) |
const T & | operator[] (const int x) const |
size_type | size () const |
rgbPixel< T > & | copy (const rgbPixel< T > &other) |
rgbPixel< T > & | operator= (const rgbPixel< T > &other) |
rgbPixel< T > & | copy (const rgbaPixel &other) |
rgbPixel< T > & | operator= (const rgbaPixel &other) |
void | castTo (rgbaPixel &other) const |
rgbaPixel | getRGBAPixel () const |
rgbaPixel | getClippedRGBAPixel () const |
bool | isEqual (const rgbPixel< T > &other) const |
bool | operator== (const rgbPixel< T > &other) const |
bool | operator!= (const rgbPixel< T > &other) const |
bool | operator< (const rgbPixel< T > &other) const |
bool | operator> (const rgbPixel< T > &other) const |
rgbPixel< T > & | add (const rgbPixel< T > &other) |
rgbPixel< T > & | operator+= (const rgbPixel< T > &other) |
rgbPixel< T > | operator+ (const rgbPixel< T > &other) const |
rgbPixel< T > & | subtract (const rgbPixel< T > &other) |
rgbPixel< T > & | operator-= (const rgbPixel< T > &other) |
rgbPixel< T > | operator- (const rgbPixel< T > &other) const |
rgbPixel< T > & | multiply (const rgbPixel< T > &other) |
rgbPixel< T > & | operator*= (const rgbPixel< T > &other) |
rgbPixel< T > | operator* (const rgbPixel< T > &other) const |
rgbPixel< T > & | multiply (const int other) |
rgbPixel< T > & | multiply (const float &other) |
rgbPixel< T > & | multiply (const double &other) |
rgbPixel< T > & | operator*= (const int other) |
rgbPixel< T > & | operator*= (const float &other) |
rgbPixel< T > & | operator*= (const double &other) |
rgbPixel< T > | operator* (const int other) const |
rgbPixel< T > | operator* (const float &other) const |
rgbPixel< T > | operator* (const double &other) const |
rgbPixel< T > & | divide (const rgbPixel< T > &other) |
rgbPixel< T > & | operator/= (const rgbPixel< T > &other) |
rgbPixel< T > | operator/ (const rgbPixel< T > &other) const |
rgbPixel< T > & | divide (const int other) |
rgbPixel< T > & | divide (const float &other) |
rgbPixel< T > & | divide (const double &other) |
rgbPixel< T > & | operator/= (const int other) |
rgbPixel< T > & | operator/= (const float &other) |
rgbPixel< T > & | operator/= (const double &other) |
rgbPixel< T > | operator/ (const int other) const |
rgbPixel< T > | operator/ (const float &other) const |
rgbPixel< T > | operator/ (const double &other) const |
typeInfo< T > ::square_accumulation_type | absSqr () const |
typeInfo< T > ::square_accumulation_type | dot (const rgbPixel< T > &other) const |
typeInfo< T > ::square_accumulation_type | distanceSqr (const rgbPixel< T > &other) const |
Public Attributes | |
union { | |
struct { | |
T red | |
T green | |
T blue | |
} | |
T data [3] | |
}; |
This is a more general type than cvr::rgbaPixel, which is used to represent points in the RGB color space with arbitrary precision, specified through the template type of the class.
The types supported for T are byte, ubyte, int16, uint16, int32, uint32, float and double.
typedef int cvr::rgbPixel< T >::size_type |
Return type of the size() member.
typedef T cvr::rgbPixel< T >::value_type |
Used for the template-based interface for pixels as vectors.
cvr::rgbPixel< T >::rgbPixel | ( | ) |
Default constructor.
The default constructor of the rgbPixel<T> does not initialize anything, in order to allow the creation of uninitialized images in a more efficient way.
cvr::rgbPixel< T >::rgbPixel | ( | const T | r, | |
const T | g, | |||
const T | b | |||
) |
RGB constructor.
r | value for the red component | |
g | value for the green component | |
b | value for the blue component |
cvr::rgbPixel< T >::rgbPixel | ( | const rgbaPixel & | other | ) |
Copy constructor.
cvr::rgbPixel< T >::rgbPixel | ( | const rgbPixel< U > & | other | ) | [inline] |
Copy constructor.
typeInfo<T>::square_accumulation_type cvr::rgbPixel< T >::absSqr | ( | ) | const [inline] |
Compute the square of the magnitud of this pixel .
rgbPixel<T>& cvr::rgbPixel< T >::add | ( | const rgbPixel< T > & | other | ) | [inline] |
Add this pixel with another one.
The alpha channel is kept unchanged.
const T& cvr::rgbPixel< T >::at | ( | const int | x | ) | const [inline] |
Used to simulate read-only vector access.
The correspondence between the elements of the vector and the color components still depents on the endianness of the system, but is usually at(0) for red, at(1) for green and at(2) for blue.
T& cvr::rgbPixel< T >::at | ( | const int | x | ) | [inline] |
void cvr::rgbPixel< T >::castTo | ( | rgbaPixel & | other | ) | const [inline] |
Cast To an cvr::rgbaPixel.
The alpha value of the rgbaPixel is always set to zero
rgbPixel<T>& cvr::rgbPixel< T >::copy | ( | const rgbaPixel & | other | ) | [inline] |
Copy the "other" pixel.
rgbPixel<T>& cvr::rgbPixel< T >::copy | ( | const rgbPixel< T > & | other | ) | [inline] |
Copy the "other" pixel.
typeInfo<T>::square_accumulation_type cvr::rgbPixel< T >::distanceSqr | ( | const rgbPixel< T > & | other | ) | const [inline] |
Square of the distance between this pixel and the other one.
.
Referenced by cvr::euclideanDistance(), and cvr::euclideanDistanceSqr().
rgbPixel<T>& cvr::rgbPixel< T >::divide | ( | const double & | other | ) | [inline] |
Divide all components of this pixel with an integer.
rgbPixel<T>& cvr::rgbPixel< T >::divide | ( | const float & | other | ) | [inline] |
Divide all components of this pixel with an integer.
rgbPixel<T>& cvr::rgbPixel< T >::divide | ( | const int | other | ) | [inline] |
Divide all components of this pixel with an integer.
rgbPixel<T>& cvr::rgbPixel< T >::divide | ( | const rgbPixel< T > & | other | ) | [inline] |
Divide this pixel with another one.
The pixel division divides elementwise the elements of the pixel except the alpha channel, which is kept unchanged.
typeInfo<T>::square_accumulation_type cvr::rgbPixel< T >::dot | ( | const rgbPixel< T > & | other | ) | const [inline] |
Scalar product in the 3D RGB color space.
Get the scalar product of this pixel with another one, considering them as a 3D point in the RGB color space.
The dot product will be the sum of the red*other.red + green*other.green + blue*other.blue
void cvr::rgbPixel< T >::get | ( | U & | r, | |
U & | g, | |||
U & | b | |||
) | const [inline] |
Get the three color components and write them in the given arguments.
T& cvr::rgbPixel< T >::getBlue | ( | ) | [inline] |
Returns blue component.
const T& cvr::rgbPixel< T >::getBlue | ( | ) | const [inline] |
Returns blue component.
rgbaPixel cvr::rgbPixel< T >::getClippedRGBAPixel | ( | ) | const [inline] |
Get a new cvr::rgbaPixel with the contents of this pixel.
Just a static_cast of the attributes will be made and the alpha is set to zero. In case of under/overflow, the values are set to zero or 255.
T& cvr::rgbPixel< T >::getGreen | ( | ) | [inline] |
Returns green component.
const T& cvr::rgbPixel< T >::getGreen | ( | ) | const [inline] |
Returns green component.
T& cvr::rgbPixel< T >::getRed | ( | ) | [inline] |
Returns red component.
const T& cvr::rgbPixel< T >::getRed | ( | ) | const [inline] |
Returns red component.
rgbaPixel cvr::rgbPixel< T >::getRGBAPixel | ( | ) | const [inline] |
Get a new cvr::rgbaPixel with the contents of this pixel.
Just a static_cast of the attributes will be made and the alpha is set to zero. No clipping of the values is made in case of under or overflow.
bool cvr::rgbPixel< T >::isEqual | ( | const rgbPixel< T > & | other | ) | const [inline] |
Compare two pixels (true if equal!).
Two pixels are equal if all four components (red, green, blue, and alpha) are equal. It is an usual error to leave the alpha channel uninizalized and then compare for equalilty.
rgbPixel<T>& cvr::rgbPixel< T >::multiply | ( | const double & | other | ) | [inline] |
Multiply all components of this pixel with a float, except the alpha channel, which is kept unchanged.
rgbPixel<T>& cvr::rgbPixel< T >::multiply | ( | const float & | other | ) | [inline] |
Multiply all components of this pixel with a float, except the alpha channel, which is kept unchanged.
rgbPixel<T>& cvr::rgbPixel< T >::multiply | ( | const int | other | ) | [inline] |
Multiply all components of this pixel with an integer, except the alpha channel, which is kept unchanged.
rgbPixel<T>& cvr::rgbPixel< T >::multiply | ( | const rgbPixel< T > & | other | ) | [inline] |
Multiply this pixel with another one.
The pixel multiplication multiplies elementwise the elements of the pixel, except the alpha channel, which is kept unchanged.
bool cvr::rgbPixel< T >::operator!= | ( | const rgbPixel< T > & | other | ) | const [inline] |
Alias for !compare().
Two pixels are equal if all four components (red, green, blue, and alpha) are equal. It is an usual error to leave the alpha channel uninizalized and then compare for equalilty.
rgbPixel<T> cvr::rgbPixel< T >::operator* | ( | const double & | other | ) | const [inline] |
rgbPixel<T> cvr::rgbPixel< T >::operator* | ( | const float & | other | ) | const [inline] |
rgbPixel<T> cvr::rgbPixel< T >::operator* | ( | const int | other | ) | const [inline] |
rgbPixel<T> cvr::rgbPixel< T >::operator* | ( | const rgbPixel< T > & | other | ) | const [inline] |
Multiply this pixel with another one without altering anything.
The alpha channel of the resulting pixel is equal to the one of this pixel (the first operand in the binary expression)
rgbPixel<T>& cvr::rgbPixel< T >::operator*= | ( | const double & | other | ) | [inline] |
Multiply all components of this pixel with a a double, except the alpha channel, which is kept unchanged.
rgbPixel<T>& cvr::rgbPixel< T >::operator*= | ( | const float & | other | ) | [inline] |
Multiply all components of this pixel with a a float, except the alpha channel, which is kept unchanged.
rgbPixel<T>& cvr::rgbPixel< T >::operator*= | ( | const int | other | ) | [inline] |
Multiply all components of this pixel with a an integer, except the alpha channel, which is kept unchanged.
rgbPixel<T>& cvr::rgbPixel< T >::operator*= | ( | const rgbPixel< T > & | other | ) | [inline] |
Multiply this pixel with another one.
The pixel multiplication multiplies elementwise the elements of the pixel, except the alpha channel, which is kept unchanged.
rgbPixel<T> cvr::rgbPixel< T >::operator+ | ( | const rgbPixel< T > & | other | ) | const [inline] |
Add this pixel with the other one without altering anything.
The alpha channel of the resulting pixel is equal to the one of this pixel (the first operand in the binary expression)
rgbPixel<T>& cvr::rgbPixel< T >::operator+= | ( | const rgbPixel< T > & | other | ) | [inline] |
Add this pixel with another one.
The alpha channel is kept unchanged.
rgbPixel<T> cvr::rgbPixel< T >::operator- | ( | const rgbPixel< T > & | other | ) | const [inline] |
Subtract 'other' from this pixel without altering anything.
The alpha channel of the resulting pixel is equal to the one of this pixel (the first operand in the binary expression)
rgbPixel<T>& cvr::rgbPixel< T >::operator-= | ( | const rgbPixel< T > & | other | ) | [inline] |
Subtract 'other' from this pixel.
The alpha channel is kept unchanged.
rgbPixel<T> cvr::rgbPixel< T >::operator/ | ( | const double & | other | ) | const [inline] |
Divide all components of this pixel with an integer without altering anything.
The alpha channel of the resulting pixel is equal to the one of this pixel (the first operand in the binary expression)
rgbPixel<T> cvr::rgbPixel< T >::operator/ | ( | const float & | other | ) | const [inline] |
Divide all components of this pixel with an integer without altering anything.
The alpha channel of the resulting pixel is equal to the one of this pixel (the first operand in the binary expression)
rgbPixel<T> cvr::rgbPixel< T >::operator/ | ( | const int | other | ) | const [inline] |
Divide all components of this pixel with an integer without altering anything.
The alpha channel of the resulting pixel is equal to the one of this pixel (the first operand in the binary expression)
rgbPixel<T> cvr::rgbPixel< T >::operator/ | ( | const rgbPixel< T > & | other | ) | const [inline] |
rgbPixel<T>& cvr::rgbPixel< T >::operator/= | ( | const double & | other | ) | [inline] |
Divide all components of this pixel with an integer.
rgbPixel<T>& cvr::rgbPixel< T >::operator/= | ( | const float & | other | ) | [inline] |
Divide all components of this pixel with an integer.
rgbPixel<T>& cvr::rgbPixel< T >::operator/= | ( | const int | other | ) | [inline] |
Divide all components of this pixel with an integer.
rgbPixel<T>& cvr::rgbPixel< T >::operator/= | ( | const rgbPixel< T > & | other | ) | [inline] |
Divide this pixel with another one.
The pixel division divides elementwise the elements of the pixel except the alpha channel, which is kept unchanged.
bool cvr::rgbPixel< T >::operator< | ( | const rgbPixel< T > & | other | ) | const [inline] |
Less than operator.
An rgbPixel<T> is said to be "smaller" than another one, if its red component its smaller, or (if both red components are equal) if the green component if smaller, or (if both green components are equal) if the blue component is smaller.
rgbPixel<T>& cvr::rgbPixel< T >::operator= | ( | const rgbaPixel & | other | ) | [inline] |
Alias for copy.
rgbPixel<T>& cvr::rgbPixel< T >::operator= | ( | const rgbPixel< T > & | other | ) | [inline] |
Alias for copy.
bool cvr::rgbPixel< T >::operator== | ( | const rgbPixel< T > & | other | ) | const [inline] |
Alias for compare().
Two pixels are equal if all four components (red, green, blue, and alpha) are equal. It is an usual error to leave the alpha channel uninizalized and then compare for equalilty.
bool cvr::rgbPixel< T >::operator> | ( | const rgbPixel< T > & | other | ) | const [inline] |
Greater than operator.
An rgbPixel<T> is said to be "greater" than another one, if its red component its greater, or (if both red components are equal) if the green component if greater, or (if both green components are equal) if the blue component is greater.
const T& cvr::rgbPixel< T >::operator[] | ( | const int | x | ) | const [inline] |
Used to simulate read-only vector access.
The correspondence between the elements of the vector and the color components still depents on the endianness of the system, but is usually [0] for red, [1] for green and [2] for blue.
T& cvr::rgbPixel< T >::operator[] | ( | const int | x | ) | [inline] |
void cvr::rgbPixel< T >::set | ( | const U | r, | |
const U | g, | |||
const U | blue | |||
) | [inline] |
Set the red, green, blue values for the pixel.
void cvr::rgbPixel< T >::setBlue | ( | const T | b | ) | [inline] |
Sets the blue component to given value.
void cvr::rgbPixel< T >::setGreen | ( | const T | g | ) | [inline] |
Sets the green component to given value.
void cvr::rgbPixel< T >::setRed | ( | const T | r | ) | [inline] |
Sets the red component to given value.
size_type cvr::rgbPixel< T >::size | ( | ) | const [inline] |
Used to simulate the vector size.
It returns always 3.
rgbPixel<T>& cvr::rgbPixel< T >::subtract | ( | const rgbPixel< T > & | other | ) | [inline] |
Subtract 'other' from this pixel.
The alpha channel is kept unchanged.
union { ... } |
Anonymous union to provide efficient access through three different mechanism to the pixel components.
The order of the data in this union assumes little endianness.
T cvr::rgbPixel< T >::blue |
Blue channel.
T cvr::rgbPixel< T >::data[3] |
The four values as array.
T cvr::rgbPixel< T >::green |
Green channel.
T cvr::rgbPixel< T >::red |
Red channel.