Foxit PDF SDK
com.foxit.sdk.common.fxcrt.Matrix2D Class Reference

Public Member Functions

 Matrix2D ()
 Construct a identity transformation matrix.

 
 Matrix2D (float a1, float b1, float c1, float d1, float e1, float f1)
 Construct a matrix with six input coefficients.
More...
 
void concat (float a, float b, float c, float d, float e, float f, boolean bPrepended)
 Concatenate with another matrix.
More...
 
void concat (Matrix2D m, boolean bPrepended)
 Concatenate with another matrix.
More...
 
void concatInverse (Matrix2D m, boolean bPrepended)
 Concatenate the inverse of another matrix.
More...
 
void copy (Matrix2D m)
 Copy coefficients from another matrix.
More...
 
float getA ()
 Get the coefficient a. More...
 
float getB ()
 Get the coefficient b. More...
 
float getC ()
 Get the coefficient c. More...
 
float getD ()
 Get the coefficient d. More...
 
float getE ()
 Get the coefficient e. More...
 
float getF ()
 Get the coefficient f. More...
 
float getUnitArea ()
 Get area of the parallelogram composing two unit vectors.
More...
 
RectF getUnitRect ()
 Get a bounding rectangle of the parallelogram composing two unit vectors.
More...
 
float getXUnit ()
 Get the x-direction unit size.
More...
 
float getYUnit ()
 Get the y-direction unit size.
More...
 
boolean is90Rotated ()
 Whether this matrix has rotating of 90, or -90 degrees.
More...
 
boolean isIdentity ()
 Determine whether a matrix is an identity transformation or not.
More...
 
boolean isInvertible ()
 Determine whether a matrix is invertible or not.
More...
 
boolean isScaled ()
 Whether this matrix has scaling (or translating) only. No rotating.
More...
 
void matchRect (RectF dest, RectF src)
 Get a matrix that transforms a source rectangle to dest rectangle.
More...
 
void reset ()
 Reset current matrix.
More...
 
void rotate (float fRadian, boolean bPrepended)
 Rotate the matrix.
More...
 
void rotateAt (float fRadian, float x, float y, boolean bPrepended)
 Rotate the matrix at a position.
More...
 
void scale (float sx, float sy, boolean bPrepended)
 Scale the matrix.
More...
 
void set (float a, float b, float c, float d, float e, float f)
 Change the coefficients in the matrix.
More...
 
void set (float[] n)
 Change the coefficients in the matrix.
More...
 
void setA (float value)
 Set the coefficient a. More...
 
void setB (float value)
 Set the coefficient b. More...
 
void setC (float value)
 Set the coefficient c. More...
 
void setD (float value)
 Set the coefficient d. More...
 
void setE (float value)
 Set the coefficient e. More...
 
void setF (float value)
 Set the coefficient f. More...
 
void setIdentity ()
 Set the matrix to be an identity transformation matrix.
More...
 
void setReverse (Matrix2D m)
 Set the coefficients of the inverse of another matrix to this matrix.
More...
 
void shear (float fAlphaRadian, float fBetaRadian, boolean bPrepended)
 Shear the matrix.
More...
 
float transformDistance (float distance)
 Transform a distance.
More...
 
float transformDistance (float dx, float dy)
 Transform distance specified by x and y value.
More...
 
int transformDistance (int dx, int dy)
 Transform distance specified by x and y value.
More...
 
void transformPoint (java.lang.Float x, java.lang.Float y)
 Transform point specified by x and y value.
More...
 
void transformPoint (java.lang.Integer x, java.lang.Integer y)
 Transform point specified by x and y value.
More...
 
void transformRect (RectF rect)
 Transform a rectangle and return a bounding rectangle. The result rectangle is always normalized: left <= right, and bottom <= top.
More...
 
void transformRect (RectI rect)
 Transform a rectangle and return a bounding rectangle. The result rectangle is always normalized: left <= right, and bottom <= top.
More...
 
float transformXDistance (float dx)
 Transform a x-distance.
More...
 
int transformXDistance (int dx)
 Transform a x-distance.
More...
 
float transformYDistance (float dy)
 Transform a y-distance.
