Foxit PDF SDK
FSGraphicsObject Class Reference
Inheritance diagram for FSGraphicsObject:
FSFormXObject FSImageObject FSPathObject FSShadingObject FSTextObject

Instance Methods

(BOOL) - addClipPath:fill_mode:
 Add a path for clipping.
More...
 
(BOOL) - addClipTextObject:
 Add text object for clipping.
More...
 
(BOOL) - clearClips
 Clear all clips.
More...
 
(FSGraphicsObject *) - clone
 Clone a new graphics object.
More...
 
(FSPath *) - getClipPath:
 Get a path clip by index.
More...
 
(int) - getClipPathCount
 Get the count of path clip.
More...
 
(FSFillMode- getClipPathFillMode:
 Get the fill mode of a path clip by index.
More...
 
(FSTextObject *) - getClipTextObject:
 Get the text object of a text clip by index.
More...
 
(int) - getClipTextObjectCount
 Get the count of text clip.
More...
 
(FSFormXObject *) - getFormXObject
 Get the form XObject graphics object if current graphics object represents a form XObject object.
More...
 
(FSImageObject *) - getImageObject
 Get the image graphics object if current graphics object represents an image object.
More...
 
(FSLayerNodeArray *) - getLayers:
 Get all the layers which are associated with current graphics object.
More...
 
(FSMarkedContent *) - getMarkedContent
 Get marked content object.
More...
 
(FSPathObject *) - getPathObject
 Get the path graphics object if current graphics object represents a path object.
More...
 
(FSRectF *) - getRect
 Get the rectangle of current graphics object.
More...
 
(FSShadingObject *) - getShadingObject
 Get the shading graphics object if current graphics object represents a shading object.
More...
 
(FSTextObject *) - getTextObject
 Get the text graphics object if current graphics object represents a text object.
More...
 
(FSGraphicsObjectType- getType
 Get the type of current graphics object.
More...
 
(BOOL) - hasTransparency
 Check whether current graphics object has transparency or not.
More...
 
(BOOL) - removeClipPath:
 Remove a path clip by index.
More...
 
(BOOL) - removeClipTextObject:
 Remove a text clip by index for clipping.
More...
 
(void) - rotate:
 Rotate current graphics object from current state with specified angle degree in clockwise.
More...
 
(BOOL) - transform:need_transform_clippath:
 Transform current graphics object.
More...
 

Properties

FSGraphicsObjectBlendMode blendMode
 Get or Set the blend mode for transparent imaging model.

 
FSRectFclipRect
 Get or Set clip rectangle.

 
FSColorStatecolorState
 Get or Set color state.
More...
 
unsigned int fillColor
 Get or Set the fill color.
More...
 
float fillOpacity
 Get or Set the opacity value for painting operations other than stroking.

 
FSGraphStategraphState
 Get or Set graph state.
More...
 
FSMatrix2Dmatrix
 Get or Set matrix.

 
unsigned int strokeColor
 Get or Set the stroke color.
More...
 
float strokeOpacity
 Get or Set opacity value for stroke painting operations for paths and glyph outlines.

 

Detailed Description

Content of a PDF page usually consists of a sequence of graphics objects. Each graphics object contains its state information, data and instructions for rendering.
Class FSGraphicsObject is the base class for all types of PDF graphics objects. It offers the base functions to get/set graphics object's common properties. For concrete graphics object types, please refer to derived classes.
To get or insert/remove a graphics object, please refer to class FSGraphicsObjects.
If any change is done to a PDF graphics object, please remember to call function FSGraphicsObjects::generateContent for FSGraphicsObjects object (to which current graphics object belongs). Please refer to comment of function FSGraphicsObjects::generateContent for more details.

See also
FSGraphicsObjects

Method Documentation

◆ addClipPath:fill_mode:()

- (BOOL) addClipPath: (FSPath*)  path
fill_mode: (FSFillMode fill_mode 

Add a path for clipping.

Parameters
[in]pathPath data to be added to current graphics object.
[in]fill_modeFill mode for the input path. Please refer to values starting from FSFillModeNone and this should be one of these values.
Returns
YES means success, while NO means failure.
Note
When this function succeeds, function FSGraphicsObjects::generateContent should be called. Please refer to function FSGraphicsObjects::generateContent for more details.

◆ addClipTextObject:()

- (BOOL) addClipTextObject: (FSTextObject*)  textobject

Add text object for clipping.

Parameters
[in]textobjectText object to be added for clipping.
Returns
YES means success, while NO means failure.
Note
When this function succeeds, function FSGraphicsObjects::generateContent should be called. Please refer to function FSGraphicsObjects::generateContent for more details.

◆ clearClips()

- (BOOL) clearClips

Clear all clips.

Returns
YES means success, while NO means failure.
Note
When this function succeeds, function FSGraphicsObjects::generateContent should be called. Please refer to function FSGraphicsObjects::generateContent for more details.

◆ clone()

- (FSGraphicsObject *) clone

Clone a new graphics object.

Newly cloned graphics object is related to the same page with current graphics object by default. Newly cloned graphics object can only be used inside the PDF file which contains current graphics object.

Returns
Cloned graphics object. If there is any error, this function will return nil.

◆ getClipPath:()

- (FSPath *) getClipPath: (int)  index

Get a path clip by index.

Parameters
[in]indexPath clip index. Valid range: from 0 to (count-1). count is returned by function FSGraphicsObject::getClipPath:.
Returns
Path data. If the return value of function FSPath::isEmpty for the returned path object is YES, that means there is any error.

◆ getClipPathCount()

- (int) getClipPathCount

Get the count of path clip.

Returns
Count of path clip.

◆ getClipPathFillMode:()

- (FSFillMode) getClipPathFillMode: (int)  index

Get the fill mode of a path clip by index.

Parameters
[in]indexPath clip index. Valid range: from 0 to (count-1). count is returned by function FSGraphicsObject::getClipPath:.
Returns
Fill mode. Please refer to values starting from FSFillModeNone and this would be one of these values.

◆ getClipTextObject:()

- (FSTextObject *) getClipTextObject: (int)  index

Get the text object of a text clip by index.

Parameters
[in]indexText clip index. Valid range: from 0 to (count-1). count is returned by function FSGraphicsObject::getClipTextObjectCount.
Returns
A text graphics object. If there is any error, this function will return nil.

◆ getClipTextObjectCount()

- (int) getClipTextObjectCount

Get the count of text clip.

Returns
Count of text clip.

◆ getFormXObject()

- (FSFormXObject *) getFormXObject

Get the form XObject graphics object if current graphics object represents a form XObject object.

Returns
Form XObject graphics object. If current graphics object does not represent a form XObject object, this function will return nil.

◆ getImageObject()

- (FSImageObject *) getImageObject

Get the image graphics object if current graphics object represents an image object.

Returns
Image graphics object. If current graphics object does not represent an image object, this function will return nil.

◆ getLayers:()

- (FSLayerNodeArray *) getLayers: (FSLayerTree*)  layer_tree

Get all the layers which are associated with current graphics object.

Parameters
[in]layer_treeA valid layer tree. All the layer nodes in this layer tree will be enumerated in order to find which are associated with current graphics object.
Returns
A layer node array which contains all the matched layer node.

◆ getMarkedContent()

- (FSMarkedContent *) getMarkedContent

Get marked content object.

Returns
A marked content object.

◆ getPathObject()

- (FSPathObject *) getPathObject

Get the path graphics object if current graphics object represents a path object.

Returns
Path graphics object. If current graphics object does not represent a path object, this function will return nil.

◆ getRect()

- (FSRectF *) getRect

Get the rectangle of current graphics object.

Returns
Rectangle of current graphics object. If there is any error, this function will return a RectF object with all values 0.

◆ getShadingObject()

- (FSShadingObject *) getShadingObject

Get the shading graphics object if current graphics object represents a shading object.

Returns
Shading graphics object. If current graphics object does not represent a shading object, this function will return nil.

◆ getTextObject()

- (FSTextObject *) getTextObject

Get the text graphics object if current graphics object represents a text object.

Returns
Text graphics object. If current graphics object does not represent a text object, this function will return nil.

◆ getType()

- (FSGraphicsObjectType) getType

Get the type of current graphics object.

Returns
Graphics object type. Please refer to values starting from FSGraphicsObjectTypeText and this would be one of these values except FSGraphicsObjectTypeAll.

◆ hasTransparency()

- (BOOL) hasTransparency

Check whether current graphics object has transparency or not.

Returns
YES means current graphics object has transparency, while NO means not.

◆ removeClipPath:()

- (BOOL) removeClipPath: (int)  index

Remove a path clip by index.

Parameters
[in]indexPath clip index. Valid range: from 0 to (count-1). count is returned by function FSGraphicsObject::getClipPath:.
Returns
YES means success, while NO means failure.
Note
When this function succeeds, function FSGraphicsObjects::generateContent should be called. Please refer to function FSGraphicsObjects::generateContent for more details.

◆ removeClipTextObject:()

- (BOOL) removeClipTextObject: (int)  index

Remove a text clip by index for clipping.

Parameters
[in]indexText clip index. Valid range: from 0 to (count-1). count is returned by function FSGraphicsObject::getClipTextObjectCount.
Returns
YES means success, while NO means failure.
Note
When this function succeeds, function FSGraphicsObjects::generateContent should be called. Please refer to function FSGraphicsObjects::generateContent for more details.

◆ rotate:()

- (void) rotate: (int)  angle

Rotate current graphics object from current state with specified angle degree in clockwise.

Parameters
[in]angleAngle degree value, which is used to rotate current graphics object from current state in clockwise. Value range: from 0 to 360. Specially, if the input value is 0 or 360 (which means not to rotate current graphics object), current function will do nothing.
Returns
None.
Note
When this function succeeds, function FSGraphicsObjects::generateContent should be called. Please refer to function FSGraphicsObjects::generateContent for more details.

◆ transform:need_transform_clippath:()

- (BOOL) transform: (FSMatrix2D*)  matrix
need_transform_clippath: (BOOL)  need_transform_clippath 

Transform current graphics object.

Parameters
[in]matrixTransform matrix.
[in]need_transform_clippathYES means to transform clip path with current graphics object. NO means to transform current graphics object only.
Returns
YES means success, while NO means failure.
Note
When this function succeeds, function FSGraphicsObjects::generateContent should be called. Please refer to function FSGraphicsObjects::generateContent for more details.

Property Documentation

◆ colorState

- (FSColorState *) colorState
readwritenonatomicweak

Get or Set color state.

Text graphics object, path graphics object, and form XObject graphics object can have color state.

◆ fillColor

- (unsigned int) fillColor
readwritenonatomicassign

Get or Set the fill color.

Text graphics object, path graphics object, and form XObject graphics object can have this property. Function FSGraphicsObject::colorState can be used to get fille color in other color space, like CMYK color space.

◆ graphState

- (FSGraphState *) graphState
readwritenonatomicweak

Get or Set graph state.

Form XObjet graphics object, path graphics object and text graphics object can have this property.

◆ strokeColor

- (unsigned int) strokeColor
readwritenonatomicassign

Get or Set the stroke color.

Text graphics object, path graphics object, and form XObject graphics object can have this property.
Function FSGraphicsObject::colorState can be used to get stroke color in other color space, like CMYK color space.