---
title: "CornerRadius"
description: "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"
type: "class"
---

<div class='type'>Class</div>


<a id='references'></a>

<div class='sourceset sourceset-common'>Common</div>


```kotlin
value class CornerRadius(val packedValue: Long)
```


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


## Properties

<div class='sourceset sourceset-common'>Common</div>


```kotlin
inline val x: Float
```


The radius value on the horizontal axis.



<div class='sourceset sourceset-common'>Common</div>


```kotlin
inline val y: Float
```


The radius value on the vertical axis.



## Functions

```kotlin
inline operator fun component1(): Float
```

```kotlin
inline operator fun component2(): Float
```

```kotlin
fun copy(x: Float = unpackFloat1(packedValue), y: Float = unpackFloat2(packedValue)) =
        CornerRadius(packFloats(x, y))
```


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


```kotlin
inline fun isZero(): Boolean
```


Whether this corner radius is 0 in x, y, or both.


```kotlin
inline fun isCircular(): Boolean
```


Whether this corner radius describes a quarter circle (x == y).


```kotlin
inline operator fun unaryMinus() = CornerRadius(packedValue xor DualFloatSignBit)
```


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.


```kotlin
operator fun minus(other: CornerRadius): CornerRadius
```


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


```kotlin
operator fun plus(other: CornerRadius): CornerRadius
```


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.


```kotlin
operator fun times(operand: Float) =
        CornerRadius(
            packFloats(unpackFloat1(packedValue) * operand, unpackFloat2(packedValue) * 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).


```kotlin
operator fun div(operand: Float) =
        CornerRadius(
            packFloats(unpackFloat1(packedValue) / operand, unpackFloat2(packedValue) / 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).


## Companion Object

#### Properties

<div class='sourceset sourceset-common'>Common</div>


```kotlin
val Zero: CornerRadius
```


A radius with `x` and `y` values set to zero.

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





