32#if defined(Color_RECURSES)
33#error Recursive header files inclusion detected in Color.h
45#include "DGtal/base/Common.h"
46#include <boost/lexical_cast.hpp>
87 Color(
const unsigned int aRgb,
88 unsigned char aAlpha = 255 );
106 Color(
const unsigned char aRedValue,
107 const unsigned char aGreenValue,
108 const unsigned char aBlueValue,
109 const unsigned char aAlphaValue = 255 )
121 unsigned char aAlphaValue = 255 )
136 void red(
const unsigned char aRedValue );
138 void green(
const unsigned char aGreenValue );
140 void blue(
const unsigned char aBlueValue );
142 void alpha(
const unsigned char aAlphaValue );
144 unsigned char red()
const ;
163 const unsigned char aGreenValue,
164 const unsigned char aBlueValue,
165 const unsigned char aAlphaValue = 255);
188 return this->
setRGBf((
float)r,(
float)g,(
float)b);
264#ifdef COLOR_WITH_ALPHA_ARITH
285#ifdef COLOR_WITH_ALPHA_ARITH
307#ifdef COLOR_WITH_ALPHA_ARITH
327#ifdef COLOR_WITH_ALPHA_ARITH
347 this->
myRed = clamp((
double)this->
myRed*coeff);
350#ifdef COLOR_WITH_ALPHA_ARITH
368 c.myBlue = clamp((
double)this->
myBlue*coeff);
369 c.myGreen = clamp((
double)this->
myGreen*coeff);
370#ifdef COLOR_WITH_ALPHA_ARITH
371 c.myAlpha = clamp((
double)this->
myAlpha*coeff);
388 std::string
svg()
const;
398 std::string
svgAlpha(
const char * aPrefix )
const;
410 std::string
tikz()
const;
450 unsigned char clamp(
const double value)
const
452 return static_cast<unsigned char>(std::max( std::min(value, 255.0), 0.0));
469 static void HSVtoRGB(
double &r,
double &g,
double &b,
470 double h,
const double s,
const double v);
482 static void RGBtoHSV(
double & h,
double & s,
double & v,
483 const unsigned char r,
484 const unsigned char g,
485 const unsigned char b );
506 const Color &aColor );
525#include "DGtal/io/Color.ih"
Structure representing an RGB triple with alpha component.
static const Color Purple
Color(const Color &aColor)=default
unsigned char blue() const
std::string postscript() const
unsigned char red() const
Color operator+(const Color &v) const
Color & operator-=(const Color &v)
Color & setRGBi(const unsigned char aRedValue, const unsigned char aGreenValue, const unsigned char aBlueValue, const unsigned char aAlphaValue=255)
static const Color Yellow
bool operator>(const Color &aColor) const
void flushPostscript(std::ostream &) const
Color & setRGBA(DGtal::uint32_t aRGBA)
DGtal::uint32_t getRGB() const
std::array< double, 3 > getHSV() const
bool operator<(const Color &aColor) const
Color operator-(const Color &v) const
void green(const unsigned char aGreenValue)
bool operator==(const Color &aColor) const
static void RGBtoHSV(double &h, double &s, double &v, const unsigned char r, const unsigned char g, const unsigned char b)
Color & setFromHSV(const double h, const double s, const double v)
Color & operator+=(const Color &v)
void selfDisplay(std::ostream &out) const
bool operator!=(const Color &aColor) const
bool operator<=(const Color &aColor) const
static void HSVtoRGB(double &r, double &g, double &b, double h, const double s, const double v)
Color operator*(const double coeff) const
Color(unsigned char aGrayValue, unsigned char aAlphaValue=255)
static const Color Silver
void red(const unsigned char aRedValue)
void alpha(const unsigned char aAlphaValue)
unsigned char clamp(const double value) const
unsigned char green() const
Color & setRGBf(float red, float green, float blue, float alpha=1.0)
bool operator>=(const Color &aColor) const
Color & operator*=(const double coeff)
std::string svgAlpha(const char *aPrefix) const
Color & operator=(const Color &pv)=default
unsigned char alpha() const
Color(const unsigned char aRedValue, const unsigned char aGreenValue, const unsigned char aBlueValue, const unsigned char aAlphaValue=255)
void blue(const unsigned char aBlueValue)
static const Color Magenta
DGtal::uint32_t getRGBA() const
DGtal is the top-level namespace which contains all DGtal functions and types.
KForm< Calculus, order, duality > operator*(const typename Calculus::Scalar &scalar, const KForm< Calculus, order, duality > &form)
boost::uint32_t uint32_t
unsigned 32-bit integer.
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)