More...
 
int transformYDistance (int dy)
 Transform a y-distance.
More...
 
void translate (float x, float y, boolean bPrepended)
 Translate the matrix.
More...
 
void translateI (int x, int y, boolean bPrepended)
 Translate the matrix. using integer value.
More...
 

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

◆ Matrix2D()

com.foxit.sdk.common.fxcrt.Matrix2D.Matrix2D ( float  a1,
float  b1,
float  c1,
float  d1,
float  e1,
float  f1 
)

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 com.foxit.sdk.common.fxcrt.Matrix2D.concat ( float  a,
float  b,
float  c,
float  d,
float  e,
float  f,
boolean  bPrepended 
)

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.

◆ concat() [2/2]

void com.foxit.sdk.common.fxcrt.Matrix2D.concat ( Matrix2D  m,
boolean  bPrepended 
)

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.

◆ concatInverse()

void com.foxit.sdk.common.fxcrt.Matrix2D.concatInverse ( Matrix2D  m,
boolean  bPrepended 
)

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 com.foxit.sdk.common.fxcrt.Matrix2D.copy ( Matrix2D  m)

Copy coefficients from another matrix.

Parameters
[in]mThe input matrix.
Returns
None.

◆ getA()

com.foxit.sdk.common.fxcrt.Matrix2D.getA ( )

Get the coefficient a.

Returns
The coefficient a.

◆ getB()

com.foxit.sdk.common.fxcrt.Matrix2D.getB ( )

Get the coefficient b.

Returns
The coefficient b.

◆ getC()

com.foxit.sdk.common.fxcrt.Matrix2D.getC ( )

Get the coefficient c.

Returns
The coefficient c.

◆ getD()

com.foxit.sdk.common.fxcrt.Matrix2D.getD ( )

Get the coefficient d.

Returns
The coefficient d.

◆ getE()

com.foxit.sdk.common.fxcrt.Matrix2D.getE ( )

Get the coefficient e.

Returns
The coefficient e.

◆ getF()

com.foxit.sdk.common.fxcrt.Matrix2D.getF ( )

Get the coefficient f.

Returns
The coefficient f.

◆ getUnitArea()

float com.foxit.sdk.common.fxcrt.Matrix2D.getUnitArea ( )

Get area of the parallelogram composing two unit vectors.

Returns
The area of the parallelogram composing two unit vectors.

◆ getUnitRect()

RectF com.foxit.sdk.common.fxcrt.Matrix2D.getUnitRect ( )

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

Returns
The unit rect.

◆ getXUnit()

float com.foxit.sdk.common.fxcrt.Matrix2D.getXUnit ( )

Get the x-direction unit size.

Returns
The x-direction unit size.

◆ getYUnit()

float com.foxit.sdk.common.fxcrt.Matrix2D.getYUnit ( )

Get the y-direction unit size.

Returns
The y-direction unit size.

◆ is90Rotated()

boolean com.foxit.sdk.common.fxcrt.Matrix2D.is90Rotated ( )

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

boolean com.foxit.sdk.common.fxcrt.Matrix2D.isIdentity ( )

Determine whether a matrix is an identity transformation or not.

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

◆ isInvertible()

boolean com.foxit.sdk.common.fxcrt.Matrix2D.isInvertible ( )

Determine whether a matrix is invertible or not.

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

◆ isScaled()

boolean com.foxit.sdk.common.fxcrt.Matrix2D.isScaled ( )

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 com.foxit.sdk.common.fxcrt.Matrix2D.matchRect ( RectF  dest,
RectF  src 
)

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

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

◆ reset()

void com.foxit.sdk.common.fxcrt.Matrix2D.reset ( )

Reset current matrix.

Returns
None.

◆ rotate()

