androidx.compose.ui.geometry
Classes
CornerRadius |
A radius for either circular or elliptical (oval) shapes. |
Cmn
|
MutableRect |
An mutable, 2D, axis-aligned, floating-point rectangle whose coordinates are relative to a given origin. |
Cmn
|
Offset |
An immutable 2D floating-point offset. |
Cmn
|
Rect |
An immutable, 2D, axis-aligned, floating-point rectangle whose coordinates are relative to a given origin. |
Cmn
|
RoundRect |
An immutable rounded rectangle with custom radii for all four corners. |
Cmn
|
Size |
Holds a 2D floating-point size. |
Cmn
|
Objects
Offset.Companion |
Cmn
|
|
Rect.Companion |
Cmn
|
|
Size.Companion |
Cmn
|
Top-level functions summary
inline CornerRadius |
CornerRadius(x: Float, y: Float)Constructs a Radius with the given |
Cmn
|
MutableRect |
MutableRect(center: Offset, radius: Float)Construct a rectangle that bounds the given circle |
Cmn
|
MutableRect |
MutableRect(offset: Offset, size: Size)Construct a rectangle from its left and top edges as well as its width and height. |
Cmn
|
MutableRect |
MutableRect(topLeft: Offset, bottomRight: Offset)Construct the smallest rectangle that encloses the given offsets, treating them as vectors from the origin. |
Cmn
|
inline Offset |
Constructs an Offset from the given relative |
Cmn
|
Rect |
Construct a rectangle that bounds the given circle |
Cmn
|
Rect |
Construct a rectangle from its left and top edges as well as its width and height. |
Cmn
|
Rect |
Construct the smallest rectangle that encloses the given offsets, treating them as vectors from the origin. |
Cmn
|
RoundRect |
RoundRect(rect: Rect, cornerRadius: CornerRadius)Construct a rounded rectangle from its bounding box and a radius that is the same in each corner. |
Cmn
|
RoundRect |
Construct a rounded rectangle from its bounding box and the same radii along its horizontal axis and its vertical axis. |
Cmn
|
RoundRect |
Construct a rounded rectangle from its left, top, right, and bottom edges, and the same radius in each corner. |
Cmn
|
RoundRect |
RoundRect(Construct a rounded rectangle from its bounding box and topLeft, topRight, bottomRight, and bottomLeft radii. |
Cmn
|
RoundRect |
Construct a rounded rectangle from its left, top, right, and bottom edges, and the same radii along its horizontal axis and its vertical axis. |
Cmn
|
inline Size |
Constructs a |
Cmn
|
CornerRadius |
lerp(start: CornerRadius, stop: CornerRadius, fraction: Float)Linearly interpolate between two radii. |
Cmn
|
Offset |
Linearly interpolate between two offsets. |
Cmn
|
Rect |
Linearly interpolate between two rectangles. |
Cmn
|
RoundRect |
Linearly interpolate between two rounded rectangles. |
Cmn
|
Size |
Linearly interpolate between two sizes |
Cmn
|
Extension functions summary
inline Offset |
Offset.takeOrElse(block: () -> Offset)If this |
Cmn
|
inline Size |
Size.takeOrElse(block: () -> Size)If this |
Cmn
|
inline operator Size |
Returns a |
Cmn
|
inline operator Size |
Returns a |
Cmn
|
inline operator Size |
Returns a |
Cmn
|
Rect |
Cmn
|
|
Rect |
Cmn
|
|
RoundRect |
Returns a new |
Cmn
|
Extension properties summary
Rect |
The bounding box of this rounded rectangle (the rectangle with no rounded corners). |
Cmn
|
Offset |
The offset to the point halfway between the left and right and the top and bottom edges of this rectangle. |
Cmn
|
Offset |
Returns the |
Cmn
|
Boolean |
Whether this rounded rectangle would draw as a circle. |
Cmn
|
Boolean |
Whether this rounded rectangle has no side with a straight section. |
Cmn
|
Boolean |
Whether this rounded rectangle encloses a non-zero area. |
Cmn
|
Boolean |
True if both x and y values of the |
Cmn
|
Boolean |
Whether all coordinates of this rounded rectangle are finite. |
Cmn
|
Boolean |
Whether this rounded rectangle is a simple rectangle with zero corner radii. |
Cmn
|
Boolean |
Returns |
Cmn
|
Boolean |
|
Cmn
|
Boolean |
|
Cmn
|
Boolean |
|
Cmn
|
Boolean |
|
Cmn
|
Float |
Cmn
|
|
Float |
The lesser of the magnitudes of the |
Cmn
|
Rect |
The non-rounded rectangle that is constrained by the smaller of the two diagonals, with each diagonal traveling through the middle of the curve corners. |
Cmn
|
Top-level functions
CornerRadius
inline fun CornerRadius(x: Float, y: Float = x): CornerRadius
Constructs a Radius with the given x and y parameters for the size of the radius along the x and y axis respectively. By default the radius along the Y axis matches that of the given x-axis unless otherwise specified. Negative radii values are clamped to 0.
MutableRect
fun MutableRect(center: Offset, radius: Float): MutableRect
Construct a rectangle that bounds the given circle
MutableRect
fun MutableRect(offset: Offset, size: Size): MutableRect
Construct a rectangle from its left and top edges as well as its width and height.
| Parameters | |
|---|---|
offset: Offset |
Offset to represent the top and left parameters of the Rect |
size: Size |
Size to determine the width and height of this |
| Returns | |
|---|---|
MutableRect |
Rect with |
MutableRect
fun MutableRect(topLeft: Offset, bottomRight: Offset): MutableRect
Construct the smallest rectangle that encloses the given offsets, treating them as vectors from the origin.
Offset
inline fun Offset(x: Float, y: Float): Offset
Constructs an Offset from the given relative x and y offsets
Rect
fun Rect(center: Offset, radius: Float): Rect
Construct a rectangle that bounds the given circle
Rect
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 |
Offset to represent the top and left parameters of the Rect |
size: Size |
Size to determine the width and height of this |
| Returns | |
|---|---|
Rect |
Rect with |
Rect
fun Rect(topLeft: Offset, bottomRight: Offset): Rect
Construct the smallest rectangle that encloses the given offsets, treating them as vectors from the origin.
RoundRect
fun RoundRect(rect: Rect, cornerRadius: CornerRadius): RoundRect
Construct a rounded rectangle from its bounding box and a radius that is the same in each corner.
RoundRect
fun RoundRect(rect: Rect, radiusX: Float, radiusY: Float): RoundRect
Construct a rounded rectangle from its bounding box and the same radii along its horizontal axis and its vertical axis.
RoundRect
fun RoundRect(
left: Float,
top: Float,
right: Float,
bottom: Float,
cornerRadius: CornerRadius
): RoundRect
Construct a rounded rectangle from its left, top, right, and bottom edges, and the same radius in each corner.
RoundRect
fun RoundRect(
rect: Rect,
topLeft: CornerRadius = CornerRadius.Zero,
topRight: CornerRadius = CornerRadius.Zero,
bottomRight: CornerRadius = CornerRadius.Zero,
bottomLeft: CornerRadius = CornerRadius.Zero
): RoundRect
Construct a rounded rectangle from its bounding box and topLeft, topRight, bottomRight, and bottomLeft radii.
The corner radii default to CornerRadius.Zero, i.e. right-angled corners
RoundRect
fun RoundRect(
left: Float,
top: Float,
right: Float,
bottom: Float,
radiusX: Float,
radiusY: Float
): RoundRect
Construct a rounded rectangle from its left, top, right, and bottom edges, and the same radii along its horizontal axis and its vertical axis.
Size
inline fun Size(width: Float, height: Float): Size
Constructs a Size from the given width and height
lerp
fun lerp(start: CornerRadius, stop: CornerRadius, fraction: Float): CornerRadius
Linearly interpolate between two radii.
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 AnimationAnimationController.
lerp
fun lerp(start: Offset, stop: Offset, fraction: Float): Offset
Linearly interpolate between two offsets.
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 AnimationAnimationController.
lerp
fun lerp(start: Rect, stop: Rect, fraction: Float): Rect
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 AnimationAnimationController.
lerp
fun lerp(start: RoundRect, stop: RoundRect, fraction: Float): RoundRect
Linearly interpolate between two rounded 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 AnimationAnimationController.
lerp
fun lerp(start: Size, stop: Size, fraction: Float): Size
Linearly interpolate between two sizes
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 AnimationAnimationController.
Extension functions
takeOrElse
inline fun Offset.takeOrElse(block: () -> Offset): Offset
If this Offset isSpecified then this is returned, otherwise block is executed and its result is returned.
takeOrElse
inline fun Size.takeOrElse(block: () -> Size): Size
If this Size isSpecified then this is returned, otherwise block is executed and its result is returned.
times
inline operator fun Int.times(size: Size): Size
Returns a Size with size's Size.width and Size.height multiplied by this
times
inline operator fun Double.times(size: Size): Size
Returns a Size with size's Size.width and Size.height multiplied by this
times
inline operator fun Float.times(size: Size): Size
Returns a Size with size's Size.width and Size.height multiplied by this
translate
fun RoundRect.translate(offset: Offset): RoundRect
Returns a new RoundRect translated by the given offset.
Extension properties
boundingRect
val RoundRect.boundingRect: Rect
The bounding box of this rounded rectangle (the rectangle with no rounded corners).
center
val RoundRect.center: Offset
The offset to the point halfway between the left and right and the top and bottom edges of this rectangle.
center
val Size.center: Offset
Returns the Offset of the center of the rect from the point of 0, 0 with this Size.
isEllipse
val RoundRect.isEllipse: Boolean
Whether this rounded rectangle has no side with a straight section.
isEmpty
val RoundRect.isEmpty: Boolean
Whether this rounded rectangle encloses a non-zero area. Negative areas are considered empty.
isFinite
val Offset.isFinite: Boolean
True if both x and y values of the Offset are finite. NaN values are not considered finite.
isFinite
val RoundRect.isFinite: Boolean
Whether all coordinates of this rounded rectangle are finite.
isRect
val RoundRect.isRect: Boolean
Whether this rounded rectangle is a simple rectangle with zero corner radii.
isSimple
val RoundRect.isSimple: Boolean
Returns true if the rounded rectangle have the same radii in both the horizontal and vertical direction for all corners.
minDimension
val RoundRect.minDimension: Float
The lesser of the magnitudes of the RoundRect.width and the RoundRect.height of this rounded rectangle.
safeInnerRect
val RoundRect.safeInnerRect: Rect
The non-rounded rectangle that is constrained by the smaller of the two diagonals, with each diagonal traveling through the middle of the curve corners. The middle of a corner is the intersection of the curve with its respective quadrant bisector.