FoxitPDFSDKforWeb  8.5.0
Foxit PDF SDK for Web
Matrix Class Reference

PDF matrix for coordinate transformation. More...

Public Member Functions

 concat (a, b, c, d, e, f, bPrepended)
 Concatenate with another matrix. More...
 
 constructor (a=1, b=0, c=0, d=1, e=0, f=0)
 
 getA ()
 Get coefficient a.
 
 getAngle ()
 Get rotated angle. More...
 
 getB ()
 Get coefficient b.
 
 getC ()
 Get coefficient c.
 
 getD ()
 Get coefficient d.
 
 getE ()
 Get coefficient e.
 
 getF ()
 Get coefficient f.
 
 getUnitRect ()
 Get a bounding rectangle of the parallelogram composing two unit vectors. More...
 
 getXUnit ()
 Get the x-direction unit size. More...
 
 getYUnit ()
 Get the y-direction unit size. More...
 
 is90Rotated ()
 Current matrix is rotated 90 degrees.
 
 isScaled ()
 Current matrix is scaled.
 
 matchRect (dest, src)
 Get a matrix that transforms a source rectangle to dest rectangle. More...
 
 reset ()
 
 reverse (matrix=this)
 
 rotate (fRadian, bPrepended)
 Rotate the matrix. More...
 
 rotateAt (dx, dy, fRadian, bPrepended)
 Rotate the matrix at a position. More...
 
 scale (sx, sy, bPrepended)
 Scale current matrix. More...
 
 set (a, b, c, d, e, f)
 Set matrix's coefficient. More...
 
 setReverse (martix)
 Set the coefficients of the inverse of another matrix to this matrix. More...
 
 transformDistance (dx, dy)
 Transform distance. More...
 
 transformPoint (x, y)
 Transform point. More...
 
 transformRect (left, top, right, bottom)
 Transform a rectangle and return a bounding rectangle. More...
 
 transformXDistance (dx)
 Transform x-direction distance. More...
 
 transformYDistance (dy)
 Transform x-direction distance. More...
 
 translate (x, y, bPrepended)
 Translate the matrix. More...
 

Static Public Member Functions

static Concat2mt (matrix1, matrix2)
 

Detailed Description

PDF matrix for coordinate transformation.

Member Function Documentation

◆ concat()

Matrix::concat (   a,
  b,
  c,
  d,
  e,
  f,
  bPrepended 
)
inline

Concatenate with another matrix.

Parameters
a{number/matrix/array} First parameter,should be one of input coefficient a, the matrix to be concatenated or an array with 6 number elements.
b{number} The input coefficient b.
c{number} The input coefficient c.
d{number} The input coefficient d.
e{number} The input coefficient e.
f{number} The input coefficient f.
bPrepended{bool}

◆ Concat2mt()

static Matrix::Concat2mt (   matrix1,
  matrix2 
)
inlinestatic

Concat two matrices. It means to get the result of matrix1*matrix2.

Parameters
matrix1{Matrix} Matrix one.
matrix2{Matrix} Matrix two.
Returns
{Matrix} The result of matrix1*matrix2.

◆ constructor()

Matrix::constructor (   a = 1,
  b = 0,
  c = 0,
  d = 1,
  e = 0,
  f = 0 
)
inline

Constructors for Matrix

Parameters
a{number} First construct parameter, could be the input coefficient a, a other Matrix object or an array with 6 number elements.
b{number} The input coefficient b.
c{number} The input coefficient c.
d{number} The input coefficient d.
e{number} The input coefficient e.
f{number} The input coefficient f.
Example:
function example () {
let matrix1 = new Matrix();//default matrix which no effects.
let matrix2 = new Matrix(2,0,0,1.5,0,0);//a matrix which magnified 2 times horizontally and 1.5 times vertically
let matrix3 = new Matrix(matrix2);//a matrix copied from matrix2.
}

◆ getAngle()

Matrix::getAngle ( )
inline

