Foxit PDF SDK

Public Member Functions | Static Public Member Functions | List of all members
com.foxit.sdk.pdf.graphics.ImageObject Class Reference
Inheritance diagram for com.foxit.sdk.pdf.graphics.ImageObject:

## Public Member Functions
Bitmap | cloneBitmap (GraphicsObjects graphics_objects) throws com.foxit.sdk.PDFException
Bitmap | cloneBitmap (PDFPage page, GraphicsObjects graphics_objects) throws com.foxit.sdk.PDFException
| Clone the bitmap from current image graphics object. More...
synchronized void | delete ()
| Clean up related C++ resources immediately. More...
int | getColorSpace () throws com.foxit.sdk.PDFException
| Get color space. More...
PDFObject | getMask ()
| Get the PDF object that represents the mask of current image graphics object. More...
PDFStream | getStream () throws com.foxit.sdk.PDFException
| Get image stream. More...
boolean | isImageMask ()
| Check if current image object is treated as mask. More...
void | setBitmap (Bitmap bitmap, Bitmap mask) throws com.foxit.sdk.PDFException
| Set a bitmap to current image graphics object. More...
void | setImage (Image image, int frame_index) throws com.foxit.sdk.PDFException
| Set one frame of an image to current image graphics object. More...
Public Member Functions inherited from com.foxit.sdk.pdf.graphics.GraphicsObject
boolean | addClipPath (Path path, int fill_mode) throws com.foxit.sdk.PDFException
| Add a path for clipping. More...
boolean | addClipTextObject (TextObject textobject) throws com.foxit.sdk.PDFException
| Add text object for clipping. More...
boolean | clearClips ()
| Clear all clips. More...
GraphicsObject | clone ()
| Clone a new graphics object. More...
GraphicsObject | clone (GraphicsObjects src_graphicsobjects, GraphicsObjects dest_graphicsobjects)
| Clone a new graphics object. More...
synchronized void | delete ()
| Clean up related C++ resources immediately. More...
boolean | equal (GraphicsObject other)
| Check if input object is equal to current object. More...
int | getBlendMode () throws com.foxit.sdk.PDFException
| Get the blend mode for transparent imaging model. More...
Path | getClipPath (int index) throws com.foxit.sdk.PDFException
| Get a path clip by index. More...
int | getClipPathCount ()
| Get the count of path clip. More...
int | getClipPathFillMode (int index) throws com.foxit.sdk.PDFException
| Get the fill mode of a path clip by index. More...
RectF | getClipRect ()
| Get clip rectangle. More...
TextObject | getClipTextObject (int index) throws com.foxit.sdk.PDFException
| Get the text object of a text clip by index. More...
int | getClipTextObjectCount ()
| Get the count of text clip. More...
ColorState | getColorState ()
| Get color state. More...
long | getFillColor ()
| Get the fill color. More...
float | getFillOpacity () throws com.foxit.sdk.PDFException
| Get the opacity value for painting operations other than stroking. More...
FormXObject | getFormXObject ()
| Get the form XObject graphics object if current graphics object represents a form XObject object. More...
GraphState | getGraphState ()
| Get graph state. More...
ImageObject | getImageObject ()
| Get the image graphics object if current graphics object represents an image object. More...
LayerNodeArray | getLayers (LayerTree layer_tree) throws com.foxit.sdk.PDFException
| Get all the layers which are associated with current graphics object. More...
MarkedContent | getMarkedContent ()
| Get marked content object. More...
Matrix2D | getMatrix () throws com.foxit.sdk.PDFException
| Get matrix. More...
PathObject | getPathObject ()
| Get the path graphics object if current graphics object represents a path object. More...
RectF | getRect ()
| Get the rectangle of current graphics object. More...
ShadingObject | getShadingObject ()
| Get the shading graphics object if current graphics object represents a shading object. More...
long | getStrokeColor ()
| Get the stroke color. More...
float | getStrokeOpacity () throws com.foxit.sdk.PDFException
| Get opacity value for stroke painting operations for paths and glyph outlines. More...
TextObject | getTextObject ()
| Get the text graphics object if current graphics object represents a text object. More...
int | getType ()
| Get the type of current graphics object. More...
boolean | 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...
boolean | removeClipPath (int index) throws com.foxit.sdk.PDFException
| Remove a path clip by index. More...
boolean | removeClipTextObject (int index) throws com.foxit.sdk.PDFException
| Remove a text clip by index for clipping. More...
void | rotate (int angle)
| Rotate current graphics object from current state with specified angle degree in clockwise. More...
void | setBlendMode (int blend_mode) throws com.foxit.sdk.PDFException
| Set the blend mode for transparent imaging model. More...
void | setClipRect (RectF clip_rect)
| Set clip rectangle. More...
void | setColorState (ColorState color_state) throws com.foxit.sdk.PDFException
| Set color state. More...
void | setFillColor (long color) throws com.foxit.sdk.PDFException
| Set the fill color. More...
void | setFillOpacity (float opacity) throws com.foxit.sdk.PDFException
| Set the opacity value for painting operations other than stroking. More...
void | setGraphState (GraphState graph_state) throws com.foxit.sdk.PDFException
| Set graph state. More...
void | setMatrix (Matrix2D matrix) throws com.foxit.sdk.PDFException
| Set matrix. More...
void | setStrokeColor (long color) throws com.foxit.sdk.PDFException
| Set the stroke color. More...
void | setStrokeOpacity (float opacity) throws com.foxit.sdk.PDFException
| Set opacity value for stroke painting operations for paths and glyph outlines. More...
boolean | transform (Matrix2D matrix, boolean need_transform_clippath)
| Transform current graphics object. More...

