Board 0.9.6
|
Structure representing an RGB triple. More...
#include <Color.h>
Public Member Functions | |
Color () | |
Color (const unsigned int rgb, unsigned char alpha=255) | |
Color (unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha=255) | |
Color (unsigned char gray, unsigned char alpha=255) | |
Color (const std::string &htmlColor, unsigned char alpha) | |
Build a color from an HTML color string (#RRGGBB) | |
Color (const std::string &htmlColor) | |
Build a color from an HTML color string (#RRGGBB or #RRGGBBAA) | |
Color (const char *htmlColor, unsigned char alpha=255) | |
Color (std::nullptr_t) | |
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 |
Color & | setRGBi (const unsigned char red, const unsigned char green, const unsigned char blue, const unsigned char alpha=255) |
setRGBi | |
Color & | setHSV (float hue, float saturation, float value, float alpha=1.0) |
setHSV | |
Color & | setRGBf (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 |
bool | isNull () const |
bool | isValid () const |
std::string | svgAlpha (const char *prefix) const |
std::string | postscript () const |
std::string | tikz () const |
void | toHSV (float &hue, float &saturation, float &value, float &alpha) const |
bool | valid () const |
std::ostream & | flush (std::ostream &out) const |
Static Public Member Functions | |
static Color | fromRGBf (float red, float green, float blue, float alpha=1.0f) |
static Color | gray (unsigned char grayLevel, unsigned char alpha=255) |
static Color | fromHSV (float hue, float saturation, float value, float alpha=1.0f) |
static Color | mixRGB (const Color &a, const Color &b, float t) |
static Color | mixHSV (const Color &a, const Color &b, float t) |
static Color | fromHueColormap (float t) |
Static Public Attributes | |
static const Color | Null |
static const Color | Black |
static const Color | Brown |
static const Color | Pink |
static const Color | Gray |
static const Color | White |
static const Color | Red |
static const Color | Green |
static const Color | DarkGreen |
static const Color | Lime |
static const Color | Blue |
static const Color | Cyan |
static const Color | DarkCyan |
static const Color | Magenta |
static const Color | Yellow |
static const Color | Silver |
static const Color | Purple |
static const Color | Navy |
static const Color | Aqua |
Structure representing an RGB triple.
Color structure.
|
inline |
Referenced by fromRGBf(), and gray().
|
inline |
|
inline |
|
inline |
|
inline |
Build a color from an HTML color string (#RRGGBB)
htmlColor | An HTML color string |
alpha | The alpha value |
|
inline |
Build a color from an HTML color string (#RRGGBB or #RRGGBBAA)
htmlColor | An HTML color string |
|
inline |
References alpha(), LibBoard::Tools::error, and Null.
|
inline |
Create a null color
|
inline |
|
inline |
|
inline |
Referenced by blue(), fromRGBf(), mixRGB(), setRGBf(), and setRGBi().
|
inline |
References blue().
Referenced by LibBoard::Board::fillGouraudTriangle(), LibBoard::GouraudTriangle::flushFIG(), LibBoard::GouraudTriangle::flushPostscript(), LibBoard::GouraudTriangle::flushSVG(), LibBoard::GouraudTriangle::GouraudTriangle(), LibBoard::GouraudTriangle::GouraudTriangle(), and mixRGB().
std::ostream & LibBoard::Color::flush | ( | std::ostream & | out | ) | const |
References isNull(), and toHSV().
Referenced by LibBoard::operator<<().
void LibBoard::Color::flushPostscript | ( | std::ostream & | stream | ) | const |
Referenced by LibBoard::Bezier::flushPostscript(), and LibBoard::Polyline::flushPostscript().
|
static |
References alpha(), and setHSV().
Referenced by fromHueColormap(), and mixHSV().
|
static |
References fromHSV().
Referenced by main(), and mustache().
|
inlinestatic |
|
inlinestatic |
|
inline |
Referenced by fromRGBf(), green(), mixRGB(), setRGBf(), and setRGBi().
|
inline |
References green().
Referenced by LibBoard::Board::fillGouraudTriangle(), LibBoard::GouraudTriangle::flushFIG(), LibBoard::GouraudTriangle::flushPostscript(), LibBoard::GouraudTriangle::flushSVG(), LibBoard::GouraudTriangle::GouraudTriangle(), LibBoard::GouraudTriangle::GouraudTriangle(), and mixRGB().
|
inline |
Referenced by flush(), isValid(), and LibBoard::RoughVisitor::map().
|
inline |
References isNull().
References fromHSV(), and toHSV().
Referenced by mustache().
References alpha(), alpha(), blue(), blue(), fromRGBf(), green(), green(), red(), and red().
Referenced by LibBoard::mix().
bool LibBoard::Color::operator!= | ( | const Color & | other | ) | const |
bool LibBoard::Color::operator< | ( | const Color & | other | ) | const |
bool LibBoard::Color::operator== | ( | const Color & | other | ) | const |
string LibBoard::Color::postscript | ( | ) | const |
|
inline |
Referenced by fromRGBf(), mixRGB(), red(), setRGBf(), and setRGBi().
|
inline |
References red().
Referenced by LibBoard::Board::fillGouraudTriangle(), LibBoard::GouraudTriangle::flushFIG(), LibBoard::GouraudTriangle::flushPostscript(), LibBoard::GouraudTriangle::flushSVG(), LibBoard::GouraudTriangle::GouraudTriangle(), LibBoard::GouraudTriangle::GouraudTriangle(), and mixRGB().
Color & LibBoard::Color::setHSV | ( | float | hue, |
float | saturation, | ||
float | value, | ||
float | alpha = 1.0 |
||
) |
setHSV
hue | |
saturation | |
value | |
alpha |
References alpha().
Referenced by fromHSV(), and LibBoard::Board::setFillColorHSV().
Color & LibBoard::Color::setRGBf | ( | float | red, |
float | green, | ||
float | blue, | ||
float | alpha = 1.0 |
||
) |
References alpha(), blue(), LibBoard::Tools::clamp(), green(), and red().
Referenced by main(), LibBoard::Board::setFillColorRGBf(), and LibBoard::Board::setPenColorRGBf().
|
inline |
setRGBi
red | |
green | |
blue | |
alpha |
References alpha(), blue(), green(), and red().
Referenced by LibBoard::Board::setFillColorRGBi(), and LibBoard::Board::setPenColorRGBi().
string LibBoard::Color::svg | ( | ) | const |
References Null, and secured_sprintf.
Referenced by LibBoard::Text::flushSVG(), and LibBoard::Style::svgProperties().
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. |
References Null, and secured_sprintf.
Referenced by LibBoard::Text::flushSVG(), and LibBoard::Style::svgProperties().
string LibBoard::Color::tikz | ( | ) | const |
Return a string representation of the color usable in TikZ commands. Use the corresponding named color (or a mixture of a named color and black) for predefined colors. Use a mixture of red, green and blue for general colors.
References Black, Blue, Gray, Green, Lime, Navy, Null, Purple, Red, secured_sprintf, Silver, and White.
Referenced by LibBoard::Style::tikzProperties().
void LibBoard::Color::toHSV | ( | float & | hue, |
float & | saturation, | ||
float & | value, | ||
float & | alpha | ||
) | const |
|
inline |
References Null.
Referenced by LibBoard::Arrow::flushFIG(), LibBoard::Dot::flushFIG(), LibBoard::Ellipse::flushFIG(), LibBoard::Line::flushFIG(), LibBoard::Polyline::flushFIG(), and LibBoard::Board::saveFIG().
|
static |
|
static |
|
static |
Referenced by LeaveBox(), main(), strikeOut(), and tikz().
|
static |
Referenced by main(), and polygons().
|
static |
|
static |
Referenced by interpolate(), main(), rough(), and tikz().
|
static |
Referenced by ell(), interpolate(), main(), merge(), rough(), slide(), space_invader(), strikeOut(), and tikz().
|
static |
Referenced by LibBoard::array(), LibBoard::Arrow::Arrow(), LibBoard::Arrow::Arrow(), LibBoard::Arrow::Arrow(), LibBoard::Arrow::Arrow(), LibBoard::boardFontText(), Color(), LibBoard::Board::fillCircle(), LibBoard::ShapeWithStyle::filled(), LibBoard::Board::fillEllipse(), LibBoard::Board::fillPolyline(), LibBoard::Board::fillRectangle(), LibBoard::Board::fillTriangle(), LibBoard::Board::fillTriangle(), LibBoard::Image::flushFIG(), LibBoard::GouraudTriangle::flushFIG(), LibBoard::Bezier::flushPostscript(), LibBoard::Ellipse::flushPostscript(), LibBoard::Polyline::flushPostscript(), LibBoard::Arrow::flushSVG(), generateGroup(), LibBoard::hachures(), LibBoard::hachuresLinesOrBezier(), LibBoard::Image::Image(), LeaveBox(), main(), LibBoard::RoughVisitor::map(), LibBoard::RoughVisitor::map(), LibBoard::RoughVisitor::map(), merge(), rough(), LibBoard::Board::saveEPS(), LibBoard::Board::saveFIG(), LibBoard::Board::saveSVG(), LibBoard::Board::saveTikZ(), LibBoard::Board::State::State(), strikeOut(), svg(), svgAlpha(), LibBoard::Style::svgProperties(), text(), tikz(), valid(), and LibBoard::BoundingBoxExtractor::visit().
|
static |
Referenced by diamond(), ell(), hachures(), hachuresBis(), hachuresTer(), interpolate(), main(), rough(), slide(), strikeOut(), text(), and tikz().
|
static |
Referenced by LibBoard::Arrow::flushPostscript(), LibBoard::Arrow::flushSVG(), main(), merge(), rough(), space_invader(), text(), and tikz().