Get rotated angle.

Returns
Rotated angle.

◆ getUnitRect()

Matrix::getUnitRect ( )
inline

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

Returns
{Array[number]} The unit rectangle.

◆ getXUnit()

Matrix::getXUnit ( )
inline

Get the x-direction unit size.

Returns
The x-direction unit size.

◆ getYUnit()

Matrix::getYUnit ( )
inline

Get the y-direction unit size.

Returns
The y-direction unit size.

◆ matchRect()

Matrix::matchRect (   dest,
  src 
)
inline

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

Parameters
dest{Array[number]} The dest rectangle.
src{Array[number]} The source rectangle.

◆ reset()

Matrix::reset ( )
inline

Reset matrix to [1,0,0,1,0,0].

◆ reverse()

Matrix::reverse (   matrix = this)
inline

Get inversed matrix of another matrix.

Parameters
matrix{Matrix} Input matrix.
Returns
<Matrix> Inversed matrix

◆ rotate()

Matrix::rotate (   fRadian,
  bPrepended 
)
inline

Rotate the matrix.

Parameters
fRadian{number} Rotation angle in radian.
bPrepended{bool} If it's TRUE, a rotation matrix is multiplied at left side, or at right side.

◆ rotateAt()

Matrix::rotateAt (   dx,
  dy,
  fRadian,
  bPrepended 
)
inline

Rotate the matrix at a position.

Parameters
dx{number} The x coordinate from which to rotate.
dy{number} The y coordinate from which to rotate.
fRadian{number} Rotation angle in radian.
bPrepended{bool} If this is TRUE, a rotation matrix is multiplied at left side, or at right side

◆ scale()

Matrix::scale (   sx,
  sy,
  bPrepended 
)
inline

Scale current matrix.

Parameters
sx{number} The x-direction scale coefficient.
sy{number} The y-direction scale coefficient.
bPrepended{bool} If this is TRUE, a scaling matrix is multiplied at left side, or at right side.

◆ set()

Matrix::set (   a,
  b,
  c,
  d,
  e,
  f 
)
inline

Set matrix's coefficient.

Parameters
a{number} The input coefficient a.
b{number} The input coefficient b.
c{number} The input coefficient c.
d{number} The input coefficient d.
e{number} The input coefficient e.
f{number} The input coefficient f.

◆ setReverse()

Matrix::setReverse (   martix)
inline

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

Parameters
matrix{Matrix} Input matrix.

◆ transformDistance()

Matrix::transformDistance (   dx,
  dy 
)
inline

Transform distance.

Parameters
{number}dx X-direction distance
{number}dy Y-direction distance
Returns
{number} The transformed distance.

◆ transformPoint()

Matrix::transformPoint (   x,
  y 
)
inline

Transform point.

Parameters
{number}dx Horizen coordinary value of point.
{number}dy Vertical coordinary value of point.
Returns
{Array.[number]} The transformed point.

◆ transformRect()

Matrix::transformRect (   left,
  top,
  right,
  bottom 
)
inline

Transform a rectangle and return a bounding rectangle.

Parameters
left{number} Left of rectangle.
top{number} Top of rectangle.
right{number} Right of rectangle.
bottom{number} Bottom of rectangle.
Returns
<Array[number]> The transformed rectangle.

◆ transformXDistance()

Matrix::transformXDistance (   dx)
inline

Transform x-direction distance.

Parameters
{number}dx X-direction distance
Returns
{number} The transformed distance.

◆ transformYDistance()

Matrix::transformYDistance (   dy)
inline

Transform x-direction distance.

Parameters
{number}dy Y-direction distance
Returns
{number} The transformed distance.

◆ translate()

Matrix::translate (   x,
  y,
  bPrepended 
)
inline

Translate the matrix.

Parameters
x{number} The x-direction delta value.
y{number} The y-direction delta value.
bPrepended{bool} If this is TRUE, a translation matrix is multiplied at left side, or at right side.

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