PoDoFo 0.9.20
|
#include <PdfColor.h>
Public Member Functions | |
PdfColor () | |
PdfColor (double gray) | |
PdfColor (double red, double green, double blue) | |
PdfColor (double cyan, double magenta, double yellow, double black) | |
PdfColor (const PdfColor &rhs)=default | |
bool | IsGrayScale () const |
bool | IsRGB () const |
bool | IsCMYK () const |
bool | IsSeparation () const |
bool | IsCieLab () const |
PdfColorSpace | GetColorSpace () const |
PdfColorSpace | GetAlternateColorSpace () const |
double | GetGrayScale () const |
double | GetRed () const |
double | GetGreen () const |
double | GetBlue () const |
double | GetCyan () const |
double | GetMagenta () const |
double | GetYellow () const |
double | GetBlack () const |
const std::string & | GetName () const |
double | GetDensity () const |
double | GetCieL () const |
double | GetCieA () const |
double | GetCieB () const |
PdfColor | ConvertToGrayScale () const |
PdfColor | ConvertToRGB () const |
PdfColor | ConvertToCMYK () const |
PdfArray | ToArray () const |
PdfObject * | BuildColorSpace (PdfDocument &document) const |
PdfColor & | operator= (const PdfColor &rhs)=default |
bool | operator== (const PdfColor &rhs) const |
bool | operator!= (const PdfColor &rhs) const |
Static Public Member Functions | |
static bool | TryCreateFromObject (const PdfObject &obj, PdfColor &color) |
static PdfColor | CreateCieLab (double cieL, double cieA, double cieB) |
static PdfColor | CreateSeparation (const std::string_view &name, double density, const PdfColor &alternateColor) |
static PdfColor | CreateSeparationNone () |
static PdfColor | CreateSeparationAll () |
static PdfColor | FromString (const std::string_view &name) |
A color object can represent either a grayscale value, a RGB color, a CMYK color, a separation color or a CieLab color.
All drawing functions in PoDoFo accept a PdfColor object to specify a drawing color in one of these colorspaces.
Derived classes PdfColorGray, PdfColorRGB, PdfColorCMYK, PdfColorSeparation and PdfColorCieLab are available for easy construction
PdfColor::PdfColor | ( | ) |
Create a PdfColor object that is grayscale black.
|
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 |
PdfObject * PdfColor::BuildColorSpace | ( | PdfDocument & | document | ) | const |
Creates a colorspace object from a color to insert into resources.
document | a pointer to the owner document of the generated 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 |
Create a new PdfColor object with a CIE-LAB-value
cieL | the value of the L component, must be between 0.0 and 100.0 |
cieA | the value of the A component, must be between -128.0 and 127.0 |
cieB | the value of the B component, must be between -128.0 and 127.0 |
|
static |
Create a new PdfColor object with a separation-name and an equivalent color
name | Name of the separation color |
density | the density value of the separation color |
alternateColor | the alternate color, must be of type gray, rgb, cmyk or cie |
|
static |
Create a new PdfColor object with Separation color All.
|
static |
Create a new PdfColor object with Separation color None.
|
static |
PdfColorSpace PdfColor::GetAlternateColorSpace | ( | ) | const |
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.
double PdfColor::GetCieA | ( | ) | const |
Get the A color value of this object.
Throws an exception if this is no CIE-Lab color object.
double PdfColor::GetCieB | ( | ) | const |
Get the B color value of this object.
Throws an exception if this is no CIE-Lab color object.
double PdfColor::GetCieL | ( | ) | const |
Get the L color value of this object.
Throws an exception if this is no CIE-Lab 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::GetDensity | ( | ) | const |
Get the density color value of this object.
Throws an exception if this is no 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.
const string & PdfColor::GetName | ( | ) | const |
Get the separation name of this object.
Throws an exception if this is no 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::IsCieLab | ( | ) | const |
Test if this is a CIE-Lab color.
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::IsSeparation | ( | ) | const |
Test if this is a separation 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 |