## Static Public Member Functions
static ImageObject | create (PDFDoc document) throws com.foxit.sdk.PDFException
| Create a new image graphics object. More...
static ImageObject | createFromType3TextObject (PDFPage page, TextObject text_obj)
| Create an image graphics object from a type3 text object. More...

## Additional Inherited Members
Static Public Attributes inherited from com.foxit.sdk.pdf.graphics.GraphicsObject
static final int | e_BlendColor = 23
| Creates a color with the hue and saturation of the source color, and the luminosity of the backdrop color. More...
static final int | e_BlendColorBurn = 7
| Darkens backdrop color to reflect the source color. More...
static final int | e_BlendColorDodge = 6
| Brightens backdrop color to reflect source colors. More...
static final int | e_BlendDarken = 4
| Select darker one of backdrop and source colors. More...
static final int | e_BlendDifference = 10
| Subtracts the darker of the two constituent colors from lighter colors. More...
static final int | e_BlendExclusion = 11
| Creates a color with the hue of the source color, and the saturation and luminosity of the backdrop color. More...
static final int | e_BlendHardlight = 8
| Multiply or screens colors, depending on source color value. More...
static final int | e_BlendHue = 21
| Creates a color with the hue of the source color, and the saturation and luminosity of the backdrop color. More...
static final int | e_BlendLighten = 5
| Select lighter one of backdrop and source colors. More...
static final int | e_BlendLuminosity = 24
| Creates a color with the luminosity of the source color, and the hue and saturation of the backdrop color. More...
static final int | e_BlendMultiply = 1
| Multiply backdrop by source color values. More...
static final int | e_BlendNormal = 0
| Selecting source color and ignoring backdrop color. More...
static final int | e_BlendOverlay = 3
| Multiply or screens colors, depending on backdrop color value. More...
static final int | e_BlendSaturation = 22
| Creates a color with the saturation of the source color, and the hue and luminosity of the backdrop color. More...
static final int | e_BlendScreen = 2
| Multiply complements of backdrop by source color values, and then complement the result. More...
static final int | e_BlendSoftlight = 9
| Darkens or lightens colors, depending on source color value. More...
static final int | e_TypeAll = 0
| Represents all graphics object types, only used as filter.
static final int | e_TypeEmptyMarkedContent = 7
| Empty marked-content object.
static final int | e_TypeFormXObject = 5
| Form XObject graphics object.
static final int | e_TypeImage = 3
| Image graphics object.
static final int | e_TypeInlines = 6
| Inline graphics object.
static final int | e_TypePath = 2
| Path graphics object.
static final int | e_TypeShading = 4
| Shading graphics object.
static final int | e_TypeText = 1
| Text graphics object.

## 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 Function Documentation

## ◆ cloneBitmap() [1/2]

Bitmap com.foxit.sdk.pdf.graphics.ImageObject.cloneBitmap | ( | GraphicsObjects | graphics_objects | ) | throws com.foxit.sdk.PDFException

