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.
<gtkada_demo>create_fixed_layout.adb</gtkada_demo>
function Equal
(Self : Gsk_Transform;
Second : Gsk_Transform) return Boolean
Checks two transforms for equality.
the second transform
true if the two transforms perform the same operation
function From_Object (Object : System.Address) return Gsk_Transform
function From_Object_Free (B : access Gsk_Transform'Class) return Gsk_Transform
function Get_Category
(Self : Gsk_Transform) return Gsk.Enums.Gsk_Transform_Category
Returns the category this transform belongs to.
The category of the transform
function Get_Type return Glib.GType
type Gsk_Transform is new Glib.C_Boxed with null record;
function Gsk_Transform_New return Gsk_Transform
Creates a new identity transform. This function is meant to be used by language bindings. For C code, this is equivalent to using NULL.
procedure Gtk_New (Self : out Gsk_Transform)
Creates a new identity transform. This function is meant to be used by language bindings. For C code, this is equivalent to using NULL.
function Invert (Self : Gsk_Transform) return Gsk_Transform
Inverts the given transform. If Self is not invertible, NULL is returned. Note that inverting NULL also returns NULL, which is the correct inverse of NULL. If you need to differentiate between those cases, you should check Self is not NULL before calling this function. This function consumes Self. Use [methodGsk.Transform.ref] first if you want to keep it around.
has transfer-ownership='full'.
The inverted transform. Has transfer-ownership='full'.
function Matrix
(Self : Gsk_Transform;
Matrix : not null access Graphene.Matrix.Graphene_Matrix_T)
return Gsk_Transform
Multiplies Next with the given Matrix. This function consumes Next. Use [methodGsk.Transform.ref] first if you want to keep it around.
has transfer-ownership='full'.
the matrix to multiply Next with
The new transform. Has transfer-ownership='full'.
function Matrix_2D
(Self : Gsk_Transform;
Xx : Interfaces.C.C_float;
Yx : Interfaces.C.C_float;
Xy : Interfaces.C.C_float;
Yy : Interfaces.C.C_float;
Dx : Interfaces.C.C_float;
Dy : Interfaces.C.C_float) return Gsk_Transform
Multiplies Next with the matrix [ xx yx x0; xy yy y0; 0 0 1 ]. The result of calling [methodGsk.Transform.to_2d] on the returned [structGsk.Transform] should match the input passed to this function. This function consumes Next. Use [methodGsk.Transform.ref] first if you want to keep it around. Since: gtk+ 4.20
has transfer-ownership='full'.
the xx member
the yx member
the xy member
the yy member
the x0 member
the y0 member
The new transform. Has transfer-ownership='full'.
Null_Gsk_Transform : constant Gsk_Transform;
function Parse
(String : UTF8_String;
Out_Transform : out Gsk_Transform) return Boolean
Parses a given into a transform. Strings printed via [methodGsk.Transform.to_string] can be read in again successfully using this function. If String does not describe a valid transform, false is returned and NULL is put in Out_Transform.
the string to parse
return location for the transform. Has transfer-ownership='full'.
true if String described a valid transform
function Perspective
(Self : Gsk_Transform;
Depth : Interfaces.C.C_float) return Gsk_Transform
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 Next. Use [methodGsk.Transform.ref] first if you want to keep it around.
has transfer-ownership='full'.
distance of the z=0 plane. Lower values give a more flattened pyramid and therefore a more pronounced perspective effect.
The new transform. Has transfer-ownership='full'.
procedure Print (Self : Gsk_Transform; String : Glib.String.Gstring)
Converts the transform into a human-readable representation. The result of this function can later be parsed with [funcGsk.Transform.parse].
The string to print into
function Ref (Self : Gsk_Transform) return Gsk_Transform
Acquires a reference on the given transform.
the transform with an additional reference. Has transfer-ownership='none'.
function Rotate
(Self : Gsk_Transform;
Angle : Interfaces.C.C_float) return Gsk_Transform
Rotates Next by an angle around the Z axis. The rotation happens around the origin point of (0, 0). This function consumes Next. Use [methodGsk.Transform.ref] first if you want to keep it around.
has transfer-ownership='full'.
the rotation angle, in degrees (clockwise)
The new transform. Has transfer-ownership='full'.
function Rotate_3D
(Self : Gsk_Transform;
Angle : Interfaces.C.C_float;
Axis : not null access Graphene.Vec3.Graphene_Vec3_T)
return Gsk_Transform
Rotates Next Angle degrees around Axis. For a rotation in 2D space, use [methodGsk.Transform.rotate] This function consumes Next. Use [methodGsk.Transform.ref] first if you want to keep it around.
has transfer-ownership='full'.
the rotation angle, in degrees (clockwise)
The rotation axis
The new transform. Has transfer-ownership='full'.
function Scale
(Self : Gsk_Transform;
Factor_X : Interfaces.C.C_float;
Factor_Y : Interfaces.C.C_float) return Gsk_Transform
Scales Next in 2-dimensional space by the given factors. Use [methodGsk.Transform.scale_3d] to scale in all 3 dimensions. This function consumes Next. Use [methodGsk.Transform.ref] first if you want to keep it around.
has transfer-ownership='full'.
scaling factor on the X axis
scaling factor on the Y axis
The new transform. Has transfer-ownership='full'.
function Scale_3D
(Self : Gsk_Transform;
Factor_X : Interfaces.C.C_float;
Factor_Y : Interfaces.C.C_float;
Factor_Z : Interfaces.C.C_float) return Gsk_Transform
Scales Next by the given factors. This function consumes Next. Use [methodGsk.Transform.ref] first if you want to keep it around.
has transfer-ownership='full'.
scaling factor on the X axis
scaling factor on the Y axis
scaling factor on the Z axis
The new transform. Has transfer-ownership='full'.
function Skew
(Self : Gsk_Transform;
Skew_X : Interfaces.C.C_float;
Skew_Y : Interfaces.C.C_float) return Gsk_Transform
Applies a skew transform. This function consumes Next. Use [methodGsk.Transform.ref] first if you want to keep it around. Since: gtk+ 4.6
has transfer-ownership='full'.
skew factor, in degrees, on the X axis
skew factor, in degrees, on the Y axis
The new transform. Has transfer-ownership='full'.
procedure To_2D
(Self : Gsk_Transform;
Out_Xx : out Interfaces.C.C_float;
Out_Yx : out Interfaces.C.C_float;
Out_Xy : out Interfaces.C.C_float;
Out_Yy : out Interfaces.C.C_float;
Out_Dx : out Interfaces.C.C_float;
Out_Dy : out Interfaces.C.C_float)
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 [methodGsk.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 a GskTransform and a matrix type from other 2D drawing libraries, in particular Cairo.
return location for the xx member
return location for the yx member
return location for the xy member
return location for the yy member
return location for the x0 member
return location for the y0 member
procedure To_2D_Components
(Self : Gsk_Transform;
Out_Skew_X : out Interfaces.C.C_float;
Out_Skew_Y : out Interfaces.C.C_float;
Out_Scale_X : out Interfaces.C.C_float;
Out_Scale_Y : out Interfaces.C.C_float;
Out_Angle : out Interfaces.C.C_float;
Out_Dx : out Interfaces.C.C_float;
Out_Dy : out Interfaces.C.C_float)
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. Since: gtk+ 4.6
return location for the skew factor in the x direction
return location for the skew factor in the y direction
return location for the scale factor in the x direction
return location for the scale factor in the y direction
return location for the rotation angle
return location for the translation in the x direction
return location for the translation in the y direction
procedure To_Affine
(Self : Gsk_Transform;
Out_Scale_X : out Interfaces.C.C_float;
Out_Scale_Y : out Interfaces.C.C_float;
Out_Dx : out Interfaces.C.C_float;
Out_Dy : out Interfaces.C.C_float)
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.
return location for the scale factor in the x direction
return location for the scale factor in the y direction
return location for the translation in the x direction
return location for the translation in the y direction
procedure To_Matrix
(Self : Gsk_Transform;
Out_Matrix : not null access Graphene.Matrix.Graphene_Matrix_T)
Computes the 4x4 matrix for the transform. The previous value of Out_Matrix will be ignored.
return location for the matrix
function To_String (Self : Gsk_Transform) return UTF8_String
Converts the transform into a human-readable string. The resulting string can be parsed with [funcGsk.Transform.parse]. This is a wrapper around [methodGsk.Transform.print].
A new string for Self
procedure To_Translate
(Self : Gsk_Transform;
Out_Dx : out Interfaces.C.C_float;
Out_Dy : out Interfaces.C.C_float)
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.
return location for the translation in the x direction
return location for the translation in the y direction
function Transform
(Self : Gsk_Transform;
Other : Gsk_Transform) return Gsk_Transform
Applies all the operations from Other to Next. This function consumes Next. Use [methodGsk.Transform.ref] first if you want to keep it around.
has transfer-ownership='full'.
transform to apply
The new transform. Has transfer-ownership='full'.
procedure Transform_Bounds
(Self : Gsk_Transform;
Rect : not null access Graphene.Rect.Graphene_Rect_T;
Out_Rect : not null access Graphene.Rect.Graphene_Rect_T)
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.
the rectangle to transform
return location for the bounds of the transformed rectangle
procedure Transform_Point
(Self : Gsk_Transform;
Point : not null access Graphene.Point.Graphene_Point_T;
Out_Point : not null access Graphene.Point.Graphene_Point_T)
Transforms a point using the given transform.
the point to transform
return location for the transformed point
function Translate
(Self : Gsk_Transform;
Point : not null access Graphene.Point.Graphene_Point_T)
return Gsk_Transform
Translates Next in 2-dimensional space by Point. This function consumes Next. Use [methodGsk.Transform.ref] first if you want to keep it around.
has transfer-ownership='full'.
the point to translate the transform by
The new transform. Has transfer-ownership='full'.
function Translate_3D
(Self : Gsk_Transform;
Point : not null access Graphene.Point3d.Graphene_Point3D_T)
return Gsk_Transform
Translates Next by Point. This function consumes Next. Use [methodGsk.Transform.ref] first if you want to keep it around.
has transfer-ownership='full'.
the point to translate the transform by
The new transform. Has transfer-ownership='full'.
procedure Unref (Self : Gsk_Transform)
Releases a reference on the given transform. If the reference was the last, the resources associated to the Self are freed.