VizKit  3.0
Static Public Member Functions | Private Member Functions | Static Private Member Functions
VizKit::VisualColorTools Class Reference

#include <VisualColorTools.h>

List of all members.

Static Public Member Functions

static PixelColor getPixelColor (const VertexColor &vertexColor)
static VertexColor getVertexColor (const PixelColor &pixelColor)
static void getColorComponentValues (const PixelColor &aPixelColor, uint8 &anAlpha, uint8 &aRed, uint8 &aGreen, uint8 &aBlue)
static PixelColor getPixelColor (const uint8 &anAlpha, const uint8 &aRed, const uint8 &aGreen, const uint8 &aBlue)
static void getMeanPixelColor (const PixelColor *colors, uint32 count, PixelColor &avgPixelColor)
static PixelColor getMeanRGBPixelColor (const PixelColor &colorX, const PixelColor &colorY, const uint32 &count)
static void RGBToHSL (const double &r, const double &g, const double &b, double *h, double *s, double *l)
static void HSLToRGB (const double &h, const double &s, const double &l, double *r, double *g, double *b)
static void RGBToHSV (const double &r, const double &g, const double &b, double *h, double *s, double *v)
static void HSVToRGB (const double &h, const double &s, const double &v, double *r, double *g, double *b)
static void convertInterleavedPixels1234To4321 (PixelColor *pixels, size_t numberOfPixels)
static void convertInterleavedPixels1234To3214 (PixelColor *pixels, size_t numberOfPixels)
static void convertARGBPixelToRGB (PixelColor &argbPixel)
static double getDistance (const PixelColor &colorX, const PixelColor &colorY)
static PixelColorcreateARGBCheckPixels (size_t width, size_t height, const VertexColor &checkColor=red)
static PixelColorcreateBGRACheckPixels (size_t width, size_t height, const VertexColor &checkColor=red)
static PixelColorcreateRGBACheckPixels (size_t width, size_t height, const VertexColor &checkColor=red)
static PixelColorcreateABGRCheckPixels (size_t width, size_t height, const VertexColor &checkColor=red)

Private Member Functions

 VisualColorTools ()
 ~VisualColorTools ()

Static Private Member Functions

static double min3 (const double &val1, const double &val2, const double &val3)
static double max3 (const double &val1, const double &val2, const double &val3)
static double hueToRGB (const double &v1, const double &v2, const double &hue)
static PixelColorcreateCheckPixels (size_t width, size_t height, const char *const format, const VertexColor &checkColor)

Detailed Description

Various utility functions dealing with pixel color values.


Constructor & Destructor Documentation

The constructor. VisualColorTools is a collection of static methods. Class does not need any instances. Constructor is private and not implemented.

The destructor. VisualColorTools is a collection of static methods. Class does not need any instances. Destructor is private and not implemented.


Member Function Documentation

void VisualColorTools::convertARGBPixelToRGB ( PixelColor argbPixel) [static]

Performs a pixel conversion in-place. ARGB is converted to RGB with alpha value being premultiplied.

Parameters:
[in,out]argbPixelAn ARGB pixel (on return the ARGB pixel is converted to RGB with premultiplied alpha).
void VisualColorTools::convertInterleavedPixels1234To3214 ( PixelColor pixels,
size_t  numberOfPixels 
) [static]

Performs a pixel conversion in-place. E.g. BGRA pixel data is converted to RGBA.

Parameters:
pixelsThe buffer of 32bpp pixel data.
numberOfPixelsThe number of pixels.
void VisualColorTools::convertInterleavedPixels1234To4321 ( PixelColor pixels,
size_t  numberOfPixels 
) [static]

Performs a pixel conversion in-place. E.g. ARGB pixel data is converted to BGRA.

Parameters:
pixelsThe buffer of 32bpp pixel data.
numberOfPixelsThe number of pixels.
uint32 * VisualColorTools::createABGRCheckPixels ( size_t  width,
size_t  height,
const VertexColor checkColor = red 
) [static]

Creates an image buffer with 8-bit per color/alpha channel ABGR pixel data.

Parameters:
widthThe width of the bitmap data.
heightThe height of the bitmap data.
checkColorThe color of the check squares of the sample image.
Returns:
A pointer to allocated pixel data.
Remarks:
The caller has to deallocate the pixel buffer by calling free().
PixelColor * VisualColorTools::createARGBCheckPixels ( size_t  width,
size_t  height,
const VertexColor checkColor = red 
) [static]

Creates an image buffer with 8-bit per color/alpha channel ARGB pixel data.

Parameters:
widthThe width of the bitmap data.
heightThe height of the bitmap data.
checkColorThe color of the check squares of the sample image.
Returns:
A pointer to allocated pixel data.
Remarks:
The caller has to deallocate the pixel buffer by calling free().
uint32 * VisualColorTools::createBGRACheckPixels ( size_t  width,
size_t  height,
const VertexColor checkColor = red 
) [static]

Creates an image buffer with 8-bit per color/alpha channel BGRA pixel data.

Parameters:
widthThe width of the bitmap data.
heightThe height of the bitmap data.
checkColorThe color of the check squares of the sample image.
Returns:
A pointer to allocated pixel data.
Remarks:
The caller has to deallocate the pixel buffer by calling free().
PixelColor * VisualColorTools::createCheckPixels ( size_t  width,
size_t  height,
const char *const  format,
const VertexColor checkColor 
) [static, private]

Internal method to create an image buffer with 8-bit per color/alpha channel pixel data in given format (ARGB, BGRA, RGBA, ABGR).

