# androidx.ui.engine.geometry

## Classes

 Offset An immutable 2D floating-point offset. Outline Defines a simple shape, used for bounding graphical regions. 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

 RRect `RRect(left: Float, top: Float, right: Float, bottom: Float, radiusX: Float, radiusY: Float)` 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 `RRect(left: Float, top: Float, right: Float, bottom: Float, radius: Radius)` Construct a rounded rectangle from its left, top, right, and bottom edges, and the same radius in each corner. RRect `RRect(rect: Rect, radiusX: Float, radiusY: Float)` Construct a rounded rectangle from its bounding box and the same radii along its horizontal axis and its vertical axis. RRect `RRect(rect: Rect, radius: Radius)` 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. RRect `lerp(start: RRect, stop: RRect, fraction: Float)` Linearly interpolate between two rounded rectangles. Radius `lerp(start: Radius, stop: Radius, fraction: Float)` Linearly interpolate between two radii. Rect `lerp(start: Rect, stop: Rect, fraction: Float)` Linearly interpolate between two rectangles.

## Extension functions summary

 For Path Unit `Path.addOutline(outline: Outline)` Adds the outline to the Path.
 For RRect Radius `RRect.bottomLeftRadius()` The bottom-left Radius. Radius `RRect.bottomRightRadius()` The bottom-right Radius. Offset `RRect.center()` The offset to the point halfway between the left and right and the top and bottom edges of this rectangle. RRect `RRect.grow(delta: Float)` Returns a new RRect with edges and radii moved outwards by the given delta. Rect `RRect.middleRect()` The rectangle that would be formed using the axis-aligned intersection of the sides of the rectangle, i. Rect `RRect.outerRect()` The bounding box of this rounded rectangle (the rectangle with no rounded corners). Rect `RRect.safeInnerRect()` 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 `RRect.shift(offset: Offset)` Returns a new RRect translated by the given offset. RRect `RRect.shrink(delta: Float)` Returns a new RRect with edges and radii moved inwards by the given delta. Rect `RRect.tallMiddleRect()` The biggest rectangle that is entirely inside the rounded rectangle and has the full height of the rounded rectangle. Radius `RRect.topLeftRadius()` The top-left Radius. Radius `RRect.topRightRadius()` The top-right Radius. Rect `RRect.wideMiddleRect()` 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 Canvas Unit `Canvas.drawOutline(outline: Outline, paint: Paint)` Draws the Outline on a Canvas.
 For Offset PxPosition `Offset.toPxPosition()`

## Extension properties summary

 For RRect Boolean `RRect.isCircle()` Whether this rounded rectangle would draw as a circle. Boolean `RRect.isEllipse()` Whether this rounded rectangle has no side with a straight section. Boolean `RRect.isEmpty()` Whether this rounded rectangle encloses a non-zero area. Boolean `RRect.isFinite()` Whether all coordinates of this rounded rectangle are finite. Boolean `RRect.isRect()` Whether this rounded rectangle is a simple rectangle with zero corner radii. Boolean `RRect.isStadium()` Whether this rounded rectangle has a side with no straight section. Float `RRect.longestSide()` The greater of the magnitudes of the RRect.width and the RRect.height of this rounded rectangle. Float `RRect.shortestSide()` The lesser of the magnitudes of the RRect.width and the RRect.height of this rounded rectangle.

## Top-level functions

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

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

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

`fun lerp(    start: Radius,     stop: Radius,     fraction: Float): Radius`

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

## Extension functions

`fun Path.addOutline(outline: Outline): Unit`

Adds the outline to the Path.

`fun RRect.bottomLeftRadius(): Radius`

`fun RRect.bottomRightRadius(): Radius`

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

### drawOutline

`fun Canvas.drawOutline(    outline: Outline,     paint: Paint): Unit`

Draws the Outline on a Canvas.

Parameters
outline: Outline the outline to draw.
paint: Paint the paint used for the drawing.

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

### shift

`fun RRect.shift(offset: Offset): RRect`

Returns a new RRect translated by the given offset.

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

### toPxPosition

`fun Offset.toPxPosition(): PxPosition`

`fun RRect.topLeftRadius(): Radius`

`fun RRect.topRightRadius(): Radius`

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

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

## Extension properties

### isCircle

`val RRect.isCircle: Boolean`

Whether this rounded rectangle would draw as a circle.

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

### isFinite

`val RRect.isFinite: Boolean`

Whether all coordinates of this rounded rectangle are finite.

### isRect

`val RRect.isRect: Boolean`

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

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