PoDoFo  0.9.4
Public Member Functions | Static Public Member Functions | List of all members
PoDoFo::PdfImage Class Reference

#include <PdfImage.h>

Inheritance diagram for PoDoFo::PdfImage:
PoDoFo::PdfXObject PoDoFo::PdfElement PoDoFo::PdfCanvas

Public Member Functions

 PdfImage (PdfVecObjects *pParent, const char *pszPrefix=NULL)
 
 PdfImage (PdfDocument *pParent, const char *pszPrefix=NULL)
 
 PdfImage (PdfObject *pObject)
 
void SetImageColorSpace (EPdfColorSpace eColorSpace, const PdfArray *indexedData=NULL)
 
void SetImageICCProfile (PdfInputStream *pStream, long lColorComponents, EPdfColorSpace eAlternateColorSpace=ePdfColorSpace_DeviceRGB)
 
void SetImageSoftmask (const PdfImage *pSoftmask)
 
double GetWidth () const
 
double GetHeight () const
 
void SetImageData (unsigned int nWidth, unsigned int nHeight, unsigned int nBitsPerComponent, PdfInputStream *pStream)
 
void SetImageData (unsigned int nWidth, unsigned int nHeight, unsigned int nBitsPerComponent, PdfInputStream *pStream, const TVecFilters &vecFilters)
 
void SetImageDataRaw (unsigned int nWidth, unsigned int nHeight, unsigned int nBitsPerComponent, PdfInputStream *pStream)
 
void LoadFromFile (const char *pszFilename)
 
void LoadFromData (const unsigned char *pData, pdf_long dwLen)
 
void SetImageChromaKeyMask (pdf_int64 r, pdf_int64 g, pdf_int64 b, pdf_int64 threshold=0)
 
void SetInterpolate (bool bValue)
 
- Public Member Functions inherited from PoDoFo::PdfXObject
 PdfXObject (const PdfRect &rRect, PdfDocument *pParent, const char *pszPrefix=NULL, bool bWithoutObjNum=false)
 
 PdfXObject (const PdfRect &rRect, PdfVecObjects *pParent, const char *pszPrefix=NULL)
 
 PdfXObject (const PdfMemDocument &rSourceDoc, int nPage, PdfDocument *pParent, const char *pszPrefix=NULL, bool bUseTrimBox=false)
 
 PdfXObject (PdfDocument *pDoc, int nPage, const char *pszPrefix=NULL, bool bUseTrimBox=false)
 
 PdfXObject (PdfObject *pObject)
 
virtual PdfObjectGetContents () const
 
virtual PdfObjectGetContentsForAppending () const
 
virtual PdfObjectGetResources () const
 
virtual const PdfRect GetPageSize () const
 
const PdfNameGetIdentifier () const
 
const PdfReferenceGetObjectReference () const
 
- Public Member Functions inherited from PoDoFo::PdfElement
PdfObjectGetObject ()
 
const PdfObjectGetObject () const
 
- Public Member Functions inherited from PoDoFo::PdfCanvas
virtual ~PdfCanvas ()
 
void AddColorResource (const PdfColor &rColor)
 
void AddResource (const PdfName &rIdentifier, const PdfReference &rRef, const PdfName &rName)
 

Static Public Member Functions

static const char ** GetSupportedFormats ()
 
- Static Public Member Functions inherited from PoDoFo::PdfCanvas
static const PdfArrayGetProcSet ()
 

Additional Inherited Members

- Protected Member Functions inherited from PoDoFo::PdfElement
 PdfElement (const char *pszType, PdfVecObjects *pParent)
 
 PdfElement (const char *pszType, PdfDocument *pParent)
 
 PdfElement (const char *pszType, PdfObject *pObject)
 
 PdfElement (EPdfDataType eExpectedDataType, PdfObject *pObject)
 
const char * TypeNameForIndex (int i, const char **ppTypes, long lLen) const
 
int TypeNameToIndex (const char *pszType, const char **ppTypes, long lLen, int nUnknownValue) const
 
PdfObjectCreateObject (const char *pszType=NULL)
 
PdfObjectGetNonConstObject () const
 

Detailed Description

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

Constructor & Destructor Documentation

PoDoFo::PdfImage::PdfImage ( PdfVecObjects pParent,
const char *  pszPrefix = NULL 
)

Constuct a new PdfImage object

Parameters
pParentparent vector of this image
pszPrefixoptional prefix for XObject-name
PoDoFo::PdfImage::PdfImage ( PdfDocument pParent,
const char *  pszPrefix = NULL 
)

Constuct a new PdfImage object This is an overloaded constructor.

