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

IntRectKt

public final class IntRectKt


Summary

Public methods

static final @NonNull IntRect
IntRect(@NonNull IntOffset center, int radius)

Construct a rectangle that bounds the given circle

static final @NonNull IntRect

Construct a rectangle from its left and top edges as well as its width and height.

static final @NonNull IntRect
IntRect(@NonNull IntOffset topLeft, @NonNull IntOffset bottomRight)

Construct the smallest rectangle that encloses the given offsets, treating them as vectors from the origin.

static final @NonNull IntRect
lerp(@NonNull IntRect start, @NonNull IntRect stop, float fraction)

Linearly interpolate between two rectangles.

static final @NonNull IntRect

Rounds a Rect to an IntRect

static final @NonNull Rect
toRect(@NonNull IntRect receiver)

Converts an IntRect to a Rect

Public methods

IntRect

public static final @NonNull IntRect IntRect(@NonNull IntOffset center, int radius)

Construct a rectangle that bounds the given circle

Parameters
@NonNull IntOffset center

Offset that represents the center of the circle

int radius

Radius of the circle to enclose

IntRect

public static final @NonNull IntRect IntRect(@NonNull IntOffset offset, @NonNull IntSize size)

Construct a rectangle from its left and top edges as well as its width and height.

Parameters
@NonNull IntOffset offset

Offset to represent the top and left parameters of the Rect

@NonNull IntSize size

Size to determine the width and height of this IntRect.

IntRect

public static final @NonNull IntRect IntRect(@NonNull IntOffset topLeft, @NonNull IntOffset bottomRight)

Construct the smallest rectangle that encloses the given offsets, treating them as vectors from the origin.

Parameters
@NonNull IntOffset topLeft

Offset representing the left and top edges of the rectangle

@NonNull IntOffset bottomRight

Offset representing the bottom and right edges of the rectangle

lerp

public static final @NonNull IntRect lerp(@NonNull IntRect start, @NonNull IntRect stop, float fraction)

Linearly interpolate between two rectangles.

The fraction argument represents position on the timeline, with 0.0 meaning that the interpolation has not started, returning start (or something equivalent to start), 1.0 meaning that the interpolation has finished, returning stop (or something equivalent to stop), and values in between meaning that the interpolation is at the relevant point on the timeline between start and stop. The interpolation can be extrapolated beyond 0.0 and 1.0, so negative values and values greater than 1.0 are valid (and can easily be generated by curves).

Values for fraction are usually obtained from an Animation, such as an AnimationController.

roundToIntRect

public static final @NonNull IntRect roundToIntRect(@NonNull Rect receiver)

Rounds a Rect to an IntRect

toRect

public static final @NonNull Rect toRect(@NonNull IntRect receiver)

Converts an IntRect to a Rect