Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

Color Class Reference

#include <Color.H>

List of all members.

Public Methods

 Color ()
 Color (const Color &c)
 Color (const float r, const float g, const float b, const float a=1.0)
 Color (str_ptr colstr)
virtual ~Color ()
void set (const float r, const float g, const float b, const float a=1.0)
void set (str_ptr colstr)
 can call this with a CONFIGval, for example

float r () const
float g () const
float b () const
float a () const
void setHLS (const float h, const float l, const float s, const float a=1.0)
 set the color in HLS mode: "h" (hue 0.0-360.0), "l" (lightness 0.0-1.0), and "s" (saturation 0.0-1.0)

void getHLS (float &h, float &l, float &s)
 get color in HLS mode: "h" (hue 0.0-360.0), "l" (lightness 0.0-1.0), and "s" (saturation 0.0-1.0)

bool setLAB (const float L, const float a, const float b, const float alpha=1.0)
 Set the color in LAB mode--if LAB is invalid, closest rgb color is set and false returned; else, true returned.

void getLAB (float &L, float &a, float &b)
 get the color in LAB mode: "L" (lightness), "a" (green to red), and "b" (blue to yellow)

void getXYZ (float &X, float &Y, float &Z)
 get the color in CIEXYZ mode

void LABtoXYZ (const float L, const float A, const float B, float &X, float &Y, float &Z)
 convert from LAB mode to XYZ mode

float * array ()
bool operator== (const Color &c) const
float operator[] (const int index) const
float & operator[] (const int index)

Static Public Methods

float getLABChroma (const float L, const float a, const float b)
 get the chroma (0.0-100.0), assumes valid LAB values

float getLABSaturation (const float L, const float a, const float b)
 get the saturation (0.0-100.0), assumes valid LAB values

float getLABHue (const float L, const float a, const float b)
 get the hue angle (0.0-360.0), assumes valid LAB values -- note: does not correspond to 'H' in HLS

void setLABLightnessChromaHue (const float L, float &a, float &b, const float chroma, const float hue)
 the following four functions set LAB values, to actually set the RGB value, setLAB() needs to be called

void setLABChromaSaturationHue (float &L, float &a, float &b, const float chroma, const float saturation, const float hue)
void setLABLightnessSaturationHue (const float L, float &a, float &b, const float saturation, const float hue)
void setLABSaturationAB (float &L, const float a, const float b, const float saturation)
float getLABColorDifference (const float L1, const float a1, const float b1, const float L2, const float a2, const float b2)
 returns the a value of difference in color

bool findMaxL_LAB (float &L, const float a, const float b, const float minL=MIN_L, const float maxL=MAX_L, const float interval=INITIAL_INTERVAL, const bool recursiveSuccess=false)
 the following functions find the max/min for a particular value when the other two values are constant

