# androidx.ui.geometry

## Interfaces

OffsetBase |
Base class for Size and Offset, which are both ways to describe a distance as a two-dimensional axis-aligned vector. |

## Classes

Offset |
An immutable 2D floating-point offset. |

Radius |
A radius for either circular or elliptical shapes. |

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

RRect |
An immutable rounded rectangle with custom radii for all four corners. |

Size |
Holds a 2D floating-point size. |

## Top-level functions summary

Offset |
Constructs an Offset from the given relative x and y offsets |

RRect |
Construct a rounded rectangle from its left, top, right, and bottom edges, and the same radii along its horizontal axis and its vertical axis. |

RRect |
Construct a rounded rectangle from its left, top, right, and bottom edges, and the same radius in each corner. |

RRect |
Construct a rounded rectangle from its bounding box and the same radii along its horizontal axis and its vertical axis. |

RRect |
Construct a rounded rectangle from its bounding box and a radius that is the same in each corner. |

RRect |
`RRect(left: Float, top: Float, right: Float, bottom: Float, topLeft: Radius = Radius.Zero, topRight: Radius = Radius.Zero, bottomRight: Radius = Radius.Zero, bottomLeft: Radius = Radius.Zero)` Construct a rounded rectangle from its left, top, right, and bottom edges, and topLeft, topRight, bottomRight, and bottomLeft radii. |

RRect |
`RRect(rect: Rect, topLeft: Radius = Radius.Zero, topRight: Radius = Radius.Zero, bottomRight: Radius = Radius.Zero, bottomLeft: Radius = Radius.Zero)` Construct a rounded rectangle from its bounding box and and topLeft, topRight, bottomRight, and bottomLeft radii. |

Radius |
Constructs a Radius with the given x and y parameters for the size of the radius along the x and y axis respectively. |

Size |
Constructs a Size from the given width and height |

Offset |
Linearly interpolate between two offsets. |

RRect |
Linearly interpolate between two rounded rectangles. |

Radius |
Linearly interpolate between two radii. |

Rect |
Linearly interpolate between two rectangles. |

Size? |
Linearly interpolate between two sizes |

## Extension functions summary

For kotlin.Double | |

operator Size |
Returns a Size with size's Size.width and Size.height multiplied by this |

For kotlin.Float | |

operator Size |
Returns a Size with size's Size.width and Size.height multiplied by this |

For kotlin.Int | |

operator Size |
Returns a Size with size's Size.width and Size.height multiplied by this |

For RRect | |

Radius |
The bottom-left Radius. |

Radius |
The bottom-right Radius. |

Offset |
The offset to the point halfway between the left and right and the top and bottom edges of this rectangle. |

RRect |
Returns a new RRect with edges and radii moved outwards by the given delta. |

Rect |
The rectangle that would be formed using the axis-aligned intersection of the sides of the rectangle, i. |

Rect |
The bounding box of this rounded rectangle (the rectangle with no rounded corners). |

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. |

RRect |
Returns a new RRect translated by the given offset. |

RRect |
Returns a new RRect with edges and radii moved inwards by the given delta. |

Rect |
The biggest rectangle that is entirely inside the rounded rectangle and has the full height of the rounded rectangle. |

Radius |
The top-left Radius. |

Radius |
The top-right Radius. |

Rect |
The biggest rectangle that is entirely inside the rounded rectangle and has the full width of the rounded rectangle. |

RRect |
`RRect.withRadius(radius: Radius)` |

For Size | |

Rect |

## Extension properties summary

For RRect | |

Boolean |
Whether this rounded rectangle would draw as a circle. |

Boolean |
Whether this rounded rectangle has no side with a straight section. |

Boolean |
Whether this rounded rectangle encloses a non-zero area. |

Boolean |
Whether all coordinates of this rounded rectangle are finite. |

Boolean |
Whether this rounded rectangle is a simple rectangle with zero corner radii. |

Boolean |
Returns |

Boolean |
Whether this rounded rectangle has a side with no straight section. |

Float |
The greater of the magnitudes of the RRect.width and the RRect.height of this rounded rectangle. |

Float |
The lesser of the magnitudes of the RRect.width and the RRect.height of this rounded rectangle. |

## Top-level functions

### Offset

@Stable inline fun Offset(

x: Float,

y: Float

): Offset

Constructs an Offset from the given relative x and y offsets

### RRect

fun RRect(

left: Float,

top: Float,

right: Float,

bottom: Float,

radiusX: Float,

radiusY: Float

): RRect

Construct a rounded rectangle from its left, top, right, and bottom edges, and the same radii along its horizontal axis and its vertical axis.

### RRect

fun RRect(

left: Float,

top: Float,

right: Float,

bottom: Float,

radius: Radius

): RRect

Construct a rounded rectangle from its left, top, right, and bottom edges, and the same radius in each corner.

### RRect

