Foxit PDF SDK
com.foxit.sdk.common.Path Class Reference
Inheritance diagram for com.foxit.sdk.common.Path:
com.foxit.sdk.common.Base

Public Member Functions

 Path ()
 Constructor.
 
 Path (Path other)
 Constructor, with another path object. More...
 
boolean appendEllipse (RectF rect) throws com.foxit.sdk.PDFException
 Add an ellipse figure to the end of current path. More...
 
boolean appendRect (RectF rect) throws com.foxit.sdk.PDFException
 Add a rectangle figure to the end of current path. More...
 
void clear () throws com.foxit.sdk.PDFException
 Clear all points. More...
 
boolean closeFigure () throws com.foxit.sdk.PDFException
 Close current figure (which is also the last figure in current path). More...
 
boolean cubicBezierTo (PointF point1, PointF point2, PointF point3) throws com.foxit.sdk.PDFException
 Add a cubic bezier spline to the end of current figure, by three points: two control points and one target point. More...
 
synchronized void delete ()
 Clean up related resources immediately. More...
 
PointF getPoint (int index) throws com.foxit.sdk.PDFException
 Get a point specified by index. More...
 
int getPointCount () throws com.foxit.sdk.PDFException
 Get the count of points. More...
 
int getPointType (int index) throws com.foxit.sdk.PDFException
 Get the type of a point specified by index. More...
 
void increasePointCount (int count) throws com.foxit.sdk.PDFException
 Increase the point count and prepare adequate memory for these new points. More...
 
boolean isEmpty ()
 Check whether current object is empty or not. More...
 
boolean lineTo (PointF point) throws com.foxit.sdk.PDFException
 Add a point to the end of current figure, and a line is to be drawn from current point to the new point. More...
 
boolean moveTo (PointF point) throws com.foxit.sdk.PDFException
 Add a point to the end of current path, to start a new figure. More...
 
boolean removePoint (int index) throws com.foxit.sdk.PDFException
 Remove a point specified by index. More...
 
boolean setPoint (int index, PointF point, int type) throws com.foxit.sdk.PDFException
 Change the value and type of a point specified by index. More...
 
void transform (Matrix2D matrix) throws com.foxit.sdk.PDFException
 Transform all points in current path with a given matrix. More...
 
- Public Member Functions inherited from com.foxit.sdk.common.Base
synchronized void delete ()
 Clean up related resources immediately. More...
 

Static Public Attributes

static final int e_TypeBezierTo = 4
 Indicates that this point is a control point or ending point for a Bezier spline.
 
static final int e_TypeBezierToCloseFigure = 5
 Indicates that this point is the ending point for a Bezier spline, and this point will also be connected to the nearest com.foxit.sdk.common.Path.e_TypeMoveTo point before this point, in order to close current figure.
 
static final int e_TypeLineTo = 2
 Indicates that a line is drawn from the previous point to this point.
 
static final int e_TypeLineToCloseFigure = 3
 Indicates that a line is drawn from the previous point to this point, and this point will also be connected to the nearest com.foxit.sdk.common.Path.e_TypeMoveTo point before this point, in order to close current figure.
 
static final int e_TypeMoveTo = 1
 Indicates that the point is the first point of a figure.
 

Detailed Description

This class represents a path which contains one or more figures.

Constructor & Destructor Documentation

◆ Path()

com.foxit.sdk.common.Path.Path ( Path  other)

Constructor, with another path object.

Parameters
[in]otherAnother path object.

Member Function Documentation

◆ appendEllipse()

boolean com.foxit.sdk.common.Path.appendEllipse ( RectF  rect) throws com.foxit.sdk.PDFException

Add an ellipse figure to the end of current path.

Parameters
[in]rectThe enclosing rectangle of an ellipse figure.
Returns
true means success, while false means failure.

◆ appendRect()

boolean com.foxit.sdk.common.Path.appendRect ( RectF  rect) throws com.foxit.sdk.PDFException

Add a rectangle figure to the end of current path.

Parameters
[in]rectA rectangle which specifies a rectangle figure.
Returns
true means success, while false means failure.

◆ clear()

void com.foxit.sdk.common.Path.clear ( ) throws com.foxit.sdk.PDFException

Clear all points.

Returns
None.

◆ closeFigure()

boolean com.foxit.sdk.common.Path.closeFigure ( ) throws com.foxit.sdk.PDFException

Close current figure (which is also the last figure in current path).

