foxit::common::Path Class Reference
Inheritance diagram for foxit::common::Path:
foxit::Base

Public Types

enum  PointType {
  e_TypeMoveTo = 1, e_TypeLineTo = 2, e_TypeLineToCloseFigure = 3, e_TypeBezierTo = 4,
  e_TypeBezierToCloseFigure = 5
}
 Enumeration for point type in path. More...
 

Public Member Functions

 Path ()
 Constructor.
 
 Path (const Path &other)
 Constructor, with another path object. More...
 
 ~Path ()
 Destructor.
 
bool AppendEllipse (const RectF &rect)
 Add an ellipse figure to the end of current path. More...
 
bool AppendRect (const RectF &rect)
 Add a rectangle figure to the end of current path. More...
 
void Clear ()
 Clear all points. More...
 
bool CloseFigure ()
 Close current figure (which is also the last figure in current path). More...
 
bool CubicBezierTo (const PointF &point1, const PointF &point2, const PointF &point3)
 Add a cubic bezier spline to the end of current figure, by three points: two control points and one target point. More...
 
PointF GetPoint (int index)
 Get a point specified by index. More...
 
int GetPointCount ()
 Get the count of points. More...
 
PointType GetPointType (int index)
 Get the type of a point specified by index. More...
 
bool IsEmpty () const
 Check whether current object is empty or not. More...
 
bool LineTo (const PointF &point)
 Add a point to the end of current figure, and a line is to be drawn from current point to the new point. More...
 
bool MoveTo (const PointF &point)
 Add a point to the end of current path, to start a new figure. More...
 
bool operator!= (const Path &other) const
 Not equal operator. More...
 
Pathoperator= (const Path &other)
 Assign operator. More...
 
bool operator== (const Path &other) const
 Equal operator. More...
 
bool RemovePoint (int index)
 Remove a point specified by index. More...
 
bool SetPoint (int index, const PointF &point, PointType type)
 Change the value and type of a point specified by index. More...
 
void Transform (const Matrix &matrix)
 Transform all points in current path with a given matrix. More...
 
- Public Member Functions inherited from foxit::Base
FS_HANDLE Handle () const
 Get the handle of current object. More...
 

Detailed Description

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

Member Enumeration Documentation

◆ PointType

Enumeration for point type in path.

Values of this enumeration should be used alone.

Enumerator
e_TypeMoveTo 

Indicates that the point is the first point of a figure.

e_TypeLineTo 

Indicates that a line is drawn from the previous point to this point.

e_TypeLineToCloseFigure 

Indicates that a line is drawn from the previous point to this point, and this point will also be connected to the nearest Path::e_TypeMoveTo point before this point, in order to close current figure.

e_TypeBezierTo 

Indicates that this point is a control point or ending point for a Bezier spline.

e_TypeBezierToCloseFigure 

Indicates that this point is the ending point for a Bezier spline, and this point will also be connected to the nearest Path::e_TypeMoveTo point before this point, in order to close current figure.

Constructor & Destructor Documentation

◆ Path()

foxit::common::Path::Path ( const Path other)

Constructor, with another path object.

Parameters
[in]otherAnother path object.

Member Function Documentation

◆ AppendEllipse()

bool foxit::common::Path::AppendEllipse ( const RectF rect)

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

bool foxit::common::Path::AppendRect ( const RectF rect)

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 foxit::common::Path::Clear ( )

Clear all points.

Returns
None.

◆ CloseFigure()

bool foxit::common::Path::CloseFigure ( )

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

bool foxit::common::Path::CubicBezierTo ( const PointF point1,
const PointF point2,
const PointF point3 
)

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.
[in]point2New point as the second control point for cubic bezier, in PDF coordinate system.
[in]point3New point as target point for cubic bezier, in PDF coordinate system.
Returns
true means success, while false means failure.

◆ GetPoint()

PointF foxit::common::Path::GetPoint ( int  index)

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 foxit::common::Path::GetPointCount ( )

Get the count of points.

Returns
The count of points.

◆ GetPointType()

PointType foxit::common::Path::GetPointType ( int  index)

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 Path::e_TypeMoveTo and this would be one of these values.

◆ IsEmpty()

bool foxit::common::Path::IsEmpty ( ) const

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

bool foxit::common::Path::LineTo ( const PointF point)

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

bool foxit::common::Path::MoveTo ( const PointF point)

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.

◆ operator!=()

bool foxit::common::Path::operator!= ( const Path other) const

Not equal operator.

Parameters
[in]otherAnother path object. This function will check if current object is not equal to this one.
Returns
true means not equal, while false means equal.

◆ operator=()

Path& foxit::common::Path::operator= ( const Path other)

Assign operator.

Parameters
[in]otherAnother path object, whose value would be assigned to current object.
Returns
Reference to current object itself.

◆ operator==()

bool foxit::common::Path::operator== ( const Path other) const

Equal operator.

Parameters
[in]otherAnother path object. This function will check if current object is equal to this one.
Returns
true means equal, while false means not equal.

◆ RemovePoint()

bool foxit::common::Path::RemovePoint ( int  index)

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

bool foxit::common::Path::SetPoint ( int  index,
const PointF point,
PointType  type 
)

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 Path::e_TypeMoveTo and this should be one of these values.
Returns
true means success, while false means failure.

◆ Transform()

void foxit::common::Path::Transform ( const Matrix matrix)

Transform all points in current path with a given matrix.

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

Foxit Software Corporation Logo
@2019 Foxit Software Incorporated. All rights reserved.