#include <ColorBuf.h>
Public Member Functions | |
void | operator+= (const ColorBuf &) |
void | operator-= (const ColorBuf &) |
void | operator *= (const float) |
ColorBuf | operator+ (const ColorBuf &other) |
operator COLORREF () | |
ColorBuf & | operator= (const ColorBuf &other) |
RGBFloat | GetFactoredRGBFloat () const |
RGBFloat | GetNormalizedRGBFloat () const |
ColorBuf () | |
ColorBuf (LONG col) | |
ColorBuf (UBYTE pred, UBYTE pgreen, UBYTE pblue) | |
ColorBuf (UBYTE pred, UBYTE pgreen, UBYTE pblue, UBYTE palpha) | |
ColorBuf (COLORREF c) | |
ColorBuf (const RGBAFloat &color) | |
UBYTE | Red () const |
UBYTE | Green () const |
UBYTE | Blue () const |
UBYTE | Alpha () const |
ULONG | Color () const |
void | Set (UBYTE pred, UBYTE pgreen, UBYTE pblue, UBYTE alpha) |
void | SetRed (UBYTE red) |
void | SetGreen (UBYTE green) |
void | SetBlue (UBYTE blue) |
void | SetAlpha (UBYTE alpha) |
void | SetColor (ULONG pcolor) |
void | GammaCorrect (float power) |
RGBFloat | Get () const |
float | GetOpacity () const |
void | Set (const RGBFloat &) |
void | SetOpacity (const float value) |
inline float RGBAToDepth(UBYTE red, UBYTE green, UBYTE blue, UBYTE alpha) { float *fptr; DWORD value; value = (DWORD)(alpha << 24 | red << 16 | green << 8 | blue); fptr = (float *)&value; return *fptr; }
inline Vector RGBAToVector(UBYTE red, UBYTE green, UBYTE blue, UBYTE alpha) { signed short value; Vector v; value = (signed short)(green << 8 | red); v.x = (float)value/32768; value = (signed short)(alpha << 8 | blue); v.y = (float)value/32768; // since the vector is normalized, z can be computed v.z = sqrt(1-v.x*v.x-v.y*v.y); return v; }
red : 11, green : 11, blue : 10;
The 4 rgba bytes represent a long in that order.. The first 11 bits are the red component, the second 11 bits are the green component and the last 10 bits are the blue component. You could create a class like this:
class Color { public: union { struct { ULONG m_red : 11, m_green: 11, m_blue : 10; }; UBYTE m_r, m_g, m_b, m_a; }; }; #define MAXCOLOR33 2047
You could then make a Set(...) member function that would set the m_r, m_g, m_b, m_a values from the TGA file, and a Get member function that would:
Color::Get(float &r, float &g, float &b ) const { r = (float)m_red/MAXCOLOR33; g = (float)m_green/MAXCOLOR33; b = (float)m_blue/(MAXCOLOR33/2); }
Definition at line 39 of file ColorBuf.h.
|
Creates an instance of a ColorBuf where the initial color is black and the alpha channel is fully opaque. Definition at line 62 of file ColorBuf.h. |
|
Creates an instance of a ColorBuf. The color is copied from the col parameter. The alpha channel is fully opaque.
Definition at line 63 of file ColorBuf.h. |
|
Creates an instance of a ColorBuf. The color channels are copied from the parameters and the alpha channel is fully opaque. Definition at line 64 of file ColorBuf.h. |
|
Creates an instance of a ColorBuf. The colors and alpha channels are copied from the parameters. Definition at line 65 of file ColorBuf.h. References values. |
|
Creates an instance of a ColorBuf. The color is copied from the c parameter. The alpha channel is fully opaque.
Definition at line 66 of file ColorBuf.h. References values. |
|
Creates an instance of a ColorBuf. The colors and alpha channels are set from the color parameter which is interpreted as being normalized. That is color and alpha channel values of 1.0 is mapped to 255. Definition at line 13 of file ColorBuf.inl. References RGBAFloat::Alpha(), RGBAFloat::Blue(), fast_ftol_unsigned(), RGBAFloat::Green(), MAXCOLOR, MIN, RGBAFloat::Red(), and values. Here is the call graph for this function: ![]() |
|
Retrieve the alpha channel value. Return value is UBYTE so between 0 and 255. Definition at line 72 of file ColorBuf.h. References values. |
|
Retrieve the blue channel value. Return value is UBYTE so between 0 and 255. Definition at line 71 of file ColorBuf.h. References values. |
|
Retrieve all the color and alpha channel values as a ULONG, so between 0 and 255. Definition at line 73 of file ColorBuf.h. References color. |
|
Apply a Gamma correction to the color channels. Alpha channel is not corrected.
Definition at line 152 of file ColorBuf.h. References GammaCorrectColBuf(), and values. Here is the call graph for this function: ![]() |
|
Retrieve the normalized (from 0.0 to 1.0) color channels values. Definition at line 28 of file ColorBuf.inl. |
|
Factored color values are between 0.0 and 255.0 where 0.0 represent total black and 255.0 represent a theoretical white. Definition at line 34 of file ColorBuf.inl. References values. |
|
Normalized color values are between 0.0 and 1.0 where 0.0 represent total black and 1.0 represent a theoretical white. Note that when stored in a ColorBuf, color values can never exceed 1.0. Definition at line 39 of file ColorBuf.inl. |
|
Retrieve the normalized (from 0.0 to 1.0) alpha channel value. Definition at line 88 of file ColorBuf.h. |
|
Retrieve the green channel value. Return value is UBYTE so between 0 and 255. Definition at line 70 of file ColorBuf.h. References values. |
|
Multiplies the current instance channel values by the factor parameter. Result is rounded to the nearest integer. Definition at line 137 of file ColorBuf.h. References values. |
|
Casts a ColorBuf into a COLORREF. Definition at line 56 of file ColorBuf.h. References values. |
|
Returns the result of adding the passed value (right side operand) to the current value (left side operand). Definition at line 119 of file ColorBuf.h. |
|
Adds the parameter value to the current instance channels (color and alpha) values. Values are capped to 255. Definition at line 98 of file ColorBuf.h. |
|
Subtracts the parameter value from the current instance value. Definition at line 129 of file ColorBuf.h. References values. |
|
Sets the color and alpha channels to the new values. Definition at line 57 of file ColorBuf.h. References color. |
|
Retrieve the red channel value. Return value is UBYTE so between 0 and 255. Definition at line 69 of file ColorBuf.h. References values. |
|
Sets the color channel values from the normalized (from 0.0 to 1.0) color parameter. Definition at line 21 of file ColorBuf.inl. References RGBFloat::Blue(), fast_ftol_unsigned(), RGBFloat::Green(), MAXCOLOR, MIN, RGBFloat::Red(), and values. Here is the call graph for this function: ![]() |
|
Sets the colors and alpha channels values from the parameters. Definition at line 74 of file ColorBuf.h. References values. |
|
Sets the alpha opacity channel value from the parameter. Definition at line 78 of file ColorBuf.h. References values. |
|
Sets the blue color channel value from the parameter. Definition at line 77 of file ColorBuf.h. References values. |
|
Sets the colors and alpha channels values from the parameter. Definition at line 79 of file ColorBuf.h. |
|
Sets the green color channel value from the parameter. Definition at line 76 of file ColorBuf.h. References values. |
|
Sets the alpha channel value from the normalized (from 0.0 to 1.0) value parameter. Definition at line 93 of file ColorBuf.h. References fast_ftol_unsigned(), MAXCOLOR, and values. Here is the call graph for this function: ![]() |
|
Sets the red color channel value from the parameter. Definition at line 75 of file ColorBuf.h. References values. |
|
Definition at line 44 of file ColorBuf.h. Referenced by operator+(). |
|
Definition at line 44 of file ColorBuf.h. Referenced by operator+(). |
|
Definition at line 49 of file ColorBuf.h. Referenced by Color(), ColorBuf(), operator=(), and SetColor(). |
|
Definition at line 44 of file ColorBuf.h. Referenced by operator+(). |
|
Definition at line 44 of file ColorBuf.h. Referenced by operator+(). |
|
Generated on Thu Oct 27 11:46:51 2005 with
1.4.5 written by Dimitri van Heesch,
© 1997-2001