Foxit PDF SDK
CFX_Matrix Class Reference

Inherits CFX_Object.

Public Member Functions

 CFX_Matrix ()
 Construct a identity transformation matrix.
 
 CFX_Matrix (FX_FLOAT a1, FX_FLOAT b1, FX_FLOAT c1, FX_FLOAT d1, FX_FLOAT e1, FX_FLOAT f1)
 Construct a matrix with six input coefficients. More...
 
void Concat (const CFX_Matrix &m, FX_BOOL bPrepended=false)
 Concatenate with another matrix. More...
 
void Concat (FX_FLOAT a, FX_FLOAT b, FX_FLOAT c, FX_FLOAT d, FX_FLOAT e, FX_FLOAT f, FX_BOOL bPrepended=false)
 Concatenate with another matrix. More...
 
void ConcatInverse (const CFX_Matrix &m, FX_BOOL bPrepended=false)
 Concatenate the inverse of another matrix. More...
 
void Copy (const CFX_Matrix &m)
 Copy coefficients from another matrix. More...
 
FX_FLOAT GetA () const
 Get the coefficient a. More...
 
FX_FLOAT GetB () const
 Get the coefficient b. More...
 
FX_FLOAT GetC () const
 Get the coefficient c. More...
 
FX_FLOAT GetD () const
 Get the coefficient d. More...
 
FX_FLOAT GetE () const
 Get the coefficient e. More...
 
FX_FLOAT GetF () const
 Get the coefficient f. More...
 
FX_FLOAT GetUnitArea () const
 Get area of the parallelogram composing two unit vectors. More...
 
void GetUnitParallelogram (CFX_ParallelogramF &pg) const
 Get a parallelogram conposing two unit vectors. More...
 
CFX_FloatRect GetUnitRect () const
 Get a bounding rectangle of the parallelogram composing two unit vectors. More...
 
void GetUnitRect (CFX_RectF &rect) const
 Get a bounding rectangle of the parallelogram composing two unit vectors. More...
 
FX_FLOAT GetXUnit () const
 Get the x-direction unit size. More...
 
FX_FLOAT GetYUnit () const
 Get the y-direction unit size. More...
 
FX_BOOL Is90Rotated () const
 Whether this matrix has rotating of 90, or -90 degrees. More...
 
FX_BOOL IsIdentity () const
 Determine whether a matrix is an identity transformation or not. More...
 
FX_BOOL IsInvertible () const
 Determine whether a matrix is invertible or not. More...
 
FX_BOOL IsScaled () const
 Whether this matrix has scaling (or translating) only. No rotating. More...
 
void MatchRect (const CFX_FloatRect &dest, const CFX_FloatRect &src)
 Get a matrix that transforms a source rectangle to dest rectangle. More...
 
FX_BOOL operator!= (const CFX_Matrix &src) const
 Compare(!=) operator overload. Compare two matrixs. More...
 
FX_BOOL operator== (const CFX_Matrix &src) const
 Compare(==) operator overload. Compare two matrixs. More...
 
void Reset ()
 Reset current matrix. More...
 
void Rotate (FX_FLOAT fRadian, FX_BOOL bPrepended=false)
 Rotate the matrix. More...
 
void RotateAt (FX_FLOAT fRadian, FX_FLOAT x, FX_FLOAT y, FX_BOOL bPrepended=false)
 Rotate the matrix at a position. More...
 
void Scale (FX_FLOAT sx, FX_FLOAT sy, FX_BOOL bPrepended=false)
 Scale the matrix. More...
 
void Set (const FX_FLOAT n[6])
 Change the coefficients in the matrix. More...
 
void Set (FX_FLOAT a, FX_FLOAT b, FX_FLOAT c, FX_FLOAT d, FX_FLOAT e, FX_FLOAT f)
 Change the coefficients in the matrix. More...
 
void SetIdentity ()
 Set the matrix to be an identity transformation matrix. More...
 
void SetReverse (const CFX_Matrix &m)
 Set the coefficients of the inverse of another matrix to this matrix. More...
 
void Shear (FX_FLOAT fAlphaRadian, FX_FLOAT fBetaRadian, FX_BOOL bPrepended=false)
 Shear the matrix. More...
 
void Transform (FX_FLOAT &x, FX_FLOAT &y) const
 Transform a point. More...
 
