Laxkit  0.0.7.1
Public Member Functions | Public Attributes
Laxkit::ColorBase Class Reference

Defines various simple conversions between rgb, cmyk, gray, and hsv. More...

Inheritance diagram for Laxkit::ColorBase:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 ColorBase (int ctype, int nmax, int c0, int c1, int c2, int c3=-1, int c4=-1)
virtual int ColorChanged ()
 Return 1 if the color array does not match the oldcolor array. Usually called after button up, compared to button down.
virtual void Updated ()
 Called when a value is changed through any of the various color setting functions.
virtual void Clamp ()
 For each field, make sure it is in range [0..max].
virtual void RestoreColor ()
 Revert colors to oldcolor.
virtual void SetMax (int newmax)
virtual void SetRGB (int r, int g, int b, int a=-1)
 Set the channel when the value is >= 0.
virtual void SetGray (int g, int a=-1)
 Set the channel when the value is >= 0.
virtual void SetCMYK (int c, int m, int y, int k, int a=-1)
 Set the channel when the value is >= 0.
virtual void SetHSV (int h, int s, int v, int a=-1)
virtual void SetRGB (double r, double g, double b, double a=-1)
virtual void SetGray (double g, double a=-1)
virtual void SetCMYK (double c, double m, double y, double k, double a=-1)
virtual void SetHSV (double h, double s, double v, double a=-1)
virtual void CMYK (double *cmyk)
 Fill cmyk[4] with double values.
virtual void RGB (double *rgb)
 Fill rgb[3] with double values.
virtual void HSV (double *hsv)
 Fill hsv[3] with double values.
virtual charHexValue (char *buffer)
 buffer must be at least 10 characters long, or you will segfault.
virtual int SetHexValue (const char *hex)
virtual int Red ()
virtual int Red (int r)
virtual double Redf (double r)
virtual double Redf ()
virtual int Green ()
virtual int Green (int g)
virtual double Greenf (double g)
virtual double Greenf ()
virtual int Blue ()
virtual int Blue (int b)
virtual double Bluef (double b)
virtual double Bluef ()
virtual int Gray ()
virtual int Gray (int g)
virtual double Grayf (double g)
virtual double Grayf ()
virtual int Cyan ()
virtual int Cyan (int c)
virtual double Cyanf (double c)
virtual double Cyanf ()
virtual int Magenta ()
virtual int Magenta (int m)
virtual double Magentaf (double m)
virtual double Magentaf ()
virtual int Yellow ()
virtual int Yellow (int y)
virtual double Yellowf (double y)
virtual double Yellowf ()
virtual int Black ()
virtual int Black (int k)
virtual double Blackf (double k)
virtual double Blackf ()
virtual int Alpha ()
virtual int Alpha (int a)
virtual double Alphaf (double a)
virtual double Alphaf ()
virtual int Hue ()
virtual int Hue (int h)
virtual double Huef (double h)
virtual double Huef ()
virtual int Saturation ()
virtual int Saturation (int s)
virtual double Saturationf (double s)
virtual double Saturationf ()
virtual int Value ()
virtual int Value (int v)
virtual double Valuef (double v)
virtual double Valuef ()

Public Attributes

int colortype
int max
int oldcolor [5]
int color1 [5]
int color2 [5]
intcolors

Detailed Description

Defines various simple conversions between rgb, cmyk, gray, and hsv.


Member Function Documentation

char * Laxkit::ColorBase::HexValue ( char buffer)
virtual

buffer must be at least 10 characters long, or you will segfault.

Puts something like "#ff00abff" (without the quotes) in buffer. Returns buffer.

Referenced by Laxkit::ColorSliders::EditHex().

void Laxkit::ColorBase::SetCMYK ( int  c,
int  m,
int  y,
int  k,
int  a = -1 
)
virtual

Set the channel when the value is >= 0.

Any values over max are clamped.

Any call to this function will set the color mode to LAX_COLOR_CMYK.

Referenced by LaxInterfaces::ViewportWithStack::Event(), and LaxInterfaces::ViewerWindow::Event().

void Laxkit::ColorBase::SetCMYK ( double  c,
double  m,
double  y,
double  k,
double  a = -1 
)
virtual

Values in [0..1].

void Laxkit::ColorBase::SetGray ( int  g,
int  a = -1 
)
virtual

Set the channel when the value is >= 0.

Any values over max are clamped.

Any call to this function will set the color mode to LAX_COLOR_CMYK.

Referenced by LaxInterfaces::ViewportWithStack::Event(), and LaxInterfaces::ViewerWindow::Event().

int Laxkit::ColorBase::SetHexValue ( const char hex)
virtual

Return 0 for success, or 1 for parse error. hex must be something like "#00ff00ff", with 8 digits. The '#' is optional.

Referenced by Laxkit::ColorSliders::Event().

void Laxkit::ColorBase::SetRGB ( int  r,
int  g,
int  b,
int  a = -1 
)
virtual

Set the channel when the value is >= 0.

Any values over max are clamped.

Any call to this function will set the color mode to LAX_COLOR_RGB.

Referenced by LaxInterfaces::ViewportWithStack::Event(), and LaxInterfaces::ViewerWindow::Event().

void Laxkit::ColorBase::SetRGB ( double  rr,
double  gg,
double  bb,
double  aa = -1 
)
virtual

Values in [0..1].

void Laxkit::ColorBase::Updated ( )
virtual

Called when a value is changed through any of the various color setting functions.

Default is do nothing.


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

Mon Feb 17 2014 11:52:59, Laxkit