Google is committed to advancing racial equity for Black communities. See how.

MutableRect

class MutableRect
kotlin.Any
   ↳ androidx.compose.ui.geometry.MutableRect

An mutable, 2D, axis-aligned, floating-point rectangle whose coordinates are relative to a given origin.

Summary

Public constructors
<init>(left: Float, top: Float, right: Float, bottom: Float)

An mutable, 2D, axis-aligned, floating-point rectangle whose coordinates are relative to a given origin.

Public methods
Boolean
contains(offset: Offset)

Whether the point specified by the given offset (which is assumed to be relative to the origin) lies between the left and right and the top and bottom edges of this rectangle.

Unit
intersect(left: Float, top: Float, right: Float, bottom: Float)

Modifies this to be the intersection of this and the rect formed by left, top, right, and bottom.

Unit
set(left: Float, top: Float, right: Float, bottom: Float)

Sets new bounds to (left, top, right, bottom)

String

Extension functions
From androidx.compose.ui.geometry
Rect

Properties
Float

The offset of the bottom edge of this rectangle from the y axis.

Float

The distance between the top and bottom edges of this rectangle.

Boolean

Whether this rectangle encloses a non-zero area.

Float

The offset of the left edge of this rectangle from the x axis.

Float

The offset of the right edge of this rectangle from the x axis.

Size

The distance between the upper-left corner and the lower-right corner of this rectangle.

Float

The offset of the top edge of this rectangle from the y axis.

Float

The distance between the left and right edges of this rectangle.

Public constructors

<init>

MutableRect(
    left: Float,
    top: Float,
    right: Float,
    bottom: Float)

An mutable, 2D, axis-aligned, floating-point rectangle whose coordinates are relative to a given origin.

Parameters
left: Float The offset of the left edge of this rectangle from the x axis.
top: Float The offset of the top edge of this rectangle from the y axis.
right: Float The offset of the right edge of this rectangle from the x axis.
bottom: Float The offset of the bottom edge of this rectangle from the y axis.

Public methods

contains

fun contains(offset: Offset): Boolean

Whether the point specified by the given offset (which is assumed to be relative to the origin) lies between the left and right and the top and bottom edges of this rectangle.

Rectangles include their top and left edges but exclude their bottom and right edges.

intersect

@Stable fun intersect(
    left: Float,
    top: Float,
    right: Float,
    bottom: Float
): Unit

Modifies this to be the intersection of this and the rect formed by left, top, right, and bottom.

set

fun set(
    left: Float,
    top: Float,
    right: Float,
    bottom: Float
): Unit

Sets new bounds to (left, top, right, bottom)

toString

fun toString(): String

Properties

bottom

var bottom: Float

The offset of the bottom edge of this rectangle from the y axis.

height

inline val height: Float

The distance between the top and bottom edges of this rectangle.

isEmpty

val isEmpty: Boolean

Whether this rectangle encloses a non-zero area. Negative areas are considered empty.

left

var left: Float

The offset of the left edge of this rectangle from the x axis.

var right: Float

The offset of the right edge of this rectangle from the x axis.

size

val size: Size

The distance between the upper-left corner and the lower-right corner of this rectangle.

top

var top: Float

The offset of the top edge of this rectangle from the y axis.

width

inline val width: Float

The distance between the left and right edges of this rectangle.