Public Member Functions | Static Public Attributes | Private Attributes

LibBoard::Color Class Reference

Structure representing an RGB triple. More...

#include <Color.h>

Collaboration diagram for LibBoard::Color:
Collaboration graph

Public Member Functions

 Color (const unsigned int rgb, unsigned char alpha=255)
 Color (unsigned char redValue, unsigned char greenValue, unsigned char blueValue, unsigned char alphaValue=255)
 Color (unsigned char grayValue, unsigned char alphaValue=255)
 Color (const bool validColor=true)
void red (unsigned char red)
void green (unsigned char green)
void blue (unsigned char blue)
void alpha (unsigned char alpha)
unsigned char red () const
unsigned char green () const
unsigned char blue () const
unsigned char alpha () const
ColorsetRGBi (const unsigned char red, const unsigned char green, const unsigned char blue, const unsigned char alpha=255)
ColorsetRGBf (float red, float green, float blue, float alpha=1.0)
bool operator== (const Color &other) const
bool operator!= (const Color &other) const
bool operator< (const Color &other) const
void flushPostscript (std::ostream &) const
std::string svg () const
std::string svgAlpha (const char *prefix) const
std::string postscript () const
bool valid () const

Static Public Attributes

static const Color None
static const Color Black
static const Color Gray
static const Color White
static const Color Red
static const Color Green
static const Color Lime
static const Color Blue
static const Color Cyan
static const Color Magenta
static const Color Yellow
static const Color Silver
static const Color Purple
static const Color Navy
static const Color Aqua

Private Attributes

int _red
int _green
int _blue
int _alpha

Detailed Description

Structure representing an RGB triple.

Color structure.

Constructor & Destructor Documentation

LibBoard::Color::Color ( const unsigned int  rgb,
unsigned char  alpha = 255 

References _blue, _green, and _red.

LibBoard::Color::Color ( unsigned char  redValue,
unsigned char  greenValue,
unsigned char  blueValue,
unsigned char  alphaValue = 255 
) [inline]
LibBoard::Color::Color ( unsigned char  grayValue,
unsigned char  alphaValue = 255 
) [inline]
LibBoard::Color::Color ( const bool  validColor = true  )  [inline]

References _blue, _green, and _red.

Member Function Documentation

void LibBoard::Color::alpha ( unsigned char  alpha  )  [inline]

References _alpha.

unsigned char LibBoard::Color::alpha (  )  const [inline]

References _alpha.

void LibBoard::Color::blue ( unsigned char  blue  )  [inline]
unsigned char LibBoard::Color::blue (  )  const [inline]

References _blue.

void LibBoard::Color::flushPostscript ( std::ostream &  stream  )  const

References _blue, _green, and _red.

Referenced by LibBoard::Polyline::flushPostscript().

unsigned char LibBoard::Color::green (  )  const [inline]

References _green.

void LibBoard::Color::green ( unsigned char  green  )  [inline]
bool LibBoard::Color::operator!= ( const Color other  )  const

References _alpha, _blue, _green, and _red.

bool LibBoard::Color::operator< ( const Color other  )  const

References _alpha, _blue, _green, and _red.

bool LibBoard::Color::operator== ( const Color other  )  const

References _alpha, _blue, _green, and _red.

string LibBoard::Color::postscript (  )  const
void LibBoard::Color::red ( unsigned char  red  )  [inline]
unsigned char LibBoard::Color::red (  )  const [inline]

References _red.

Color & LibBoard::Color::setRGBf ( float  red,
float  green,
float  blue,
float  alpha = 1.0 
Color & LibBoard::Color::setRGBi ( const unsigned char  red,
const unsigned char  green,
const unsigned char  blue,
const unsigned char  alpha = 255 
) [inline]
string LibBoard::Color::svg (  )  const
string LibBoard::Color::svgAlpha ( const char *  prefix  )  const

Return a an SVG parameter string for the opacity value.

prefix A prefix string to be appended to the returned string if not empty.
An empty string if alpha == 255, otherwise the string <prefix>-opacity="<alpha-value>".

References _alpha, None, and secured_sprintf.

Referenced by LibBoard::Text::flushSVG(), LibBoard::Arrow::flushSVG(), and LibBoard::Shape::svgProperties().

bool LibBoard::Color::valid (  )  const [inline]

Field Documentation

int LibBoard::Color::_alpha [private]
int LibBoard::Color::_blue [private]
int LibBoard::Color::_green [private]
int LibBoard::Color::_red [private]
const Color LibBoard::Color::Aqua [static]
const Color LibBoard::Color::Black [static]
const Color LibBoard::Color::Blue [static]
const Color LibBoard::Color::Cyan [static]
const Color LibBoard::Color::Gray [static]
const Color LibBoard::Color::Green [static]
const Color LibBoard::Color::Lime [static]
const Color LibBoard::Color::Navy [static]
const Color LibBoard::Color::None [static]
const Color LibBoard::Color::Red [static]
const Color LibBoard::Color::White [static]

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