#include <PdfImage.h>
|
| | PdfImage (PdfDocument &doc, const std::string_view &prefix={ }) |
| |
| void | SetImageColorSpace (PdfColorSpace colorSpace, const PdfArray *indexedData=nullptr) |
| |
| PdfColorSpace | GetImageColorSpace () |
| |
| void | SetImageICCProfile (PdfInputStream &stream, unsigned colorComponents, PdfColorSpace alternateColorSpace=PdfColorSpace::DeviceRGB) |
| |
| void | SetImageSoftmask (const PdfImage &softmask) |
| |
| unsigned | GetWidth () const |
| |
| unsigned | GetHeight () const |
| |
| void | SetImageData (PdfInputStream &stream, unsigned width, unsigned height, unsigned bitsPerComponent) |
| |
| void | SetImageData (PdfInputStream &stream, unsigned width, unsigned height, unsigned bitsPerComponent, PdfFilterList &filters) |
| |
| void | SetImageDataRaw (PdfInputStream &stream, unsigned width, unsigned height, unsigned bitsPerComponent) |
| |
| void | LoadFromFile (const std::string_view &filename) |
| |
| void | LoadFromData (const unsigned char *data, size_t len) |
| |
| void | SetImageChromaKeyMask (int64_t r, int64_t g, int64_t b, int64_t threshold=0) |
| |
| void | SetInterpolate (bool value) |
| |
| const PdfName & | GetIdentifier () const |
| |
A PdfImage object is needed when ever you want to embedd an image file into a PDF document. The PdfImage object is embedded once and can be drawn as often as you want on any page in the document using PdfPainter
- See also
- GetImageReference
-
PdfPainter::DrawImage
-
SetImageData
◆ PdfImage()
| mm::PdfImage::PdfImage |
( |
PdfDocument & |
doc, |
|
|
const std::string_view & |
prefix = { } |
|
) |
| |
Constuct a new PdfImage object This is an overloaded constructor.
- Parameters
-
| parent | parent document |
| prefix | optional prefix for XObject-name |
◆ GetHeight()
| unsigned PdfImage::GetHeight |
( |
| ) |
const |
Get the height of the image when drawn in PDF units
- Returns
- the height in PDF units
◆ GetImageColorSpace()
Get the color space of the image
- Returns
- the color space of the image
◆ GetWidth()
| unsigned PdfImage::GetWidth |
( |
| ) |
const |
Get the width of the image when drawn in PDF units
- Returns
- the width in PDF units
◆ LoadFromData()
| void PdfImage::LoadFromData |
( |
const unsigned char * |
data, |
|
|
size_t |
len |
|
) |
| |
Load the image data from bytes
- Parameters
-
| data | bytes |
| len | number of bytes |
◆ LoadFromFile()
| void PdfImage::LoadFromFile |
( |
const std::string_view & |
filename | ) |
|
Load the image data from a file
- Parameters
-
◆ SetImageChromaKeyMask()
| void PdfImage::SetImageChromaKeyMask |
( |
int64_t |
r, |
|
|
int64_t |
g, |
|
|
int64_t |
b, |
|
|
int64_t |
threshold = 0 |
|
) |
| |
Set an color/chroma-key mask on an image. The masked color will not be painted, i.e. masked as being transparent.
- Parameters
-
| r | red RGB value of color that should be masked |
| g | green RGB value of color that should be masked |
| b | blue RGB value of color that should be masked |
| threshold | colors are masked that are in the range [(r-threshold, r+threshold),(g-threshold, g+threshold),(b-threshold, b+threshold)] |
◆ SetImageColorSpace()
◆ SetImageData() [1/2]
| void PdfImage::SetImageData |
( |
PdfInputStream & |
stream, |
|
|
unsigned |
width, |
|
|
unsigned |
height, |
|
|
unsigned |
bitsPerComponent |
|
) |
| |
Set the actual image data from an input stream
The image data will be flate compressed. If you want no compression or another filter to be applied use the overload of SetImageData which takes a TVecFilters as argument.
- Parameters
-
| stream | stream supplieding raw image data |
| width | width of the image in pixels |
| height | height of the image in pixels |
| bitsPerComponent | bits per color component of the image (depends on the image colorspace you have set but is 8 in most cases) |
- See also
- SetImageData
◆ SetImageData() [2/2]
| void PdfImage::SetImageData |
( |
PdfInputStream & |
stream, |
|
|
unsigned |
width, |
|
|
unsigned |
height, |
|
|
unsigned |
bitsPerComponent, |
|
|
PdfFilterList & |
filters |
|
) |
| |
Set the actual image data from an input stream
- Parameters
-
| stream | stream suplying raw image data |
| width | width of the image in pixels |
| height | height of the image in pixels |
| bitsPerComponent | bits per color component of the image (depends on the image colorspace you have set but is 8 in most cases) |
| filters | these filters will be applied to compress the image data |
◆ SetImageDataRaw()
| void PdfImage::SetImageDataRaw |
( |
PdfInputStream & |
stream, |
|
|
unsigned |
width, |
|
|
unsigned |
height, |
|
|
unsigned |
bitsPerComponent |
|
) |
| |
Set the actual image data from an input stream. The data has to be encoded already and an appropriate filters key entry has to be set manually before!
- Parameters
-
| stream | stream supplieding raw image data |
| width | width of the image in pixels |
| height | height of the image in pixels |
| bitsPerComponent | bits per color component of the image (depends on the image colorspace you have set but is 8 in most cases) |
◆ SetImageICCProfile()
Set an ICC profile for this image.
- Parameters
-
| stream | an input stream from which the ICC profiles data can be read |
| colorComponents | the number of colorcomponents of the ICC profile |
| alternateColorSpace | an alternate colorspace to use if the ICC profile cannot be used |
- See also
- SetImageColorSpace to set an colorspace instead of an ICC profile for this image
◆ SetImageSoftmask()
| void PdfImage::SetImageSoftmask |
( |
const PdfImage & |
softmask | ) |
|
Set a softmask for this image.
- Parameters
-
| pSoftmask | a PdfImage pointer to the image, which is to be set as softmask, must be 8-Bit-Grayscale |
◆ SetInterpolate()
| void PdfImage::SetInterpolate |
( |
bool |
value | ) |
|
Apply an interpolation to the image if the source resolution is lower than the resolution of the output device. Default is false.
- Parameters
-
| value | whether the image should be interpolated |