#include <rgba_color.hpp>
Definition at line 51 of file rgba_color.hpp.
Public Member Functions | |
| CRgbaColor () | |
| default ctor | |
| CRgbaColor (const float *color, size_t size) | |
| construct around a given float array | |
| CRgbaColor (float r, float g, float b) | |
| construct with explicit (floating point) RGB values | |
| CRgbaColor (float r, float g, float b, float a) | |
| construct with explicit (floating point) RGB+alpha values | |
| CRgbaColor (unsigned char r, unsigned char g, unsigned char b) | |
| construct with explicit (unsigned char) RGB values. | |
| CRgbaColor (unsigned char r, unsigned char g, unsigned char b, unsigned char a) | |
| construct with explicit (unsigned char) RGB+alpha values. | |
| CRgbaColor (int r, int g, int b) | |
| construct with explicit (int) RGB values. | |
| CRgbaColor (int r, int g, int b, int a) | |
| construct with explicit (int) RGB+alpha values. | |
| CRgbaColor (const string &s) | |
| construct from a string encoded in the form "r g b" | |
| virtual | ~CRgbaColor () |
| virtual dtor | |
| void | Set (float r, float g, float b) |
| set the values from explicit (floating point) RGB values | |
| void | Set (float r, float g, float b, float a) |
| set the values from explicit (floating point) RGB+alpha values | |
| void | Set (unsigned char r, unsigned char g, unsigned char b) |
| set the values from explicit (unsigned char) RGB values. | |
| void | Set (unsigned char r, unsigned char g, unsigned char b, unsigned char a) |
| set the values from explicit (unsigned char) RGB+alpha values. | |
| void | SetRed (float r) |
| Set specific channels from floating point values. | |
| void | SetGreen (float r) |
| void | SetBlue (float r) |
| void | SetAlpha (float r) |
| void | SetRed (unsigned char r) |
| Set specific channels from floating unsigned char values. | |
| void | SetGreen (unsigned char r) |
| void | SetBlue (unsigned char r) |
| void | SetAlpha (unsigned char r) |
| float | GetRed (void) const |
| Get specific channels in floating point values. | |
| float | GetGreen (void) const |
| float | GetBlue (void) const |
| float | GetAlpha (void) const |
| unsigned char | GetRedUC (void) const |
| Get specific channels in unsigned char values. | |
| unsigned char | GetGreenUC (void) const |
| unsigned char | GetBlueUC (void) const |
| unsigned char | GetAlphaUC (void) const |
| const float * | GetColorArray (void) const |
| Access the color array directly. | |
| virtual void | PrintTo (CNcbiOstream &strm) const |
| print the color to a stream in the form "r g b" | |
| virtual void | PrintTo (CNcbiOstream &strm, bool printAlpha, bool uchars=true) const |
| virtual string | ToString (bool printAlpha=true, bool uchars=true) const |
| Return a string representation of the current color. | |
| virtual void | FromString (const string &str) |
| Assign color values encoded in a string. | |
| CRgbaColor & | operator+= (const CRgbaColor &c1) |
| CRgbaColor & | operator *= (float f) |
| void | Lighten (float scale) |
| void | Darken (float scale) |
| CRgbaColor | ContrastingColor (bool onlyBW=true) const |
| Return a color guaranteed to contrast nicely with this color. | |
Static Public Member Functions | |
| static const char * | ColorStrFromName (const string &desc) |
| return a mapped color string from a named color | |
| static CRgbaColor | GetColor (const string &color_type) |
| return a color based on a string. | |
| static CRgbaColor | Interpolate (const CRgbaColor &color1, const CRgbaColor &color2, float alpha) |
| Interpolate two colors. | |
| static CRgbaColor | Invert (const CRgbaColor &color1) |
| returns XOR complementary color, alpha is not affected | |
| static CRgbaColor | RotateColor (const CRgbaColor &c, float degrees) |
| Rotate the hue of the color by degrees. | |
| static float | Brightness (const CRgbaColor &rgb) |
| return the brightness or luminance of the color. | |
| static float | ColorDistance (const CRgbaColor &c1, const CRgbaColor &c2) |
| returns the distance in the RGB color cube between the two colors, scaled to a range [0, 1]. | |
Color space conversion functions. | |
| static void | RgbToHsv (const CRgbaColor &rgb, float &h, float &s, float &v) |
| convert RGB to HSV. | |
| static CRgbaColor | HsvToRgb (float h, float s, float v) |
| static void | RgbToYuv (const CRgbaColor &rgb, float &y, float &u, float &v) |
| convert RGB to YUV. | |
| static bool | YuvToRgb (float y, float u, float v, CRgbaColor &rgb) |
| Not all possible input values of y, u and v will make a valid RGB color. | |
Private Member Functions | |
| void | x_Clamp () |
Private Attributes | |
| float | m_Rgba [4] |
|
|
default ctor
Definition at line 134 of file rgba_color.cpp. References m_Rgba. Referenced by ContrastingColor(), GetColor(), HsvToRgb(), and YuvToRgb(). |
|
||||||||||||
|
construct around a given float array
Definition at line 147 of file rgba_color.cpp. |
|
||||||||||||||||
|
construct with explicit (floating point) RGB values
Definition at line 156 of file rgba_color.cpp. |
|
||||||||||||||||||||
|
construct with explicit (floating point) RGB+alpha values
Definition at line 166 of file rgba_color.cpp. |
|
||||||||||||||||
|
construct with explicit (unsigned char) RGB values. These are normalized to 0-1 internally. Definition at line 201 of file rgba_color.cpp. References m_Rgba. |
|
||||||||||||||||||||
|
construct with explicit (unsigned char) RGB+alpha values. These are normalized from 0-1 internally. Definition at line 210 of file rgba_color.cpp. References m_Rgba. |
|
||||||||||||||||
|
construct with explicit (int) RGB values. These are normalized to 0-1 internally. The values should be in the rane of 0-255. Definition at line 176 of file rgba_color.cpp. |
|
||||||||||||||||||||
|
construct with explicit (int) RGB+alpha values. These are normalized from 0-1 internally. The values should be in the rane of 0-255. Definition at line 188 of file rgba_color.cpp. |
|
|
construct from a string encoded in the form "r g b"
Definition at line 141 of file rgba_color.cpp. References FromString(). |
|
|
virtual dtor
Definition at line 220 of file rgba_color.cpp. |
|
|
return the brightness or luminance of the color. Same as Y in RgbToYuv
Definition at line 1394 of file rgba_color.cpp. References GetBlue(), GetGreen(), and GetRed(). Referenced by ContrastingColor(), operator<(), and RgbToYuv(). |
|
||||||||||||
|
returns the distance in the RGB color cube between the two colors, scaled to a range [0, 1].
Definition at line 1418 of file rgba_color.cpp. References f(), GetBlue(), GetGreen(), and GetRed(). |
|
|
return a mapped color string from a named color
Definition at line 1291 of file rgba_color.cpp. Referenced by FromString(). |
|
|
Return a color guaranteed to contrast nicely with this color.
Definition at line 1427 of file rgba_color.cpp. References Brightness(), CRgbaColor(), f(), HsvToRgb(), and RgbToHsv(). Referenced by CRnaCdsGroup::x_DrawFeatureBar(). |
|
|
Definition at line 513 of file rgba_color.cpp. References _ASSERT, f(), and m_Rgba. Referenced by CRnaCdsGroup::x_DrawFeatureBar(), and CAlnMultiHeader::x_RenderBox(). |
|
|
Assign color values encoded in a string. This function is responsible for all string-based processing; all other string-based interfaces funnel through this. The formats accepted include, in order of parsing: 1. A named color, such as "red", "blue", "green", "salmon", etc. There are approximately 750 named colors that are currently understood. 2. HTML-format colors, such as "#f0f0dd", or "f0f0dd". These are accepted with or without the leading '#'. 3. Bracketed or non-bracketed triplets or quadruplets of integers, in any of the formats below (mix and match spaces or commas as separators, with or without '[]' or '()'): 123 123 123 123, 123, 123 [123 123 123] (123, 123, 123) (123 123 123) [123, 123, 123] Definition at line 400 of file rgba_color.cpp. References ColorStrFromName(). Referenced by CRgbaColor(). |
|
|
Definition at line 334 of file rgba_color.cpp. References m_Rgba. Referenced by CRgbaGradColorTable::FillGradient(), operator *(), operator+(), operator==(), CGraphPanel::PrepareContext(), CHitMatrixRenderer::Render(), CGlBackground::SetDarkColor(), ToString(), CSeqTextPane::x_Render(), and CAlnMultiRenderer::x_Render(). |
|
|
Definition at line 358 of file rgba_color.cpp. References m_Rgba. Referenced by ConvertColor(), ToString(), and CColorPickerValidator::TransferToWindow(). |
|
|
|
Definition at line 352 of file rgba_color.cpp. References m_Rgba. Referenced by ConvertColor(), ToString(), and CColorPickerValidator::TransferToWindow(). |
|
|
return a color based on a string. This function will understand two forms of color type:
Definition at line 1286 of file rgba_color.cpp. References CRgbaColor(). Referenced by CPVecPolygon::CPVecPolygon(), CColorTableMethod::Load(), s_CreateDefaultColorTable(), and CTemplateScoringMethod::x_GetColor(). |
|
|
Access the color array directly.
Definition at line 479 of file rgba_color.cpp. References m_Rgba. Referenced by CGlLight::Apply(), CGlMaterial::Apply(), CGlBackground::Draw(), and IPhyloTreeRenderer::x_RenderNode(). |
|
|
|
Definition at line 346 of file rgba_color.cpp. References m_Rgba. Referenced by ConvertColor(), ToString(), and CColorPickerValidator::TransferToWindow(). |
|
|
Get specific channels in floating point values.
Definition at line 316 of file rgba_color.cpp. References m_Rgba. Referenced by Brightness(), ColorDistance(), CRgbaGradColorTable::FillGradient(), operator *(), operator+(), operator==(), CGraphPanel::PrepareContext(), CHitMatrixRenderer::Render(), RgbToHsv(), RgbToYuv(), CGlBackground::SetDarkColor(), ToString(), CSeqGraphicRenderer::x_Draw(), CSeqTextPane::x_Render(), CAlnMultiRenderer::x_Render(), CHitMatrixGraph::x_RenderHits(), CAlnMultiRenderer::x_RenderMasterRow(), and CHitMatrixGraph::x_RenderPath(). |
|
|
Get specific channels in unsigned char values.
Definition at line 340 of file rgba_color.cpp. References m_Rgba. Referenced by ConvertColor(), ToString(), and CColorPickerValidator::TransferToWindow(). |
|
||||||||||||||||
|
Definition at line 1332 of file rgba_color.cpp. References CRgbaColor(), and f(). Referenced by ContrastingColor(), and RotateColor(). |
|
||||||||||||||||
|
Interpolate two colors. The resulting color returned is ( (color1 * alpha) + (color2 * (1 - alpha) ) Definition at line 485 of file rgba_color.cpp. Referenced by CGradientPanel::OnPaint(), CGradientColorPanel::OnPaint(), CAlignSmearGlyph::x_Draw(), and CRnaCdsGroup::x_DrawFeatureBar(). |
|
|
returns XOR complementary color, alpha is not affected
Definition at line 494 of file rgba_color.cpp. |
|
|
Definition at line 504 of file rgba_color.cpp. References _ASSERT, f(), and m_Rgba. Referenced by CRenderingContext::Draw3DFletch(), CRenderingContext::Draw3DTriangle(), CRenderingContext::DrawDisk(), CLDBlockGlyph::x_Draw(), CRnaCdsGroup::x_DrawFeatureBar(), CAlnMultiHeader::x_RenderBox(), and IPhyloTreeRenderer::x_RenderNode(). |
|
|
Definition at line 81 of file rgba_color.cpp. References m_Rgba. |
|
|
Definition at line 60 of file rgba_color.cpp. |
|
||||||||||||||||
|
Definition at line 370 of file rgba_color.cpp. References ToString(). |
|
|
print the color to a stream in the form "r g b"
Definition at line 364 of file rgba_color.cpp. |
|
||||||||||||||||||||
|
convert RGB to HSV.
Definition at line 1302 of file rgba_color.cpp. References GetBlue(), GetGreen(), and GetRed(). Referenced by ContrastingColor(), and RotateColor(). |
|
||||||||||||||||||||
|
convert RGB to YUV.
Definition at line 1369 of file rgba_color.cpp. References Brightness(), GetBlue(), and GetRed(). |
|
||||||||||||
|
Rotate the hue of the color by degrees.
Definition at line 1400 of file rgba_color.cpp. References HsvToRgb(), and RgbToHsv(). Referenced by GetRandomColor(). |
|
||||||||||||||||||||
|
set the values from explicit (unsigned char) RGB+alpha values. These are normalized internally to the range 0-1. Definition at line 254 of file rgba_color.cpp. References m_Rgba. |
|
||||||||||||||||
|
set the values from explicit (unsigned char) RGB values. These are normalized internally to the range 0-1. Definition at line 245 of file rgba_color.cpp. References m_Rgba. |
|
||||||||||||||||||||
|
set the values from explicit (floating point) RGB+alpha values
Definition at line 235 of file rgba_color.cpp. |
|
||||||||||||||||
|
set the values from explicit (floating point) RGB values
Definition at line 225 of file rgba_color.cpp. References m_Rgba, and x_Clamp(). Referenced by CGlMaterial::Init(), CGlLight::Init(), CColorPickerValidator::TransferFromWindow(), CPhyloTreeScheme::x_DefaultScheme(), CSimpleScoringMethod::x_Init(), and CQualityScoringMethod::x_Init(). |
|
|
Definition at line 310 of file rgba_color.cpp. References m_Rgba. |
|
|
Definition at line 303 of file rgba_color.cpp. References clamp(), and m_Rgba. Referenced by CGlBackground::SetDarkColor(). |
|
|
Definition at line 297 of file rgba_color.cpp. References m_Rgba. |
|
|
Definition at line 290 of file rgba_color.cpp. References clamp(), and m_Rgba. Referenced by CGlBackground::SetDarkColor(). |
|
|
Definition at line 284 of file rgba_color.cpp. References m_Rgba. |
|
|
Definition at line 277 of file rgba_color.cpp. References clamp(), and m_Rgba. Referenced by CGlBackground::SetDarkColor(). |
|
|
Set specific channels from floating unsigned char values. These are normalized internally to the range 0-1. Definition at line 271 of file rgba_color.cpp. References m_Rgba. |
|
|
Set specific channels from floating point values.
Definition at line 264 of file rgba_color.cpp. References clamp(), and m_Rgba. Referenced by CGlBackground::SetDarkColor(). |
|
||||||||||||
|
Return a string representation of the current color.
Definition at line 377 of file rgba_color.cpp. References GetAlpha(), GetAlphaUC(), GetBlue(), GetBlueUC(), GetGreen(), GetGreenUC(), GetRed(), and GetRedUC(). Referenced by PrintTo(), CColorTableMethod::Save(), and CTestSettings::SaveCurrentSettings(). |
|
|
Definition at line 51 of file rgba_color.cpp. References clamp(), and m_Rgba. Referenced by CRgbaColor(), operator+=(), and Set(). |
|
||||||||||||||||||||
|
Not all possible input values of y, u and v will make a valid RGB color. in that case the RGB values are clamped to [0, 1].
Definition at line 1377 of file rgba_color.cpp. References CRgbaColor(), and g(). |
|
|
Definition at line 254 of file rgba_color.hpp. Referenced by CRgbaColor(), Darken(), GetAlpha(), GetAlphaUC(), GetBlue(), GetBlueUC(), GetColorArray(), GetGreen(), GetGreenUC(), GetRed(), GetRedUC(), Lighten(), operator *=(), operator+=(), Set(), SetAlpha(), SetBlue(), SetGreen(), SetRed(), and x_Clamp(). |
1.4.6
Modified on Mon Dec 07 16:23:53 2009 by modify_doxy.py rev. 173732