This source file includes following definitions.
- alpha
- alpha
- alphaQuantum
- alphaQuantum
- blueQuantum
- blueQuantum
- greenQuantum
- greenQuantum
- redQuantum
- redQuantum
- initPixel
- PixelPacket
- blue
- blue
- green
- green
- red
- red
#if !defined (Magick_Color_header)
#define Magick_Color_header
#include "Magick++/Include.h"
#include <string>
namespace Magick
{
class MagickPPExport Color;
MagickPPExport int operator ==
(const Magick::Color &left_,const Magick::Color &right_);
MagickPPExport int operator !=
(const Magick::Color &left_,const Magick::Color &right_);
MagickPPExport int operator >
(const Magick::Color &left_,const Magick::Color &right_);
MagickPPExport int operator <
(const Magick::Color &left_,const Magick::Color &right_);
MagickPPExport int operator >=
(const Magick::Color &left_,const Magick::Color &right_);
MagickPPExport int operator <=
(const Magick::Color &left_,const Magick::Color &right_);
class MagickPPExport Color
{
public:
Color(void);
Color(Quantum red_,Quantum green_,Quantum blue_);
Color(Quantum red_,Quantum green_,Quantum blue_,Quantum alpha_);
Color(const char *x11color_);
Color(const Color &color_);
Color(const PixelPacket &color_);
Color(const std::string &x11color_);
virtual ~Color(void);
Color& operator=(const Color& color_);
const Color& operator=(const char *x11color);
const Color& operator=(const std::string &x11color_);
const Color& operator=(const PixelPacket &color_);
operator PixelPacket() const;
operator std::string() const;
void alpha(double alpha_);
double alpha(void) const;
void alphaQuantum(Quantum alpha_);
Quantum alphaQuantum(void) const;
void blueQuantum(Quantum blue_);
Quantum blueQuantum (void) const;
void greenQuantum(Quantum green_);
Quantum greenQuantum(void) const;
void isValid(bool valid_);
bool isValid(void) const;
void redQuantum(Quantum red_);
Quantum redQuantum (void) const;
double intensity(void) const
{
return (0.299*(_pixel->red)+0.587*(_pixel->green)+0.114*(_pixel->blue));
}
static Quantum scaleDoubleToQuantum(const double double_)
{
return (static_cast<Magick::Quantum>(double_*QuantumRange));
}
#if (MAGICKCORE_QUANTUM_DEPTH < 32)
static double scaleQuantumToDouble(const Quantum quantum_)
{
return (static_cast<double>(quantum_)/QuantumRange);
}
#endif
static double scaleQuantumToDouble(const double quantum_)
{
return (quantum_/QuantumRange);
}
protected:
enum PixelType
{
RGBPixel,
RGBAPixel,
CYMKPixel
};
Color(PixelPacket *rep_,PixelType pixelType_);
void pixel(PixelPacket *rep_,PixelType pixelType_);
PixelPacket *_pixel;
private:
bool _isValid;
bool _pixelOwn;
PixelType _pixelType;
void initPixel();
};
class MagickPPExport ColorGray : public Color
{
public:
ColorGray(void);
ColorGray(const Color & color_);
ColorGray(double shade_);
~ColorGray();
void shade(double shade_);
double shade(void) const;
ColorGray& operator=(const Color& color_);
protected:
ColorGray(PixelPacket *rep_,PixelType pixelType_);
};
class MagickPPExport ColorHSL: public Color
{
public:
ColorHSL(void);
ColorHSL(const Color &color_);
ColorHSL(double hue_,double saturation_,double luminosity_);
~ColorHSL();
ColorHSL& operator=(const Color& color_);
void hue(double hue_);
double hue(void) const;
void luminosity(double luminosity_);
double luminosity(void) const;
void saturation(double saturation_);
double saturation(void) const;
protected:
ColorHSL(PixelPacket *rep_,PixelType pixelType_);
};
class MagickPPExport ColorMono : public Color
{
public:
ColorMono(void);
ColorMono(bool mono_);
ColorMono(const Color & color_);
~ColorMono();
ColorMono& operator=(const Color& color_);
void mono(bool mono_);
bool mono(void) const;
protected:
ColorMono(PixelPacket *rep_,PixelType pixelType_);
};
class MagickPPExport ColorRGB: public Color
{
public:
ColorRGB(void);
ColorRGB(const Color &color_);
ColorRGB(double red_,double green_,double blue_);
~ColorRGB(void);
ColorRGB& operator=(const Color& color_);
void blue(double blue_);
double blue(void) const;
void green(double green_);
double green(void) const;
void red(double red_);
double red(void) const;
protected:
ColorRGB(PixelPacket *rep_,PixelType pixelType_);
};
class MagickPPExport ColorYUV: public Color
{
public:
ColorYUV(void);
ColorYUV(const Color &color_);
ColorYUV(double y_,double u_,double v_);
~ColorYUV(void);
ColorYUV& operator=(const Color& color_);
void u(double u_);
double u(void) const;
void v(double v_);
double v(void) const;
void y(double y_);
double y(void) const;
protected:
ColorYUV(PixelPacket *rep_,PixelType pixelType_);
};
}
inline void Magick::Color::alpha(double alpha_)
{
alphaQuantum(scaleDoubleToQuantum(alpha_));
}
inline double Magick::Color::alpha(void) const
{
return scaleQuantumToDouble(alphaQuantum());
}
inline void Magick::Color::alphaQuantum(Magick::Quantum alpha_)
{
_pixel->opacity=alpha_;
_isValid=true ;
}
inline Magick::Quantum Magick::Color::alphaQuantum(void) const
{
return _pixel->opacity;
}
inline void Magick::Color::blueQuantum(Magick::Quantum blue_)
{
_pixel->blue=blue_;
_isValid=true;
}
inline Magick::Quantum Magick::Color::blueQuantum(void) const
{
return _pixel->blue;
}
inline void Magick::Color::greenQuantum(Magick::Quantum green_)
{
_pixel->green=green_;
_isValid=true;
}
inline Magick::Quantum Magick::Color::greenQuantum(void) const
{
return _pixel->green;
}
inline void Magick::Color::redQuantum(Magick::Quantum red_)
{
_pixel->red=red_;
_isValid=true;
}
inline Magick::Quantum Magick::Color::redQuantum(void) const
{
return _pixel->red;
}
inline void Magick::Color::initPixel()
{
_pixel->red=0;
_pixel->green=0;
_pixel->blue=0;
_pixel->opacity=TransparentOpacity;
}
inline Magick::Color::operator MagickCore::PixelPacket() const
{
return *_pixel;
}
inline Magick::ColorGray::ColorGray(Magick::PixelPacket *rep_,
Magick::Color::PixelType pixelType_)
: Color(rep_,pixelType_)
{
}
inline Magick::ColorHSL::ColorHSL(Magick::PixelPacket *rep_,
Magick::Color::PixelType pixelType_)
: Color(rep_,pixelType_)
{
}
inline Magick::ColorMono::ColorMono(Magick::PixelPacket *rep_,
Magick::Color::PixelType pixelType_)
: Color(rep_,pixelType_)
{
}
inline Magick::ColorRGB::ColorRGB(Magick::PixelPacket *rep_,
Magick::Color::PixelType pixelType_)
: Color(rep_,pixelType_)
{
}
inline void Magick::ColorRGB::blue(double blue_)
{
blueQuantum(scaleDoubleToQuantum(blue_));
}
inline double Magick::ColorRGB::blue(void) const
{
return scaleQuantumToDouble(blueQuantum());
}
inline void Magick::ColorRGB::green(double green_)
{
greenQuantum(scaleDoubleToQuantum(green_));
}
inline double Magick::ColorRGB::green(void) const
{
return scaleQuantumToDouble(greenQuantum());
}
inline void Magick::ColorRGB::red(double red_)
{
redQuantum(scaleDoubleToQuantum(red_));
}
inline double Magick::ColorRGB::red(void) const
{
return scaleQuantumToDouble(redQuantum());
}
inline Magick::ColorYUV::ColorYUV(Magick::PixelPacket *rep_,
Magick::Color::PixelType pixelType_)
: Color(rep_,pixelType_)
{
}
#endif