Describes a 3D transform.
Unlike <GrapheneMatrix>,
<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.
Checks two transforms for equality.
Passed: a <GskTransform>.
the first transform
Passed, or left out: a <GskTransform>, or
#f.
the second transform
Returned: a boolean.
true if the two transforms perform the same operation
Returns the category this transform belongs to.
Passed: a <GskTransform>.
a transform
Returned: a <GskTransformCategory>.
The category of the 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 transform:ref first if you want to keep it around.
Passed: a <GskTransform>.
transform to invert
Returned: a <GskTransform>, or #f.
The inverted transform
Multiplies self with the given matrix.
This function consumes self. Use transform:ref first if you want to keep it around.
Passed: a <GskTransform>.
the next transform
Passed: a <GrapheneMatrix>.
the matrix to multiply self with
Returned: a <GskTransform>.
The new transform
Multiplies self with the matrix [ xx yx x0; xy yy y0; 0 0 1 ].
The result of calling transform:to-2d on
the returned <GskTransform> should match the
input passed to this function.
This function consumes self. Use transform:ref first if you want to keep it around.
Passed: a <GskTransform>.
the next transform
Passed: a real number.
the xx member
Passed: a real number.
the yx member
Passed: a real number.
the xy member
Passed: a real number.
the yy member
Passed: a real number.
the x0 member
Passed: a real number.
the y0 member
Returned: a <GskTransform>, or #f.
The new 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.
Returned: a <GskTransform>.
A new identity transform
Parses a given into a transform.
Strings printed via 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.
Passed: a string.
the string to parse
Returned: a boolean.
true if string described a valid transform
Returned: a <GskTransform>.
return location for the 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 self. Use transform:ref first if you want to keep it around.
Passed: a <GskTransform>.
the next transform
Passed: a real number.
distance of the z=0 plane. Lower values give a more flattened pyramid and therefore a more pronounced perspective effect.
Returned: a <GskTransform>.
The new transform
Converts the transform into a human-readable representation.
The result of this function can later be parsed with
transform:parse.
Passed: a <GskTransform>.
a transform
Passed: a <GString>.
The string to print into
Acquires a reference on the given transform.
Passed: a <GskTransform>.
a transform
Returned: a <GskTransform>, or #f.
the transform with an additional reference
Rotates self by an angle around the Z axis.
The rotation happens around the origin point of (0, 0).
This function consumes self. Use transform:ref first if you want to keep it around.
Passed: a <GskTransform>.
the next transform
Passed: a real number.
the rotation angle, in degrees (clockwise)
Returned: a <GskTransform>, or #f.
The new transform
Rotates self angle degrees around axis.
For a rotation in 2D space, use transform:rotate
This function consumes self. Use transform:ref first if you want to keep it around.
Passed: a <GskTransform>.
the next transform
Passed: a real number.
the rotation angle, in degrees (clockwise)
Passed: a <GrapheneVec3>.
The rotation axis
Returned: a <GskTransform>, or #f.
The new transform
Scales self in 2-dimensional space by the given factors.
Use transform:scale-3d to scale in all
3 dimensions.
This function consumes self. Use transform:ref first if you want to keep it around.
Passed: a <GskTransform>.
the next transform
Passed: a real number.
scaling factor on the X axis
Passed: a real number.
scaling factor on the Y axis
Returned: a <GskTransform>, or #f.
The new transform
Scales self by the given factors.
This function consumes self. Use transform:ref first if you want to keep it around.
Passed: a <GskTransform>.
the next transform
Passed: a real number.
scaling factor on the X axis
Passed: a real number.
scaling factor on the Y axis
Passed: a real number.
scaling factor on the Z axis
Returned: a <GskTransform>, or #f.
The new transform
Applies a skew transform.
This function consumes self. Use transform:ref first if you want to keep it around.
Passed: a <GskTransform>.
the next transform
Passed: a real number.
skew factor, in degrees, on the X axis
Passed: a real number.
skew factor, in degrees, on the Y axis
Returned: a <GskTransform>, or #f.
The new transform
Converts a transform to a 2D transformation matrix.
self must be a 2D transformation. If you are not sure, use
transform:get-category >=
GSK_TRANSFORM_CATEGORY_2D
to check.
The returned values are a subset of the full 4x4 matrix that is computed
by 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.
Passed: a <GskTransform>.
a 2D transform
Returned: a real number.
return location for the xx member
Returned: a real number.
return location for the yx member
Returned: a real number.
return location for the xy member
Returned: a real number.
return location for the yy member
Returned: a real number.
return location for the x0 member
Returned: a real number.
return location for the y0 member
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
transform:get-category >=
GSK_TRANSFORM_CATEGORY_2D
to check.
Passed: a <GskTransform>.
a transform
Returned: a real number.
return location for the skew factor in the x direction
Returned: a real number.
return location for the skew factor in the y direction
Returned: a real number.
return location for the scale factor in the x direction
Returned: a real number.
return location for the scale factor in the y direction
Returned: a real number.
return location for the rotation angle
Returned: a real number.
return location for the translation in the x direction
Returned: a real number.
return location for the translation in the y direction
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
transform:get-category >=
GSK_TRANSFORM_CATEGORY_2D_AFFINE
to check.
Passed: a <GskTransform>.
a transform
Returned: a real number.
return location for the scale factor in the x direction
Returned: a real number.
return location for the scale factor in the y direction
Returned: a real number.
return location for the translation in the x direction
Returned: a real number.
return location for the translation in the y direction
Computes the 4x4 matrix for the transform.
The previous value of out-matrix will be ignored.
Passed: a <GskTransform>.
a transform
Passed, filled in, and returned: a
<GrapheneMatrix>.
return location for the matrix
Converts the transform into a human-readable string.
The resulting string can be parsed with transform:parse.
This is a wrapper around transform:print.
Passed: a <GskTransform>.
a transform
Returned: a string.
A new string for self
Converts a transform to a translation operation.
self must be a 2D transformation. If you are not sure, use
transform:get-category >=
GSK_TRANSFORM_CATEGORY_2D_TRANSLATE
to check.
Passed: a <GskTransform>.
a transform
Returned: a real number.
return location for the translation in the x direction
Returned: a real number.
return location for the translation in the y direction
Applies all the operations from other to self.
This function consumes self. Use transform:ref first if you want to keep it around.
Passed: a <GskTransform>.
transform to apply other to
Passed, or left out: a <GskTransform>, or
#f.
transform to apply
Returned: a <GskTransform>, or #f.
The new transform
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.
Passed: a <GskTransform>.
a transform
Passed: a <GrapheneRect>.
the rectangle to transform
Passed, filled in, and returned: a
<GrapheneRect>.
return location for the bounds of the transformed rectangle
Transforms a point using the given transform.
Passed: a <GskTransform>.
a transform
Passed: a <GraphenePoint>.
the point to transform
Passed, filled in, and returned: a
<GraphenePoint>.
return location for the transformed point
Translates self in 2-dimensional space by point.
This function consumes self. Use transform:ref first if you want to keep it around.
Passed: a <GskTransform>.
the next transform
Passed: a <GraphenePoint>.
the point to translate the transform by
Returned: a <GskTransform>, or #f.
The new transform
Translates self by point.
This function consumes self. Use transform:ref first if you want to keep it around.
Passed: a <GskTransform>.
the next transform
Passed: a <GraphenePoint3D>.
the point to translate the transform by
Returned: a <GskTransform>, or #f.
The new transform
Releases a reference on the given transform.
If the reference was the last, the resources associated to the self are freed.
Passed: a <GskTransform>.
a transform