Foxit PDF SDK
foxit::pdf::graphics::ImageObject Class Reference
Inheritance diagram for foxit::pdf::graphics::ImageObject:
foxit::pdf::graphics::GraphicsObject

Public Types

enum  ColorSpace {
  e_ColorSpaceInvalid = 0, e_ColorSpaceDeviceGray = 1, e_ColorSpaceDeviceRGB = 2, e_ColorSpaceDeviceCMYK = 3,
  e_ColorSpaceCalGray = 4, e_ColorSpaceCalRGB = 5, e_ColorSpaceLab = 6, e_ColorSpaceSeparation = 8,
  e_ColorSpaceDeviceN = 9, e_ColorSpacePattern = 11, e_ColorSpaceICCBasedDeviceGray = 12, e_ColorSpaceICCBasedDeviceRGB = 13,
  e_ColorSpaceICCBasedDeviceCMYK = 14
}
 Enumeration for image color space. More...
 
- Public Types inherited from foxit::pdf::graphics::GraphicsObject
enum  BlendMode {
  e_BlendNormal = 0, e_BlendMultiply = 1, e_BlendScreen = 2, e_BlendOverlay = 3,
  e_BlendDarken = 4, e_BlendLighten = 5, e_BlendColorDodge = 6, e_BlendColorBurn = 7,
  e_BlendHardlight = 8, e_BlendSoftlight = 9, e_BlendDifference = 10, e_BlendExclusion = 11,
  e_BlendHue = 21, e_BlendSaturation = 22, e_BlendColor = 23, e_BlendLuminosity = 24
}
 Enumeration for render blend mode. More...
 
enum  Type {
  e_TypeAll = 0, e_TypeText = 1, e_TypePath = 2, e_TypeImage = 3,
  e_TypeShading = 4, e_TypeFormXObject = 5
}
 Enumeration for PDF graphics object type. More...
 

Public Member Functions

common::Bitmap CloneBitmap (const GraphicsObjects &graphics_objects)
 Clone the bitmap from current image graphics object. More...
 
ColorSpace GetColorSpace () const
 Get color space. More...
 
objects::PDFObjectGetMask () const
 Get the PDF object that represents the mask of current image graphics object. More...
 
objects::PDFStreamGetStream () const
 Get image stream. More...
 
bool IsImageMask () const
 Check if current image object is treated as mask. More...
 
void SetBitmap (const common::Bitmap &bitmap, const common::Bitmap &mask=common::Bitmap())
 Set a bitmap to current image graphics object. More...
 
void SetImage (const common::Image &image, int frame_index)
 Set one frame of an image to current image graphics object. More...
 
- Public Member Functions inherited from foxit::pdf::graphics::GraphicsObject
bool AddClipPath (const common::Path &path, common::FillMode fill_mode)
 Add a path for clipping. More...
 
bool AddClipTextObject (TextObject *textobject)
 Add text object for clipping. More...
 
bool ClearClips ()
 Clear all clips. More...
 
GraphicsObjectClone ()
 Clone a new graphics object. More...
 
BlendMode GetBlendMode () const
 Get the blend mode for transparent imaging model. More...
 
common::Path GetClipPath (int index) const
 Get a path clip by index. More...
 
int GetClipPathCount () const
 Get the count of path clip. More...
 
common::FillMode GetClipPathFillMode (int index) const
 Get the fill mode of a path clip by index. More...
 
RectF GetClipRect () const
 Get clip rectangle. More...
 
TextObjectGetClipTextObject (int index) const
 Get the text object of a text clip by index. More...
 
int GetClipTextObjectCount () const
 Get the count of text clip. More...
 
ARGB GetFillColor () const
 Get the fill color. More...
 
float GetFillOpacity () const
 Get the opacity value for painting operations other than stroking. More...
 
FormXObjectGetFormXObject () const
 Get the form XObject graphics object if current graphics object represents a form XObject object. More...
 
common::GraphState GetGraphState () const
 Get graph state. More...
 