bool findMinL_LAB (float &L, const float a, const float b, const float minL=MIN_L, const float maxL=MAX_L, const float interval=INITIAL_INTERVAL, const bool recursiveSuccess=false)
bool findMaxA_LAB (const float L, float &a, const float b, const float minA=MIN_A, const float maxA=MAX_A, const float interval=INITIAL_INTERVAL, const bool recursiveSuccess=false)
bool findMinA_LAB (const float L, float &a, const float b, const float minA=MIN_A, const float maxA=MAX_A, const float interval=INITIAL_INTERVAL, const bool recursiveSuccess=false)
bool findMaxB_LAB (const float L, const float a, float &b, const float minB=MIN_B, const float maxB=MAX_B, const float interval=INITIAL_INTERVAL, const bool recursiveSuccess=false)
bool findMinB_LAB (const float L, const float a, float &b, const float minB=MIN_B, const float maxB=MAX_B, const float interval=INITIAL_INTERVAL, const bool recursiveSuccess=false)
bool findMaxL_LA_LAB (float &L, float &a, const float b, const float minL=MIN_L, const float maxL=MAX_L, const float interval=INITIAL_INTERVAL, const bool recursiveSuccess=false)
bool findMinL_LA_LAB (float &L, float &a, const float b, const float minL=MIN_L, const float maxL=MAX_L, const float interval=INITIAL_INTERVAL, const bool recursiveSuccess=false)
bool findMaxA_LA_LAB (float &L, float &a, const float b, const float minA=MIN_A, const float maxA=MAX_A, const float interval=INITIAL_INTERVAL, const bool recursiveSuccess=false)
bool findMinA_LA_LAB (float &L, float &a, const float b, const float minA=MIN_A, const float maxA=MAX_A, const float interval=INITIAL_INTERVAL, const bool recursiveSuccess=false)
bool findMaxL_LB_LAB (float &L, const float a, float &b, const float minL=MIN_L, const float maxL=MAX_L, const float interval=INITIAL_INTERVAL, const bool recursiveSuccess=false)
bool findMinL_LB_LAB (float &L, const float a, float &b, const float minL=MIN_L, const float maxL=MAX_L, const float interval=INITIAL_INTERVAL, const bool recursiveSuccess=false)
bool findMaxB_LB_LAB (float &L, const float a, float &b, const float minB=MIN_B, const float maxB=MAX_B, const float interval=INITIAL_INTERVAL, const bool recursiveSuccess=false)
bool findMinB_LB_LAB (float &L, const float a, float &b, const float minB=MIN_B, const float maxB=MAX_B, const float interval=INITIAL_INTERVAL, const bool recursiveSuccess=false)
bool findMaxA_AB_LAB (const float L, float &a, float &b, const float minA=MIN_A, const float maxA=MAX_A, const float interval=INITIAL_INTERVAL, const bool recursiveSuccess=false)
bool findMinA_AB_LAB (const float L, float &a, float &b, const float minA=MIN_A, const float maxA=MAX_A, const float interval=INITIAL_INTERVAL, const bool recursiveSuccess=false)
bool findMaxB_AB_LAB (const float L, float &a, float &b, const float minB=MIN_B, const float maxB=MAX_B, const float interval=INITIAL_INTERVAL, const bool recursiveSuccess=false)
bool findMinB_AB_LAB (const float L, float &a, float &b, const float minB=MIN_B, const float maxB=MAX_B, const float interval=INITIAL_INTERVAL, const bool recursiveSuccess=false)

Static Public Attributes

const Color black
const Color white
const Color grey
const Color red
const Color green
const Color yellow
const Color blue
const Color magenta
const Color cyan
const Color pink
const Color brown
const Color tan
const Color orange
const Color firebrick
const double RGBtoXYZarray [3][3]
const double XYZtoRGBarray [3][3]

Static Protected Methods

double value (double n1, double n2, double hue)
 helps the HLS conversion

double Labf (const double ratio)
 These help the LAB conversion.

double Labfinv (const double ratio)

Protected Attributes

float _col [4]


Constructor & Destructor Documentation

Color::Color   [inline]
 

Color::Color const Color &    c [inline]
 

Color::Color const float    r,
const float    g,
const float    b,
const float    a = 1.0
[inline]
 

Color::Color str_ptr    colstr [inline]
 

virtual Color::~Color   [inline, virtual]
 


Member Function Documentation

float Color::a   const [inline]
 

float* Color::array   [inline]
 

float Color::b   const [inline]
 

bool Color::findMaxA_AB_LAB const float    L,
float &    a,
float &    b,
const float    minA = MIN_A,
const float    maxA = MAX_A,
const float    interval = INITIAL_INTERVAL,
const bool    recursiveSuccess = false
[static]
 

bool Color::findMaxA_LA_LAB float &    L,
float &    a,
const float    b,
const float    minA = MIN_A,
const float    maxA = MAX_A,
const float    interval = INITIAL_INTERVAL,
const bool    recursiveSuccess = false
[static]
 

bool Color::findMaxA_LAB const float    L,
float &    a,
const float    b,
const float    minA = MIN_A,
const float    maxA = MAX_A,
const float    interval = INITIAL_INTERVAL,
const bool    recursiveSuccess = false
[static]
 

