public class Matrix
extends java.lang.Object
Matrix
represents a matrix.
It holds a 3x3 matrix for transforming coordinates, and matrices are column-vector matrices stored in column-major order:
m[offset + 0] m[offset + 3] m[offset + 6] m[offset + 1] m[offset + 4] m[offset + 7] m[offset + 2] m[offset + 5] m[offset + 8]but the last three values will be ignored by Foxit PDF SDK for now.
Constructor and Description |
---|
Matrix()
Construct a
Matrix object by the default way. |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object other)
Check whether the specified object is a
Matrix |
void |
getValues(float[] values)
get 9 values from the matrix into the array .
|
boolean |
mapRect(RectF dst,
RectF src)
Apply this matrix to the source rectangle, and write the transformed
rectangle into destination rectangle.
|
boolean |
postRotate(float degrees)
PostRotate the matrix with the specified rotation.
|
boolean |
postRotate(float degrees,
float px,
float py)
PostRotate the matrix with the specified degrees at a pivot point.
|
boolean |
postScale(float sx,
float sy)
PostScale the matrix with the specified scale.
|
boolean |
postScale(float sx,
float sy,
float px,
float py)
PostScale the matrix with the specified scale at a pivot point.
|
boolean |
postTranslate(float dx,
float dy)
PostTranslate the matrix with the specified translation.
|
boolean |
preRotate(float degrees)
PreRotate the matrix with the specified degrees.
|
boolean |
preRotate(float degrees,
float px,
float py)
PreRotate the matrix with the specified degrees at a pivot point.
|
boolean |
preScale(float sx,
float sy)
PreScale the matrix with the specified scale.
|
boolean |
preScale(float sx,
float sy,
float px,
float py)
PreScale the matrix with the specified scale at a pivot point.
|
boolean |
preTranslate(float dx,
float dy)
PreTranslate the matrix with the specified translation.
|
void |
setScale(float sx,
float sy)
Set the matrix to scale by sx and sy.
|
void |
setScale(float sx,
float sy,
float px,
float py)
Set the matrix to scale by sx and sy, with a pivot point at (px, py).
|
void |
setValues(float[] values)
set 9 values from the float array into the matrix.
|
public Matrix()
Matrix
object by the default way.
And the matrix values will be initialized to {1,0,0,0,1,0,0,0,1}.public void setValues(float[] values)
values
- The float array with 9 values.public void getValues(float[] values)
values
- A float array to receive the matrix value.public void setScale(float sx, float sy, float px, float py)
The pivot point is the coordinate that should remain unchanged by the specified transformation.
sx
- The scale value on X coordinate.sy
- The scale value on Y coordinate.px
- The X coordinate of pivot point.py
- The Y coordinate of pivot point.public void setScale(float sx, float sy)
sx
- The scale value on X coordinate.sy
- The scale value on Y coordinate.public boolean mapRect(RectF dst, RectF src)
dst
- Where the transformed rectangle is written.src
- The original rectangle to be transformed.public boolean preTranslate(float dx, float dy)
dx
- The translation value on X coordinate.dy
- The translation value on Y coordinate.public boolean preScale(float sx, float sy, float px, float py)
sx
- The scale value on X coordinate.sy
- The scale value on Y coordinate.px
- The X coordinate of pivot point.py
- The Y coordinate of pivot point.public boolean preScale(float sx, float sy)
sx
- The scale value on X coordinate.sy
- The scale value on Y coordinate.public boolean preRotate(float degrees, float px, float py)
degrees
- An angle measured in degrees.px
- The X coordinate of pivot point.py
- The Y coordinate of pivot point.public boolean preRotate(float degrees)
degrees
- An angle measured in degrees.public boolean postTranslate(float dx, float dy)
dx
- The translation value on X coordinate.dy
- The translation value on Y coordinate.public boolean postScale(float sx, float sy, float px, float py)
sx
- The scale value on X coordinate.sy
- The scale value on Y coordinate.px
- The X coordinate of pivot point.py
- The Y coordinate of pivot point.public boolean postScale(float sx, float sy)
sx
- The scale value on X coordinate.sy
- The scale value on Y coordinate.public boolean postRotate(float degrees, float px, float py)
degrees
- An angle measured in degrees.px
- The X coordinate of pivot point.py
- The Y coordinate of pivot point.public boolean postRotate(float degrees)
degrees
- An angle measured in degrees.public boolean equals(java.lang.Object other)
Matrix class and its values equal our values.
equals
in class java.lang.Object
other
- The specified object to compare.boolean
value to indicate the result of checking.