Group: Affine Matrix
Matrix functions to initialize, transform and various other operations on these matrices. They can be used with gdTransformAffineCopy and are also used in various transformations functions in GD.
matrix[0] == xx matrix[1] == yx matrix[2] == xy matrix[3] == xy matrix[4] == x0 matrix[5] == y0
where the transformation of a given point (x,y) is given by:
x_new = xx * x + xy * y + x0; y_new = yx * x + yy * y + y0;
Matrix | Group: Affine Matrix |
Functions | |
gdAffineApplyToPointF | Applies an affine transformation to a point (floating point gdPointF) |
gdAffineInvert | Find the inverse of an affine transformation. |
gdAffineFlip | Flip an affine transformation horizontally or vertically. |
gdAffineConcat | Concat (Multiply) two affine transformation matrices. |
gdAffineIdentity | Set up the identity matrix. |
gdAffineScale | Set up a scaling matrix. |
gdAffineRotate | Set up a rotation affine transform. |
gdAffineShearHorizontal | Set up a horizontal shearing matrix || becomes \\. |
gdAffineShearVertical | Set up a vertical shearing matrix, columns are untouched. |
gdAffineTranslate | Set up a translation matrix. |
gdAffineRectilinear | Determines whether the affine transformation is axis aligned. |
gdAffineEqual | Determines whether two affine transformations are equal. |
int gdAffineApplyToPointF ( gdPointFPtr dst, const gdPointFPtr src, const double affine[6] )
Applies an affine transformation to a point (floating point gdPointF)
dst | Where to store the resulting point |
affine | Source Point |
flip_horz | affine matrix |
GD_TRUE if the affine is rectilinear or GD_FALSE
int gdAffineInvert ( double dst[6], const double src[6] )
Find the inverse of an affine transformation.
All non-degenerate affine transforms are invertible. Applying the inverted matrix will restore the original values. Multiplying <src> by <dst> (commutative) will return the identity affine (rounding error possible).
dst | Where to store the resulting affine transform |
src_affine | Original affine matrix |
flip_horz | Whether or not to flip horizontally |
flip_vert | Whether or not to flip vertically |
GD_TRUE on success or GD_FALSE on failure
int gdAffineFlip ( double dst[6], const double src[6], const int flip_h, const int flip_v )
Flip an affine transformation horizontally or vertically.
Flips the affine transform, giving GD_FALSE for <flip_horz> and <flip_vert> will clone the affine matrix. GD_TRUE for both will copy a 180° rotation.
dst | Where to store the resulting affine transform |
src_affine | Original affine matrix |
flip_h | Whether or not to flip horizontally |
flip_v | Whether or not to flip vertically |
GD_TRUE on success or GD_FALSE
int gdAffineConcat ( double dst[6], const double m1[6], const double m2[6] )
Concat (Multiply) two affine transformation matrices.
Concats two affine transforms together, i.e. the result will be the equivalent of doing first the transformation m1 and then m2. All parameters can be the same matrix (safe to call using the same array for all three arguments).
dst | Where to store the resulting affine transform |
m1 | First affine matrix |
m2 | Second affine matrix |
GD_TRUE on success or GD_FALSE
int gdAffineRotate ( double dst[6], const double angle )
Set up a rotation affine transform.
Like the other angle in libGD, in which increasing y moves downward, this is a counterclockwise rotation.
dst | Where to store the resulting affine transform |
angle | Rotation angle in degrees |
GD_TRUE on success or GD_FALSE
Applies an affine transformation to a point (floating point gdPointF)
int gdAffineApplyToPointF ( gdPointFPtr dst, const gdPointFPtr src, const double affine[6] )
Find the inverse of an affine transformation.
int gdAffineInvert ( double dst[6], const double src[6] )
Flip an affine transformation horizontally or vertically.
int gdAffineFlip ( double dst[6], const double src[6], const int flip_h, const int flip_v )
Concat (Multiply) two affine transformation matrices.
int gdAffineConcat ( double dst[6], const double m1[6], const double m2[6] )
Set up the identity matrix.
int gdAffineIdentity ( double dst[6] )
Set up a scaling matrix.
int gdAffineScale ( double dst[6], const double scale_x, const double scale_y )
Set up a rotation affine transform.
int gdAffineRotate ( double dst[6], const double angle )
Set up a horizontal shearing matrix || becomes \\.
int gdAffineShearHorizontal( double dst[6], const double angle )
Set up a vertical shearing matrix, columns are untouched.
int gdAffineShearVertical( double dst[6], const double angle )
Set up a translation matrix.
int gdAffineTranslate ( double dst[6], const double offset_x, const double offset_y )
Determines whether the affine transformation is axis aligned.
int gdAffineRectilinear ( const double m[6] )
Determines whether two affine transformations are equal.
int gdAffineEqual ( const double m1[6], const double m2[6] )