bool Color::findMaxB_AB_LAB const float    L,
float &    a,
float &    b,
const float    minB = MIN_B,
const float    maxB = MAX_B,
const float    interval = INITIAL_INTERVAL,
const bool    recursiveSuccess = false
[static]
 

bool Color::findMaxB_LAB const float    L,
const float    a,
float &    b,
const float    minB = MIN_B,
const float    maxB = MAX_B,
const float    interval = INITIAL_INTERVAL,
const bool    recursiveSuccess = false
[static]
 

bool Color::findMaxB_LB_LAB float &    L,
const float    a,
float &    b,
const float    minB = MIN_B,
const float    maxB = MAX_B,
const float    interval = INITIAL_INTERVAL,
const bool    recursiveSuccess = false
[static]
 

bool Color::findMaxL_LA_LAB float &    L,
float &    a,
const float    b,
const float    minL = MIN_L,
const float    maxL = MAX_L,
const float    interval = INITIAL_INTERVAL,
const bool    recursiveSuccess = false
[static]
 

bool Color::findMaxL_LAB float &    L,
const float    a,
const float    b,
const float    minL = MIN_L,
const float    maxL = MAX_L,
const float    interval = INITIAL_INTERVAL,
const bool    recursiveSuccess = false
[static]
 

the following functions find the max/min for a particular value when the other two values are constant

bool Color::findMaxL_LB_LAB float &    L,
const float    a,
float &    b,
const float    minL = MIN_L,
const float    maxL = MAX_L,
const float    interval = INITIAL_INTERVAL,
const bool    recursiveSuccess = false
[static]
 

bool Color::findMinA_AB_LAB const float    L,
float &    a,
float &    b,
const float    minA = MIN_A,
const float    maxA = MAX_A,
const float    interval = INITIAL_INTERVAL,
const bool    recursiveSuccess = false
[static]
 

bool Color::findMinA_LA_LAB float &    L,
float &    a,
const float    b,
const float    minA = MIN_A,
const float    maxA = MAX_A,
const float    interval = INITIAL_INTERVAL,
const bool    recursiveSuccess = false
[static]
 

bool Color::findMinA_LAB const float    L,
float &    a,
const float    b,
const float    minA = MIN_A,
const float    maxA = MAX_A,
const float    interval = INITIAL_INTERVAL,
const bool    recursiveSuccess = false
[static]
 

bool Color::findMinB_AB_LAB const float    L,
float &    a,
float &    b,
const float    minB = MIN_B,
const float    maxB = MAX_B,
const float    interval = INITIAL_INTERVAL,
const bool    recursiveSuccess = false
[static]
 

bool Color::findMinB_LAB const float    L,
const float    a,
float &    b,
const float    minB = MIN_B,
const float    maxB = MAX_B,
const float    interval = INITIAL_INTERVAL,
const bool    recursiveSuccess = false
[static]
 

bool Color::findMinB_LB_LAB float &    L,
const float    a,
float &    b,
const float    minB = MIN_B,
const float    maxB = MAX_B,
const float    interval = INITIAL_INTERVAL,
const bool    recursiveSuccess = false
[static]
 

bool Color::findMinL_LA_LAB float &    L,
float &    a,
const float    b,
const float    minL = MIN_L,
const float    maxL = MAX_L,
const float    interval = INITIAL_INTERVAL,
const bool    recursiveSuccess = false
[static]
 

bool Color::findMinL_LAB float &    L,
const float    a,
const float    b,
const float    minL = MIN_L,
const float    maxL = MAX_L,
const float    interval = INITIAL_INTERVAL,
const bool    recursiveSuccess = false
[static]
 

bool Color::findMinL_LB_LAB float &    L,
const float    a,
float &    b,
const float    minL = MIN_L,
const float    maxL = MAX_L,
const float    interval = INITIAL_INTERVAL,
const bool    recursiveSuccess = false
[static]
 

float Color::g   const [inline]
 

void Color::getHLS float &    h,
float &    l,
float &    s
 

get color in HLS mode: "h" (hue 0.0-360.0), "l" (lightness 0.0-1.0), and "s" (saturation 0.0-1.0)

void Color::getLAB float &    L,
float &    a,
float &    b
 

