PoDoFo
1.0.0-dev
|
A color object can represent either a grayscale value, a RGB color, a CMYK color. More...
#include <PdfColor.h>
Public Member Functions | |
PdfColor () | |
Create a PdfColor object that is grayscale black. | |
PdfColor (double gray) | |
Create a new PdfColor object with a grayscale value. More... | |
PdfColor (double red, double green, double blue) | |
Create a new PdfColor object with a RGB color. More... | |
PdfColor (double cyan, double magenta, double yellow, double black) | |
Create a new PdfColor object with a CMYK color. More... | |
PdfColor (const PdfColor &rhs)=default | |
Copy constructor. More... | |
bool | IsGrayScale () const |
Test if this is a grayscale color. More... | |
bool | IsRGB () const |
Test if this is a RGB color. More... | |
bool | IsCMYK () const |
Test if this is a CMYK color. More... | |
bool | IsTransparent () const |
PdfColorSpaceType | GetColorSpace () const |
Get the colorspace of this PdfColor object. More... | |
double | GetGrayScale () const |
Get the grayscale color value of this object. More... | |
double | GetRed () const |
Get the red color value of this object. More... | |
double | GetGreen () const |
Get the green color value of this object. More... | |
double | GetBlue () const |
Get the blue color value of this object. More... | |
double | GetCyan () const |
Get the cyan color value of this object. More... | |
double | GetMagenta () const |
Get the magenta color value of this object. More... | |
double | GetYellow () const |
Get the yellow color value of this object. More... | |
double | GetBlack () const |
Get the black color value of this object. More... | |
PdfColor | ConvertToGrayScale () const |
Converts the color object into a grayscale color object. More... | |
PdfColor | ConvertToRGB () const |
Converts the color object into a RGB color object. More... | |
PdfColor | ConvertToCMYK () const |
Converts the color object into a CMYK color object. More... | |
PdfArray | ToArray () const |
Creates a PdfArray which represents a color from a color. More... | |
unsigned char | GetComponentCount () const |
const PdfColorRaw & | GetRawColor () const |
PdfColor & | operator= (const PdfColor &rhs)=default |
Assignment operator. More... | |
bool | operator== (const PdfColor &rhs) const |
Test for equality of colors. More... | |
bool | operator!= (const PdfColor &rhs) const |
Test for inequality of colors. More... | |
Static Public Member Functions | |
static bool | TryCreateFromObject (const PdfObject &obj, PdfColor &color) |
Creates a color object from a PdfArray which represents a color. More... | |
static PdfColor | CreateFromObject (const PdfObject &obj) |
static PdfColor | CreateTransparent () |
static PdfColor | CreateFromString (const std::string_view &name) |
Creates a color object from a string. More... | |
A color object can represent either a grayscale value, a RGB color, a CMYK color.
All drawing functions in PoDoFo accept a PdfColor object to specify a drawing color in one of these colorspaces.
|
explicit |
Create a new PdfColor object with a grayscale value.
gray | a grayscale value between 0.0 and 1.0 |
PdfColor::PdfColor | ( | double | red, |
double | green, | ||
double | blue | ||
) |
Create a new PdfColor object with a RGB color.
red | the value of the red component, must be between 0.0 and 1.0 |
green | the value of the green component, must be between 0.0 and 1.0 |
blue | the value of the blue component, must be between 0.0 and 1.0 |
PdfColor::PdfColor | ( | double | cyan, |
double | magenta, | ||
double | yellow, | ||
double | black | ||
) |
Create a new PdfColor object with a CMYK color.
cyan | the value of the cyan component, must be between 0.0 and 1.0 |
magenta | the value of the magenta component, must be between 0.0 and 1.0 |
yellow | the value of the yellow component, must be between 0.0 and 1.0 |
black | the value of the black component, must be between 0.0 and 1.0 |
|
default |
Copy constructor.
rhs | copy rhs into this object |
PdfColor PdfColor::ConvertToCMYK | ( | ) | const |
Converts the color object into a CMYK color object.
This is only a convenience function. It might be useful for on screen display but is in NO WAY suitable to professional printing!
PdfColor PdfColor::ConvertToGrayScale | ( | ) | const |
Converts the color object into a grayscale color object.
This is only a convenience function. It might be useful for on screen display but is in NO WAY suitable to professional printing!
PdfColor PdfColor::ConvertToRGB | ( | ) | const |
Converts the color object into a RGB color object.
This is only a convenience function. It might be useful for on screen display but is in NO WAY suitable to professional printing!
|
static |
double PdfColor::GetBlack | ( | ) | const |
Get the black color value of this object.
Throws an exception if this is no CMYK or separation color object.
double PdfColor::GetBlue | ( | ) | const |
Get the blue color value of this object.
Throws an exception if this is no RGB color object.
|
inline |
double PdfColor::GetCyan | ( | ) | const |
Get the cyan color value of this object.
Throws an exception if this is no CMYK or separation color object.
double PdfColor::GetGrayScale | ( | ) | const |
Get the grayscale color value of this object.
Throws an exception if this is no grayscale color object.
double PdfColor::GetGreen | ( | ) | const |
Get the green color value of this object.
Throws an exception if this is no RGB color object.
double PdfColor::GetMagenta | ( | ) | const |
Get the magenta color value of this object.
Throws an exception if this is no CMYK or separation color object.
double PdfColor::GetRed | ( | ) | const |
Get the red color value of this object.
Throws an exception if this is no RGB color object.
double PdfColor::GetYellow | ( | ) | const |
Get the yellow color value of this object.
Throws an exception if this is no CMYK or separation color object.
bool PdfColor::IsCMYK | ( | ) | const |
Test if this is a CMYK color.
bool PdfColor::IsGrayScale | ( | ) | const |
Test if this is a grayscale color.
bool PdfColor::IsRGB | ( | ) | const |
Test if this is a RGB color.
bool PdfColor::operator!= | ( | const PdfColor & | rhs | ) | const |
Test for inequality of colors.
rhs | color to compare to |
Assignment operator.
rhs | copy rhs into this object |
bool PdfColor::operator== | ( | const PdfColor & | rhs | ) | const |
Test for equality of colors.
rhs | color to compare to |
PdfArray PdfColor::ToArray | ( | ) | const |