Package ch.bailu.gtk.gsk
Klasse Transform
java.lang.Object
ch.bailu.gtk.type.Type
ch.bailu.gtk.type.Pointer
ch.bailu.gtk.type.Record
ch.bailu.gtk.gsk.Transform
- Alle implementierten Schnittstellen:
PointerInterface
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.
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.
-
Feldübersicht
-
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungboolean
Checks two transforms for equality.int
Returns the category this transform belongs to.static ClassHandler
static int
static long
static TypeSystem.TypeSize
static long
static TypeSystem.TypeSize
invert()
Inverts the given transform.Multiplies @next with the given @matrix.perspective
(float depth) Applies a perspective projection transform.void
Converts the transform into a human-readable representation.ref()
Acquires a reference on the given transform.rotate
(float angle) Rotates @next by an angle around the Z axis.Rotates @next @angle degrees around @axis.scale
(float factor_x, float factor_y) Scales @next in 2-dimensional space by the given factors.scale3d
(float factor_x, float factor_y, float factor_z) Scales @next by the given factors.skew
(float skew_x, float skew_y) Applies a skew transform.void
Converts a transform to a 2D transformation matrix.void
to2dComponents
(Flt out_skew_x, Flt out_skew_y, Flt out_scale_x, Flt out_scale_y, Flt out_angle, Flt out_dx, Flt out_dy) Converts a transform to 2D transformation factors.void
Converts a transform to 2D affine transformation factors.void
Computes the 4x4 matrix for the transform.toStr()
Converts the transform into a human-readable string.void
toTranslate
(Flt out_dx, Flt out_dy) Converts a transform to a translation operation.Applies all the operations from @other to @next.void
transformBounds
(Rect rect, Rect out_rect) Transforms a rectangle using the given transform.void
transformPoint
(Point point, Point out_point) Transforms a point using the given transform.Translates @next in 2-dimensional space by @point.translate3d
(Point3D point) Translates @next by @point.void
unref()
Releases a reference on the given transform.Von Klasse geerbte Methoden ch.bailu.gtk.type.Pointer
asCPointer, cast, connectSignal, disconnectSignals, disconnectSignals, equals, hashCode, throwIfNull, throwNullPointerException, toString, unregisterCallbacks, unregisterCallbacks
Von Klasse geerbte Methoden ch.bailu.gtk.type.Type
asCPointer, asCPointer, asCPointerNotNull, asJnaPointer, asJnaPointer, asPointer, asPointer, cast, cast, throwIfNull
Von Klasse geerbte Methoden java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Von Schnittstelle geerbte Methoden ch.bailu.gtk.type.PointerInterface
asCPointerNotNull, asJnaPointer, asPointer, isNotNull, isNull
-
Konstruktordetails
-
Transform
-
Transform
public 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`.
-
-
Methodendetails
-
getClassHandler
-
equal
Checks two transforms for equality.- Parameter:
second
- the second transform- Gibt zurück:
- true if the two transforms perform the same operation
-
getCategory
public int getCategory()Returns the category this transform belongs to.- Gibt zurück:
- The category of the transform
-
invert
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 [method@Gsk.Transform.ref] first
if you want to keep it around.- Gibt zurück:
- The inverted transform
-
matrix
Multiplies @next with the given @matrix.
This function consumes @next. Use [method@Gsk.Transform.ref] first
if you want to keep it around.- Parameter:
matrix
- the matrix to multiply @next with- Gibt zurück:
- The new transform
-
perspective
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 [method@Gsk.Transform.ref] first
if you want to keep it around.- Parameter:
depth
- distance of the z=0 plane. Lower values give a more flattened pyramid and therefore a more pronounced perspective effect.- Gibt zurück:
- The new transform
-
print
Converts the transform into a human-readable representation.
The result of this function can later be parsed with
[func@Gsk.Transform.parse].- Parameter:
string
- The string to print into
-
ref
Acquires a reference on the given transform.- Gibt zurück:
- the transform with an additional reference
-
rotate
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.- Parameter:
angle
- the rotation angle, in degrees (clockwise)- Gibt zurück:
- The new transform
-
rotate3d
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.- Parameter:
angle
- the rotation angle, in degrees (clockwise)axis
- The rotation axis- Gibt zurück:
- The new transform
-
scale
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.- Parameter:
factor_x
- scaling factor on the X axisfactor_y
- scaling factor on the Y axis- Gibt zurück:
- The new transform
-
scale3d
Scales @next by the given factors.
This function consumes @next. Use [method@Gsk.Transform.ref] first
if you want to keep it around.- Parameter:
factor_x
- scaling factor on the X axisfactor_y
- scaling factor on the Y axisfactor_z
- scaling factor on the Z axis- Gibt zurück:
- The new transform
-
skew
Applies a skew transform.
This function consumes @next. Use [method@Gsk.Transform.ref] first
if you want to keep it around.- Parameter:
skew_x
- skew factor, in degrees, on the X axisskew_y
- skew factor, in degrees, on the Y axis- Gibt zurück:
- The new transform
-
to2d
public void to2d(@Nonnull Flt out_xx, @Nonnull Flt out_yx, @Nonnull Flt out_xy, @Nonnull Flt out_yy, @Nonnull Flt out_dx, @Nonnull Flt out_dy) 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 a `GskTransform`
and a matrix type from other 2D drawing libraries, in particular
Cairo.- Parameter:
out_xx
- return location for the xx memberout_yx
- return location for the yx memberout_xy
- return location for the xy memberout_yy
- return location for the yy memberout_dx
- return location for the x0 memberout_dy
- return location for the y0 member
-
to2dComponents
public void to2dComponents(@Nonnull Flt out_skew_x, @Nonnull Flt out_skew_y, @Nonnull Flt out_scale_x, @Nonnull Flt out_scale_y, @Nonnull Flt out_angle, @Nonnull Flt out_dx, @Nonnull Flt out_dy) 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_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.- Parameter:
out_skew_x
- return location for the skew factor in the x directionout_skew_y
- return location for the skew factor in the y directionout_scale_x
- return location for the scale factor in the x directionout_scale_y
- return location for the scale factor in the y directionout_angle
- return location for the rotation angleout_dx
- return location for the translation in the x directionout_dy
- return location for the translation in the y direction
-
toAffine
public void toAffine(@Nonnull Flt out_scale_x, @Nonnull Flt out_scale_y, @Nonnull Flt out_dx, @Nonnull Flt out_dy) 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.- Parameter:
out_scale_x
- return location for the scale factor in the x directionout_scale_y
- return location for the scale factor in the y directionout_dx
- return location for the translation in the x directionout_dy
- return location for the translation in the y direction
-
toMatrix
Computes the 4x4 matrix for the transform.
The previous value of @out_matrix will be ignored.- Parameter:
out_matrix
- return location for the matrix
-
toStr
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].- Gibt zurück:
- A new string for @self
-
toTranslate
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.- Parameter:
out_dx
- return location for the translation in the x directionout_dy
- return location for the translation in the y direction
-
transform
Applies all the operations from @other to @next.
This function consumes @next. Use [method@Gsk.Transform.ref] first
if you want to keep it around.- Parameter:
other
- transform to apply- Gibt zurück:
- The new transform
-
transformBounds
Transforms a rectangle using the given transform.
The result is the bounding box containing the coplanar quad.- Parameter:
rect
- the rectangle to transformout_rect
- return location for the bounds of the transformed rectangle
-
transformPoint
Transforms a point using the given transform.- Parameter:
point
- the point to transformout_point
- return location for the transformed point
-
translate
Translates @next in 2-dimensional space by @point.
This function consumes @next. Use [method@Gsk.Transform.ref] first
if you want to keep it around.- Parameter:
point
- the point to translate the transform by- Gibt zurück:
- The new transform
-
translate3d
Translates @next by @point.
This function consumes @next. Use [method@Gsk.Transform.ref] first
if you want to keep it around.- Parameter:
point
- the point to translate the transform by- Gibt zurück:
- The new transform
-
unref
public void unref()Releases a reference on the given transform.
If the reference was the last, the resources associated to the @self are
freed. -
getTypeID
public static long getTypeID() -
getParentTypeID
public static long getParentTypeID() -
getTypeSize
-
getParentTypeSize
-
getInstanceSize
public static int getInstanceSize()
-