get the color in LAB mode: "L" (lightness), "a" (green to red), and "b" (blue to yellow)

float Color::getLABChroma const float    L,
const float    a,
const float    b
[static]
 

get the chroma (0.0-100.0), assumes valid LAB values

float Color::getLABColorDifference const float    L1,
const float    a1,
const float    b1,
const float    L2,
const float    a2,
const float    b2
[static]
 

returns the a value of difference in color

float Color::getLABHue const float    L,
const float    a,
const float    b
[static]
 

get the hue angle (0.0-360.0), assumes valid LAB values -- note: does not correspond to 'H' in HLS

float Color::getLABSaturation const float    L,
const float    a,
const float    b
[static]
 

get the saturation (0.0-100.0), assumes valid LAB values

void Color::getXYZ float &    X,
float &    Y,
float &    Z
 

get the color in CIEXYZ mode

double Color::Labf const double    ratio [inline, static, protected]
 

These help the LAB conversion.

double Color::Labfinv const double    ratio [inline, static, protected]
 

void Color::LABtoXYZ const float    L,
const float    A,
const float    B,
float &    X,
float &    Y,
float &    Z
 

convert from LAB mode to XYZ mode

bool Color::operator== const Color &    c const [inline]
 

float& Color::operator[] const int    index [inline]
 

float Color::operator[] const int    index const [inline]
 

float Color::r   const [inline]
 

void Color::set str_ptr    colstr
 

can call this with a CONFIGval, for example

void Color::set const float    r,
const float    g,
const float    b,
const float    a = 1.0
[inline]
 

void Color::setHLS const float    h,
const float    l,
const float    s,
const float    a = 1.0
 

set the color in HLS mode: "h" (hue 0.0-360.0), "l" (lightness 0.0-1.0), and "s" (saturation 0.0-1.0)

bool Color::setLAB const float    L,
const float    a,
const float    b,
const float    alpha = 1.0
 

Set the color in LAB mode--if LAB is invalid, closest rgb color is set and false returned; else, true returned.

void Color::setLABChromaSaturationHue float &    L,
float &    a,
float &    b,
const float    chroma,
const float    saturation,
const float    hue
[static]
 

void Color::setLABLightnessChromaHue const float    L,
float &    a,
float &    b,
const float    chroma,
const float    hue
[static]
 

the following four functions set LAB values, to actually set the RGB value, setLAB() needs to be called

void Color::setLABLightnessSaturationHue const float    L,
float &    a,
float &    b,
const float    saturation,
const float    hue
[static]
 

void Color::setLABSaturationAB float &    L,
const float    a,
const float    b,
const float    saturation
[static]
 

double Color::value double    n1,
double    n2,
double    hue
[static, protected]
 

helps the HLS conversion


Member Data Documentation

float Color::_col[4] [protected]
 

const Color Color::black [static]
 

const Color Color::blue [static]
 

const Color Color::brown [static]
 

const Color Color::cyan [static]
 

const Color Color::firebrick [static]
 

const Color Color::green [static]
 

const Color Color::grey [static]
 

const Color Color::magenta [static]
 

const Color Color::orange [static]
 

const Color Color::pink [static]
 

const Color Color::red [static]
 

const double Color::RGBtoXYZarray [static]
 

Initial value:

 {
   {0.412390799265959184,0.357584339383878058,0.180480788401834288},
   {0.212639005871510189,0.715168678767756116,0.0721923153607336942},
   {0.0193308187155918336,0.119194779794626025,0.950532152249660455}}

const Color Color::tan [static]
 

const Color Color::white [static]
 

const double Color::XYZtoRGBarray [static]
 

Initial value:

 {
   {3.24096994190452392,-1.53738317757009479,-0.498610760293003707},
   {-0.969243636280879528,1.87596750150771995,0.0415550574071756084},
   {0.0556300796969936062,-0.203976958888976556,1.0569715142428786}}

const Color Color::yellow [static]
 


The documentation for this class was generated from the following files:
Generated on Mon Sep 15 16:27:57 2003 for inspace by doxygen1.2.18