VizKit
3.3.7
|
Various utility functions dealing with pixel color values. More...
#include <VisualColorTools.h>
Static Public Member Functions | |
static PixelColor | getPixelColor (const VertexColor &vertexColor) |
Converts from VertexColor to PixelColor. | |
static VertexColor | getVertexColor (const PixelColor &pixelColor) |
Converts from PixelColor to VertexColor. | |
static void | getColorComponentValues (const PixelColor &aPixelColor, uint8 &anAlpha, uint8 &aRed, uint8 &aGreen, uint8 &aBlue) |
Returns the alpha, red, green, and blue color channel values. | |
static PixelColor | getPixelColor (const uint8 &anAlpha, const uint8 &aRed, const uint8 &aGreen, const uint8 &aBlue) |
Returns the Pixel color value for given alpha, red, green, and blue color channel values. | |
static void | getMeanPixelColor (const PixelColor *colors, uint32 count, PixelColor &avgPixelColor) |
Calculates the average pixel color for a number of pixel colors. | |
static PixelColor | getMeanRGBPixelColor (const PixelColor &colorX, const PixelColor &colorY, const uint32 &count) |
Returns the weighted average value. | |
static void | RGBToHSL (const double &r, const double &g, const double &b, double *h, double *s, double *l) |
Converts a color from RGB to HSL. | |
static void | HSLToRGB (const double &h, const double &s, const double &l, double *r, double *g, double *b) |
Converts a color from HSL to RGB. | |
static void | RGBToHSV (const double &r, const double &g, const double &b, double *h, double *s, double *v) |
Converts a color from RGB to HSV. | |
static void | HSVToRGB (const double &h, const double &s, const double &v, double *r, double *g, double *b) |
Converts a color from HSV to RGB. | |
static void | convertInterleavedPixels1234To4321 (PixelColor *pixels, size_t numberOfPixels) |
Performs a pixel conversion in-place. | |
static void | convertInterleavedPixels1234To3214 (PixelColor *pixels, size_t numberOfPixels) |
Performs a pixel conversion in-place. | |
static void | convertARGBPixelToRGB (PixelColor &argbPixel) |
Performs a pixel conversion in-place. | |
static double | getDistance (const PixelColor &colorX, const PixelColor &colorY) |
Returns the distance between two RGB pixel values. | |
static PixelColor * | createARGBCheckPixels (size_t width, size_t height, const VertexColor &checkColor=red) |
Creates an image buffer with 8-bit per color/alpha channel ARGB pixel data. | |
static PixelColor * | createBGRACheckPixels (size_t width, size_t height, const VertexColor &checkColor=red) |
Creates an image buffer with 8-bit per color/alpha channel BGRA pixel data. | |
static PixelColor * | createRGBACheckPixels (size_t width, size_t height, const VertexColor &checkColor=red) |
Creates an image buffer with 8-bit per color/alpha channel RGBA pixel data. | |
static PixelColor * | createABGRCheckPixels (size_t width, size_t height, const VertexColor &checkColor=red) |
Creates an image buffer with 8-bit per color/alpha channel ABGR pixel data. | |
Private Member Functions | |
VisualColorTools () | |
The constructor. | |
~VisualColorTools () | |
The destructor. | |
Static Private Member Functions | |
static double | min3 (const double &val1, const double &val2, const double &val3) |
Returns the minimum value of three values. | |
static double | max3 (const double &val1, const double &val2, const double &val3) |
Returns the maximum value of three values. | |
static double | hueToRGB (const double &v1, const double &v2, const double &hue) |
Helper function to match hue to a red, green, or blue value. | |
static PixelColor * | createCheckPixels (size_t width, size_t height, const char *const format, const VertexColor &checkColor) |
Internal method to create an image buffer with 8-bit per color/alpha channel pixel data in given format (ARGB, BGRA, RGBA, ABGR). |
Various utility functions dealing with pixel color values.
VizKit::VisualColorTools::VisualColorTools | ( | ) | [private] |
The constructor.
VisualColorTools is a collection of static methods. Class does not need any instances. Constructor is private and not implemented.
VizKit::VisualColorTools::~VisualColorTools | ( | ) | [private] |
The destructor.
VisualColorTools is a collection of static methods. Class does not need any instances. Destructor is private and not implemented.
void VisualColorTools::convertARGBPixelToRGB | ( | PixelColor & | argbPixel | ) | [static] |
Performs a pixel conversion in-place.
ARGB is converted to RGB with alpha value being premultiplied.
[in,out] | argbPixel | An 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.
pixels | The buffer of 32bpp pixel data. |
numberOfPixels | The 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.
pixels | The buffer of 32bpp pixel data. |
numberOfPixels | The 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.
width | The width of the bitmap data. |
height | The height of the bitmap data. |
checkColor | The color of the check squares of the sample image. |
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.
width | The width of the bitmap data. |
height | The height of the bitmap data. |
checkColor | The color of the check squares of the sample image. |
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.
width | The width of the bitmap data. |
height | The height of the bitmap data. |
checkColor | The color of the check squares of the sample image. |
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).
width | The width of the bitmap data. |
height | The height of the bitmap data. |
format | The format of the pixel data (e.g. ARGB). |
checkColor | The color of the check squares of the sample image. |
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.
width | The width of the bitmap data. |
height | The height of the bitmap data. |
checkColor | The color of the check squares of the sample image. |
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.
pixelColor | The pixelColor to analyze. | |
[out] | alpha | The 8-bit value of the alpha component. |
[out] | red | The 8-bit value of the red component. |
[out] | green | The 8-bit value of the green component. |
[out] | blue | The 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.
colorX | One color. |
colorY | The other color. |
void VisualColorTools::getMeanPixelColor | ( | const PixelColor * | colors, |
uint32 | count, | ||
PixelColor & | avgPixelColor | ||
) | [static] |
Calculates the average pixel color for a number of pixel colors.
colors | Array of pixel colors. | |
count | The number of pixel colors to summarize. | |
[out] | avgPixelColor | The average pixel color. |
PixelColor VisualColorTools::getMeanRGBPixelColor | ( | const PixelColor & | colorX, |
const PixelColor & | colorY, | ||
const uint32 & | count | ||
) | [static] |
Returns the weighted average value.
colorX | The existing color value. |
colorY | The new incoming color value. |
count | The 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.
vertexColor | The vertexColor to convert. |
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.
[out] | alpha | The 8-bit value of the alpha component. |
[out] | red | The 8-bit value of the red component. |
[out] | green | The 8-bit value of the green component. |
[out] | blue | The 8-bit value of the blue component. |
VertexColor VisualColorTools::getVertexColor | ( | const PixelColor & | pixelColor | ) | [static] |
Converts from PixelColor to VertexColor.
pixelColor | The pixelColor to convert. |
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.
h | Hue color value. | |
s | Saturation color value. | |
l | Lightness color value. | |
[out] | r | Red color component value. |
[out] | g | Green color component value. |
[out] | b | Blue 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.
h | Hue color value. | |
s | Saturation color value. | |
v | Value color value. | |
[out] | r | Red color component value. |
[out] | g | Green color component value. |
[out] | b | Blue 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.
v1 | First value. |
v2 | Second value. |
hue | Hue value. |
double VisualColorTools::max3 | ( | const double & | val1, |
const double & | val2, | ||
const double & | val3 | ||
) | [static, private] |
Returns the maximum value of three values.
val1 | First value. |
val2 | Second value. |
val3 | Third value. |
double VisualColorTools::min3 | ( | const double & | val1, |
const double & | val2, | ||
const double & | val3 | ||
) | [static, private] |
Returns the minimum value of three values.
val1 | First value. |
val2 | Second value. |
val3 | Third value. |
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.
r | Red color component value. | |
g | Green color component value. | |
b | Blue color component value. | |
[out] | h | Hue color value. |
[out] | s | Saturation color value. |
[out] | l | Lightness 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.
r | Red color component value. | |
g | Green color component value. | |
b | Blue color component value. | |
[out] | h | Hue color value. |
[out] | s | Saturation color value. |
[out] | v | Value color value. |