ImageObjectGetImageObject () const
 Get the image graphics object if current graphics object represents an image object. More...
 
LayerNodeArray GetLayers (const LayerTree &layer_tree)
 Get all the layers which are associated with current graphics object. More...
 
MarkedContentGetMarkedContent () const
 Get marked content object. More...
 
Matrix GetMatrix () const
 Get matrix. More...
 
PathObjectGetPathObject () const
 Get the path graphics object if current graphics object represents a path object. More...
 
RectF GetRect () const
 Get the rectangle of current graphics object. More...
 
ShadingObjectGetShadingObject () const
 Get the shading graphics object if current graphics object represents a shading object. More...
 
ARGB GetStrokeColor () const
 Get the stroke color. More...
 
float GetStrokeOpacity () const
 Get opacity value for stroke painting operations for paths and glyph outlines. More...
 
TextObjectGetTextObject () const
 Get the text graphics object if current graphics object represents a text object. More...
 
Type GetType () const
 Get the type of current graphics object. More...
 
bool HasTransparency ()
 Check whether current graphics object has transparency or not. More...
 
void Release ()
 Release a cloned or newly created PDF graphics object which has not been inserted into any PDF page or other object. More...
 
bool RemoveClipPath (int index)
 Remove a path clip by index. More...
 
bool RemoveClipTextObject (int index)
 Remove a text clip by index for clipping. More...
 
void SetBlendMode (BlendMode blend_mode)
 Set the blend mode for transparent imaging model. More...
 
void SetClipRect (const RectF &clip_rect)
 Set clip rectangle. More...
 
void SetFillColor (ARGB color)
 Set the fill color. More...
 
void SetFillOpacity (float opacity)
 Set the opacity value for painting operations other than stroking. More...
 
void SetGraphState (const common::GraphState &graph_state)
 Set graph state. More...
 
void SetMatrix (const Matrix &matrix)
 Set matrix. More...
 
void SetStrokeColor (ARGB color)
 Set the stroke color. More...
 
void SetStrokeOpacity (float opacity)
 Set opacity value for stroke painting operations for paths and glyph outlines. More...
 
bool Transform (const Matrix &matrix, bool need_transform_clippath)
 Transform current graphics object. More...
 

Static Public Member Functions

static ImageObjectCreate (const PDFDoc &document)
 Create a new image graphics object. More...
 

Detailed Description

Image graphics object is a kind of PDF graphics object, so class ImageObject is derived from class GraphicsObject. It offers functions to get/set image graphics object's data.
To create a new image graphics object, please use function ImageObject::Create and then use setting functions to set information to the new image graphics object.

See also
GraphicsObject

Member Enumeration Documentation

◆ ColorSpace

Enumeration for image color space.

Values of this enumeration should be used alone.

Enumerator
e_ColorSpaceInvalid 

Color space: Invalid.

e_ColorSpaceDeviceGray 

Color space: DeviceGray.

e_ColorSpaceDeviceRGB 

Color space: DeviceRGB.

e_ColorSpaceDeviceCMYK 

Color space: DeviceCMYK.

e_ColorSpaceCalGray 

Color space: CalGray.

e_ColorSpaceCalRGB 

Color space: CalRGB.

e_ColorSpaceLab 

Color space: Lab.

e_ColorSpaceSeparation 

Color space: Separation.

e_ColorSpaceDeviceN 

Color space: DeviceN.

e_ColorSpacePattern 

Color space: Pattern.

e_ColorSpaceICCBasedDeviceGray 

Color space: ICCBased DeviceGray.

e_ColorSpaceICCBasedDeviceRGB 

Color space: ICCBased DeviceRGB.

e_ColorSpaceICCBasedDeviceCMYK 

Color space: ICCBased DeviceCMYK.

Member Function Documentation

◆ CloneBitmap()

common::Bitmap foxit::pdf::graphics::ImageObject::CloneBitmap ( const GraphicsObjects graphics_objects)

Clone the bitmap from current image graphics object.