void Transform (FX_FLOAT x, FX_FLOAT y, FX_FLOAT &x1, FX_FLOAT &y1) const
 Transform a point. More...
 
FX_FLOAT TransformDistance (FX_FLOAT distance) const
 Transform a distance. More...
 
FX_FLOAT TransformDistance (FX_FLOAT dx, FX_FLOAT dy) const
 Transform distance specified by x and y value. More...
 
FX_INT32 TransformDistance (FX_INT32 dx, FX_INT32 dy) const
 Transform distance specified by x and y value. More...
 
void TransformParallelogram (CFX_Parallelogram &pg) const
 Transform a parallelogram. More...
 
void TransformParallelogram (CFX_ParallelogramF &pg) const
 Transform a parallelogram. More...
 
void TransformPoint (FX_FLOAT &x, FX_FLOAT &y) const
 Transform point specified by x and y value. More...
 
void TransformPoint (FX_INT32 &x, FX_INT32 &y) const
 Transform point specified by x and y value. More...
 
void TransformPoints (CFX_Point *points, FX_INT32 iCount) const
 Transform points. More...
 
void TransformPoints (CFX_PointF *points, FX_INT32 iCount) const
 Transform points. More...
 
void TransformRect (CFX_FloatRect &rect) const
 Transform a rectangle and return a bounding rectangle. The result rectangle is always normalized: left <= right, and bottom <= top. More...
 
void TransformRect (CFX_Rect &rect) const
 Transform a rectangle and return a bounding rectangle. The result rectangle is always normalized: left <= right, and top <= bottom. More...
 
void TransformRect (CFX_RectF &rect) const
 Transform a rectangle and return a bounding rectangle. The result rectangle is always normalized: left <= right, and top <= bottom. More...
 
void TransformRect (FX_FLOAT &left, FX_FLOAT &right, FX_FLOAT &top, FX_FLOAT &bottom) const
 Transform a rectangle and return a bounding rectangle. The result rectangle is always normalized: left <= right, and bottom <= top. More...
 
void TransformRect (FX_RECT &rect) const
 Transform a rectangle and return a bounding rectangle. The result rectangle is always normalized: left <= right, and bottom <= top. More...
 
void TransformRoundRect (CFX_RoundRect &rr) const
 Transform a round rectangle. More...
 
void TransformRoundRect (CFX_RoundRectF &rr) const
 Transform a round rectangle. More...
 
void TransformVector (CFX_Vector &v) const
 Transform a vector. More...
 
void TransformVector (CFX_VectorF &v) const
 Transform a vector. More...
 
FX_FLOAT TransformXDistance (FX_FLOAT dx) const
 Transform a x-distance. More...
 
FX_INT32 TransformXDistance (FX_INT32 dx) const
 Transform a x-distance. More...
 
FX_FLOAT TransformYDistance (FX_FLOAT dy) const
 Transform a y-distance. More...
 
FX_INT32 TransformYDistance (FX_INT32 dy) const
 Transform a y-distance. More...
 
void Translate (FX_FLOAT x, FX_FLOAT y, FX_BOOL bPrepended=false)
 Translate the matrix. More...
 
void TranslateI (FX_INT32 x, FX_INT32 y, FX_BOOL bPrepended=false)
 Translate the matrix. using integer value. More...
 

Public Attributes

FX_FLOAT a
 The coefficient a.
 
FX_FLOAT b
 The coefficient b.
 
FX_FLOAT c
 The coefficient c.
 
FX_FLOAT d
 The coefficient d.
 
FX_FLOAT e
 The coefficient e.
 
FX_FLOAT f
 The coefficient f.
 

Detailed Description

Affine (linear) transformation matrix.

It defines six coefficients: a, b, c, d, e, f. The transformation equations are: dest_x = a * src_x + c * src_y + e; dest_y = b * src_x + d * src_y + f;

Constructor & Destructor Documentation

◆ CFX_Matrix()

CFX_Matrix::CFX_Matrix ( FX_FLOAT  a1,
FX_FLOAT  b1,
FX_FLOAT  c1,
FX_FLOAT  d1,
FX_FLOAT  e1,
FX_FLOAT  f1 
)
inline

Construct a matrix with six input coefficients.

