DGtal 2.0.0
|
Structure representing an RGB triple with alpha component. More...
#include <DGtal/io/Color.h>
Public Member Functions | |
~Color ()=default | |
Color (const unsigned int aRgb, unsigned char aAlpha=255) | |
Color (const Color &aColor)=default | |
Color (const unsigned char aRedValue, const unsigned char aGreenValue, const unsigned char aBlueValue, const unsigned char aAlphaValue=255) | |
Color (unsigned char aGrayValue, unsigned char aAlphaValue=255) | |
Color () | |
void | red (const unsigned char aRedValue) |
void | green (const unsigned char aGreenValue) |
void | blue (const unsigned char aBlueValue) |
void | alpha (const unsigned char aAlphaValue) |
unsigned char | red () const |
unsigned char | green () const |
unsigned char | blue () const |
unsigned char | alpha () const |
double | r () const |
double | g () const |
double | b () const |
double | a () const |
Color & | setRGBi (const unsigned char aRedValue, const unsigned char aGreenValue, const unsigned char aBlueValue, const unsigned char aAlphaValue=255) |
Color & | setRGBA (DGtal::uint32_t aRGBA) |
Color & | setFromHSV (const double h, const double s, const double v) |
std::array< double, 3 > | getHSV () const |
DGtal::uint32_t | getRGB () const |
DGtal::uint32_t | getRGBA () const |
bool | valid () const |
void | selfDisplay (std::ostream &out) const |
bool | isValid () const |
Color & | setRGBf (float red, float green, float blue, float alpha=1.0) |
bool | operator== (const Color &aColor) const |
bool | operator!= (const Color &aColor) const |
bool | operator< (const Color &aColor) const |
bool | operator> (const Color &aColor) const |
bool | operator<= (const Color &aColor) const |
bool | operator>= (const Color &aColor) const |
Color & | operator+= (const Color &v) |
Color | operator+ (const Color &v) const |
Color & | operator-= (const Color &v) |
Color | operator- (const Color &v) const |
Color & | operator*= (const double coeff) |
Color | operator* (const double coeff) const |
Color & | operator= (const Color &pv)=default |
void | flushPostscript (std::ostream &) const |
std::string | svg () const |
std::string | svgAlpha (const char *aPrefix) const |
std::string | postscript () const |
std::string | tikz () const |
Static Public Member Functions | |
static void | HSVtoRGB (double &r, double &g, double &b, double h, const double s, const double v) |
static void | RGBtoHSV (double &h, double &s, double &v, const unsigned char r, const unsigned char g, const unsigned char b) |
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 Member Functions | |
unsigned char | clamp (const double value) const |
Private Attributes | |
unsigned char | myRed |
unsigned char | myGreen |
unsigned char | myBlue |
unsigned char | myAlpha |
Structure representing an RGB triple with alpha component.
Description of class 'Color'
|
default |
Destructor.
DGtal::Color::Color | ( | const unsigned int | aRgb, |
unsigned char | aAlpha = 255 ) |
Constructor.
aRgb | an unsigned int representing the color. |
aAlpha | color transparency (default value =255); |
Referenced by Color(), operator!=(), operator*(), operator*=(), operator+(), operator+=(), operator-(), operator-=(), operator<(), operator<=(), operator=(), operator==(), operator>(), operator>=(), setFromHSV(), setRGBA(), setRGBf(), and setRGBi().
|
default |
|
inline |
|
inline |
|
inline |
double DGtal::Color::a | ( | ) | const |
unsigned char DGtal::Color::alpha | ( | ) | const |
void DGtal::Color::alpha | ( | const unsigned char | aAlphaValue | ) |
Referenced by setRGBf().
double DGtal::Color::b | ( | ) | const |
Referenced by HSVtoRGB(), RGBtoHSV(), and setFromHSV().
unsigned char DGtal::Color::blue | ( | ) | const |
Referenced by getHSV().
void DGtal::Color::blue | ( | const unsigned char | aBlueValue | ) |
Referenced by LibBoard::Board::fillGouraudTriangle(), LibBoard::GouraudTriangle::GouraudTriangle(), main(), DGtal::functors::BlueChannel::operator()(), DGtal::functors::MeanChannels::operator()(), setRGBf(), and testGrayscaleColorMap().
|
inlineprivate |
Clamp an int to [0,255]
[in] | value | the value to clamp |
Definition at line 459 of file Color.h.
Referenced by operator*(), operator*=(), operator+(), operator+=(), operator-(), and operator-=().
void DGtal::Color::flushPostscript | ( | std::ostream & | ) | const |
double DGtal::Color::g | ( | ) | const |
Referenced by HSVtoRGB(), RGBtoHSV(), and setFromHSV().
|
inline |
Definition at line 201 of file Color.h.
References blue(), green(), red(), and RGBtoHSV().
DGtal::uint32_t DGtal::Color::getRGB | ( | ) | const |
Referenced by DGtal::functors::ColorRGBEncoder< TValue >::operator()().
DGtal::uint32_t DGtal::Color::getRGBA | ( | ) | const |
unsigned char DGtal::Color::green | ( | ) | const |
Referenced by getHSV().
void DGtal::Color::green | ( | const unsigned char | aGreenValue | ) |
Referenced by LibBoard::Board::fillGouraudTriangle(), LibBoard::GouraudTriangle::GouraudTriangle(), main(), DGtal::functors::GreenChannel::operator()(), DGtal::functors::MeanChannels::operator()(), setRGBf(), and testGrayscaleColorMap().
|
static |
Converts a color from the HSV (Hue,Saturation,Value) space to the RGB space.
r | The red component (out). |
g | The green component (out). |
b | The blue component (out). |
h | The hue of the color in [0..360) |
s | The saturation of the color in [0..1]. |
v | The value of the color in [0..1]. |
Referenced by setFromHSV().
bool DGtal::Color::isValid | ( | ) | const |
Checks the validity/consistency of the object.
|
inline |
Multiplication by a scalar (component-wise)
coeff | the scalar. |
Definition at line 373 of file Color.h.
References clamp(), Color(), myAlpha, myBlue, myGreen, and myRed.
|
inline |
Multiplication by a scalar (component-wise)
coeff | the scalar |
Definition at line 354 of file Color.h.
References clamp(), Color(), myAlpha, myBlue, myGreen, and myRed.
Addition operator.
v | is the Color that gets added to *this. |
Definition at line 288 of file Color.h.
References clamp(), Color(), myAlpha, myBlue, myGreen, and myRed.
Addition operator with assignement.
v | is the Color that gets added to *this. |
Definition at line 268 of file Color.h.
References clamp(), Color(), myAlpha, myBlue, myGreen, and myRed.
Substraction operator.
v | is the Color that gets substacted to *this. |
Definition at line 330 of file Color.h.
References clamp(), Color(), myAlpha, myBlue, myGreen, and myRed.
Substraction operator with assignement.
v | is the Point that gets substracted to *this. |
Definition at line 311 of file Color.h.
References clamp(), Color(), myAlpha, myBlue, myGreen, and myRed.
Assignement Operator
pv | the object to copy. |
References Color().
std::string DGtal::Color::postscript | ( | ) | const |
double DGtal::Color::r | ( | ) | const |
Referenced by HSVtoRGB(), RGBtoHSV(), and setFromHSV().
unsigned char DGtal::Color::red | ( | ) | const |
Referenced by getHSV().
void DGtal::Color::red | ( | const unsigned char | aRedValue | ) |
Referenced by LibBoard::Board::fillGouraudTriangle(), LibBoard::GouraudTriangle::GouraudTriangle(), main(), DGtal::functors::MeanChannels::operator()(), DGtal::functors::RedChannel::operator()(), setRGBf(), and testGrayscaleColorMap().
|
static |
Converts a color from the RGB space to the HSV (Hue,Saturation,Value) space.
h | (out) The hue of the color in [0..360) |
s | (out) The saturation of the color in [0..1]. |
v | (out) The value of the color in [0..1]. |
r | The red component. |
g | The green component. |
b | The blue component. |
Referenced by getHSV().
void DGtal::Color::selfDisplay | ( | std::ostream & | out | ) | const |
Writes/Displays the object on an output stream.
out | the output stream where the object is written. |
|
inline |
Set the color from HSV values
h | hue |
s | saturation |
v | value |
Definition at line 193 of file Color.h.
References b(), Color(), g(), HSVtoRGB(), r(), and setRGBf().
Color & DGtal::Color::setRGBA | ( | DGtal::uint32_t | aRGBA | ) |
Color & DGtal::Color::setRGBf | ( | float | red, |
float | green, | ||
float | blue, | ||
float | alpha = 1.0 ) |
Color & DGtal::Color::setRGBi | ( | const unsigned char | aRedValue, |
const unsigned char | aGreenValue, | ||
const unsigned char | aBlueValue, | ||
const unsigned char | aAlphaValue = 255 ) |
References Color().
Referenced by testColor().
std::string DGtal::Color::svg | ( | ) | const |
std::string DGtal::Color::svgAlpha | ( | const char * | aPrefix | ) | const |
Return a an SVG parameter string for the opacity value.
aPrefix | A prefix string to be appended to the returned string if not empty. |
std::string DGtal::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.
bool DGtal::Color::valid | ( | ) | const |
|
static |
Definition at line 422 of file Color.h.
Referenced by addColorMapSample(), drawCCP(), drawPolygon(), DGtal::Shortcuts< Z3i::KSpace >::getZeroTickedColorMap(), main(), main(), main(), saveToObj(), LibBoard::Board::State::State(), testBreadthFirstPropagation(), testCMAP(), testDepthFirstPropagation(), testDistancePropagation(), testGrayscaleColorMap(), LibBoard::Text::Text(), LibBoard::Text::Text(), DGtal::SurfaceMeshWriter< RealPoint, RealVector >::writeEdgeLinesOBJ(), DGtal::SurfaceMeshWriter< RealPoint, RealVector >::writeIsoLinesOBJ(), and DGtal::SurfaceMeshWriter< RealPoint, RealVector >::writeIsoLinesOBJ().
|
static |
Definition at line 428 of file Color.h.
Referenced by convexHull(), drawCCP(), main(), main(), main(), showGreedySegmantation(), testAlphaThickSegmentConvexHullAndBox(), testAlphaThickSegmentFreeman(), testAlphaThickSpecialInit(), testConvexHullCompThickness(), testMeshGeneration(), testThicknessDefinitions(), and testVisualTubularMesh().
|
static |
|
static |
Definition at line 423 of file Color.h.
Referenced by main(), testAlphaThickSegmentComputerFloatingPointContour(), testAlphaThickSegmentConvexHullAndBox(), and testThicknessDefinitions().
|
static |
Definition at line 426 of file Color.h.
Referenced by drawCCP(), main(), main(), main(), testAlphaThickSegmentConvexHullAndBox(), testAlphaThickSegmentFreeman(), testAlphaThickSpecialInit(), testMeshGeneration(), and testThicknessDefinitions().
|
static |
Definition at line 430 of file Color.h.
Referenced by main(), main(), and testAlphaThickSegmentConvexHullAndBox().
|
private |
The opacity.
Definition at line 445 of file Color.h.
Referenced by Color(), Color(), Color(), operator*(), operator*=(), operator+(), operator+=(), operator-(), and operator-=().
|
private |
The blue component.
Definition at line 444 of file Color.h.
Referenced by Color(), Color(), Color(), operator*(), operator*=(), operator+(), operator+=(), operator-(), and operator-=().
|
private |
The green component.
Definition at line 443 of file Color.h.
Referenced by Color(), Color(), Color(), operator*(), operator*=(), operator+(), operator+=(), operator-(), and operator-=().
|
private |
The red component.
Definition at line 442 of file Color.h.
Referenced by Color(), Color(), Color(), operator*(), operator*=(), operator+(), operator+=(), operator-(), and operator-=().
|
static |
Definition at line 421 of file Color.h.
Referenced by addColorMapSample(), DGtal::Board2D::Board2D(), LibBoard::Board::drawArc(), LibBoard::Board::drawArrow(), LibBoard::Board::fillCircle(), LibBoard::Shape::filled(), LibBoard::Board::fillEllipse(), LibBoard::Board::fillPolyline(), LibBoard::Board::fillRectangle(), LibBoard::Board::fillTriangle(), LibBoard::Board::fillTriangle(), LibBoard::Arc::flushCairo(), LibBoard::Arrow::flushCairo(), LibBoard::Circle::flushCairo(), LibBoard::Ellipse::flushCairo(), LibBoard::Polyline::flushCairo(), LibBoard::QuadraticBezierCurve::flushCairo(), LibBoard::Rectangle::flushCairo(), LibBoard::GouraudTriangle::flushFIG(), LibBoard::Arc::flushPostscript(), LibBoard::Ellipse::flushPostscript(), LibBoard::Polyline::flushPostscript(), LibBoard::QuadraticBezierCurve::flushPostscript(), DGtal::GradientColorMap< Scalar >::GradientColorMap(), main(), main(), main(), LibBoard::Board::saveCairo(), LibBoard::Board::saveEPS(), LibBoard::Board::saveFIG(), DGtal::Shortcuts< Z3i::KSpace >::saveOFF(), DGtal::Shortcuts< Z3i::KSpace >::saveOFF(), DGtal::Shortcuts< Z3i::KSpace >::saveOFF(), LibBoard::Board::saveSVG(), LibBoard::Board::saveTikZ(), LibBoard::Board::State::State(), LibBoard::Shape::svgProperties(), testAlphaThickSegmentConvexHullAndBox(), testComputeInterior(), testMultiWidth(), and testThicknessDefinitions().
|
static |
Definition at line 433 of file Color.h.
Referenced by testAlphaThickSegmentConvexHullAndBox(), testMeshReader(), and testThicknessDefinitions().
|
static |
Definition at line 425 of file Color.h.
Referenced by convexHull(), drawCCP(), drawPolygon(), laplacian(), main(), main(), main(), DGtal::RandomColorMap::RandomColorMap(), saveToObj(), MyDrawStyleCustomRed::setStyle(), specificTestLatticePolytope2D(), testAlphaThickSegmentConvexHullAndBox(), testBreadthFirstPropagation(), testCMAP(), testColor(), testComputeInterior(), testConvexHullCompThickness(), testDepthFirstPropagation(), testDisplay(), testDistancePropagation(), testMesh(), testMeshReader(), and testThicknessDefinitions().
|
static |
Definition at line 424 of file Color.h.
Referenced by DGtal::Mesh< RealPoint >::addFace(), DGtal::Mesh< RealPoint >::addQuadFace(), DGtal::Mesh< RealPoint >::addTriangularFace(), DGtal::Mesh< RealPoint >::createMeshFromHeightSequence(), DGtal::Mesh< RealPoint >::createTubularMesh(), DGtal::Mesh< RealPoint >::createTubularMesh(), DGtal::MeshHelpers::exportOBJwithFaceNormalAndColor(), DGtal::MeshHelpers::exportOBJwithFaceNormalAndColor(), main(), main(), DGtal::Shortcuts< Z3i::KSpace >::makeMesh(), DGtal::Shortcuts< Z3i::KSpace >::makeMesh(), DGtal::RandomColorMap::RandomColorMap(), DGtal::Shortcuts< Z3i::KSpace >::saveOBJ(), DGtal::Shortcuts< Z3i::KSpace >::saveOBJ(), DGtal::Shortcuts< Z3i::KSpace >::saveOBJ(), DGtal::Shortcuts< Z3i::KSpace >::saveOBJ(), DGtal::Shortcuts< Z3i::KSpace >::saveOBJ(), DGtal::Shortcuts< Z3i::KSpace >::saveOBJ(), DGtal::Shortcuts< Z3i::KSpace >::saveVectorFieldOBJ(), testGrayscaleColorMap(), testMesh(), testTickedColorMap(), DGtal::TickedColorMap< Scalar, ColorMap >::TickedColorMap(), DGtal::TickedColorMap< Scalar, ColorMap >::TickedColorMap(), and DGtal::SurfaceMeshWriter< RealPoint, RealVector >::writeOBJ().
|
static |
Definition at line 431 of file Color.h.
Referenced by drawCCP(), main(), main(), testAlphaThickSegmentConvexHullAndBox(), and testMeshGeneration().