When closing current figure, the last point's type may be changed:

Returns
true means success, while false means failure.

◆ cubicBezierTo()

boolean com.foxit.sdk.common.Path.cubicBezierTo ( PointF  point1,
PointF  point2,
PointF  point3 
) throws com.foxit.sdk.PDFException

Add a cubic bezier spline to the end of current figure, by three points: two control points and one target point.

If this function succeeds, parameter point3 will become the new "current point".

Parameters
[in]point1New point as the first control point for cubic bezier, in [PDF coordinate system] (com.foxit.sdk.pdf.PDFPage).
[in]point2New point as the second control point for cubic bezier, in [PDF coordinate system] (com.foxit.sdk.pdf.PDFPage).
[in]point3New point as target point for cubic bezier, in PDF coordinate system.
Returns
true means success, while false means failure.

◆ delete()

synchronized void com.foxit.sdk.common.Path.delete ( )

Clean up related resources immediately.

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

◆ getPoint()

PointF com.foxit.sdk.common.Path.getPoint ( int  index) throws com.foxit.sdk.PDFException

Get a point specified by index.

Parameters
[in]indexThe index of the point. Valid range: 0 to (count-1). count is returned by function Path.getPointCount .
Returns
The specified point.

◆ getPointCount()

int com.foxit.sdk.common.Path.getPointCount ( ) throws com.foxit.sdk.PDFException

Get the count of points.

Returns
The count of points.

◆ getPointType()

int com.foxit.sdk.common.Path.getPointType ( int  index) throws com.foxit.sdk.PDFException

Get the type of a point specified by index.

Parameters
[in]indexThe index of the point. Valid range: 0 to (count-1). count is returned by function Path.getPointCount .
Returns
The type of specified point. Please refer to values starting from com.foxit.sdk.common.Path.e_TypeMoveTo and this would be one of these values.

◆ increasePointCount()

void com.foxit.sdk.common.Path.increasePointCount ( int  count) throws com.foxit.sdk.PDFException

Increase the point count and prepare adequate memory for these new points.

This function will allocate more memory for given point count and initialize these new points with point (0, 0) and type com.foxit.sdk.common.Path.e_TypeMoveTo by default. After calling this function successfully, user can use function Path.setPoint to set these new points.

Parameters
[in]countThe new point count. It should not be negative.
Returns
None.

◆ isEmpty()

boolean com.foxit.sdk.common.Path.isEmpty ( )

Check whether current object is empty or not.

When the current object is empty, that means current object is useless.

Returns
true means current object is empty, while false means not.

◆ lineTo()

boolean com.foxit.sdk.common.Path.lineTo ( PointF  point) throws com.foxit.sdk.PDFException

Add a point to the end of current figure, and a line is to be drawn from current point to the new point.

If this function succeeds, the new point will become the new "current point".

Parameters
[in]pointNew point, in PDF coordinate system.
Returns
true means success, while false means failure.

◆ moveTo()

boolean com.foxit.sdk.common.Path.moveTo ( PointF  point) throws com.foxit.sdk.PDFException

Add a point to the end of current path, to start a new figure.

If this function succeeds, the new point will become the new "current point", and the new figure will become the new "current figure".

Parameters
[in]pointNew point, in PDF coordinate system.
Returns
true means success, while false means failure.

◆ removePoint()

boolean com.foxit.sdk.common.Path.removePoint ( int  index) throws com.foxit.sdk.PDFException

Remove a point specified by index.

Parameters
[in]indexThe index of the point to be removed. Valid range: 0 to (count-1). count is returned by function Path.getPointCount .
Returns
true means success, while false means failure.

◆ setPoint()

boolean com.foxit.sdk.common.Path.setPoint ( int  index,
PointF  point,
int  type 
) throws com.foxit.sdk.PDFException

Change the value and type of a point specified by index.

Parameters
[in]indexThe index of the point. Valid range: 0 to (count-1). count is returned by function Path.getPointCount .
[in]pointThe new point to set, in PDF coordinate system.
[in]typeThe type used to set to the new point. Please refer to values starting from com.foxit.sdk.common.Path.e_TypeMoveTo and this should be one of these values.
Returns
true means success, while false means failure.

◆ transform()

void com.foxit.sdk.common.Path.transform ( Matrix2D  matrix) throws com.foxit.sdk.PDFException

Transform all points in current path with a given matrix.

Parameters
[in]matrixA matrix used for transforming.
Returns
None.