Parameters
[in]a1The input coefficient a.
[in]b1The input coefficient b.
[in]c1The input coefficient c.
[in]d1The input coefficient d.
[in]e1The input coefficient e.
[in]f1The input coefficient f.

Member Function Documentation

◆ Concat() [1/2]

void CFX_Matrix::Concat ( const CFX_Matrix m,
FX_BOOL  bPrepended = false 
)

Concatenate with another matrix.

Parameters
[in]mThe input matrix.
[in]bPrependedIf this is true, the concatenation matrix is multiplied at left side, or at right side.
Returns
None.

◆ Concat() [2/2]

void CFX_Matrix::Concat ( FX_FLOAT  a,
FX_FLOAT  b,
FX_FLOAT  c,
FX_FLOAT  d,
FX_FLOAT  e,
FX_FLOAT  f,
FX_BOOL  bPrepended = false 
)

Concatenate with another matrix.

Parameters
[in]aThe coefficient a of the input matrix.
[in]bThe coefficient b of the input matrix.
[in]cThe coefficient c of the input matrix.
[in]dThe coefficient d of the input matrix.
[in]eThe coefficient e of the input matrix.
[in]fThe coefficient f of the input matrix.
[in]bPrependedIf this is true, the concatenation matrix is multiplied at left side, or at right side.
Returns
None.

◆ ConcatInverse()

void CFX_Matrix::ConcatInverse ( const CFX_Matrix m,
FX_BOOL  bPrepended = false 
)

Concatenate the inverse of another matrix.

Parameters
[in]mThe input matrix.
[in]bPrependedIf this is true, the concatenation matrix is multiplied at left side, or at right side.
Returns
None.

◆ Copy()

void CFX_Matrix::Copy ( const CFX_Matrix m)
inline

Copy coefficients from another matrix.

Parameters
[in]mThe input matrix.
Returns
None.

◆ GetA()

FX_FLOAT CFX_Matrix::GetA ( ) const
inline

Get the coefficient a.

Returns
The coefficient a.

◆ GetB()

FX_FLOAT CFX_Matrix::GetB ( ) const
inline

Get the coefficient b.

Returns
The coefficient b.

◆ GetC()

FX_FLOAT CFX_Matrix::GetC ( ) const
inline

Get the coefficient c.

Returns
The coefficient c.

◆ GetD()

FX_FLOAT CFX_Matrix::GetD ( ) const
inline

Get the coefficient d.

Returns
The coefficient d.

◆ GetE()

FX_FLOAT CFX_Matrix::GetE ( ) const
inline

Get the coefficient e.

Returns
The coefficient e.

◆ GetF()

FX_FLOAT CFX_Matrix::GetF ( ) const
inline

Get the coefficient f.

Returns
The coefficient f.

◆ GetUnitArea()

FX_FLOAT CFX_Matrix::GetUnitArea ( ) const

Get area of the parallelogram composing two unit vectors.

Returns
The area of the parallelogram composing two unit vectors.

◆ GetUnitParallelogram()

void CFX_Matrix::GetUnitParallelogram ( CFX_ParallelogramF pg) const

Get a parallelogram conposing two unit vectors.

Parameters
[out]pgIt recieves the outputting unit parallelogram.
Returns
None.

◆ GetUnitRect() [1/2]

CFX_FloatRect CFX_Matrix::GetUnitRect ( ) const

Get a bounding rectangle of the parallelogram composing two unit vectors.

Returns
The unit rect.

◆ GetUnitRect() [2/2]

void CFX_Matrix::GetUnitRect ( CFX_RectF rect) const

Get a bounding rectangle of the parallelogram composing two unit vectors.

Parameters
[out]rectIt recieves the outputting unit rect.
Returns
None.

◆ GetXUnit()

FX_FLOAT CFX_Matrix::GetXUnit ( ) const

Get the x-direction unit size.

Returns
The x-direction unit size.

◆ GetYUnit()

FX_FLOAT CFX_Matrix::GetYUnit ( ) const

Get the y-direction unit size.

Returns
The y-direction unit size.

◆ Is90Rotated()

FX_BOOL CFX_Matrix::Is90Rotated ( ) const

Whether this matrix has rotating of 90, or -90 degrees.

Returns
true means current matrix has rotating of 90, or -90 degrees, while false means not.

◆ IsIdentity()