Deprecated:
  This function is deprecated. Use function ImageObject.cloneBitmap with two parameters instead.

Currently, the bitmap can be cloned from image graphics object only when the bitmap format is one of following formats:
com.foxit.sdk.common.Bitmap.e_DIB8bppMask , com.foxit.sdk.common.Bitmap.e_DIB8bpp , com.foxit.sdk.common.Bitmap.e_DIBRgb , com.foxit.sdk.common.Bitmap.e_DIBRgb32 , com.foxit.sdk.common.Bitmap.e_DIBArgb , com.foxit.sdk.common.Bitmap.e_DIBCmyk .
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_objects | A valid com.foxit.sdk.pdf.GraphicsObjects object. Please ensure that current image graphics object just belongs to this com.foxit.sdk.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.

## ◆ cloneBitmap() [2/2]

Bitmap com.foxit.sdk.pdf.graphics.ImageObject.cloneBitmap | ( | PDFPage | page,
|  | GraphicsObjects | graphics_objects
| ) |  | throws com.foxit.sdk.PDFException

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:
com.foxit.sdk.common.Bitmap.e_DIB8bppMask , com.foxit.sdk.common.Bitmap.e_DIB8bpp , com.foxit.sdk.common.Bitmap.e_DIBRgb , com.foxit.sdk.common.Bitmap.e_DIBRgb32 , com.foxit.sdk.common.Bitmap.e_DIBArgb , com.foxit.sdk.common.Bitmap.e_DIBCmyk .
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] | page | A valid PDF page object. Please ensure that current image graphics object just belongs to this page.
  [in] | graphics_objects | A valid com.foxit.sdk.pdf.GraphicsObjects object. Please ensure that current image graphics object just belongs to this com.foxit.sdk.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 com.foxit.sdk.pdf.graphics.ImageObject.create | ( | PDFDoc | document | ) | throws com.foxit.sdk.PDFException
| 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. 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.

Parameters

  [in] | document | A 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 there is any error, this function will return null.

## ◆ createFromType3TextObject()

static ImageObject com.foxit.sdk.pdf.graphics.ImageObject.createFromType3TextObject | ( | PDFPage | page,
|  | TextObject | text_obj
| ) |  |
| static

Create an image graphics object from a type3 text 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.

Parameters

  [in] | page | A valid PDF page object.
  [in] | text_obj | A valid text object. This text object should be a type3 text object.

Returns
  A new image object. If there is any error, this function will return null.

## ◆ delete()

synchronized void com.foxit.sdk.pdf.graphics.ImageObject.delete | ( |  | ) |

Clean up related C++ resources immediately.

Returns
  None.

Note
  Once this function is called, current object cannot be used anymore.

## ◆ getColorSpace()

int com.foxit.sdk.pdf.graphics.ImageObject.getColorSpace | ( |  | ) | throws com.foxit.sdk.PDFException

Get color space.

Returns
  Color space. Please refer to values starting from com.foxit.sdk.common.Constants.e_ColorSpaceDeviceGray and this would be one of these values.

## ◆ getMask()

PDFObject com.foxit.sdk.pdf.graphics.ImageObject.getMask | ( |  | ) |

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()

PDFStream com.foxit.sdk.pdf.graphics.ImageObject.getStream | ( |  | ) | throws com.foxit.sdk.PDFException

Get image stream.

Returns
  A com.foxit.sdk.pdf.objects.PDFStream that represents the image stream. If there is any error, this function will return null.

## ◆ isImageMask()

boolean com.foxit.sdk.pdf.graphics.ImageObject.isImageMask | ( |  | ) |

Check if current image object is treated as mask.

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

## ◆ setBitmap()

void com.foxit.sdk.pdf.graphics.ImageObject.setBitmap | ( | Bitmap | bitmap,
|  | Bitmap | mask
| ) |  | throws com.foxit.sdk.PDFException

Set a bitmap to current image graphics object.

Parameters

  [in] | bitmap | A valid bitmap object to be set to current image.
  [in] | mask | Mask 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 com.foxit.sdk.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 com.foxit.sdk.pdf.graphics.ImageObject.setImage | ( | Image | image,
|  | int | frame_index
| ) |  | throws com.foxit.sdk.PDFException

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] | image | A valid image object. This image should contain at least one frame and the image type should not be com.foxit.sdk.common.Image.e_Unknown .
  [in] | frame_index | Frame 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.