Currently, the bitmap can be cloned from image graphics object only when the bitmap format is one of following formats:
common::Bitmap::e_DIB8bppMask, common::Bitmap::e_DIB8bpp, common::Bitmap::e_DIBRgb, common::Bitmap::e_DIBRgb32, common::Bitmap::e_DIBArgb.
If the return value of function common::Bitmap::IsEmpty for the returned bitmap object is true, that means the DIB format of the bitmap is unsupported.

Parameters
[in]graphics_objectsA valid pdf::GraphicsObjects object. Please ensure that current image graphics object just belongs to this pdf::GraphicsObjects object (it may be a PDF page).
Returns
The new cloned bitmap object. If the return value of function common::Bitmap::IsEmpty for the returned bitmap object is true, that means the DIB format of the bitmap is unsupported.

◆ Create()

static ImageObject* foxit::pdf::graphics::ImageObject::Create ( const PDFDoc document)
static

Create a new image graphics object.

The newly created image graphics object does not have any data yet. Then, setting functions can be called to set data to the new image graphics object.

Parameters
[in]documentA valid PDF document object. The new image graphics object should be inserted to one page of this PDF document then.
Returns
A new image object.
If the newly created image graphics object will not inserted to any page or other objects, please remember to call function GraphicsObject::Release to release it when no use.

◆ GetColorSpace()

ColorSpace foxit::pdf::graphics::ImageObject::GetColorSpace ( ) const

Get color space.

Returns
Color space. Please refer to values starting from ImageObject::e_ColorSpaceDeviceGray and this would be one of these values.

◆ GetMask()

objects::PDFObject* foxit::pdf::graphics::ImageObject::GetMask ( ) const

Get the PDF object that represents the mask of current image graphics object.

The mask can be either a PDF dictionary or a PDF array:

  • A PDF dictionary represents an image mask to be applied to this image.
  • A PDF array represents a range of colors to be applied to it as a color key mask.

Please refer to Section 4.8.4 "Image Dictionaries" in <PDF Reference 1.7> for more details.

Returns
A PDF object that represents the mask. If ImageObject::IsImageMask returns true, this function will return NULL.

◆ GetStream()

objects::PDFStream* foxit::pdf::graphics::ImageObject::GetStream ( ) const

Get image stream.

Returns
A objects::PDFStream that represents the image stream. If there is any error, this function will return NULL.

◆ IsImageMask()

bool foxit::pdf::graphics::ImageObject::IsImageMask ( ) const

Check if current image object is treated as mask.

Returns
true means current object is treated as mask, while false means not.

◆ SetBitmap()

void foxit::pdf::graphics::ImageObject::SetBitmap ( const common::Bitmap bitmap,
const common::Bitmap mask = common::Bitmap() 
)

Set a bitmap to current image graphics object.

Parameters
[in]bitmapA valid bitmap object to be set to current image.
[in]maskMask bitmap. Default value: A bitmap object by default constructor and not set any value, which means no mask is used.
If this is valid, its format should be common::Bitmap::e_DIB8bppMask.
This is useful only when parameter bitmap does not have an alpha channel.
Returns
None
Note
When this function succeeds, function GraphicsObjects::GenerateContent should be called. Please refer to function GraphicsObjects::GenerateContent for more details.

◆ SetImage()

void foxit::pdf::graphics::ImageObject::SetImage ( const common::Image image,
int  frame_index 
)

Set one frame of an image to current image graphics object.

Input image may contain multiple frames, and only one frame of the image can be set to current image graphics object.

Parameters
[in]imageA valid image object. This image should contain at least one frame and the image type should not be common::Image::e_Unknown.
[in]frame_indexFrame index used to decide which frame of parameter image is to be set. Valid range: from 0 to (count-1). count is returned by function common::Image::GetFrameCount.
Returns
None
Note
When this function succeeds, function GraphicsObjects::GenerateContent should be called. Please refer to function GraphicsObjects::GenerateContent for more details.