gimpmatrix

Name

gimpmatrix -- Utilities to set up and manipulate 3x3 transformation matrices.

Synopsis



typedef     GimpMatrix3[3][3];
typedef     GimpMatrix4[4][4];
void        gimp_matrix3_transform_point    (GimpMatrix3 matrix,
                                             gdouble x,
                                             gdouble y,
                                             gdouble *newx,
                                             gdouble *newy);
void        gimp_matrix3_mult               (GimpMatrix3 matrix1,
                                             GimpMatrix3 matrix2);
void        gimp_matrix3_identity           (GimpMatrix3 matrix);
void        gimp_matrix3_translate          (GimpMatrix3 matrix,
                                             gdouble x,
                                             gdouble y);
void        gimp_matrix3_scale              (GimpMatrix3 matrix,
                                             gdouble x,
                                             gdouble y);
void        gimp_matrix3_rotate             (GimpMatrix3 matrix,
                                             gdouble theta);
void        gimp_matrix3_xshear             (GimpMatrix3 matrix,
                                             gdouble amount);
void        gimp_matrix3_yshear             (GimpMatrix3 matrix,
                                             gdouble amount);
gdouble     gimp_matrix3_determinant        (GimpMatrix3 matrix);
void        gimp_matrix3_invert             (GimpMatrix3 matrix,
                                             GimpMatrix3 matrix_inv);
void        gimp_matrix3_duplicate          (GimpMatrix3 src,
                                             GimpMatrix3 target);
gboolean    gimp_matrix3_is_diagonal        (GimpMatrix3 matrix);
gboolean    gimp_matrix3_is_identity        (GimpMatrix3 matrix);
gboolean    gimp_matrix3_is_simple          (GimpMatrix3 matrix);
void        gimp_matrix4_to_deg             (GimpMatrix4 matrix,
                                             gdouble *a,
                                             gdouble *b,
                                             gdouble *c);

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

GimpMatrix3[3][3]

typedef gdouble GimpMatrix3[3][3];


GimpMatrix4[4][4]

typedef gdouble GimpMatrix4[4][4];


gimp_matrix3_transform_point ()

void        gimp_matrix3_transform_point    (GimpMatrix3 matrix,
                                             gdouble x,
                                             gdouble y,
                                             gdouble *newx,
                                             gdouble *newy);

Transforms a point in 2D as specified by the transformation matrix.


gimp_matrix3_mult ()

void        gimp_matrix3_mult               (GimpMatrix3 matrix1,
                                             GimpMatrix3 matrix2);

Multiplies two matrices and puts the result into the second one.


gimp_matrix3_identity ()

void        gimp_matrix3_identity           (GimpMatrix3 matrix);

Sets the matrix to the identity matrix.


gimp_matrix3_translate ()

void        gimp_matrix3_translate          (GimpMatrix3 matrix,
                                             gdouble x,
                                             gdouble y);

Translates the matrix by x and y.


gimp_matrix3_scale ()

void        gimp_matrix3_scale              (GimpMatrix3 matrix,
                                             gdouble x,
                                             gdouble y);

Scales the matrix by x and y


gimp_matrix3_rotate ()

void        gimp_matrix3_rotate             (GimpMatrix3 matrix,
                                             gdouble theta);

Rotates the matrix by theta degrees.


gimp_matrix3_xshear ()

void        gimp_matrix3_xshear             (GimpMatrix3 matrix,
                                             gdouble amount);

Shears the matrix in the X direction.


gimp_matrix3_yshear ()

void        gimp_matrix3_yshear             (GimpMatrix3 matrix,
                                             gdouble amount);

Shears the matrix in the Y direction.


gimp_matrix3_determinant ()

gdouble     gimp_matrix3_determinant        (GimpMatrix3 matrix);

Calculates the determinant of the given matrix.


gimp_matrix3_invert ()

void        gimp_matrix3_invert             (GimpMatrix3 matrix,
                                             GimpMatrix3 matrix_inv);

Inverts the given matrix.


gimp_matrix3_duplicate ()

void        gimp_matrix3_duplicate          (GimpMatrix3 src,
                                             GimpMatrix3 target);

Copies the source matrix to the destination matrix.


gimp_matrix3_is_diagonal ()

gboolean    gimp_matrix3_is_diagonal        (GimpMatrix3 matrix);

Checks if the given matrix is diagonal.


gimp_matrix3_is_identity ()

gboolean    gimp_matrix3_is_identity        (GimpMatrix3 matrix);

Checks if the given matrix is the identity matrix.


gimp_matrix3_is_simple ()

gboolean    gimp_matrix3_is_simple          (GimpMatrix3 matrix);

Checks if we'll need to interpolate when applying this matrix as a transformation.


gimp_matrix4_to_deg ()

void        gimp_matrix4_to_deg             (GimpMatrix4 matrix,
                                             gdouble *a,
                                             gdouble *b,
                                             gdouble *c);

See Also

GimpVector2

GimpVector3

GimpVector4