package ocgtk
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=4e50fdb5093136a10fc8ffbe388e44cbcb70d52f8afdd48863ec7e22580ff054
doc/ocgtk.gsk/Ocgtk_gsk/Gsk/Wrappers/Transform/index.html
Module Wrappers.Transform
type t = [ `transform ] Gobject.obj`GskTransform` is an object to describe transform matrices.
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.
val new_ : unit -> tCreate a new Transform
val translate_3d : t -> Ocgtk_graphene.Graphene.Wrappers.Point3_d.t -> t optionTranslates @next by @point.
val translate : t -> Ocgtk_graphene.Graphene.Wrappers.Point.t -> t optionTranslates @next in 2-dimensional space by @point.
val transform_point :
t ->
Ocgtk_graphene.Graphene.Wrappers.Point.t ->
Ocgtk_graphene.Graphene.Wrappers.Point.tTransforms a `graphene_point_t` using the given transform @self.
val transform_bounds :
t ->
Ocgtk_graphene.Graphene.Wrappers.Rect.t ->
Ocgtk_graphene.Graphene.Wrappers.Rect.tTransforms a `graphene_rect_t` using the given transform @self.
The result is the bounding box containing the coplanar quad.
val to_translate : t -> float * floatConverts a `GskTransform` 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.
val to_string : t -> stringConverts a matrix into a string that is suitable for printing.
The resulting string can be parsed with func@Gsk.Transform.parse.
This is a wrapper around method@Gsk.Transform.print.
val to_matrix : t -> Ocgtk_graphene.Graphene.Wrappers.Matrix.tComputes the actual value of @self and stores it in @out_matrix.
The previous value of @out_matrix will be ignored.
val to_affine : t -> float * float * float * floatConverts a `GskTransform` 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.
val to_2d_components :
t ->
float * float * float * float * float * float * floatConverts a `GskTransform` 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_T (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.
val to_2d : t -> float * float * float * float * float * floatConverts a `GskTransform` 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 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.
Scales @next in 2-dimensional space by the given factors.
Use method@Gsk.Transform.scale_3d to scale in all 3 dimensions.
val rotate_3d :
t ->
float ->
Ocgtk_graphene.Graphene.Wrappers.Vec3.t ->
t optionRotates @next @angle degrees around @axis.
For a rotation in 2D space, use method@Gsk.Transform.rotate
Rotates @next @angle degrees in 2D - or in 3D-speak, around the Z axis. The rotation happens around the origin point of (0, 0).
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.
val matrix : t -> Ocgtk_graphene.Graphene.Wrappers.Matrix.t -> tMultiplies @next with the given @matrix.
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.
val get_category : t -> Gsk_enums.transformcategoryReturns the category this transform belongs to.
val get_type : unit -> Gobject.Type.t