void com.foxit.sdk.common.fxcrt.Matrix2D.rotate ( float  fRadian,
boolean  bPrepended 
)

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 com.foxit.sdk.common.fxcrt.Matrix2D.rotateAt ( float  fRadian,
float  x,
float  y,
boolean  bPrepended 
)

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 com.foxit.sdk.common.fxcrt.Matrix2D.scale ( float  sx,
float  sy,
boolean  bPrepended 
)

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 com.foxit.sdk.common.fxcrt.Matrix2D.set ( float  a,
float  b,
float  c,
float  d,
float  e,
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.

◆ set() [2/2]

void com.foxit.sdk.common.fxcrt.Matrix2D.set ( float[]  n)

Change the coefficients in the matrix.

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

◆ setA()

com.foxit.sdk.common.fxcrt.Matrix2D.setA ( float  value)

Set the coefficient a.

Parameters
[in]valueThe coefficient a.
Returns
None.

◆ setB()

com.foxit.sdk.common.fxcrt.Matrix2D.setB ( float  value)

Set the coefficient b.

Parameters
[in]valueThe coefficient b.
Returns
None.

◆ setC()

com.foxit.sdk.common.fxcrt.Matrix2D.setC ( float  value)

Set the coefficient c.

Parameters
[in]valueThe coefficient c.
Returns
None.

◆ setD()

com.foxit.sdk.common.fxcrt.Matrix2D.setD ( float  value)

Set the coefficient d.

Parameters
[in]valueThe coefficient d.
Returns
None.

◆ setE()

com.foxit.sdk.common.fxcrt.Matrix2D.setE ( float  value)

Set the coefficient e.

Parameters
[in]valueThe coefficient e.
Returns
None.

◆ setF()

com.foxit.sdk.common.fxcrt.Matrix2D.setF ( float  value)

Set the coefficient f.

Parameters
[in]valueThe coefficient f.
Returns
None.

◆ setIdentity()

void com.foxit.sdk.common.fxcrt.Matrix2D.setIdentity ( )

Set the matrix to be an identity transformation matrix.

Returns
None.

◆ setReverse()

void com.foxit.sdk.common.fxcrt.Matrix2D.setReverse ( Matrix2D  m)

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

Parameters
[in]mThe input matrix.
Returns
None.

◆ shear()

void com.foxit.sdk.common.fxcrt.Matrix2D.shear ( float  fAlphaRadian,
float  fBetaRadian,
boolean  bPrepended 
)

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.

◆ transformDistance() [1/3]

float com.foxit.sdk.common.fxcrt.Matrix2D.transformDistance ( float  distance)

Transform a distance.

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

◆ transformDistance() [2/3]

float com.foxit.sdk.common.fxcrt.Matrix2D.transformDistance ( float  dx,
float  dy 
)

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]

int com.foxit.sdk.common.fxcrt.Matrix2D.transformDistance ( int  dx,
int  dy 
)

Transform distance specified by x and y value.

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

◆ transformPoint() [1/2]

void com.foxit.sdk.common.fxcrt.Matrix2D.transformPoint ( java.lang.Float  x,
java.lang.Float  y 
)

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 com.foxit.sdk.common.fxcrt.Matrix2D.transformPoint ( java.lang.Integer  x,
java.lang.Integer  y 
)

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.

◆ transformRect() [1/2]

void com.foxit.sdk.common.fxcrt.Matrix2D.transformRect ( RectF  rect)

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/2]

void com.foxit.sdk.common.fxcrt.Matrix2D.transformRect ( RectI  rect)

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.

◆ transformXDistance() [1/2]

float com.foxit.sdk.common.fxcrt.Matrix2D.transformXDistance ( float  dx)

Transform a x-distance.

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

◆ transformXDistance() [2/2]

int com.foxit.sdk.common.fxcrt.Matrix2D.transformXDistance ( int  dx)

Transform a x-distance.

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

◆ transformYDistance() [1/2]

float com.foxit.sdk.common.fxcrt.Matrix2D.transformYDistance ( float  dy)

Transform a y-distance.

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

◆ transformYDistance() [2/2]

int com.foxit.sdk.common.fxcrt.Matrix2D.transformYDistance ( int  dy)

Transform a y-distance.

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

◆ translate()

void com.foxit.sdk.common.fxcrt.Matrix2D.translate ( float  x,
float  y,
boolean  bPrepended 
)

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 com.foxit.sdk.common.fxcrt.Matrix2D.translateI ( int  x,
int  y,
boolean  bPrepended 
)

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.