Gimp.Matrix3

Fields

Name

Type

Access

Description

coeff

[float]

r/w

the coefficients

Methods

affine (a, b, c, d, e, f)

determinant ()

equal (matrix2)

identity ()

invert ()

is_affine ()

is_diagonal ()

is_identity ()

is_simple ()

mult (right)

rotate (theta)

scale (x, y)

transform_point (x, y, newx, newy)

translate (x, y)

xshear (amount)

yshear (amount)

Details

class Gimp.Matrix3

A three by three matrix.

affine(a, b, c, d, e, f)
Parameters:
  • a (float) – the ‘a’ coefficient

  • b (float) – the ‘b’ coefficient

  • c (float) – the ‘c’ coefficient

  • d (float) – the ‘d’ coefficient

  • e (float) – the ‘e’ coefficient

  • f (float) – the ‘f’ coefficient

Applies the affine transformation given by six values to self. The six values form define an affine transformation matrix as illustrated below:

( a c e ) ( b d f ) ( 0 0 1 )

determinant()
Returns:

The determinant.

Return type:

float

Calculates the determinant of the given matrix.

equal(matrix2)
Parameters:

matrix2 (Gimp.Matrix3) – The second matrix

Returns:

True the matrices are equal, False otherwise

Return type:

bool

Checks if two matrices are equal.

New in version 2.10.16.

identity()

Sets the matrix to the identity matrix.

invert()

Inverts the given matrix.

is_affine()
Returns:

True if the matrix defines an affine transformation, False otherwise

Return type:

bool

Checks if the given matrix defines an affine transformation.

New in version 2.4.

is_diagonal()
Returns:

True if the matrix is diagonal, False otherwise

Return type:

bool

Checks if the given matrix is diagonal.

is_identity()
Returns:

True if the matrix is the identity matrix, False otherwise

Return type:

bool

Checks if the given matrix is the identity matrix.

is_simple()
Returns:

True if all entries of the upper left 2x2 matrix are either 0 or 1, False otherwise

Return type:

bool

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

mult(right)
Parameters:

right (Gimp.Matrix3) – The second input matrix which will be overwritten by the result.

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

rotate(theta)
Parameters:

theta (float) – The angle of rotation (in radians).

Rotates the matrix by theta degrees.

scale(x, y)
Parameters:
  • x (float) – X scale factor.

  • y (float) – Y scale factor.

Scales the matrix by x and y

transform_point(x, y, newx, newy)
Parameters:
  • x (float) – The source X coordinate.

  • y (float) – The source Y coordinate.

  • newx (float) – The transformed X coordinate.

  • newy (float) – The transformed Y coordinate.

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

translate(x, y)
Parameters:
  • x (float) – Translation in X direction.

  • y (float) – Translation in Y direction.

Translates the matrix by x and y.

xshear(amount)
Parameters:

amount (float) – X shear amount.

Shears the matrix in the X direction.

yshear(amount)
Parameters:

amount (float) – Y shear amount.

Shears the matrix in the Y direction.