32#if defined(Color_RECURSES)
33#error Recursive header files inclusion detected in Color.h
44#include <DGtal/base/BasicTypes.h>
51#ifndef secured_sprintf
53#define secured_sprintf sprintf_s
56#define secured_sprintf snprintf
97 unsigned char aAlpha = 255 );
115 Color(
const unsigned char aRedValue,
116 const unsigned char aGreenValue,
117 const unsigned char aBlueValue,
118 const unsigned char aAlphaValue = 255 )
115 Color(
const unsigned char aRedValue, {
…}
130 unsigned char aAlphaValue = 255 )
145 void red(
const unsigned char aRedValue );
147 void green(
const unsigned char aGreenValue );
149 void blue(
const unsigned char aBlueValue );
151 void alpha(
const unsigned char aAlphaValue );
153 unsigned char red()
const ;
172 const unsigned char aGreenValue,
173 const unsigned char aBlueValue,
174 const unsigned char aAlphaValue = 255);
197 return this->
setRGBf((
float)r,(
float)
g,(
float)
b);
273#ifdef COLOR_WITH_ALPHA_ARITH
294#ifdef COLOR_WITH_ALPHA_ARITH
316#ifdef COLOR_WITH_ALPHA_ARITH
336#ifdef COLOR_WITH_ALPHA_ARITH
359#ifdef COLOR_WITH_ALPHA_ARITH
379#ifdef COLOR_WITH_ALPHA_ARITH
407 std::string
svgAlpha(
const char * aPrefix )
const;
459 unsigned char clamp(
const double value)
const
461 return static_cast<unsigned char>(std::max( std::min(value, 255.0), 0.0));
459 unsigned char clamp(
const double value)
const {
…}
479 double h,
const double s,
const double v);
491 static void RGBtoHSV(
double & h,
double & s,
double & v,
492 const unsigned char r,
493 const unsigned char g,
494 const unsigned char b );
515 const Color &aColor );
534#include "DGtal/io/Color.ih"
Structure representing an RGB triple with alpha component.
Color(const Color &aColor)=default
unsigned char blue() const
std::string svgAlpha(const char *aPrefix) 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)
std::string postscript() const
static const Color Purple
bool operator>(const Color &aColor) const
void flushPostscript(std::ostream &) const
DGtal::uint32_t getRGB() const
std::array< double, 3 > getHSV() const
Color(const unsigned int aRgb, unsigned char aAlpha=255)
bool operator<(const Color &aColor) const
Color operator-(const Color &v) const
static const Color Silver
Color & setRGBA(DGtal::uint32_t aRGBA)
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)
void red(const unsigned char aRedValue)
void alpha(const unsigned char aAlphaValue)
unsigned char clamp(const double value) const
unsigned char green() const
static const Color Yellow
bool operator>=(const Color &aColor) const
Color & operator*=(const double coeff)
Color & setRGBf(float red, float green, float blue, float alpha=1.0)
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)
std::uint32_t uint32_t
unsigned 32-bit integer.
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)