9 #define MAGICKCORE_IMPLEMENTATION
10 #define MAGICK_PLUSPLUS_IMPLEMENTATION 1
32 return(!(left_ == right_));
38 return(!(left_ < right_ ) && (left_ != right_ ));
60 return((left_ > right_) || (left_ == right_));
66 return((left_ < right_) || (left_ == right_));
70 : _pixel(new PixelPacket),
79 : _pixel(new PixelPacket),
91 : _pixel(new PixelPacket),
103 : _pixel(new PixelPacket),
115 : _pixel(new PixelPacket),
116 _isValid(color_._isValid),
118 _pixelType(color_._pixelType)
124 : _pixel(new PixelPacket),
131 if (color_.opacity != OpaqueOpacity)
136 : _pixel(new PixelPacket),
152 _pixel=(PixelPacket *)NULL;
157 *
this=std::string(x11color_);
170 _isValid=color_._isValid;
173 _pixelType=color_._pixelType;
179 (
const MagickCore::PixelPacket &color_)
182 if (color_.opacity != OpaqueOpacity)
183 _pixelType=RGBAPixel;
198 if (QueryColorDatabase(x11color_.c_str(),&target_color,exceptionInfo))
200 redQuantum( target_color.red );
201 greenQuantum( target_color.green );
202 blueQuantum( target_color.blue );
203 alphaQuantum( target_color.opacity );
205 if (target_color.opacity > OpaqueOpacity)
206 _pixelType=RGBAPixel;
217 Magick::Color::operator std::string()
const
220 colorbuf[MaxTextExtent];
226 return std::string(
"none");
228 pixel.colorspace=RGBColorspace;
229 pixel.matte=_pixelType == RGBAPixel ? MagickTrue : MagickFalse;
230 pixel.depth=MAGICKCORE_QUANTUM_DEPTH;
231 pixel.red=_pixel->red;
232 pixel.green=_pixel->green;
233 pixel.blue=_pixel->blue;
234 pixel.opacity=_pixel->opacity;
235 GetColorTuple(&pixel,MagickTrue,colorbuf);
237 return(std::string(colorbuf));
247 if ((valid_ && isValid()) || (!valid_ && !isValid()))
252 _pixel=
new PixelPacket;
265 _pixelType(pixelType_)
277 _pixelType=pixelType_;
291 :
Color(scaleDoubleToQuantum(shade_),scaleDoubleToQuantum(shade_),
292 scaleDoubleToQuantum(shade_))
303 Quantum gray=scaleDoubleToQuantum(shade_);
311 return(scaleQuantumToDouble(greenQuantum()));
338 ConvertHSLToRGB(hue_,saturation_,luminosity_,&red,&green,&blue);
368 ConvertRGBToHSL(redQuantum(),greenQuantum(),blueQuantum(),&hue,&saturation,
373 ConvertHSLToRGB(hue,saturation,luminosity,&red,&green,&blue);
387 ConvertRGBToHSL(redQuantum(),greenQuantum(),blueQuantum(),&hue,&saturation,
405 ConvertRGBToHSL(redQuantum(),greenQuantum(),blueQuantum(),&hue,&saturation,
408 luminosity=luminosity_;
410 ConvertHSLToRGB(hue,saturation,luminosity,&red,&green,&blue);
424 ConvertRGBToHSL(redQuantum(),greenQuantum(),blueQuantum(),&hue,&saturation,
442 ConvertRGBToHSL(redQuantum(),greenQuantum(),blueQuantum(),&hue,&saturation,
445 saturation=saturation_;
447 ConvertHSLToRGB(hue,saturation,luminosity,&red,&green,&blue);
461 ConvertRGBToHSL(redQuantum(),greenQuantum(),blueQuantum(),&hue,&saturation,
473 :
Color((mono_ ? QuantumRange : 0),
474 (mono_ ? QuantumRange : 0),
475 (mono_ ? QuantumRange : 0))
497 redQuantum(mono_ ? QuantumRange : 0);
498 greenQuantum(mono_ ? QuantumRange : 0);
499 blueQuantum(mono_ ? QuantumRange : 0);
504 return(greenQuantum() == 0);
518 :
Color(scaleDoubleToQuantum(red_),scaleDoubleToQuantum(green_),
519 scaleDoubleToQuantum(blue_))
545 :
Color(scaleDoubleToQuantum(y_ + 1.13980 * v_),
546 scaleDoubleToQuantum(y_ - (0.39380 * u_) - (0.58050 * v_)),
547 scaleDoubleToQuantum(y_ + 2.02790 * u_))
567 redQuantum(scaleDoubleToQuantum(Y + 1.13980 * V ));
568 greenQuantum(scaleDoubleToQuantum( Y - (0.39380 * u_) - (0.58050 * V)));
569 blueQuantum(scaleDoubleToQuantum( Y + 2.02790 * u_));
574 return scaleQuantumToDouble((-0.14740 * redQuantum()) - (0.28950 *
575 greenQuantum()) + (0.43690 * blueQuantum()));
583 redQuantum(scaleDoubleToQuantum( Y + 1.13980 * v_ ));
584 greenQuantum(scaleDoubleToQuantum( Y - (0.39380 * U) - (0.58050 * v_) ));
585 blueQuantum(scaleDoubleToQuantum( Y + 2.02790 * U ));
590 return scaleQuantumToDouble((0.61500 * redQuantum()) - (0.51500 *
591 greenQuantum()) - (0.10000 * blueQuantum()));
599 redQuantum(scaleDoubleToQuantum(y_ + 1.13980 * V));
600 greenQuantum(scaleDoubleToQuantum(y_ - (0.39380 * U) - (0.58050 * V)));
601 blueQuantum(scaleDoubleToQuantum(y_ + 2.02790 * U));
606 return scaleQuantumToDouble((0.29900 * redQuantum()) + (0.58700 *
607 greenQuantum()) + (0.11400 * blueQuantum()));
ColorYUV & operator=(const Color &color_)
MagickPPExport int operator!=(const Magick::Color &left_, const Magick::Color &right_)
void isValid(bool valid_)
Quantum greenQuantum(void) const
Quantum alphaQuantum(void) const
void pixel(PixelPacket *rep_, PixelType pixelType_)
void redQuantum(Quantum red_)
MagickPPExport int operator<(const Magick::Color &left_, const Magick::Color &right_)
Quantum blueQuantum(void) const
ColorGray & operator=(const Color &color_)
MagickPPExport int operator<=(const Magick::Color &left_, const Magick::Color &right_)
MagickPPExport int operator>=(const Magick::Color &left_, const Magick::Color &right_)
ColorRGB & operator=(const Color &color_)
#define ThrowPPException(quiet)
void blueQuantum(Quantum blue_)
void greenQuantum(Quantum green_)
MagickPPExport int operator>(const Magick::Color &left_, const Magick::Color &right_)
MagickPPExport int operator==(const Magick::Color &left_, const Magick::Color &right_)
Color & operator=(const Color &color_)
ColorMono & operator=(const Color &color_)
Quantum redQuantum(void) const
double saturation(void) const
double luminosity(void) const
ColorHSL & operator=(const Color &color_)