Basics
Guides
API Reference
Basics
Guides
API Reference
[18:7] extends: object
Describes a 3D transform. Unlike graphene_matrix_t, GskTransform retains
the steps in how a transform was constructed, and allows inspecting them. It
is modeled after the way CSS describes transforms. GskTransform objects are
immutable and cannot be changed after creation. This means code can safely
expose them as properties of objects without having to worry about others
changing them.
GskTransform (Handle = null)
Creates a new identity transform. This function is meant to be used by language bindings. For C code, this is equivalent to using
NULL.
Handle is an optional native handle or wrapper whose handle to adopt; when the native constructor is called.toNativeHandle (Source)
Normalizes a constructor argument into a raw pointer carrier. Accepts a raw NativeHandle, a raw NativeBuffer returned from
fn.call(...), another generated wrapper exposinghandle(), or null. Returns null when the argument carries no pointer.
Source is the raw handle, raw buffer, wrapper, or null.A raw pointer carrier or null when no pointer is present.getLib ()
Returns the opened native library for this generated wrapper.
The opened native library.handle ()
Returns the wrapped NativeHandle.
The wrapped NativeHandle.isNull ()
Returns true when the wrapped handle is null.
A bool.describe ()
Returns a small string for debugging generated wrappers.
A string.equal (object second)
Checks two transforms for equality.
second is the second transform.true if the two transforms perform the same operation.get_category ()
Returns the category this transform belongs to.
The category of the transform.invert ()
Inverts the given transform. If @self is not invertible,
NULLis returned. Note that invertingNULLalso returnsNULL, which is the correct inverse ofNULL. If you need to differentiate between those cases, you should check @self is notNULLbefore calling this function. This function consumes @self. Use [method@Gsk.Transform.ref] first if you want to keep it around.
The inverted transform.matrix (object matrix)
Multiplies @next with the given @matrix. This function consumes @next. Use [method@Gsk.Transform.ref] first if you want to keep it around.
matrix is the matrix to multiply @next with.The new transform.matrix_2d (double xx, double yx, double xy, double yy, double dx, double dy)
Multiplies @next with the matrix [ xx yx x0; xy yy y0; 0 0 1 ]. The result of calling [method@Gsk.Transform.to_2d] on the returned [struct@Gsk.Transform] should match the input passed to this function. This function consumes @next. Use [method@Gsk.Transform.ref] first if you want to keep it around.
xx is the xx member.yx is the yx member.xy is the xy member.yy is the yy member.dx is the x0 member.dy is the y0 member.The new transform.perspective (double depth)
Applies a perspective projection transform. This transform scales points in X and Y based on their Z value, scaling points with positive Z values away from the origin, and those with negative Z values towards the origin. Points on the z=0 plane are unchanged. This function consumes
Use [method@Gsk.Transform.ref] first if you want to keep it around.depth is distance of the z=0 plane. Lower values give a more flattened pyramid and therefore a more pronounced perspective effect..The new transform.print (object arg1String)
Converts the transform into a human-readable representation. The result of this function can later be parsed with [func@Gsk.Transform.parse].
string is The string to print into.None.ref ()
Acquires a reference on the given transform.
the transform with an additional reference.rotate (double angle)
Rotates @next by an angle around the Z axis. The rotation happens around the origin point of (0, 0). This function consumes @next. Use [method@Gsk.Transform.ref] first if you want to keep it around.
angle is the rotation angle, in degrees (clockwise).The new transform.rotate_3d (double angle, object axis)
Rotates @next @angle degrees around @axis. For a rotation in 2D space, use [method@Gsk.Transform.rotate] This function consumes @next. Use [method@Gsk.Transform.ref] first if you want to keep it around.
angle is the rotation angle, in degrees (clockwise).axis is The rotation axis.The new transform.scale (double factor_x, double factor_y)
Scales @next in 2-dimensional space by the given factors. Use [method@Gsk.Transform.scale_3d] to scale in all 3 dimensions. This function consumes @next. Use [method@Gsk.Transform.ref] first if you want to keep it around.
factor_x is scaling factor on the X axis.factor_y is scaling factor on the Y axis.The new transform.scale_3d (double factor_x, double factor_y, double factor_z)
Scales @next by the given factors. This function consumes @next. Use [method@Gsk.Transform.ref] first if you want to keep it around.
factor_x is scaling factor on the X axis.factor_y is scaling factor on the Y axis.factor_z is scaling factor on the Z axis.The new transform.skew (double skew_x, double skew_y)
Applies a skew transform. This function consumes @next. Use [method@Gsk.Transform.ref] first if you want to keep it around.
skew_x is skew factor, in degrees, on the X axis.skew_y is skew factor, in degrees, on the Y axis.The new transform.to_2d ()
Converts a transform to a 2D transformation matrix. @self must be a 2D transformation. If you are not sure, use gsk_transform_get_category() >= GSK_TRANSFORM_CATEGORY_2D to check. The returned values are a subset of the full 4x4 matrix that is computed by [method@Gsk.Transform.to_matrix] and have the following layout:
| xx yx | | a b 0 | | xy yy | = | c d 0 | | dx dy | | tx ty 1 |This function can be used to convert between aGskTransformand a matrix type from other 2D drawing libraries, in particular Cairo.
out_xx is return location for the xx member.out_yx is return location for the yx member.out_xy is return location for the xy member.out_yy is return location for the yy member.out_dx is return location for the x0 member.out_dy is return location for the y0 member.None.to_2d_components ()
Converts a transform to 2D transformation factors. To recreate an equivalent transform from the factors returned by this function, use gsk_transform_skew ( gsk_transform_scale ( gsk_transform_rotate ( gsk_transform_translate (NULL, &GRAPHENE_POINT_INIT (dx, dy)), angle), scale_x, scale_y), skew_x, skew_y) @self must be a 2D transformation. If you are not sure, use gsk_transform_get_category() >= GSK_TRANSFORM_CATEGORY_2D to check.
out_skew_x is return location for the skew factor in the x direction.out_skew_y is return location for the skew factor in the y direction.out_scale_x is return location for the scale factor in the x direction.out_scale_y is return location for the scale factor in the y direction.out_angle is return location for the rotation angle.out_dx is return location for the translation in the x direction.out_dy is return location for the translation in the y direction.None.to_affine ()
Converts a transform to 2D affine transformation factors. To recreate an equivalent transform from the factors returned by this function, use gsk_transform_scale ( gsk_transform_translate ( NULL, &GRAPHENE_POINT_T (dx, dy)), sx, sy) @self must be a 2D affine transformation. If you are not sure, use gsk_transform_get_category() >= GSK_TRANSFORM_CATEGORY_2D_AFFINE to check.
out_scale_x is return location for the scale factor in the x direction.out_scale_y is return location for the scale factor in the y direction.out_dx is return location for the translation in the x direction.out_dy is return location for the translation in the y direction.None.to_matrix ()
Computes the 4x4 matrix for the transform. The previous value of
will be ignored.out_matrix is return location for the matrix.None.to_string ()
Converts the transform into a human-readable string. The resulting string can be parsed with [func@Gsk.Transform.parse]. This is a wrapper around [method@Gsk.Transform.print].
A new string for @self.to_translate ()
Converts a transform to a translation operation. @self must be a 2D transformation. If you are not sure, use gsk_transform_get_category() >= GSK_TRANSFORM_CATEGORY_2D_TRANSLATE to check.
out_dx is return location for the translation in the x direction.out_dy is return location for the translation in the y direction.None.transform (object other)
Applies all the operations from @other to @next. This function consumes
Use [method@Gsk.Transform.ref] first if you want to keep it around.other is transform to apply.The new transform.transform_bounds (object rect)
Transforms a rectangle using the given transform. The result is the bounding box containing the coplanar quad. The input and output rect may point to the same rectangle.
rect is the rectangle to transform.out_rect is return location for the bounds of the transformed rectangle.None.transform_point (object point)
Transforms a point using the given transform.
point is the point to transform.out_point is return location for the transformed point.None.translate (object point)
Translates @next in 2-dimensional space by @point. This function consumes
Use [method@Gsk.Transform.ref] first if you want to keep it around.point is the point to translate the transform by.The new transform.translate_3d (object point)
Translates @next by @point. This function consumes @next. Use [method@Gsk.Transform.ref] first if you want to keep it around.
point is the point to translate the transform by.The new transform.unref ()
Releases a reference on the given transform. If the reference was the last, the resources associated to the @self are freed.
None.
Aussom
Write once. Embed everywhere.
Copyright 2026 Austin Lehman. All rights reserved.