![]() |
#include <Image.h>
Public Types | |
enum | InputFilter { e_none, e_jpeg, e_jp2, e_flate, e_g3, e_g4, e_ascii_hex } |
Public Member Functions | |
Image (SDF::Obj image_xobject=0) | |
Create an image from an existing image represented as a SDF/Cos object. | |
Image (const Image &) | |
Image & | operator= (const Image &) |
SDF::Obj | GetSDFObj () const |
bool | IsValid () const |
Filters::Filter | GetImageData () const |
int | GetImageDataSize () const |
Gdiplus::Bitmap * | GetBitmap () const |
Convert PDF image to GDI+ Bitmap. | |
ColorSpace | GetImageColorSpace () const |
int | GetImageWidth () const |
int | GetImageHeight () const |
SDF::Obj | GetDecodeArray () const |
int | GetBitsPerComponent () const |
int | GetComponentNum () const |
bool | IsImageMask () const |
bool | IsImageInterpolate () const |
SDF::Obj | GetMask () const |
void | SetMask (Image &image_mask) |
Set an Explicit Image Mask. | |
void | SetMask (SDF::Obj mask) |
Set a Color Key Mask. | |
SDF::Obj | GetSoftMask () |
void | SetSoftMask (Image &soft_mask) |
Set a Soft Mask. | |
GState::RenderingIntent | GetImageRenderingIntent () const |
int | Export (const UString &filename) |
Saves this image to a file. | |
int | Export (Filters::FilterWriter &writer) |
Saves this image to the output stream. | |
void | ExportAsTiff (const UString &filename) |
Saves this image to a TIFF file. | |
void | ExportAsTiff (Filters::FilterWriter &writer) |
Saves this image to a TIFF output stream. | |
void | ExportAsPng (const UString &filename) |
Saves this image to a PNG file. | |
void | ExportAsPng (Filters::FilterWriter &writer) |
Saves this image to a PNG output stream. | |
Static Public Member Functions | |
static Image | Create (SDF::SDFDoc &doc, const UString &filename, SDF::Obj encoder_hints=0) |
Create and embed an Image from an external file taking into account specified compression hints. | |
static Image | Create (SDF::SDFDoc &doc, const char *image_data, size_t image_data_size, int width, int height, int bpc, ColorSpace color_space, SDF::Obj encoder_hints=0) |
Create and embed an Image. | |
static Image | Create (SDF::SDFDoc &doc, Filters::FilterReader &image_data, int width, int height, int bpc, ColorSpace color_space, SDF::Obj encoder_hints=0) |
Create and embed an Image. | |
static Image | Create (SDF::SDFDoc &doc, Gdiplus::Bitmap *bmp, SDF::Obj encoder_hints=0) |
Create and embed an Image from any GDI+ Bitmap taking into account specified compression hints. | |
static Image | CreateImageMask (SDF::SDFDoc &doc, const char *image_data, size_t image_data_size, int width, int height, SDF::Obj encoder_hints=0) |
Create and embed an ImageMask. | |
static Image | CreateImageMask (SDF::SDFDoc &doc, Filters::FilterReader &image_data, int width, int height, SDF::Obj encoder_hints=0) |
Create and embed an ImageMask. | |
static Image | CreateSoftMask (SDF::SDFDoc &doc, const char *image_data, size_t image_data_size, int width, int height, int bpc, SDF::Obj encoder_hints=0) |
Create and embed a Soft Mask. | |
static Image | CreateSoftMask (SDF::SDFDoc &doc, Filters::FilterReader &image_data, int width, int height, int bpc, SDF::Obj encoder_hints=0) |
Create and embed a Soft Mask. | |
static Image | Create (SDF::SDFDoc &doc, const char *image_data, size_t image_data_size, int width, int height, int bpc, ColorSpace color_space, InputFilter input_format) |
Directly embed the image that is already compressed using the Image::InputFilter format. | |
static Image | Create (SDF::SDFDoc &doc, Filters::FilterReader &image_data, int width, int height, int bpc, ColorSpace color_space, InputFilter input_format) |
Embed the raw image data taking into account specified compression hints. |
pdftron::PDF::Image::Image | ( | SDF::Obj | image_xobject = 0 |
) |
Create an image from an existing image represented as a SDF/Cos object.
pdftron::PDF::Image::Image | ( | const Image & | ) |
static Image pdftron::PDF::Image::Create | ( | SDF::SDFDoc & | doc, | |
const UString & | filename, | |||
SDF::Obj | encoder_hints = 0 | |||
) | [static] |
Create and embed an Image from an external file taking into account specified compression hints.
doc | - A document to which the image should be added. To obtain SDF::Doc from PDFDoc use PDFDoc::GetSDFDoc() or Obj::GetDoc(). | |
filename | - The name of the image file. Currently supported formats are JPEG, PNG, GIF, TIFF, BMP, EMF, and WMF. Other raster formats can be embedded by decompressing image data and using other versions of Image::Create(...) method. | |
encoder_hints | - An optional SDF::Obj containing a hint (or an SDF::Array of hints) that could be used to select a specific compression method and compression parameters. For a concrete example of how to create encoder hints, please take a look at JBIG2Test and AddImage sample projects. The image encoder accepts the following hints: |
static Image pdftron::PDF::Image::Create | ( | SDF::SDFDoc & | doc, | |
const char * | image_data, | |||
size_t | image_data_size, | |||
int | width, | |||
int | height, | |||
int | bpc, | |||
ColorSpace | color_space, | |||
SDF::Obj | encoder_hints = 0 | |||
) | [static] |
Create and embed an Image.
Embed the raw image data taking into account specified compression hints.
By default the function will compress all images using Flate compression. It is possible to fine tune compression or to select a different compression algorithm using 'encoder_hints' object.
doc | - A document to which the image should be added. The 'Doc' object can be obtained using Obj::GetDoc() or PDFDoc::GetSDFDoc(). | |
image_data | - The stream or buffer containing image data. The image data must not be compressed and must follow PDF format for sample representation (please refer to section 4.8.2 'Sample Representation' in PDF Reference Manual for details). | |
width | - The width of the image, in samples. | |
height | - The height of the image, in samples. | |
bpc | - The number of bits used to represent each color component. | |
color_space | - The color space in which image samples are represented. | |
encoder_hints | - An optional parameter that can be used to fine tune compression or to select a different compression algorithm. See Image::Create() for details. |
static Image pdftron::PDF::Image::Create | ( | SDF::SDFDoc & | doc, | |
Filters::FilterReader & | image_data, | |||
int | width, | |||
int | height, | |||
int | bpc, | |||
ColorSpace | color_space, | |||
SDF::Obj | encoder_hints = 0 | |||
) | [static] |
Create and embed an Image.
Embed the raw image data taking into account specified compression hints.
static Image pdftron::PDF::Image::Create | ( | SDF::SDFDoc & | doc, | |
Gdiplus::Bitmap * | bmp, | |||
SDF::Obj | encoder_hints = 0 | |||
) | [static] |
Create and embed an Image from any GDI+ Bitmap taking into account specified compression hints.
This method is available only on Windows platforms.
doc | - A document to which the image should be added. The 'Doc' object can be obtained using Obj::GetDoc() or PDFDoc::GetSDFDoc(). | |
bmp | - GDI+ bitmap. |
static Image pdftron::PDF::Image::CreateImageMask | ( | SDF::SDFDoc & | doc, | |
const char * | image_data, | |||
size_t | image_data_size, | |||
int | width, | |||
int | height, | |||
SDF::Obj | encoder_hints = 0 | |||
) | [static] |
Create and embed an ImageMask.
Embed the raw image data taking into account specified compression hints. The ImageMask can be used as a stencil mask for painting in the current color or as an explicit mask specifying which areas of the image to paint and which to mask out. One of the most important uses of stencil masking is for painting character glyphs represented as bitmaps.
doc | - A document to which the image should be added. The 'Doc' object can be obtained using Obj::GetDoc() or PDFDoc::GetSDFDoc(). | |
image_data | - The stream or buffer containing image data stored in 1 bit per sample format. The image data must not be compressed and must follow PDF format for sample representation (please refer to section 4.8.2 'Sample Representation' in PDF Reference Manual for details). | |
width | - The width of the image, in samples. | |
height | - The height of the image, in samples. | |
encoder_hints | - An optional parameter that can be used to fine tune compression or to select a different compression algorithm. See Image::Create() for details. |
static Image pdftron::PDF::Image::CreateImageMask | ( | SDF::SDFDoc & | doc, | |
Filters::FilterReader & | image_data, | |||
int | width, | |||
int | height, | |||
SDF::Obj | encoder_hints = 0 | |||
) | [static] |
static Image pdftron::PDF::Image::CreateSoftMask | ( | SDF::SDFDoc & | doc, | |
const char * | image_data, | |||
size_t | image_data_size, | |||
int | width, | |||
int | height, | |||
int | bpc, | |||
SDF::Obj | encoder_hints = 0 | |||
) | [static] |
Create and embed a Soft Mask.
Embed the raw image data taking into account specified compression hints.
A | soft-mask image (see “Soft-Mask Images” in PDF Reference Manual) to be used as a source of mask shape or mask opacity values in the transparent imaging model. | |
doc | - A document to which the image should be added. The 'Doc' object can be obtained using Obj::GetDoc() or PDFDoc::GetSDFDoc(). | |
image_data | - The stream or buffer containing image data represented in DeviceGray color space (i.e. one component per sample). The image data must not be compressed and must follow PDF format for sample representation (please refer to section 4.8.2 'Sample Representation' in PDF Reference Manual for details). | |
width | - The width of the image, in samples. | |
height | - The height of the image, in samples. | |
bpc | - The number of bits used to represent each color component. | |
encoder_hints | - An optional parameter that can be used to fine tune compression or to select a different compression algorithm. See Image::Create() for details. |
static Image pdftron::PDF::Image::CreateSoftMask | ( | SDF::SDFDoc & | doc, | |
Filters::FilterReader & | image_data, | |||
int | width, | |||
int | height, | |||
int | bpc, | |||
SDF::Obj | encoder_hints = 0 | |||
) | [static] |
Create and embed a Soft Mask.
Embed the raw image data taking into account specified compression hints.
static Image pdftron::PDF::Image::Create | ( | SDF::SDFDoc & | doc, | |
const char * | image_data, | |||
size_t | image_data_size, | |||
int | width, | |||
int | height, | |||
int | bpc, | |||
ColorSpace | color_space, | |||
InputFilter | input_format | |||
) | [static] |
Directly embed the image that is already compressed using the Image::InputFilter format.
The function can be used to pass-through pre-compressed image data.
doc | - A document to which the image should be added. The 'Doc' object can be obtained using Obj::GetDoc() or PDFDoc::GetSDFDoc(). | |
image_data | - The stream or buffer containing compressed image data. The compression format must match the input_format parameter. | |
width | - The width of the image, in samples. | |
height | - The height of the image, in samples. | |
bpc | - The number of bits used to represent each color component. | |
color_space | - The color space in which image samples are specified. | |
input_format | - Image::InputFilter describing the format of pre-compressed image data. | |
encoder_hints | - An optional parameter that can be used to fine tune compression or to select a different compression algorithm. See Image::Create() for details. |
static Image pdftron::PDF::Image::Create | ( | SDF::SDFDoc & | doc, | |
Filters::FilterReader & | image_data, | |||
int | width, | |||
int | height, | |||
int | bpc, | |||
ColorSpace | color_space, | |||
InputFilter | input_format | |||
) | [static] |
Embed the raw image data taking into account specified compression hints.
SDF::Obj pdftron::PDF::Image::GetSDFObj | ( | ) | const |
bool pdftron::PDF::Image::IsValid | ( | ) | const |
Filters::Filter pdftron::PDF::Image::GetImageData | ( | ) | const |
int pdftron::PDF::Image::GetImageDataSize | ( | ) | const |
Gdiplus::Bitmap* pdftron::PDF::Image::GetBitmap | ( | ) | const |
Convert PDF image to GDI+ Bitmap.
ColorSpace pdftron::PDF::Image::GetImageColorSpace | ( | ) | const |
int pdftron::PDF::Image::GetImageWidth | ( | ) | const |
int pdftron::PDF::Image::GetImageHeight | ( | ) | const |
SDF::Obj pdftron::PDF::Image::GetDecodeArray | ( | ) | const |
int pdftron::PDF::Image::GetBitsPerComponent | ( | ) | const |
int pdftron::PDF::Image::GetComponentNum | ( | ) | const |
bool pdftron::PDF::Image::IsImageMask | ( | ) | const |
bool pdftron::PDF::Image::IsImageInterpolate | ( | ) | const |
SDF::Obj pdftron::PDF::Image::GetMask | ( | ) | const |
void pdftron::PDF::Image::SetMask | ( | Image & | image_mask | ) |
Set an Explicit Image Mask.
An | Image object which serves as an explicit mask for the base (this) image. The base image and the image mask need not have the same resolution (Width and Height values), but since all images are defined on the unit square in user space, their boundaries on the page will coincide; that is, they will overlay each other. The image mask indicates which places on the page are to be painted and which are to be masked out (left unchanged). Unmasked areas are painted with the corresponding portions of the base image; masked areas are not. |
void pdftron::PDF::Image::SetMask | ( | SDF::Obj | mask | ) |
Set a Color Key Mask.
mask | is an Cos/SDF array specifying a range of colors to be masked out. Samples in the image that fall within this range are not painted, allowing the existing background to show through. The effect is similar to that of the video technique known as chroma-key. For details of the array format please refer to section 4.8.5 'Color Key Masking' in PDF Reference Manual. |
SDF::Obj pdftron::PDF::Image::GetSoftMask | ( | ) |
void pdftron::PDF::Image::SetSoftMask | ( | Image & | soft_mask | ) |
Set a Soft Mask.
soft_mask | is a subsidiary Image object defining a soft-mask image (See section 7.5.4 'Soft-Mask Images' in PDF Reference Manual) to be used as a source of mask shape or mask opacity values in the transparent imaging model. The alpha source parameter in the graphics state determines whether the mask values are interpreted as shape or opacity. |
GState::RenderingIntent pdftron::PDF::Image::GetImageRenderingIntent | ( | ) | const |
int pdftron::PDF::Image::Export | ( | const UString & | filename | ) |
Saves this image to a file.
The output image format (TIFF, JPEG, or PNG) will be automatically selected based on the properties of the embedded image. For example, if the embedded image is using CCITT Fax compression, the output format will be TIFF. Similarly, if the embedded image is using JPEG compression the output format will be JPEG. If your application needs to explicitly control output image format you may want to use ExportAsTiff() or ExportAsPng().
filename | string that specifies the path name for the saved image. The filename should not include the extension which will be appended to the filename string based on the output format. |
int pdftron::PDF::Image::Export | ( | Filters::FilterWriter & | writer | ) |
Saves this image to the output stream.
writer | A pointer to FilterWriter used to write to the output stream. If the parameter is null, nothing will be written to the output stream, but the function returns the format identifier. |
void pdftron::PDF::Image::ExportAsTiff | ( | const UString & | filename | ) |
Saves this image to a TIFF file.
filename | string that specifies the path name for the saved image. The filename should include the file extension |
void pdftron::PDF::Image::ExportAsTiff | ( | Filters::FilterWriter & | writer | ) |
Saves this image to a TIFF output stream.
writer | FilterWriter used to write to the output stream. |
void pdftron::PDF::Image::ExportAsPng | ( | const UString & | filename | ) |
Saves this image to a PNG file.
filename | string that specifies the path name for the saved image. The filename should include the file extension |
void pdftron::PDF::Image::ExportAsPng | ( | Filters::FilterWriter & | writer | ) |
Saves this image to a PNG output stream.
writer | FilterWriter used to write to the output stream. |