Parameters:
widthThe width of the bitmap data.
heightThe height of the bitmap data.
formatThe format of the pixel data (e.g. ARGB).
checkColorThe color of the check squares of the sample image.
Returns:
A pointer to allocated pixel data.
uint32 * VisualColorTools::createRGBACheckPixels ( size_t  width,
size_t  height,
const VertexColor checkColor = red 
) [static]

Creates an image buffer with 8-bit per color/alpha channel RGBA pixel data.

Parameters:
widthThe width of the bitmap data.
heightThe height of the bitmap data.
checkColorThe color of the check squares of the sample image.
Returns:
A pointer to allocated pixel data.
Remarks:
The caller has to deallocate the pixel buffer by calling free().
void VisualColorTools::getColorComponentValues ( const PixelColor aPixelColor,
uint8 anAlpha,
uint8 aRed,
uint8 aGreen,
uint8 aBlue 
) [static]

Returns the alpha, red, green, and blue color channel values.

Parameters:
pixelColorThe pixelColor to analyze.
[out]alphaThe 8-bit value of the alpha component.
[out]redThe 8-bit value of the red component.
[out]greenThe 8-bit value of the green component.
[out]blueThe 8-bit value of the blue component.
double VisualColorTools::getDistance ( const PixelColor colorX,
const PixelColor colorY 
) [static]

Returns the distance between two RGB pixel values.

Parameters:
colorXOne color.
colorYThe other color.
Returns:
The distance between two RGB pixel values.
void VisualColorTools::getMeanPixelColor ( const PixelColor colors,
uint32  count,
PixelColor avgPixelColor 
) [static]

Calculates the average pixel color for a number of pixel colors.

Parameters:
colorsArray of pixel colors.
countThe number of pixel colors to summarize.
[out]avgPixelColorThe average pixel color.
PixelColor VisualColorTools::getMeanRGBPixelColor ( const PixelColor colorX,
const PixelColor colorY,
const uint32 count 
) [static]

Returns the weighted average value.

Parameters:
colorXThe existing color value.
colorYThe new incoming color value.
countThe number of existing color values. The new incoming color value (colorY) is weighted with 1 while the existing color value (colorX) is weighted with (count - 1).
PixelColor VisualColorTools::getPixelColor ( const VertexColor vertexColor) [static]

Converts from VertexColor to PixelColor.

Parameters:
vertexColorThe vertexColor to convert.
Returns:
Returns the pixel color value of the vertex color.
PixelColor VisualColorTools::getPixelColor ( const uint8 anAlpha,
const uint8 aRed,
const uint8 aGreen,
const uint8 aBlue 
) [static]

Returns the Pixel color value for given alpha, red, green, and blue color channel values.

Parameters:
[out]alphaThe 8-bit value of the alpha component.
[out]redThe 8-bit value of the red component.
[out]greenThe 8-bit value of the green component.
[out]blueThe 8-bit value of the blue component.
Returns:
The pixel color.
VertexColor VisualColorTools::getVertexColor ( const PixelColor pixelColor) [static]

Converts from PixelColor to VertexColor.

Parameters:
pixelColorThe pixelColor to convert.
Returns:
Returns the vertex color value of the pixel color.
void VisualColorTools::HSLToRGB ( const double &  h,
const double &  s,
const double &  l,
double *  r,
double *  g,
double *  b 
) [static]

Converts a color from HSL to RGB.

Parameters:
hHue color value.
sSaturation color value.
lLightness color value.
[out]rRed color component value.
[out]gGreen color component value.
[out]bBlue color component value.
void VisualColorTools::HSVToRGB ( const double &  h,
const double &  s,
const double &  v,
double *  r,
double *  g,
double *  b 
) [static]

Converts a color from HSV to RGB.

Parameters:
hHue color value.
sSaturation color value.
vValue color value.
[out]rRed color component value.
[out]gGreen color component value.
[out]bBlue color component value.
double VisualColorTools::hueToRGB ( const double &  v1,
const double &  v2,
const double &  hue 
) [static, private]

Helper function to match hue to a red, green, or blue value.

Parameters:
v1First value.
v2Second value.
hueHue value.
Returns:
Color component value (red, green, or blue).
double VisualColorTools::max3 ( const double &  val1,
const double &  val2,
const double &  val3 
) [static, private]

Returns the maximum value of three values.

Parameters:
val1First value.
val2Second value.
val3Third value.
Returns:
The maximum value of the three values.
double VisualColorTools::min3 ( const double &  val1,
const double &  val2,
const double &  val3 
) [static, private]

Returns the minimum value of three values.

Parameters:
val1First value.
val2Second value.
val3Third value.
Returns:
The minimum value of the three values.
void VisualColorTools::RGBToHSL ( const double &  r,
const double &  g,
const double &  b,
double *  h,
double *  s,
double *  l 
) [static]

Converts a color from RGB to HSL.

Parameters:
rRed color component value.
gGreen color component value.
bBlue color component value.
[out]hHue color value.
[out]sSaturation color value.
[out]lLightness color value.
void VisualColorTools::RGBToHSV ( const double &  r,
const double &  g,
const double &  b,
double *  h,
double *  s,
double *  v 
) [static]

Converts a color from RGB to HSV.

Parameters:
rRed color component value.
gGreen color component value.
bBlue color component value.
[out]hHue color value.
[out]sSaturation color value.
[out]vValue color value.

The documentation for this class was generated from the following files:

Generated on Sun Mar 25 2012 14:27:43 for VizKit by doxygen 1.8.0