FX_BOOL CFX_Matrix::IsIdentity ( ) const
inline

Determine whether a matrix is an identity transformation or not.

Returns
true means current matrix is identity, while false means not.

◆ IsInvertible()

FX_BOOL CFX_Matrix::IsInvertible ( ) const

Determine whether a matrix is invertible or not.

Returns
true means current matrix is invertible, while false means not.

◆ IsScaled()

FX_BOOL CFX_Matrix::IsScaled ( ) const

Whether this matrix has scaling (or translating) only. No rotating.

Returns
true means current matrix has scaling (or translating) only, while false means not.

◆ MatchRect()

void CFX_Matrix::MatchRect ( const CFX_FloatRect dest,
const CFX_FloatRect src 
)

Get a matrix that transforms a source rectangle to dest rectangle.

Parameters
[in]destThe dest rectangle.
[in]srcThe source rectangle.
Returns
None.

◆ operator!=()

FX_BOOL CFX_Matrix::operator!= ( const CFX_Matrix src) const
inline

Compare(!=) operator overload. Compare two matrixs.

Parameters
[in]srcThe matrix to compare.
Returns
true means not equal, while false means equal.

◆ operator==()

FX_BOOL CFX_Matrix::operator== ( const CFX_Matrix src) const
inline

Compare(==) operator overload. Compare two matrixs.

Parameters
[in]srcThe matrix to compare.
Returns
true means equal, while false means not equal.

◆ Reset()

void CFX_Matrix::Reset ( )
inline

Reset current matrix.

Returns
None.

◆ Rotate()

void CFX_Matrix::Rotate ( FX_FLOAT  fRadian,
FX_BOOL  bPrepended = false 
)

Rotate the matrix.

Parameters
[in]fRadianRotation angle in radian.
[in]bPrependedIf it's true, a rotation matrix is multiplied at left side, or at right side.
Returns
None.

◆ RotateAt()

void CFX_Matrix::RotateAt ( FX_FLOAT  fRadian,
FX_FLOAT  x,
FX_FLOAT  y,
FX_BOOL  bPrepended = false 
)

Rotate the matrix at a position.

Parameters
[in]fRadianRotation angle in radian.
[in]xThe x coordinate from which to rotate.
[in]yThe y coordinate from which to rotate.
[in]bPrependedIf this is true, a rotation matrix is multiplied at left side, or at right side.
Returns
None.

◆ Scale()

void CFX_Matrix::Scale ( FX_FLOAT  sx,
FX_FLOAT  sy,
FX_BOOL  bPrepended = false 
)

Scale the matrix.

Parameters
[in]sxThe x-direction scale coefficient.
[in]syThe y-direction scale coefficient.
[in]bPrependedIf this is true, a scaling matrix is multiplied at left side, or at right side.
Returns
None.

◆ Set() [1/2]

void CFX_Matrix::Set ( const FX_FLOAT  n[6])

Change the coefficients in the matrix.

Parameters
[in]nThe input coefficient array.
Returns
None.

◆ Set() [2/2]

void CFX_Matrix::Set ( FX_FLOAT  a,
FX_FLOAT  b,
FX_FLOAT  c,
FX_FLOAT  d,
FX_FLOAT  e,
FX_FLOAT  f 
)

Change the coefficients in the matrix.

Parameters
[in]aThe input coefficient a.
[in]bThe input coefficient b.
[in]cThe input coefficient c.
[in]dThe input coefficient d.
[in]eThe input coefficient e.
[in]fThe input coefficient f.
Returns
None.

◆ SetIdentity()

void CFX_Matrix::SetIdentity ( )
inline

Set the matrix to be an identity transformation matrix.

Returns
None.

◆ SetReverse()

void CFX_Matrix::SetReverse ( const CFX_Matrix m)

Set the coefficients of the inverse of another matrix to this matrix.

Parameters
[in]mThe input matrix.
Returns
None.

◆ Shear()

void CFX_Matrix::Shear ( FX_FLOAT  fAlphaRadian,
FX_FLOAT  fBetaRadian,
FX_BOOL  bPrepended = false 
)

Shear the matrix.

Parameters
[in]fAlphaRadianShearing angle of x axis.
[in]fBetaRadianShearing angle of y axis.
[in]bPrependedIf this is true, a shearing matrix is multiplied at left side, or at right side.
Returns
None.

