| FoxitPDFSDKforWeb v11.0.6 Archives Foxit PDF SDK for Web

Public Member Functions | Static Public Member Functions | List of all members
Matrix Class Reference
PDF

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. More...
| getAngle ()
| Get rotated angle. More...
| getB ()
| Get coefficient b. More...
| getC ()
| Get coefficient c. More...
| getD ()
| Get coefficient d. More...
| getE ()
| Get coefficient e. More...
| getF ()
| Get coefficient f. More...
| 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|[number,number,number,number,number,number] - 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 | boolean -

## ◆ Concat2mt()

static Matrix::Concat2mt | ( |  | matrix1,
|  |  | matrix2
| ) |  |
| inline static

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.
  }

## ◆ getA()

Matrix::getA | ( |  | ) |
| inline

Get coefficient a.

Returns
  number -

## ◆ getAngle()

Matrix::getAngle | ( |  | ) |
| inline

Get rotated angle.

Returns
  number - Rotated angle.

## ◆ getB()

Matrix::getB | ( |  | ) |
| inline

Get coefficient b.

Returns
  number -

## ◆ getC()

Matrix::getC | ( |  | ) |
| inline

Get coefficient c.

Returns
  number -

## ◆ getD()

Matrix::getD | ( |  | ) |
| inline

Get coefficient d.

Returns
  number -

## ◆ getE()

Matrix::getE | ( |  | ) |
| inline

Get coefficient e.

Returns
  number -

## ◆ getF()

Matrix::getF | ( |  | ) |
| inline

Get coefficient f.

Returns
  number -

## ◆ getUnitRect()

Matrix::getUnitRect | ( |  | ) |
| inline

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

Returns
  number[] - The unit rectangle.

## ◆ getXUnit()

Matrix::getXUnit | ( |  | ) |
| inline

Get the x-direction unit size.

Returns
  number - The x-direction unit size.

## ◆ getYUnit()

Matrix::getYUnit | ( |  | ) |
| inline

Get the y-direction unit size.

Returns
  number - The y-direction unit size.

## ◆ matchRect()

Matrix::matchRect | ( |  | dest,
|  |  | src
| ) |  |
| inline

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

Parameters

  dest | number[] - The dest rectangle.
  src | 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 | boolean - 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 | boolean - 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 | boolean - 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

  dx | number - X-direction distance
  dy | number - Y-direction distance

Returns
  number - The transformed distance.

## ◆ transformPoint()

Matrix::transformPoint | ( |  | x,
|  |  | y
| ) |  |
| inline

Transform point.

Parameters

  dx | number - Horizen coordinary value of point.
  dy | number - Vertical coordinary value of point.

Returns
  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
  number[] - The transformed rectangle.

## ◆ transformXDistance()

Matrix::transformXDistance | ( |  | dx | ) |
| inline

Transform x-direction distance.

Parameters

  dx | number - X-direction distance

Returns
  number - The transformed distance.

## ◆ transformYDistance()

Matrix::transformYDistance | ( |  | dy | ) |
| inline

Transform x-direction distance.

Parameters

  dy | number - 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 | boolean - If this is TRUE, a translation matrix is multiplied at left side, or at right side.

@2025 Foxit Software Incorporated. All rights reserved.