Google is committed to advancing racial equity for Black communities. See how.

Radius

@Immutable inline class Radius
kotlin.Any
   ↳ androidx.compose.ui.geometry.Radius

A radius for either circular or elliptical shapes.

Summary

Public constructors
<init>(packedValue: Long)

A radius for either circular or elliptical shapes.

Public methods
Radius
copy(x: Float = this.x, y: Float = this.y)

Returns a copy of this Radius instance optionally overriding the radius parameter for the x or y axis

operator Radius
div(operand: Float)

Division operator.

operator Radius
minus(other: Radius)

Binary subtraction operator.

operator Radius
plus(other: Radius)

Binary addition operator.

operator Radius
rem(operand: Float)

Modulo (remainder) operator.

operator Radius
times(operand: Float)

Multiplication operator.

String

Radius
truncDiv(operand: Float)

Integer (truncating) division operator.

operator Radius

Unary negation operator.

Properties
Float

The radius value on the horizontal axis.

Float

The radius value on the vertical axis.

Companion properties
Radius

A radius with x and y values set to zero.

Public constructors

<init>

Radius(packedValue: Long)

A radius for either circular or elliptical shapes.

Public methods

copy

fun copy(
    x: Float = this.x,
    y: Float = this.y
): Radius

Returns a copy of this Radius instance optionally overriding the radius parameter for the x or y axis

div

@Stable operator fun div(operand: Float): Radius

Division operator.

Returns a radius whose coordinates are the coordinates of the left-hand-side operand (a radius) divided by the scalar right-hand-side operand (a Float).

minus

@Stable operator fun minus(other: Radius): Radius

Binary subtraction operator.

Returns a radius whose x value is the left-hand-side operand's x minus the right-hand-side operand's x and whose y value is the left-hand-side operand's y minus the right-hand-side operand's y.

plus

@Stable operator fun plus(other: Radius): Radius

Binary addition operator.

Returns a radius whose x value is the sum of the x values of the two operands, and whose y value is the sum of the y values of the two operands.

rem

@Stable operator fun rem(operand: Float): Radius

Modulo (remainder) operator.

Returns a radius whose coordinates are the remainder of dividing the coordinates of the left-hand-side operand (a radius) by the scalar right-hand-side operand (a Float).

times

@Stable operator fun times(operand: Float): Radius

Multiplication operator.

Returns a radius whose coordinates are the coordinates of the left-hand-side operand (a radius) multiplied by the scalar right-hand-side operand (a Float).

toString

fun toString(): String

truncDiv

fun truncDiv(operand: Float): Radius

Integer (truncating) division operator.

Returns a radius whose coordinates are the coordinates of the left-hand-side operand (a radius) divided by the scalar right-hand-side operand (a Float), rounded towards zero.

unaryMinus

@Stable operator fun unaryMinus(): Radius

Unary negation operator.

Returns a Radius with the distances negated.

Radiuses with negative values aren't geometrically meaningful, but could occur as part of expressions. For example, negating a radius of one pixel and then adding the result to another radius is equivalent to subtracting a radius of one pixel from the other.

Properties

x

@Stable val x: Float

The radius value on the horizontal axis.

y

@Stable val y: Float

The radius value on the vertical axis.

Companion properties

Zero

@Stable val Zero: Radius

A radius with x and y values set to zero.

You can use Radius.Zero with RoundRect to have right-angle corners.