Parameters
pParentparent document
pszPrefixoptional prefix for XObject-name
PoDoFo::PdfImage::PdfImage ( PdfObject pObject)

Construct an image from an existing PdfObject

Parameters
pObjecta PdfObject that has to be an image

Member Function Documentation

double PoDoFo::PdfImage::GetHeight ( ) const
inline

Get the height of the image when drawn in PDF units

Returns
the height in PDF units
const char ** PoDoFo::PdfImage::GetSupportedFormats ( )
static

Get a list of all image formats supported by this PoDoFo build.

Example: { "JPEG", "TIFF", NULL }

Returns
a zero terminates list of all supported image formats
double PoDoFo::PdfImage::GetWidth ( ) const
inline

Get the width of the image when drawn in PDF units

Returns
the width in PDF units
void PoDoFo::PdfImage::LoadFromData ( const unsigned char *  pData,
pdf_long  dwLen 
)

Load the image data from bytes

Parameters
pDatabytes
dwLennumber of bytes
void PoDoFo::PdfImage::LoadFromFile ( const char *  pszFilename)

Load the image data from a file

Parameters
pszFilename
void PoDoFo::PdfImage::SetImageChromaKeyMask ( pdf_int64  r,
pdf_int64  g,
pdf_int64  b,
pdf_int64  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
rred RGB value of color that should be masked
ggreen RGB value of color that should be masked
bblue RGB value of color that should be masked
thresholdcolors are masked that are in the range [(r-threshold, r+threshold),(g-threshold, g+threshold),(b-threshold, b+threshold)]
void PoDoFo::PdfImage::SetImageColorSpace ( EPdfColorSpace  eColorSpace,
const PdfArray indexedData = NULL 
)

Set the color space of this image. The default value is ePdfColorSpace_DeviceRGB.

Parameters
eColorSpaceone of ePdfColorSpace_DeviceGray, ePdfColorSpace_DeviceRGB and ePdfColorSpace_DeviceCMYK, ePdfColorSpace_Indexed
indexedDatathis parameter is required only for ePdfColorSpace_Indexed and it contains string with one number and then color palette, like "/DeviceRGB 15 <000000 00FF00...>" or the string array can be a resource name.
See also
SetImageICCProfile to set an ICC profile instead of a simple colorspace
void PoDoFo::PdfImage::SetImageData ( unsigned int  nWidth,
unsigned int  nHeight,
unsigned int  nBitsPerComponent,
PdfInputStream pStream 
)

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
nWidthwidth of the image in pixels
nHeightheight of the image in pixels
nBitsPerComponentbits per color component of the image (depends on the image colorspace you have set but is 8 in most cases)
pStreamstream supplieding raw image data
See also
SetImageData
void PoDoFo::PdfImage::SetImageData ( unsigned int  nWidth,
unsigned int  nHeight,
unsigned int  nBitsPerComponent,
PdfInputStream pStream,
const TVecFilters &  vecFilters 
)

Set the actual image data from an input stream

Parameters
nWidthwidth of the image in pixels
nHeightheight of the image in pixels
nBitsPerComponentbits per color component of the image (depends on the image colorspace you have set but is 8 in most cases)
pStreamstream supplieding raw image data
vecFiltersthese filters will be applied to compress the image data
void PoDoFo::PdfImage::SetImageDataRaw ( unsigned int  nWidth,
unsigned int  nHeight,
unsigned int  nBitsPerComponent,
PdfInputStream pStream 
)

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
nWidthwidth of the image in pixels
nHeightheight of the image in pixels
nBitsPerComponentbits per color component of the image (depends on the image colorspace you have set but is 8 in most cases)
pStreamstream supplieding raw image data
void PoDoFo::PdfImage::SetImageICCProfile ( PdfInputStream pStream,
long  lColorComponents,
EPdfColorSpace  eAlternateColorSpace = ePdfColorSpace_DeviceRGB 
)

Set an ICC profile for this image.

Parameters
pStreaman input stream from which the ICC profiles data can be read
lColorComponentsthe number of colorcomponents of the ICC profile
eAlternateColorSpacean 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
void PoDoFo::PdfImage::SetImageSoftmask ( const PdfImage pSoftmask)

Set a softmask for this image.

Parameters
pSoftmaska PdfImage pointer to the image, which is to be set as softmask, must be 8-Bit-Grayscale
void PoDoFo::PdfImage::SetInterpolate ( bool  bValue)

Apply an interpolation to the image if the source resolution is lower than the resolution of the output device. Default is false.

Parameters
bValuewhether the image should be interpolated