◆ Transform() [1/2]

void CFX_Matrix::Transform ( FX_FLOAT x,
FX_FLOAT y 
) const
inline

Transform a point.

Parameters
[in,out]xThe input x-coordinate of the point, and It receives the output transformed x-coordinate.
[in,out]yThe input y-coordinate of the point, and It receives the output transformed y-coordinate.
Returns
None.

◆ Transform() [2/2]

void CFX_Matrix::Transform ( FX_FLOAT  x,
FX_FLOAT  y,
FX_FLOAT x1,
FX_FLOAT y1 
) const
inline

Transform a point.

Parameters
[in]xThe input x-coordinate of the point.
[in]yThe input y-coordinate of the point.
[out]x1It receives the output transformed x-coordinate.
[out]y1It receives the output transformed y-coordinate.
Returns
None.

◆ TransformDistance() [1/3]

FX_FLOAT CFX_Matrix::TransformDistance ( FX_FLOAT  distance) const

Transform a distance.

Parameters
[in]distanceThe input distance.
Returns
The transformed distance.

◆ TransformDistance() [2/3]

FX_FLOAT CFX_Matrix::TransformDistance ( FX_FLOAT  dx,
FX_FLOAT  dy 
) const

Transform distance specified by x and y value.

Parameters
[in]dxThe input x value.
[in]dyThe input y value.
Returns
The transformed distance.

◆ TransformDistance() [3/3]

FX_INT32 CFX_Matrix::TransformDistance ( FX_INT32  dx,
FX_INT32  dy 
) const

Transform distance specified by x and y value.

Parameters
[in]dxThe input x value.
[in]dyThe input y value.
Returns
The transformed distance.

◆ TransformParallelogram() [1/2]

void CFX_Matrix::TransformParallelogram ( CFX_Parallelogram pg) const

Transform a parallelogram.

Parameters
[in,out]pgThe input parallelogram, and it receives the output transformed parallelogram.
Returns
None.

◆ TransformParallelogram() [2/2]

void CFX_Matrix::TransformParallelogram ( CFX_ParallelogramF pg) const

Transform a parallelogram.

Parameters
[in,out]pgThe input parallelogram, and it receives the output transformed parallelogram.
Returns
None.

◆ TransformPoint() [1/2]

void CFX_Matrix::TransformPoint ( FX_FLOAT x,
FX_FLOAT y 
) const

Transform point specified by x and y value.

Parameters
[in,out]xThe input x-coordinate of the point, and it receives the output transformed x-coordinate.
[in,out]yThe input y-coordinate of the point, and it receives the output transformed y-coordinate.
Returns
None.

◆ TransformPoint() [2/2]

void CFX_Matrix::TransformPoint ( FX_INT32 x,
FX_INT32 y 
) const

Transform point specified by x and y value.

Parameters
[in,out]xThe input x-coordinate of the point, and it receives the output transformed x-coordinate.
[in,out]yThe input y-coordinate of the point, and it receives the output transformed y-coordinate.
Returns
None.

◆ TransformPoints() [1/2]

void CFX_Matrix::TransformPoints ( CFX_Point points,
FX_INT32  iCount 
) const

Transform points.

Parameters
[in,out]pointsThe input a array of the points, and it receives the output array of the transformed points.
[in]iCountThe input count of the points.
Returns
None.

◆ TransformPoints() [2/2]

void CFX_Matrix::TransformPoints ( CFX_PointF points,
FX_INT32  iCount 
) const

Transform points.

Parameters
[in,out]pointsThe input a array of the points, and it receives the output array of the transformed points.
[in]iCountThe input count of the points.
Returns
None.

◆ TransformRect() [1/5]

void CFX_Matrix::TransformRect ( CFX_FloatRect rect) const
inline

Transform a rectangle and return a bounding rectangle. The result rectangle is always normalized: left <= right, and bottom <= top.

Parameters
[in,out]rectThe input rectangle, and it receives the output transformed and normalized rectangle.
Returns
None.

◆ TransformRect() [2/5]

void CFX_Matrix::TransformRect ( CFX_Rect rect) const

Transform a rectangle and return a bounding rectangle. The result rectangle is always normalized: left <= right, and top <= bottom.

