RoundRect


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

Summary

Public companion properties

RoundRect

A rounded rectangle with all the values set to zero.

Cmn

Public constructors

RoundRect(
    left: Float,
    top: Float,
    right: Float,
    bottom: Float,
    topLeftCornerRadius: CornerRadius,
    topRightCornerRadius: CornerRadius,
    bottomRightCornerRadius: CornerRadius,
    bottomLeftCornerRadius: CornerRadius
)
Cmn

Public functions

operator Boolean
contains(point: Offset)

Whether the point specified by the given offset (which is assumed to be relative to the origin) lies inside the rounded rectangle.

Cmn
open String
Cmn

Public properties

Float

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

Cmn
CornerRadius

The bottom-left radius

Cmn
CornerRadius

The bottom-right radius

Cmn
Float

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

Cmn
Float

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

Cmn
Float

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

Cmn
Float

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

Cmn
CornerRadius

The top-left radius

Cmn
CornerRadius

The top-right radius

Cmn
Float

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

Cmn

Extension functions

RoundRect

Returns a new RoundRect translated by the given offset.

Cmn

Extension properties

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

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 true if the rounded rectangle have the same radii in both the horizontal and vertical direction for all corners.

Cmn
Float
Cmn
Float

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

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

Public companion properties

Zero

val ZeroRoundRect

A rounded rectangle with all the values set to zero.

Public constructors

RoundRect

RoundRect(
    left: Float,
    top: Float,
    right: Float,
    bottom: Float,
    topLeftCornerRadius: CornerRadius = CornerRadius.Zero,
    topRightCornerRadius: CornerRadius = CornerRadius.Zero,
    bottomRightCornerRadius: CornerRadius = CornerRadius.Zero,
    bottomLeftCornerRadius: CornerRadius = CornerRadius.Zero
)

Public functions

contains

operator fun contains(point: Offset): Boolean

Whether the point specified by the given offset (which is assumed to be relative to the origin) lies inside the rounded rectangle.

This method may allocate (and cache) a copy of the object with normalized radii the first time it is called on a particular RoundRect instance. When using this method, prefer to reuse existing RoundRects rather than recreating the object each time.

toString

open fun toString(): String

Public properties

bottom

val bottomFloat

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

bottomLeftCornerRadius

val bottomLeftCornerRadiusCornerRadius

The bottom-left radius

bottomRightCornerRadius

val bottomRightCornerRadiusCornerRadius

The bottom-right radius

height

val heightFloat

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

left

val leftFloat

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

right

val rightFloat

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

top

val topFloat

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

topLeftCornerRadius

val topLeftCornerRadiusCornerRadius

The top-left radius

topRightCornerRadius

val topRightCornerRadiusCornerRadius

The top-right radius

width

val widthFloat

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

Extension functions

fun RoundRect.translate(offset: Offset): RoundRect

Returns a new RoundRect translated by the given offset.

Extension properties

boundingRect

val RoundRect.boundingRectRect

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

center

val RoundRect.centerOffset

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

isCircle

val RoundRect.isCircleBoolean

Whether this rounded rectangle would draw as a circle.

isEllipse

val RoundRect.isEllipseBoolean

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

isEmpty

val RoundRect.isEmptyBoolean

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

isFinite

val RoundRect.isFiniteBoolean

Whether all coordinates of this rounded rectangle are finite.

isRect

val RoundRect.isRectBoolean

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

isSimple

val RoundRect.isSimpleBoolean

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

maxDimension

val RoundRect.maxDimensionFloat

minDimension

val RoundRect.minDimensionFloat

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

safeInnerRect

val RoundRect.safeInnerRectRect

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.