{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}

CornerRadius

value public final class CornerRadius


A radius for either circular or elliptical (oval) shapes.

Note consumers should create an instance of this class through the corresponding function constructor as it is represented as an inline class with 2 float parameters packed into a single long to reduce allocation overhead

Summary

Nested types

public static class CornerRadius.Companion

Public methods

final float
final float
final @NonNull CornerRadius
copy(float x, float y)

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

final @NonNull CornerRadius
div(float operand)

Division operator.

final float

The radius value on the horizontal axis.

final float

The radius value on the vertical axis.

final @NonNull CornerRadius

Binary subtraction operator.

final @NonNull CornerRadius

Binary addition operator.

final @NonNull CornerRadius
times(float operand)

Multiplication operator.

@NonNull String
final @NonNull CornerRadius

Unary negation operator.

Public methods

component1

public final float component1()

component2

public final float component2()

copy

public final @NonNull CornerRadius copy(float x, float y)

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

div

public final @NonNull CornerRadius div(float operand)

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

getX

public final float getX()

The radius value on the horizontal axis.

getY

public final float getY()

The radius value on the vertical axis.

minus

public final @NonNull CornerRadius minus(@NonNull CornerRadius other)

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

public final @NonNull CornerRadius plus(@NonNull CornerRadius other)

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.

times

public final @NonNull CornerRadius times(float operand)

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

public @NonNull String toString()

unaryMinus

public final @NonNull CornerRadius unaryMinus()

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.