Parameters
[in,out]rectThe input rectangle, and it receives the output transformed rectangle.
Returns
None.

◆ TransformRect() [3/5]

void CFX_Matrix::TransformRect ( CFX_RectF rect) const

Transform a rectangle and return a bounding rectangle. The result rectangle is always normalized: left <= right, and top <= bottom.

Parameters
[in,out]rectThe input rectangle, and it receives the output transformed rectangle.
Returns
None.

◆ TransformRect() [4/5]

void CFX_Matrix::TransformRect ( FX_FLOAT left,
FX_FLOAT right,
FX_FLOAT top,
FX_FLOAT bottom 
) const

Transform a rectangle and return a bounding rectangle. The result rectangle is always normalized: left <= right, and bottom <= top.

Parameters
[in,out]leftThe input x-coordinate of the left-bottom corner, and it receives the output transformed and normalized x-coordinate.
[in,out]rightThe input x-coordinate of the right-top corner, and it receives the output transformed and normalized x-coordinate.
[in,out]topThe input y-coordinate of the right-top corner, and it receives the output transformed and normalized y-coordinate.
[in,out]bottomThe input y-coordinate of the left-bottom corner, and it receives the output transformed and normalized y-coordinate.
Returns
None.

◆ TransformRect() [5/5]

void CFX_Matrix::TransformRect ( FX_RECT rect) const

Transform a rectangle and return a bounding rectangle. The result rectangle is always normalized: left <= right, and bottom <= top.

Parameters
[in,out]rectThe input rectangle, and it receives the output transformed and normalized rectangle.
Returns
None.

◆ TransformRoundRect() [1/2]

void CFX_Matrix::TransformRoundRect ( CFX_RoundRect rr) const

Transform a round rectangle.

Parameters
[in,out]rrThe input round rectangle, and it receives the output transformed round rectangle.
Returns
None.

◆ TransformRoundRect() [2/2]

void CFX_Matrix::TransformRoundRect ( CFX_RoundRectF rr) const

Transform a round rectangle.

Parameters
[in,out]rrThe input round rectangle, and it receives the output transformed round rectangle.
Returns
None.

◆ TransformVector() [1/2]

void CFX_Matrix::TransformVector ( CFX_Vector v) const

Transform a vector.

Parameters
[in,out]vThe input vector, and it receives the output transformed vector.
Returns
None.

◆ TransformVector() [2/2]

void CFX_Matrix::TransformVector ( CFX_VectorF v) const

Transform a vector.

Parameters
[in,out]vThe input vector, and it receives the output transformed vector.
Returns
None.

◆ TransformXDistance() [1/2]

FX_FLOAT CFX_Matrix::TransformXDistance ( FX_FLOAT  dx) const

Transform a x-distance.

Parameters
[in]dxThe input x-distance.
Returns
The transformed distance.

◆ TransformXDistance() [2/2]

FX_INT32 CFX_Matrix::TransformXDistance ( FX_INT32  dx) const

Transform a x-distance.

Parameters
[in]dxThe input x-distance.
Returns
The transformed distance.

◆ TransformYDistance() [1/2]

FX_FLOAT CFX_Matrix::TransformYDistance ( FX_FLOAT  dy) const

Transform a y-distance.

Parameters
[in]dyThe input y-distance.
Returns
The transformed distance.

◆ TransformYDistance() [2/2]

FX_INT32 CFX_Matrix::TransformYDistance ( FX_INT32  dy) const

Transform a y-distance.

Parameters
[in]dyThe input y-distance.
Returns
The transformed distance.

◆ Translate()

void CFX_Matrix::Translate ( FX_FLOAT  x,
FX_FLOAT  y,
FX_BOOL  bPrepended = false 
)

Translate the matrix.

Parameters
[in]xThe x-direction delta value.
[in]yThe y-direction delta value.
[in]bPrependedIf this is true, a translation matrix is multiplied at left side, or at right side.
Returns
None.

◆ TranslateI()

void CFX_Matrix::TranslateI ( FX_INT32  x,
FX_INT32  y,
FX_BOOL  bPrepended = false 
)
inline

Translate the matrix. using integer value.

Parameters
[in]xThe x-direction delta integer value.
[in]yThe y-direction delta integer value.
[in]bPrependedIf this is true, a translation matrix is multiplied at left side, or at right side.
Returns
None.