Function

Rect

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

RevenueCat

RevenueCat

Add subscriptions to your apps in minutes

Ad Get started for free
Source set: Common

Added in 1.11.0-rc01

fun Rect(offset: Offset, size: Size): Rect

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

Parameters

offset Offset to represent the top and left parameters of the Rect
size Size to determine the width and height of this Rect.

Returns

Rect with Rect.left and Rect.top configured to Offset.x and Offset.y as Rect.right and Rect.bottom to Offset.x + Size.width and Offset.y + Size.height respectively
Source set: Common

Added in 1.11.0-rc01

fun Rect(topLeft: Offset, bottomRight: Offset): Rect

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

Parameters

topLeft Offset representing the left and top edges of the rectangle
bottomRight Offset representing the bottom and right edges of the rectangle
Source set: Common

Added in 1.11.0-rc01

fun Rect(center: Offset, radius: Float): Rect

Construct a rectangle that bounds the given circle

Parameters

center Offset that represents the center of the circle
radius Radius of the circle to enclose