fun RRect(

rect: Rect,

radiusX: Float,

radiusY: Float

): RRect

Construct a rounded rectangle from its bounding box and the same radii along its horizontal axis and its vertical axis.

### RRect

fun RRect(

rect: Rect,

radius: Radius

): RRect

Construct a rounded rectangle from its bounding box and a radius that is the same in each corner.

### RRect

fun RRect(

left: Float,

top: Float,

right: Float,

bottom: Float,

topLeft: Radius = Radius.Zero,

topRight: Radius = Radius.Zero,

bottomRight: Radius = Radius.Zero,

bottomLeft: Radius = Radius.Zero

): RRect

Construct a rounded rectangle from its left, top, right, and bottom edges, and topLeft, topRight, bottomRight, and bottomLeft radii.

The corner radii default to Radius.Zero, i.e. right-angled corners.

### RRect

fun RRect(

rect: Rect,

topLeft: Radius = Radius.Zero,

topRight: Radius = Radius.Zero,

bottomRight: Radius = Radius.Zero,

bottomLeft: Radius = Radius.Zero

): RRect

Construct a rounded rectangle from its bounding box and and topLeft, topRight, bottomRight, and bottomLeft radii.

The corner radii default to Radius.Zero, i.e. right-angled corners

### Radius

@Stable inline fun Radius(

x: Float,

y: Float = x

): Radius

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

### Size

@Stable fun Size(

width: Float,

height: Float

): Size

Constructs a Size from the given width and height

### lerp

@Stable 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 Animation, such as
an `AnimationController`

.

### lerp

fun lerp(

start: RRect,

stop: RRect,

fraction: Float

): RRect

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 Animation, such as
an `AnimationController`

.

### lerp

@Stable fun lerp(

start: Radius,

stop: Radius,

fraction: Float

): Radius

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 Animation, such as
an `AnimationController`

.

### lerp

@Stable fun lerp(

start: Rect,

stop: Rect,

fraction: Float

): Rect

Linearly interpolate between two rectangles.

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

.

### lerp

@Stable fun lerp(

start: Size,

stop: Size,

fraction: Float

): Size?

Linearly interpolate between two sizes

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

.

## Extension functions

### center

fun RRect.center(): Offset

The offset to the point halfway between the left and right and the top and bottom edges of this rectangle.

### grow

fun RRect.grow(delta: Float): RRect

Returns a new RRect with edges and radii moved outwards by the given delta.

### middleRect

fun RRect.middleRect(): Rect

The rectangle that would be formed using the axis-aligned intersection of the sides of the rectangle, i.e., the rectangle formed from the inner-most centers of the ellipses that form the corners. This is the intersection of the wideMiddleRect and the tallMiddleRect. If any of the intersections are void, the resulting Rect will have negative width or height.

### outerRect

fun RRect.outerRect(): Rect

The bounding box of this rounded rectangle (the rectangle with no rounded corners).

### safeInnerRect

fun RRect.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.

### shrink

fun RRect.shrink(delta: Float): RRect

Returns a new RRect with edges and radii moved inwards by the given delta.

### tallMiddleRect

fun RRect.tallMiddleRect(): Rect

The biggest rectangle that is entirely inside the rounded rectangle and has the full height of the rounded rectangle. If the rounded rectangle does not have an axis-aligned intersection of its top and bottom side, the resulting Rect will have negative width or height.

### times

@Stable inline operator fun Double.times(size: Size): Size

Returns a Size with size's Size.width and Size.height multiplied by this

### times

@Stable inline operator fun Float.times(size: Size): Size

Returns a Size with size's Size.width and Size.height multiplied by this

### times

@Stable inline operator fun Int.times(size: Size): Size

Returns a Size with size's Size.width and Size.height multiplied by this

### wideMiddleRect

fun RRect.wideMiddleRect(): Rect

The biggest rectangle that is entirely inside the rounded rectangle and has the full width of the rounded rectangle. If the rounded rectangle does not have an axis-aligned intersection of its left and right side, the resulting Rect will have negative width or height.

## Extension properties

### isEllipse

val RRect.isEllipse: Boolean

Whether this rounded rectangle has no side with a straight section.

### isEmpty

val RRect.isEmpty: Boolean

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

### isRect

val RRect.isRect: Boolean

Whether this rounded rectangle is a simple rectangle with zero corner radii.

### isSimple

val RRect.isSimple: Boolean

Returns `true`

if the rounded rectangle have the same radii in both the horizontal and vertical
direction for all corners.

### isStadium

val RRect.isStadium: Boolean

Whether this rounded rectangle has a side with no straight section.

### longestSide

val RRect.longestSide: Float

The greater of the magnitudes of the RRect.width and the RRect.height of this rounded rectangle.

### shortestSide

val RRect.shortestSide: Float

The lesser of the magnitudes of the RRect.width and the RRect.height of this rounded rectangle.