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 = 0frounds the corner with a circular arc.smoothing > 0fextends symmetric cubic Bézier flanking curves from the circular arc toward
the adjacent edges (1f maximizes the flanking curves).
Create instances with CornerRounding.dp, CornerRounding.fraction, or Unrounded.
Functions
equals
override fun equals(other: Any?): Boolean
hashCode
override fun hashCode(): Int
toString
override fun toString(): String
Members
Companion
public companion object
Properties
Unrounded
public val Unrounded: CornerRounding = CornerRounding(0f, UnitDp, 0f)
Sharp corner with a rounding radius of zero.
Functions
dp
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
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 |