A matrix that represents an affine transformation. More...
#include <gfxMatrix.h>
Public Member Functions | |
| gfxMatrix () | |
| Initializes this matrix as the identity matrix. | |
| gfxMatrix (gfxFloat a, gfxFloat b, gfxFloat c, gfxFloat d, gfxFloat tx, gfxFloat ty) | |
| Initializes the matrix from individual components. | |
| const gfxMatrix & | operator*= (const gfxMatrix &m) |
| Post-multiplies m onto the matrix. | |
| gfxMatrix | operator* (const gfxMatrix &m) const |
| Multiplies *this with m and returns the result. | |
| const gfxMatrix & | Reset () |
| Resets this matrix to the identity matrix. | |
| const gfxMatrix & | Invert () |
| Inverts this matrix, if possible. | |
| PRBool | IsSingular () const |
| Check if matrix is singular (no inverse exists). | |
| const gfxMatrix & | Scale (gfxFloat x, gfxFloat y) |
| Scales this matrix. | |
| const gfxMatrix & | Translate (const gfxPoint &pt) |
| Translates this matrix. | |
| const gfxMatrix & | Rotate (gfxFloat radians) |
| Rotates this matrix. | |
| const gfxMatrix & | Multiply (const gfxMatrix &m) |
| Multiplies the current matrix with m. | |
| const gfxMatrix & | PreMultiply (const gfxMatrix &m) |
| Multiplies the current matrix with m. | |
| gfxPoint | Transform (const gfxPoint &point) const |
| Transforms a point according to this matrix. | |
| gfxSize | Transform (const gfxSize &size) const |
| Transform a distance according to this matrix. | |
| gfxRect | Transform (const gfxRect &rect) const |
| Transforms both the point and distance according to this matrix. | |
| gfxRect | TransformBounds (const gfxRect &rect) const |
| gfxPoint | GetTranslation () const |
| Returns the translation component of this matrix. | |
| PRBool | HasNonIntegerTranslation () const |
| Returns true if the matrix is anything other than a straight translation by integers. | |
| PRBool | HasNonTranslation () const |
| Returns true if the matrix has any transform other than a straight translation. | |
| PRBool | HasNonTranslationOrFlip () const |
| Returns true if the matrix has any transform other than a translation or a -1 y scale (y axis flip). | |
| PRBool | HasNonAxisAlignedTransform () const |
| Returns true if the matrix has any transform other than a translation or scale; this is, if there is no rotation. | |
| double | Determinant () const |
| Computes the determinant of this matrix. | |
| gfxSize | ScaleFactors (PRBool xMajor) const |
Public Attributes | |
| double | xx |
| double | yx |
| double | xy |
| double | yy |
| double | x0 |
| double | y0 |
A matrix that represents an affine transformation.
Projective transformations are not supported. This matrix looks like:
/ a b 0 \ | c d 0 | \ tx ty 1 /
So, transforming a point (x, y) results in:
/ a b 0 \ / a * x + c * y + tx \ T (x y 1) * | c d 0 | = | b * x + d * y + ty | \ tx ty 1 / \ 1 /
| gfxMatrix::gfxMatrix | ( | ) | [inline] |
Initializes this matrix as the identity matrix.
| gfxMatrix::gfxMatrix | ( | gfxFloat | a, | |
| gfxFloat | b, | |||
| gfxFloat | c, | |||
| gfxFloat | d, | |||
| gfxFloat | tx, | |||
| gfxFloat | ty | |||
| ) | [inline] |
Initializes the matrix from individual components.
See the class description for the layout of the matrix.
| double gfxMatrix::Determinant | ( | ) | const [inline] |
Computes the determinant of this matrix.
| gfxPoint gfxMatrix::GetTranslation | ( | ) | const [inline] |
Returns the translation component of this matrix.
| PRBool gfxMatrix::HasNonAxisAlignedTransform | ( | ) | const [inline] |
Returns true if the matrix has any transform other than a translation or scale; this is, if there is no rotation.
| PRBool gfxMatrix::HasNonIntegerTranslation | ( | ) | const [inline] |
Returns true if the matrix is anything other than a straight translation by integers.
| PRBool gfxMatrix::HasNonTranslation | ( | ) | const [inline] |
Returns true if the matrix has any transform other than a straight translation.
| PRBool gfxMatrix::HasNonTranslationOrFlip | ( | ) | const [inline] |
Returns true if the matrix has any transform other than a translation or a -1 y scale (y axis flip).
| const gfxMatrix& gfxMatrix::Invert | ( | ) |
Inverts this matrix, if possible.
Otherwise, the matrix is left unchanged.
XXX should this do something with the return value of cairo_matrix_invert?
| PRBool gfxMatrix::IsSingular | ( | ) | const [inline] |
Check if matrix is singular (no inverse exists).
Multiplies the current matrix with m.
This is a post-multiplication, i.e. the transformations of m are applied _after_ the existing transformations.
XXX is that difference (compared to Rotate etc) a good thing?
Multiplies *this with m and returns the result.
Post-multiplies m onto the matrix.
Multiplies the current matrix with m.
This is a pre-multiplication, i.e. the transformations of m are applied _before_ the existing transformations.
| const gfxMatrix& gfxMatrix::Reset | ( | ) |
Resets this matrix to the identity matrix.
Rotates this matrix.
The rotation is pre-multiplied onto this matrix, i.e. the translation takes place after the other transformations.
| radians | Angle in radians. |
Scales this matrix.
The scale is pre-multiplied onto this matrix, i.e. the scaling takes place before the other transformations.
Transforms both the point and distance according to this matrix.
Transform a distance according to this matrix.
This does not apply any translation components.
Transforms a point according to this matrix.
Translates this matrix.
The translation is pre-multiplied onto this matrix, i.e. the translation takes place before the other transformations.
| double gfxMatrix::x0 |
| double gfxMatrix::xx |
| double gfxMatrix::xy |
| double gfxMatrix::y0 |
| double gfxMatrix::yx |
| double gfxMatrix::yy |
1.6.1