30#include "DGtal/io/Color.h"
45 :myAlpha( aAlphaValue )
47 myRed = ( rgb & 0xFF0000u ) >> 16;
48 myGreen = ( rgb & 0xFF00u ) >> 8;
56 myRed = ( aRGBA & 0xFF000000u ) >> 24;
57 myGreen = ( aRGBA & 0xFF0000u ) >> 16;
58 myBlue = ( aRGBA & 0xFF00u ) >> 8;
59 myAlpha = aRGBA & 0xFF;
69 if ( aRedValue > 1.0f ) aRedValue = 1.0f;
70 if ( aRedValue < 0.0f ) aRedValue = 0.0f;
71 myRed =
static_cast<unsigned char>( 255 * aRedValue );
72 if ( aGreenValue > 1.0f ) aGreenValue = 1.0f;
73 if ( aGreenValue < 0.0f ) aGreenValue = 0.0f;
74 myGreen =
static_cast<unsigned char>( 255 * aGreenValue );
75 if ( aBlueValue > 1.0f ) aBlueValue = 1.0f;
76 if ( aBlueValue < 0.0f ) aBlueValue = 0.0f;
77 myBlue =
static_cast<unsigned char>( 255 * aBlueValue );
78 if ( aAlphaValue > 1.0f ) aAlphaValue = 1.0f;
79 if ( aAlphaValue < 0.0f ) aAlphaValue = 0.0f;
80 myAlpha =
static_cast<unsigned char>( 255 * aAlphaValue );
89 return myRed == aColor.
myRed
98 return myRed != aColor.
myRed
100 || myBlue != aColor.
myBlue
107 if ( myRed < aColor.
myRed )
109 if ( myRed == aColor.
myRed ) {
110 if ( myGreen < aColor.
myGreen )
112 if ( myGreen == aColor.
myGreen ) {
113 if ( myBlue < aColor.
myBlue )
115 if ( myBlue == aColor.
myBlue )
116 return myAlpha < aColor.
myAlpha;
144 stream << ((double)myRed/255.0) <<
" "
145 << ((
double)myGreen/255.0) <<
" "
146 << ((double)myBlue/255.0) <<
" srgb\n";
153 secured_sprintf( buffer, 255,
"%.4f %.4f %.4f", myRed/255.0, myGreen/255.0, myBlue/255.0 );
162 secured_sprintf( buffer, 255,
"rgb(%d,%d,%d)",myRed, myGreen, myBlue );
171 secured_sprintf( buffer, 255,
" %s-opacity=\"%f\"", prefix, myAlpha/255.0f );
195 secured_sprintf( buffer, 255,
"{rgb,255:red,%d;green,%d;blue,%d}", myRed, myGreen, myBlue );
227 out <<
"[Color] RGBA("<<(int)myRed<<
","<<(
int)myGreen<<
","<<(int)myBlue<<
","<<(
int)myAlpha<<
")";
Structure representing an RGB triple with alpha component.
static const Color Purple
std::string postscript() const
static const Color Yellow
bool operator>(const Color &aColor) const
void flushPostscript(std::ostream &) const
Color & setRGBA(DGtal::uint32_t aRGBA)
bool operator<(const Color &aColor) const
bool operator==(const Color &aColor) const
void selfDisplay(std::ostream &out) const
bool operator!=(const Color &aColor) const
bool operator<=(const Color &aColor) const
static const Color Silver
Color & setRGBf(float red, float green, float blue, float alpha=1.0)
bool operator>=(const Color &aColor) const
std::string svgAlpha(const char *aPrefix) const
static const Color Magenta
bool operator==(PointVector< ptDim, LeftEuclideanRing, LeftContainer > const &lhs, PointVector< ptDim, RightEuclideanRing, RightContainer > const &rhs)
Equality operator between two Points/Vectors.
boost::uint32_t uint32_t
unsigned 32-bit integer.
bool operator<(PointVector< ptDim, LeftEuclideanRing, LeftContainer > const &lhs, PointVector< ptDim, RightEuclideanRing, RightContainer > const &rhs)
Comparison operator on Points/Vectors (LesserThan).
bool operator>(PointVector< ptDim, LeftEuclideanRing, LeftContainer > const &lhs, PointVector< ptDim, RightEuclideanRing, RightContainer > const &rhs)
Comparison operator on Points/Vectors (GreaterThan).