{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}

DrawTransformKt

public final class DrawTransformKt


Summary

Public methods

static final void
inset(@NonNull DrawTransform receiver, float inset)

Convenience method modifies the DrawScope bounds to inset both left, top, right and bottom bounds by inset.

static final void
inset(@NonNull DrawTransform receiver, float horizontal, float vertical)

Convenience method modifies the DrawTransform bounds to inset both left and right bounds by horizontal as well as the top and bottom by vertical.

static final void
rotateRad(
    @NonNull DrawTransform receiver,
    float radians,
    @NonNull Offset pivot
)

Add a rotation (in radians clockwise) to the current transform at the given pivot point.

static final void
scale(@NonNull DrawTransform receiver, float scale, @NonNull Offset pivot)

Add an axis-aligned scale to the current transform, scaling uniformly in both directions by the provided scale factor at the pivot coordinate.

Public methods

inset

public static final void inset(@NonNull DrawTransform receiver, float inset)

Convenience method modifies the DrawScope bounds to inset both left, top, right and bottom bounds by inset. After this method is invoked, the coordinate space is returned to the state before this inset was applied.

Parameters
float inset

number of pixels to inset left, top, right, and bottom bounds.

inset

public static final void inset(@NonNull DrawTransform receiver, float horizontal, float vertical)

Convenience method modifies the DrawTransform bounds to inset both left and right bounds by horizontal as well as the top and bottom by vertical. After this method is invoked, the coordinate space is returned to the state before the inset was applied

Parameters
float horizontal

number of pixels to inset both left and right bounds. Zero by default.

float vertical

number of pixels to inset both top and bottom bounds. Zero by default.

rotateRad

public static final void rotateRad(
    @NonNull DrawTransform receiver,
    float radians,
    @NonNull Offset pivot
)

Add a rotation (in radians clockwise) to the current transform at the given pivot point. The pivot coordinate remains unchanged by the rotation transformation

Parameters
float radians

to rotate clockwise

@NonNull Offset pivot

The coordinate for the pivot point, defaults to the center of the coordinate space

scale

public static final void scale(@NonNull DrawTransform receiver, float scale, @NonNull Offset pivot)

Add an axis-aligned scale to the current transform, scaling uniformly in both directions by the provided scale factor at the pivot coordinate. The pivot coordinate remains unchanged by the scale transformation.

Parameters
float scale

The amount to scale

@NonNull Offset pivot

The coordinate for the pivot point, defaults to the center of the coordinate space