Name
gimpmatrix -- Utilities to set up and manipulate 3x3 transformation matrices.
Synopsis
typedef GimpMatrix[3][3];
void gimp_matrix_transform_point (GimpMatrix matrix,
gdouble x,
gdouble y,
gdouble *newx,
gdouble *newy);
void gimp_matrix_mult (GimpMatrix matrix1,
GimpMatrix matrix2);
void gimp_matrix_identity (GimpMatrix matrix);
void gimp_matrix_translate (GimpMatrix matrix,
gdouble x,
gdouble y);
void gimp_matrix_scale (GimpMatrix matrix,
gdouble x,
gdouble y);
void gimp_matrix_rotate (GimpMatrix matrix,
gdouble theta);
void gimp_matrix_xshear (GimpMatrix matrix,
gdouble amount);
void gimp_matrix_yshear (GimpMatrix matrix,
gdouble amount);
gdouble gimp_matrix_determinant (GimpMatrix matrix);
void gimp_matrix_invert (GimpMatrix matrix,
GimpMatrix matrix_inv);
void gimp_matrix_duplicate (GimpMatrix src,
GimpMatrix target);
gboolean gimp_matrix_is_diagonal (GimpMatrix matrix);
gboolean gimp_matrix_is_identity (GimpMatrix matrix);
gboolean gimp_matrix_is_simple (GimpMatrix matrix); |
Description
When doing image manipulation you will often need 3x3 transformation
matrices that define translation, rotation, scaling, shearing and
arbitrary perspective transformations using a 3x3 matrix. Here you'll
find a set of utility functions to set up those matrices and to perform
basic matrix manipulations and tests.
Details
GimpMatrix[3][3]
typedef gdouble GimpMatrix[3][3]; |
gimp_matrix_transform_point ()
void gimp_matrix_transform_point (GimpMatrix matrix,
gdouble x,
gdouble y,
gdouble *newx,
gdouble *newy); |
Transforms a point in 2D as specified by the transformation matrix.
gimp_matrix_mult ()
void gimp_matrix_mult (GimpMatrix matrix1,
GimpMatrix matrix2); |
Multiplies two matrices and puts the result into the second one.
gimp_matrix_identity ()
void gimp_matrix_identity (GimpMatrix matrix); |
Sets the matrix to the identity matrix.
gimp_matrix_translate ()
void gimp_matrix_translate (GimpMatrix matrix,
gdouble x,
gdouble y); |
Translates the matrix by x and y.
gimp_matrix_scale ()
void gimp_matrix_scale (GimpMatrix matrix,
gdouble x,
gdouble y); |
Scales the matrix by x and y
gimp_matrix_rotate ()
void gimp_matrix_rotate (GimpMatrix matrix,
gdouble theta); |
Rotates the matrix by theta degrees.
gimp_matrix_xshear ()
void gimp_matrix_xshear (GimpMatrix matrix,
gdouble amount); |
Shears the matrix in the X direction.
gimp_matrix_yshear ()
void gimp_matrix_yshear (GimpMatrix matrix,
gdouble amount); |
Shears the matrix in the Y direction.
gimp_matrix_determinant ()
gdouble gimp_matrix_determinant (GimpMatrix matrix); |
Calculates the determinant of the given matrix.
gimp_matrix_invert ()
void gimp_matrix_invert (GimpMatrix matrix,
GimpMatrix matrix_inv); |
Inverts the given matrix.
gimp_matrix_duplicate ()
void gimp_matrix_duplicate (GimpMatrix src,
GimpMatrix target); |
Copies the source matrix to the destination matrix.
gimp_matrix_is_diagonal ()
gboolean gimp_matrix_is_diagonal (GimpMatrix matrix); |
Checks if the given matrix is diagonal.
gimp_matrix_is_identity ()
gboolean gimp_matrix_is_identity (GimpMatrix matrix); |
Checks if the given matrix is the identity matrix.
gimp_matrix_is_simple ()
gboolean gimp_matrix_is_simple (GimpMatrix matrix); |
Checks if we'll need to interpolate when applying this matrix as
a transformation.