Class

CornerRounding

Defines the radius and smoothness of rounding at a polygon vertex.

Source set: Common
public class CornerRounding internal constructor(
    internal val value: Float,
    internal val unit: Int,
    internal val smoothing: Float,
)

Defines the radius and smoothness of rounding at a polygon vertex.

  • Unrounded (radius = 0) keeps a sharp corner.
  • smoothing = 0f rounds the corner with a circular arc.
  • the adjacent edges (1f maximizes the flanking curves).

  • smoothing > 0f extends symmetric cubic Bézier flanking curves from the circular arc toward

Create instances with CornerRounding.dp, CornerRounding.fraction, or Unrounded.

Functions

equals

Source set: Common
override fun equals(other: Any?): Boolean

hashCode

Source set: Common
override fun hashCode(): Int

toString

Source set: Common
override fun toString(): String

Members

Companion

Source set: Common
public companion object

Properties

Unrounded

Source set: Common
public val Unrounded: CornerRounding = CornerRounding(0f, UnitDp, 0f)

Sharp corner with a rounding radius of zero.

Functions

dp

Source set: Common
public fun dp(
            radius: Dp,
            @FloatRange(from = 0.0, to = 1.0) smoothing: Float = 0f,
        ): CornerRounding

Creates a CornerRounding with a radius in Dp.

Parameters

radius corner rounding radius, at least 0.dp
smoothing transition smoothness from the circular arc to adjacent edges, in 0f..1f

Throws: IllegalArgumentException

if radius is negative/unspecified or smoothing is outside 0f..1f

fraction

Source set: Common
public fun fraction(
            @FloatRange(from = 0.0, to = 1.0) fraction: Float,
            @FloatRange(from = 0.0, to = 1.0) smoothing: Float = 0f,
        ): CornerRounding

Creates a CornerRounding with a radius as a fraction of the polygon's size.

For polygons defined with a radius (such as PolygonShape.regularPolygon, PolygonShape.star, and PolygonShapeScope.polygon with radius), the corner radius is `fraction * radius. For polygons defined with custom vertices ([PolygonShapeGeometry](/jetpack-compose/androidx.compose.foundation/foundation/classes/PolygonShapeGeometry/api)), which do not have a radius, the corner radius is a fraction of the polygon's smaller dimension (min(width, height)`).

Parameters

fraction rounding radius as a fraction of the polygon's size, in 0f..1f
smoothing transition smoothness from the circular arc to adjacent edges, in 0f..1f

Throws: IllegalArgumentException

if fraction or smoothing is outside 0f..1f

Jetpack Compose beyond MaterialFree components, screens and templates for apps that don’t look like Google’s. Copy them into your app, or let your coding agent add them.Browse for free

Content updated: