The SMatrix class holds a 3x3 matrix for transforming coordinates. SMatrix does not have a constructor, so it must be explicitly initialized using either reset() - to construct an identity matrix, or one of the set functions (e.g., setTranslate, setRotate, etc.). More...
#include <SMatrix.h>
Public Types | |
enum | TypeMask { kIdentity_Mask = 0 , kTranslate_Mask = 0x01 , kScale_Mask = 0x02 , kAffine_Mask = 0x04 , kPerspective_Mask = 0x08 } |
Enum of bit fields for the mask returned by getType(). Use this to identify the complexity of the matrix. More... | |
enum | { kAScaleX , kASkewY , kASkewX , kAScaleY , kATransX , kATransY } |
Enum for affine array indices. Affine arrays are in column major order because that's how PDF and XPS like it. More... | |
enum | ScaleToFit { kFill_ScaleToFit , kStart_ScaleToFit , kCenter_ScaleToFit , kEnd_ScaleToFit } |
Enum for scale-to-fit options. More... | |
enum | { kMaxFlattenSize = 9 * sizeof(float) + sizeof(uint32_t) } |
typedef void(* | MapXYProc) (const SMatrix &mat, float x, float y, SPoint *result) |
Function pointer type for mapping a single point (x, y) to a transformed point. | |
typedef void(* | MapPtsProc) (const SMatrix &mat, SPoint dst[], const SPoint src[], int count) |
Function pointer type for mapping an array of points. | |
Public Member Functions | |
SMatrix () | |
Default constructor, initializes the matrix to identity. | |
SMatrix (const float data[9]) | |
Constructor that initializes the matrix with the given data array. | |
SMatrix & | operator*= (const SMatrix &src) |
Multiplies the matrix by another matrix. | |
SMatrix | operator* (const SMatrix &src) const |
Multiplies the matrix by another matrix. | |
SMatrix & | operator= (const SMatrix &src) |
Assignment operator. | |
SMatrix & | translate (float dx, float dy) |
Post-concats the matrix with a translation. | |
SMatrix & | scale (float sx, float sy) |
Post-concats the matrix with a scale. | |
SMatrix & | shear (float sh, float sv) |
Post-concats the matrix with a shear. | |
SMatrix & | rotate (float deg) |
Post-concats the matrix with a rotation. | |
IxForm * | Data () SCONST OVERRIDE |
Returns a pointer to the matrix data. | |
void | reset () OVERRIDE |
Resets the matrix to the identity matrix. | |
void | setIdentity () OVERRIDE |
Sets the matrix to the identity matrix. | |
BOOL | isIdentity () SCONST OVERRIDE |
Checks if the matrix is the identity matrix. | |
void | setTranslate (float dx, float dy) OVERRIDE |
Sets the matrix to a translation. | |
void | setScale (float sx, float sy) OVERRIDE |
Sets the matrix to a scale. | |
void | setScale2 (float sx, float sy, float px, float py) OVERRIDE |
Sets the matrix to a scale with pivot point. | |
void | setRotate (float degrees) OVERRIDE |
Sets the matrix to a rotation. | |
void | setRotate2 (float degrees, float px, float py) OVERRIDE |
Sets the matrix to a rotation with pivot point. | |
void | setSkew (float kx, float ky) OVERRIDE |
Sets the matrix to a skew. | |
void | setSkew2 (float kx, float ky, float px, float py) OVERRIDE |
Sets the matrix to a skew with pivot point. | |
TypeMask | getType () const |
Returns a bitfield describing the transformations the matrix may perform. The bitfield is computed conservatively, so it may include false positives. For example, when kPerspective_Mask is true, all other bits may be set to true even in the case of a non-perspective transform. | |
bool | isScaleTranslate () const |
Checks if the matrix contains only scale and translation. | |
bool | rectStaysRect () const |
Returns true if the matrix will map a rectangle to another rectangle. This can be true if the matrix is identity, scale-only, or rotates a multiple of 90 degrees. | |
bool | preservesAxisAlignment () const |
Alias for rectStaysRect(). | |
bool | hasPerspective () const |
Checks if the matrix contains perspective elements. | |
bool | isSimilarity (float tol=((1.0f)/(1<< 12))) const |
Checks if the matrix contains only translation, rotation/reflection, or uniform scale. Returns false if other transformation types are included or if the matrix is degenerate. | |
bool | preservesRightAngles (float tol=((1.0f)/(1<< 12))) const |
Checks if the matrix contains only translation, rotation/reflection, or scale (non-uniform scale is allowed). Returns false if other transformation types are included or if the matrix is degenerate. | |
float | operator[] (int index) const |
Accesses the matrix element at the specified index. | |
float | get (int index) const |
Accesses the matrix element at the specified index. | |
float & | operator[] (int index) |
Accesses the matrix element at the specified index. | |
void | set (int index, float value) |
Sets the matrix element at the specified index. | |
void | setMatrix (const float data[9], int matType=kUnknown_Mask) |
Sets the matrix to the specified data array. | |
void | setTranslate (const SVector2D &v) |
Sets the matrix to a translation. | |
bool | setIDiv (int divx, int divy) |
Sets the matrix to scale by 1/divx and 1/divy. | |
void | setSinCos (float sinValue, float cosValue, float px, float py) |
Sets the matrix to rotate by the specified sine and cosine values, with a pivot point at (px, py). | |
void | setSinCos (float sinValue, float cosValue) |
Sets the matrix to rotate by the specified sine and cosine values. | |
void | setConcat (const SMatrix &a, const SMatrix &b) |
Sets the matrix to the concatenation of the two specified matrices. | |
void | preTranslate (float dx, float dy) |
Pre-concats the matrix with the specified translation. | |
void | preTranslate (int dx, int dy) |
Pre-concats the matrix with the specified translation. | |
void | preScale (float sx, float sy, float px, float py) |
Pre-concats the matrix with the specified scale. | |
void | preScale (float sx, float sy) |
Pre-concats the matrix with the specified scale. | |
void | preRotate (float degrees, float px, float py) |
Pre-concats the matrix with the specified rotation. | |
void | preRotate (float degrees) |
Pre-concats the matrix with the specified rotation. | |
void | preSkew (float kx, float ky, float px, float py) |
Pre-concats the matrix with the specified skew. | |
void | preSkew (float kx, float ky) |
Pre-concats the matrix with the specified skew. | |
void | preConcat (const SMatrix &other) |
Pre-concats the matrix with the specified matrix. | |
void | postTranslate (float dx, float dy) |
Post-concats the matrix with the specified translation. | |
void | postTranslate (int dx, int dy) |
Post-concats the matrix with the specified translation. | |
void | postScale (float sx, float sy, float px, float py) |
Post-concats the matrix with the specified scale. | |
void | postScale (float sx, float sy) |
Post-concats the matrix with the specified scale. | |
bool | postIDiv (int divx, int divy) |
Post-concats the matrix by dividing it by the specified integers. | |
void | postRotate (float degrees, float px, float py) |
Post-concats the matrix with the specified rotation. | |
void | postRotate (float degrees) |
Post-concats the matrix with the specified rotation. | |
void | postSkew (float kx, float ky, float px, float py) |
Post-concats the matrix with the specified skew. | |
void | postSkew (float kx, float ky) |
Post-concats the matrix with the specified skew. | |
void | postConcat (const SMatrix &other) |
Post-concats the matrix with the specified matrix. | |
bool | setRectToRect (const SRect &src, const SRect &dst, ScaleToFit stf) |
Set the matrix to the scale and translate values that map the source rectangle to the destination rectangle, returning true if the result can be represented. | |
bool | setPolyToPoly (const SPoint src[], const SPoint dst[], int count) |
Set the matrix such that the specified src points would map to the specified dst points. count must be within [0..4]. | |
bool | invert (SMatrix *inverse) const |
If this matrix can be inverted, return true and if inverse is not null, set inverse to be the inverse of this matrix. If this matrix cannot be inverted, ignore inverse and return false. | |
bool | asAffine (float affine[6]) const |
Fills the passed array with the affine values in column major order. If the matrix is a perspective transform, returns false and does not change the passed array. | |
void | mapPoints (SPoint dst[], const SPoint src[], int count) const |
Apply this matrix to the array of points specified by src, and write the transformed points into the array of points specified by dst. dst[] = M * src[]. | |
void | mapPoints (SPoint pts[], int count) const |
Apply this matrix to the array of points, overwriting it with the transformed values. dst[] = M * pts[]. | |
void | mapPointsWithStride (SPoint pts[], size_t stride, int count) const |
Like mapPoints but with custom byte stride between the points. Stride should be a multiple of sizeof(float). | |
void | mapPointsWithStride (SPoint dst[], SPoint src[], size_t stride, int count) const |
Like mapPoints but with custom byte stride between the points. | |
void | mapHomogeneousPoints (float dst[], const float src[], int count) const |
Apply this matrix to the array of homogeneous points, specified by src, where a homogeneous point is defined by 3 contiguous scalar values, and write the transformed points into the array of scalars specified by dst. dst[] = M * src[]. | |
void | mapXY (float x, float y, SPoint *result) const |
Apply this matrix to the point (x, y) and store the result in *result. | |
void | mapVectors (SVector2D dst[], const SVector2D src[], int count) const |
Apply this matrix to the array of vectors specified by src, and write the transformed vectors into the array of vectors specified by dst. This is similar to mapPoints, but ignores any translation in the matrix. | |
void | mapVectors (SVector2D vecs[], int count) const |
Apply this matrix to the array of vectors specified by src, and write the transformed vectors into the array of vectors specified by dst. This is similar to mapPoints, but ignores any translation in the matrix. | |
bool | mapRect (SRect *dst, const SRect &src) const |
Apply this matrix to the src rectangle, and write the transformed rectangle into dst. This is accomplished by transforming the 4 corners of src, and then setting dst to the bounds of those points. | |
bool | mapRect (SRect *rect) const |
Apply this matrix to the rectangle, and write the transformed rectangle back into it. This is accomplished by transforming the 4 corners of rect, and then setting it to the bounds of those points. | |
void | mapRectToQuad (SPoint dst[4], const SRect &rect) const |
Apply this matrix to the src rectangle, and write the four transformed points into dst. The points written to dst will be the original top-left, top-right, bottom-right, and bottom-left points transformed by the matrix. | |
float | mapRadius (float radius) const |
Return the mean radius of a circle after it has been mapped by this matrix. NOTE: in perspective this value assumes the circle has its center at the origin. | |
MapXYProc | getMapXYProc () const |
Get the appropriate MapXYProc for this matrix. | |
MapPtsProc | getMapPtsProc () const |
Get the appropriate MapPtsProc for this matrix. | |
bool | cheapEqualTo (const SMatrix &m) const |
Efficient comparison of two matrices. It distinguishes between zero and negative zero. It will return false when the sign of zero values is the only difference between the two matrices. It considers NaN values to be equal to themselves. So a matrix full of NaNs is "cheap equal" to another matrix full of NaNs iff the NaN values are bitwise identical while according to strict the strict == test a matrix with a NaN value is equal to nothing, including itself. | |
float | getMinScale () const |
Calculates the minimum scaling factor of the matrix as computed from the SVD of the upper left 2x2. If the matrix has perspective -1 is returned. | |
float | getMaxScale () const |
Calculates the maximum scaling factor of the matrix as computed from the SVD of the upper left 2x2. If the matrix has perspective -1 is returned. | |
bool | getMinMaxScales (float scaleFactors[2]) const |
Gets both the min and max scale factors. The min scale factor is scaleFactors[0] and the max is scaleFactors[1]. If the matrix has perspective false will be returned and scaleFactors will be unchanged. | |
void | dirtyMatrixTypeCache () |
Testing routine; the matrix's type cache should never need to be manually invalidated during normal use. | |
Static Public Member Functions | |
static void | SetAffineIdentity (float affine[6]) |
Fills the passed array with affine identity values in column major order. | |
static MapXYProc | GetMapXYProc (TypeMask mask) |
Get the appropriate MapXYProc for the given type mask. | |
static MapPtsProc | GetMapPtsProc (TypeMask mask) |
Get the appropriate MapPtsProc for the given type mask. | |
static const SMatrix & | I () |
Return a reference to a const identity matrix. | |
static const SMatrix & | InvalidMatrix () |
Return a reference to a const matrix that is "invalid", one that could never be used. | |
static SMatrix | Concat (const SMatrix &a, const SMatrix &b) |
Return the concatenation of two matrices, a * b. | |
static float | SFloatSinCos (float radians, float *cosValue) |
Friends | |
class | SkPerspIter |
bool | operator== (const SMatrix &a, const SMatrix &b) |
Equality operator. | |
bool | operator!= (const SMatrix &a, const SMatrix &b) |
Inequality operator. | |
Additional Inherited Members | |
![]() | |
float | fMat [kMCount] |
Array of floats representing the matrix elements. | |
The SMatrix class holds a 3x3 matrix for transforming coordinates. SMatrix does not have a constructor, so it must be explicitly initialized using either reset() - to construct an identity matrix, or one of the set functions (e.g., setTranslate, setRotate, etc.).
typedef void(* SMatrix::MapPtsProc) (const SMatrix &mat, SPoint dst[], const SPoint src[], int count) |
typedef void(* SMatrix::MapXYProc) (const SMatrix &mat, float x, float y, SPoint *result) |
anonymous enum |
enum SMatrix::ScaleToFit |
Enum for scale-to-fit options.
enum SMatrix::TypeMask |
Enum of bit fields for the mask returned by getType(). Use this to identify the complexity of the matrix.
|
inline |
SMatrix::SMatrix | ( | const float | data[9] | ) |
Constructor that initializes the matrix with the given data array.
data | Array of 9 floats representing the matrix elements. |
Definition at line 35 of file SMatrix.cpp.
bool SMatrix::asAffine | ( | float | affine[6] | ) | const |
Fills the passed array with the affine values in column major order. If the matrix is a perspective transform, returns false and does not change the passed array.
affine | Array to fill with affine values. Ignored if NULL. |
Definition at line 859 of file SMatrix.cpp.
|
inline |
Efficient comparison of two matrices. It distinguishes between zero and negative zero. It will return false when the sign of zero values is the only difference between the two matrices. It considers NaN values to be equal to themselves. So a matrix full of NaNs is "cheap equal" to another matrix full of NaNs iff the NaN values are bitwise identical while according to strict the strict == test a matrix with a NaN value is equal to nothing, including itself.
m | Matrix to compare with. |
IxForm * SMatrix::Data | ( | ) |
Returns a pointer to the matrix data.
Definition at line 1772 of file SMatrix.cpp.
|
inline |
|
inline |
|
inlinestatic |
Get the appropriate MapPtsProc for the given type mask.
mask | Type mask of the matrix. |
|
inline |
Get the appropriate MapPtsProc for this matrix.
|
inline |
float SMatrix::getMaxScale | ( | ) | const |
Calculates the maximum scaling factor of the matrix as computed from the SVD of the upper left 2x2. If the matrix has perspective -1 is returned.
Definition at line 1658 of file SMatrix.cpp.
bool SMatrix::getMinMaxScales | ( | float | scaleFactors[2] | ) | const |
Gets both the min and max scale factors. The min scale factor is scaleFactors[0] and the max is scaleFactors[1]. If the matrix has perspective false will be returned and scaleFactors will be unchanged.
scaleFactors | Array to store the min and max scale factors. |
Definition at line 1671 of file SMatrix.cpp.
float SMatrix::getMinScale | ( | ) | const |
Calculates the minimum scaling factor of the matrix as computed from the SVD of the upper left 2x2. If the matrix has perspective -1 is returned.
Definition at line 1645 of file SMatrix.cpp.
|
inline |
Returns a bitfield describing the transformations the matrix may perform. The bitfield is computed conservatively, so it may include false positives. For example, when kPerspective_Mask is true, all other bits may be set to true even in the case of a non-perspective transform.
|
inline |
|
static |
Return a reference to a const identity matrix.
Definition at line 1691 of file SMatrix.cpp.
|
static |
Return a reference to a const matrix that is "invalid", one that could never be used.
Definition at line 1698 of file SMatrix.cpp.
|
inline |
If this matrix can be inverted, return true and if inverse is not null, set inverse to be the inverse of this matrix. If this matrix cannot be inverted, ignore inverse and return false.
inverse | Pointer to the matrix to store the inverse. |
BOOL SMatrix::isIdentity | ( | ) |
Checks if the matrix is the identity matrix.
Definition at line 1777 of file SMatrix.cpp.
|
inline |
bool SMatrix::isSimilarity | ( | float | tol = ( (1.0f) / (1 << 12)) | ) | const |
Checks if the matrix contains only translation, rotation/reflection, or uniform scale. Returns false if other transformation types are included or if the matrix is degenerate.
tol | Tolerance for floating-point comparison (default is SK_ScalarNearlyZero). |
Definition at line 172 of file SMatrix.cpp.
void SMatrix::mapHomogeneousPoints | ( | float | dst[], |
const float | src[], | ||
int | count ) const |
Apply this matrix to the array of homogeneous points, specified by src, where a homogeneous point is defined by 3 contiguous scalar values, and write the transformed points into the array of scalars specified by dst. dst[] = M * src[].
dst | Where the transformed coordinates are written. It must contain at least 3 * count entries. |
src | The original coordinates that are to be transformed. It must contain at least 3 * count entries. |
count | The number of triples (homogeneous points) in src to read, and then transform into dst. |
Definition at line 1155 of file SMatrix.cpp.
void SMatrix::mapPoints | ( | SPoint | dst[], |
const SPoint | src[], | ||
int | count ) const |
Apply this matrix to the array of points specified by src, and write the transformed points into the array of points specified by dst. dst[] = M * src[].
dst | Where the transformed coordinates are written. It must contain at least count entries. |
src | The original coordinates that are to be transformed. It must contain at least count entries. |
count | The number of points in src to read, and then transform into dst. |
Definition at line 1135 of file SMatrix.cpp.
|
inline |
|
inline |
|
inline |
float SMatrix::mapRadius | ( | float | radius | ) | const |
Return the mean radius of a circle after it has been mapped by this matrix. NOTE: in perspective this value assumes the circle has its center at the origin.
radius | Original radius of the circle. |
Definition at line 1237 of file SMatrix.cpp.
bool SMatrix::mapRect | ( | SRect * | dst, |
const SRect & | src ) const |
Apply this matrix to the src rectangle, and write the transformed rectangle into dst. This is accomplished by transforming the 4 corners of src, and then setting dst to the bounds of those points.
dst | Where the transformed rectangle is written. |
src | The original rectangle to be transformed. |
Definition at line 1216 of file SMatrix.cpp.
|
inline |
Apply this matrix to the rectangle, and write the transformed rectangle back into it. This is accomplished by transforming the 4 corners of rect, and then setting it to the bounds of those points.
rect | The rectangle to transform. |
|
inline |
Apply this matrix to the src rectangle, and write the four transformed points into dst. The points written to dst will be the original top-left, top-right, bottom-right, and bottom-left points transformed by the matrix.
dst | Where the transformed quad is written. |
rect | The original rectangle to be transformed. |
void SMatrix::mapVectors | ( | SVector2D | dst[], |
const SVector2D | src[], | ||
int | count ) const |
Apply this matrix to the array of vectors specified by src, and write the transformed vectors into the array of vectors specified by dst. This is similar to mapPoints, but ignores any translation in the matrix.
dst | Where the transformed coordinates are written. It must contain at least count entries. |
src | The original coordinates that are to be transformed. It must contain at least count entries. |
count | The number of vectors in src to read, and then transform into dst. |
Definition at line 1189 of file SMatrix.cpp.
|
inline |
Apply this matrix to the array of vectors specified by src, and write the transformed vectors into the array of vectors specified by dst. This is similar to mapPoints, but ignores any translation in the matrix.
vecs | The vectors to be transformed. It must contain at least count entries. |
count | The number of vectors in vecs. |
|
inline |
Multiplies the matrix by another matrix.
src | The matrix to multiply with. |
Returns the result of multiplying this matrix by the given matrix.
Note that matrix multiplication is not commutative, i.e. a*b != b*a.
Definition at line 1731 of file SMatrix.cpp.
Multiplies the matrix by another matrix.
src | The matrix to multiply with. |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Returns the result of multiplying this matrix by the given matrix.
Definition at line 1715 of file SMatrix.cpp.
Assignment operator.
src | The matrix to assign from. |
Assigns the given matrix's values to this matrix.
Definition at line 1741 of file SMatrix.cpp.
|
inline |
|
inline |
void SMatrix::postConcat | ( | const SMatrix & | other | ) |
Post-concats the matrix with the specified matrix.
other | Matrix to post-concatenate. |
Definition at line 793 of file SMatrix.cpp.
bool SMatrix::postIDiv | ( | int | divx, |
int | divy ) |
Post-concats the matrix by dividing it by the specified integers.
divx | Division factor in the x-direction. |
divy | Division factor in the y-direction. |
Definition at line 435 of file SMatrix.cpp.
void SMatrix::postRotate | ( | float | degrees | ) |
Post-concats the matrix with the specified rotation.
degrees | Rotation angle in degrees. |
Definition at line 548 of file SMatrix.cpp.
void SMatrix::postRotate | ( | float | degrees, |
float | px, | ||
float | py ) |
Post-concats the matrix with the specified rotation.
degrees | Rotation angle in degrees. |
px | Pivot point x-coordinate. |
py | Pivot point y-coordinate. |
Definition at line 541 of file SMatrix.cpp.
void SMatrix::postScale | ( | float | sx, |
float | sy ) |
Post-concats the matrix with the specified scale.
sx | Scale factor in the x-direction. |
sy | Scale factor in the y-direction. |
Definition at line 422 of file SMatrix.cpp.
void SMatrix::postScale | ( | float | sx, |
float | sy, | ||
float | px, | ||
float | py ) |
Post-concats the matrix with the specified scale.
sx | Scale factor in the x-direction. |
sy | Scale factor in the y-direction. |
px | Pivot point x-coordinate. |
py | Pivot point y-coordinate. |
Definition at line 411 of file SMatrix.cpp.
void SMatrix::postSkew | ( | float | kx, |
float | ky ) |
Post-concats the matrix with the specified skew.
kx | Skew factor in the x-direction. |
ky | Skew factor in the y-direction. |
Definition at line 610 of file SMatrix.cpp.
void SMatrix::postSkew | ( | float | kx, |
float | ky, | ||
float | px, | ||
float | py ) |
Post-concats the matrix with the specified skew.
kx | Skew factor in the x-direction. |
ky | Skew factor in the y-direction. |
px | Pivot point x-coordinate. |
py | Pivot point y-coordinate. |
Definition at line 603 of file SMatrix.cpp.
void SMatrix::postTranslate | ( | float | dx, |
float | dy ) |
Post-concats the matrix with the specified translation.
dx | Translation in the x-direction. |
dy | Translation in the y-direction. |
Definition at line 300 of file SMatrix.cpp.
void SMatrix::postTranslate | ( | int | dx, |
int | dy ) |
Post-concats the matrix with the specified translation.
dx | Translation in the x-direction. |
dy | Translation in the y-direction. |
Definition at line 406 of file SMatrix.cpp.
void SMatrix::preConcat | ( | const SMatrix & | other | ) |
Pre-concats the matrix with the specified matrix.
other | Matrix to pre-concatenate. |
Definition at line 783 of file SMatrix.cpp.
void SMatrix::preRotate | ( | float | degrees | ) |
Pre-concats the matrix with the specified rotation.
degrees | Rotation angle in degrees. |
Definition at line 534 of file SMatrix.cpp.
void SMatrix::preRotate | ( | float | degrees, |
float | px, | ||
float | py ) |
Pre-concats the matrix with the specified rotation.
degrees | Rotation angle in degrees. |
px | Pivot point x-coordinate. |
py | Pivot point y-coordinate. |
Definition at line 527 of file SMatrix.cpp.
void SMatrix::preScale | ( | float | sx, |
float | sy ) |
Pre-concats the matrix with the specified scale.
sx | Scale factor in the x-direction. |
sy | Scale factor in the y-direction. |
Definition at line 383 of file SMatrix.cpp.
void SMatrix::preScale | ( | float | sx, |
float | sy, | ||
float | px, | ||
float | py ) |
Pre-concats the matrix with the specified scale.
sx | Scale factor in the x-direction. |
sy | Scale factor in the y-direction. |
px | Pivot point x-coordinate. |
py | Pivot point y-coordinate. |
Definition at line 371 of file SMatrix.cpp.
|
inline |
Alias for rectStaysRect().
bool SMatrix::preservesRightAngles | ( | float | tol = ( (1.0f) / (1 << 12)) | ) | const |
Checks if the matrix contains only translation, rotation/reflection, or scale (non-uniform scale is allowed). Returns false if other transformation types are included or if the matrix is degenerate.
tol | Tolerance for floating-point comparison (default is SK_ScalarNearlyZero). |
Definition at line 205 of file SMatrix.cpp.
void SMatrix::preSkew | ( | float | kx, |
float | ky ) |
Pre-concats the matrix with the specified skew.
kx | Skew factor in the x-direction. |
ky | Skew factor in the y-direction. |
Definition at line 596 of file SMatrix.cpp.
void SMatrix::preSkew | ( | float | kx, |
float | ky, | ||
float | px, | ||
float | py ) |
Pre-concats the matrix with the specified skew.
kx | Skew factor in the x-direction. |
ky | Skew factor in the y-direction. |
px | Pivot point x-coordinate. |
py | Pivot point y-coordinate. |
Definition at line 589 of file SMatrix.cpp.
void SMatrix::preTranslate | ( | float | dx, |
float | dy ) |
Pre-concats the matrix with the specified translation.
dx | Translation in the x-direction. |
dy | Translation in the y-direction. |
Definition at line 274 of file SMatrix.cpp.
void SMatrix::preTranslate | ( | int | dx, |
int | dy ) |
Pre-concats the matrix with the specified translation.
dx | Translation in the x-direction. |
dy | Translation in the y-direction. |
Definition at line 295 of file SMatrix.cpp.
|
inline |
void SMatrix::reset | ( | ) |
Resets the matrix to the identity matrix.
Definition at line 46 of file SMatrix.cpp.
|
inline |
|
inline |
|
inline |
|
static |
Fills the passed array with affine identity values in column major order.
affine | Array to fill with affine identity values. Must not be NULL. |
Definition at line 849 of file SMatrix.cpp.
Sets the matrix to the concatenation of the two specified matrices.
a | First matrix. |
b | Second matrix. |
Definition at line 724 of file SMatrix.cpp.
void SMatrix::setIdentity | ( | ) |
Sets the matrix to the identity matrix.
Definition at line 1767 of file SMatrix.cpp.
bool SMatrix::setIDiv | ( | int | divx, |
int | divy ) |
Sets the matrix to scale by 1/divx and 1/divy.
divx | Division factor in the x-direction. |
divy | Division factor in the y-direction. |
Definition at line 361 of file SMatrix.cpp.
void SMatrix::setMatrix | ( | const float | data[9], |
int | matType = kUnknown_Mask ) |
Sets the matrix to the specified data array.
data | Array of 9 floats representing the matrix elements. |
matType | Type mask for the matrix (default is kUnknown_Mask). |
Definition at line 1761 of file SMatrix.cpp.
bool SMatrix::setPolyToPoly | ( | const SPoint | src[], |
const SPoint | dst[], | ||
int | count ) |
Set the matrix such that the specified src points would map to the specified dst points. count must be within [0..4].
src | Array of source points. |
dst | Array of destination points. |
count | Number of points to use for the transformation. |
Definition at line 1490 of file SMatrix.cpp.
bool SMatrix::setRectToRect | ( | const SRect & | src, |
const SRect & | dst, | ||
ScaleToFit | stf ) |
Set the matrix to the scale and translate values that map the source rectangle to the destination rectangle, returning true if the result can be represented.
src | Source rectangle to map from. |
dst | Destination rectangle to map to. |
stf | ScaleToFit option. |
Definition at line 619 of file SMatrix.cpp.
void SMatrix::setRotate | ( | float | degrees | ) |
Sets the matrix to a rotation.
degrees | Rotation angle in degrees. |
Definition at line 520 of file SMatrix.cpp.
void SMatrix::setRotate2 | ( | float | degrees, |
float | px, | ||
float | py ) |
Sets the matrix to a rotation with pivot point.
degrees | Rotation angle in degrees. |
px | Pivot point x-coordinate. |
py | Pivot point y-coordinate. |
Definition at line 513 of file SMatrix.cpp.
void SMatrix::setScale | ( | float | sx, |
float | sy ) |
Sets the matrix to a scale.
sx | Scale factor in the x-direction. |
sy | Scale factor in the y-direction. |
Definition at line 343 of file SMatrix.cpp.
void SMatrix::setScale2 | ( | float | sx, |
float | sy, | ||
float | px, | ||
float | py ) |
Sets the matrix to a scale with pivot point.
sx | Scale factor in the x-direction. |
sy | Scale factor in the y-direction. |
px | Pivot point x-coordinate. |
py | Pivot point y-coordinate. |
Definition at line 323 of file SMatrix.cpp.
void SMatrix::setSinCos | ( | float | sinValue, |
float | cosValue ) |
Sets the matrix to rotate by the specified sine and cosine values.
sinValue | Sine of the rotation angle. |
cosValue | Cosine of the rotation angle. |
Definition at line 497 of file SMatrix.cpp.
void SMatrix::setSinCos | ( | float | sinValue, |
float | cosValue, | ||
float | px, | ||
float | py ) |
Sets the matrix to rotate by the specified sine and cosine values, with a pivot point at (px, py).
sinValue | Sine of the rotation angle. |
cosValue | Cosine of the rotation angle. |
px | Pivot point x-coordinate. |
py | Pivot point y-coordinate. |
Definition at line 459 of file SMatrix.cpp.
void SMatrix::setSkew | ( | float | kx, |
float | ky ) |
Sets the matrix to a skew.
kx | Skew factor in the x-direction. |
ky | Skew factor in the y-direction. |
Definition at line 573 of file SMatrix.cpp.
void SMatrix::setSkew2 | ( | float | kx, |
float | ky, | ||
float | px, | ||
float | py ) |
Sets the matrix to a skew with pivot point.
kx | Skew factor in the x-direction. |
ky | Skew factor in the y-direction. |
px | Pivot point x-coordinate. |
py | Pivot point y-coordinate. |
Definition at line 557 of file SMatrix.cpp.
|
inline |
void SMatrix::setTranslate | ( | float | dx, |
float | dy ) |
Sets the matrix to a translation.
dx | Translation in the x-direction. |
dy | Translation in the y-direction. |
Definition at line 256 of file SMatrix.cpp.
|
static |
Definition at line 477 of file SMatrix.cpp.
|
inline |
|
inline |
Equality operator.
a | First matrix. |
b | Second matrix. |
Definition at line 153 of file SMatrix.cpp.