# ShapesKt

Added in 1.0.0

*** ** * ** ***


```
public final class ShapesKt
```

<br />

*** ** * ** ***

## Summary

| ### Public methods |
|---|---|
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/graphics/shapes/RoundedPolygon` | `https://developer.android.com/reference/androidx/graphics/shapes/ShapesKt#(androidx.graphics.shapes.RoundedPolygon.Companion).circle(kotlin.Int,kotlin.Float,kotlin.Float,kotlin.Float)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/graphics/shapes/RoundedPolygon.Companion receiver, @https://developer.android.com/reference/androidx/annotation/IntRange(from = 3) int numVertices, float radius, float centerX, float centerY )` Creates a circular shape, approximating the rounding of the shape around the underlying polygon vertices. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/graphics/shapes/RoundedPolygon` | `https://developer.android.com/reference/androidx/graphics/shapes/ShapesKt#(androidx.graphics.shapes.RoundedPolygon.Companion).pill(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/graphics/shapes/RoundedPolygon.Companion receiver, float width, float height, float smoothing, float centerX, float centerY )` A pill shape consists of a rectangle shape bounded by two semicircles at either of the long ends of the rectangle. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/graphics/shapes/RoundedPolygon` | `https://developer.android.com/reference/androidx/graphics/shapes/ShapesKt#(androidx.graphics.shapes.RoundedPolygon.Companion).pillStar(kotlin.Float,kotlin.Float,kotlin.Int,kotlin.Float,androidx.graphics.shapes.CornerRounding,androidx.graphics.shapes.CornerRounding,kotlin.collections.List,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/graphics/shapes/RoundedPolygon.Companion receiver, float width, float height, int numVerticesPerRadius, @https://developer.android.com/reference/androidx/annotation/FloatRange(from = 0.0, fromInclusive = false, to = 1.0, toInclusive = false) float innerRadiusRatio, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/graphics/shapes/CornerRounding rounding, https://developer.android.com/reference/androidx/graphics/shapes/CornerRounding innerRounding, https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/graphics/shapes/CornerRounding> perVertexRounding, @https://developer.android.com/reference/androidx/annotation/FloatRange(from = 0.0, to = 1.0) float vertexSpacing, @https://developer.android.com/reference/androidx/annotation/FloatRange(from = 0.0, to = 1.0) float startLocation, float centerX, float centerY )` A pillStar shape is like a `https://developer.android.com/reference/androidx/graphics/shapes/package-summary#(androidx.graphics.shapes.RoundedPolygon.Companion).pill(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float)` except it has inner and outer radii along its pill-shaped outline, just like a `https://developer.android.com/reference/androidx/graphics/shapes/package-summary#(androidx.graphics.shapes.RoundedPolygon.Companion).star(kotlin.Int,kotlin.Float,kotlin.Float,androidx.graphics.shapes.CornerRounding,androidx.graphics.shapes.CornerRounding,kotlin.collections.List,kotlin.Float,kotlin.Float)` has inner and outer radii along its circular outline. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/graphics/shapes/RoundedPolygon` | `https://developer.android.com/reference/androidx/graphics/shapes/ShapesKt#(androidx.graphics.shapes.RoundedPolygon.Companion).rectangle(kotlin.Float,kotlin.Float,androidx.graphics.shapes.CornerRounding,kotlin.collections.List,kotlin.Float,kotlin.Float)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/graphics/shapes/RoundedPolygon.Companion receiver, float width, float height, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/graphics/shapes/CornerRounding rounding, https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/graphics/shapes/CornerRounding> perVertexRounding, float centerX, float centerY )` Creates a rectangular shape with the given width/height around the given center. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/graphics/shapes/RoundedPolygon` | `https://developer.android.com/reference/androidx/graphics/shapes/ShapesKt#(androidx.graphics.shapes.RoundedPolygon.Companion).star(kotlin.Int,kotlin.Float,kotlin.Float,androidx.graphics.shapes.CornerRounding,androidx.graphics.shapes.CornerRounding,kotlin.collections.List,kotlin.Float,kotlin.Float)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/graphics/shapes/RoundedPolygon.Companion receiver, int numVerticesPerRadius, float radius, float innerRadius, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/graphics/shapes/CornerRounding rounding, https://developer.android.com/reference/androidx/graphics/shapes/CornerRounding innerRounding, https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/graphics/shapes/CornerRounding> perVertexRounding, float centerX, float centerY )` Creates a star polygon, which is like a regular polygon except every other vertex is on either an inner or outer radius. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Path.html` | `https://developer.android.com/reference/androidx/graphics/shapes/ShapesKt#(androidx.graphics.shapes.RoundedPolygon).toPath(android.graphics.Path)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/graphics/shapes/RoundedPolygon receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Path.html path)` Gets a `https://developer.android.com/reference/android/graphics/Path.html` representation for a `https://developer.android.com/reference/androidx/graphics/shapes/RoundedPolygon` shape. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Path.html` | `https://developer.android.com/reference/androidx/graphics/shapes/ShapesKt#(androidx.graphics.shapes.Morph).toPath(kotlin.Float,android.graphics.Path)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/graphics/shapes/Morph receiver, float progress, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Path.html path)` |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/graphics/shapes/RoundedPolygon` | `https://developer.android.com/reference/androidx/graphics/shapes/ShapesKt#(androidx.graphics.shapes.RoundedPolygon).transformed(android.graphics.Matrix)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/graphics/shapes/RoundedPolygon receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Matrix.html matrix)` Transforms a `https://developer.android.com/reference/androidx/graphics/shapes/RoundedPolygon` by the given matrix. |

## Public methods

### circle

Artifact: [androidx.graphics:graphics-shapes](https://developer.android.com/jetpack/androidx/releases/graphics) [View Source](https://cs.android.com/search?q=file:androidx/graphics/shapes/Shapes.kt+function:circle) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/graphics#1.0.0)

```
public static final @NonNull RoundedPolygon circle(
    @NonNull RoundedPolygon.Companion receiver,
    @IntRange(from = 3) int numVertices,
    float radius,
    float centerX,
    float centerY
)
```

Creates a circular shape, approximating the rounding of the shape around the underlying polygon vertices.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/IntRange(from = 3) int numVertices` | The number of vertices in the underlying polygon with which to approximate the circle, default value is 8 |
| `float radius` | optional radius for the circle, default value is 1.0 |
| `float centerX` | X coordinate of optional center for the circle, default value is 0 |
| `float centerY` | Y coordinate of optional center for the circle, default value is 0 |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | `https://developer.android.com/reference/androidx/graphics/shapes/package-summary#(androidx.graphics.shapes.RoundedPolygon.Companion).circle(kotlin.Int,kotlin.Float,kotlin.Float,kotlin.Float)` must be at least 3 |

### pill

Artifact: [androidx.graphics:graphics-shapes](https://developer.android.com/jetpack/androidx/releases/graphics) [View Source](https://cs.android.com/search?q=file:androidx/graphics/shapes/Shapes.kt+function:pill) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/graphics#1.0.0)

```
public static final @NonNull RoundedPolygon pill(
    @NonNull RoundedPolygon.Companion receiver,
    float width,
    float height,
    float smoothing,
    float centerX,
    float centerY
)
```

A pill shape consists of a rectangle shape bounded by two semicircles at either of the long ends of the rectangle.

| Parameters |
|---|---|
| `float width` | The width of the resulting shape. |
| `float height` | The height of the resulting shape. |
| `float smoothing` | the amount by which the arc is "smoothed" by extending the curve from the circular arc on each endcap to the edge between the endcaps. A value of 0 (no smoothing) indicates that the corner is rounded by only a circular arc. |
| `float centerX` | The X coordinate of the center of the polygon, around which all vertices will be placed. The default center is at (0,0). |
| `float centerY` | The Y coordinate of the center of the polygon, around which all vertices will be placed. The default center is at (0,0). |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if either `https://developer.android.com/reference/androidx/graphics/shapes/package-summary#(androidx.graphics.shapes.RoundedPolygon.Companion).pill(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float)` or `https://developer.android.com/reference/androidx/graphics/shapes/package-summary#(androidx.graphics.shapes.RoundedPolygon.Companion).pill(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float)` are \<= 0. |

### pillStar

Artifact: [androidx.graphics:graphics-shapes](https://developer.android.com/jetpack/androidx/releases/graphics) [View Source](https://cs.android.com/search?q=file:androidx/graphics/shapes/Shapes.kt+function:pillStar) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/graphics#1.0.0)

```
public static final @NonNull RoundedPolygon pillStar(
    @NonNull RoundedPolygon.Companion receiver,
    float width,
    float height,
    int numVerticesPerRadius,
    @FloatRange(from = 0.0, fromInclusive = false, to = 1.0, toInclusive = false) float innerRadiusRatio,
    @NonNull CornerRounding rounding,
    CornerRounding innerRounding,
    List<@NonNull CornerRounding> perVertexRounding,
    @FloatRange(from = 0.0, to = 1.0) float vertexSpacing,
    @FloatRange(from = 0.0, to = 1.0) float startLocation,
    float centerX,
    float centerY
)
```

A pillStar shape is like a `https://developer.android.com/reference/androidx/graphics/shapes/package-summary#(androidx.graphics.shapes.RoundedPolygon.Companion).pill(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float)` except it has inner and outer radii along its pill-shaped outline, just like a `https://developer.android.com/reference/androidx/graphics/shapes/package-summary#(androidx.graphics.shapes.RoundedPolygon.Companion).star(kotlin.Int,kotlin.Float,kotlin.Float,androidx.graphics.shapes.CornerRounding,androidx.graphics.shapes.CornerRounding,kotlin.collections.List,kotlin.Float,kotlin.Float)` has inner and outer radii along its circular outline. The parameters for a `https://developer.android.com/reference/androidx/graphics/shapes/package-summary#(androidx.graphics.shapes.RoundedPolygon.Companion).pillStar(kotlin.Float,kotlin.Float,kotlin.Int,kotlin.Float,androidx.graphics.shapes.CornerRounding,androidx.graphics.shapes.CornerRounding,kotlin.collections.List,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float)` are similar to those of a `https://developer.android.com/reference/androidx/graphics/shapes/package-summary#(androidx.graphics.shapes.RoundedPolygon.Companion).star(kotlin.Int,kotlin.Float,kotlin.Float,androidx.graphics.shapes.CornerRounding,androidx.graphics.shapes.CornerRounding,kotlin.collections.List,kotlin.Float,kotlin.Float)` except, like `https://developer.android.com/reference/androidx/graphics/shapes/package-summary#(androidx.graphics.shapes.RoundedPolygon.Companion).pill(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float)`, it has a `https://developer.android.com/reference/androidx/graphics/shapes/package-summary#(androidx.graphics.shapes.RoundedPolygon.Companion).pillStar(kotlin.Float,kotlin.Float,kotlin.Int,kotlin.Float,androidx.graphics.shapes.CornerRounding,androidx.graphics.shapes.CornerRounding,kotlin.collections.List,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float)` and `https://developer.android.com/reference/androidx/graphics/shapes/package-summary#(androidx.graphics.shapes.RoundedPolygon.Companion).pillStar(kotlin.Float,kotlin.Float,kotlin.Int,kotlin.Float,androidx.graphics.shapes.CornerRounding,androidx.graphics.shapes.CornerRounding,kotlin.collections.List,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float)` to determine the general shape of the underlying pill. Also, there is a subtle complication with the way that inner and outer vertices proceed along the circular ends of the shape, depending on the magnitudes of the `https://developer.android.com/reference/androidx/graphics/shapes/package-summary#(androidx.graphics.shapes.RoundedPolygon.Companion).pillStar(kotlin.Float,kotlin.Float,kotlin.Int,kotlin.Float,androidx.graphics.shapes.CornerRounding,androidx.graphics.shapes.CornerRounding,kotlin.collections.List,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float)`, `https://developer.android.com/reference/androidx/graphics/shapes/package-summary#(androidx.graphics.shapes.RoundedPolygon.Companion).pillStar(kotlin.Float,kotlin.Float,kotlin.Int,kotlin.Float,androidx.graphics.shapes.CornerRounding,androidx.graphics.shapes.CornerRounding,kotlin.collections.List,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float)`, and `https://developer.android.com/reference/androidx/graphics/shapes/package-summary#(androidx.graphics.shapes.RoundedPolygon.Companion).pillStar(kotlin.Float,kotlin.Float,kotlin.Int,kotlin.Float,androidx.graphics.shapes.CornerRounding,androidx.graphics.shapes.CornerRounding,kotlin.collections.List,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float)` parameters. For example, a shape with outer vertices that lie along the curved end outline will necessarily have inner vertices that are closer to each other, because of the curvature of that part of the shape. Conversely, if the inner vertices are lined up along the pill outline at the ends, then the outer vertices will be much further apart from each other.

The default approach, reflected by the default value of `https://developer.android.com/reference/androidx/graphics/shapes/package-summary#(androidx.graphics.shapes.RoundedPolygon.Companion).pillStar(kotlin.Float,kotlin.Float,kotlin.Int,kotlin.Float,androidx.graphics.shapes.CornerRounding,androidx.graphics.shapes.CornerRounding,kotlin.collections.List,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float)`, is to use the average of the outer and inner radii, such that each set of vertices falls equally to the other side of the pill outline on the curved ends. Depending on the values used for the various rounding and radius parameters, you may want to change that value to suit the look you want. A value of 0 for `https://developer.android.com/reference/androidx/graphics/shapes/package-summary#(androidx.graphics.shapes.RoundedPolygon.Companion).pillStar(kotlin.Float,kotlin.Float,kotlin.Int,kotlin.Float,androidx.graphics.shapes.CornerRounding,androidx.graphics.shapes.CornerRounding,kotlin.collections.List,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float)` is equivalent to aligning the inner vertices along the circular curve, and a value of 1 is equivalent to aligning the outer vertices along that curve.

| Parameters |
|---|---|
| `float width` | The width of the resulting shape. |
| `float height` | The height of the resulting shape. |
| `int numVerticesPerRadius` | The number of vertices along each of the two radii. |
| `@https://developer.android.com/reference/androidx/annotation/FloatRange(from = 0.0, fromInclusive = false, to = 1.0, toInclusive = false) float innerRadiusRatio` | Inner radius ratio for this star shape, must be greater than 0 and less than or equal to 1. Note that a value of 1 would be similar to creating a `https://developer.android.com/reference/androidx/graphics/shapes/package-summary#(androidx.graphics.shapes.RoundedPolygon.Companion).pill(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float)`, but with more vertices. The default value is .5. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/graphics/shapes/CornerRounding rounding` | The `https://developer.android.com/reference/androidx/graphics/shapes/CornerRounding` properties of every vertex. If some vertices should have different rounding properties, then use `https://developer.android.com/reference/androidx/graphics/shapes/package-summary#(androidx.graphics.shapes.RoundedPolygon.Companion).pillStar(kotlin.Float,kotlin.Float,kotlin.Int,kotlin.Float,androidx.graphics.shapes.CornerRounding,androidx.graphics.shapes.CornerRounding,kotlin.collections.List,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float)` instead. The default rounding value is `https://developer.android.com/reference/androidx/graphics/shapes/CornerRounding#Unrounded()`, meaning that the polygon will use the vertices themselves in the final shape and not curves rounded around the vertices. |
| `https://developer.android.com/reference/androidx/graphics/shapes/CornerRounding innerRounding` | Optional rounding parameters for the vertices on the `https://developer.android.com/reference/androidx/graphics/shapes/package-summary#(androidx.graphics.shapes.RoundedPolygon.Companion).pillStar(kotlin.Float,kotlin.Float,kotlin.Int,kotlin.Float,androidx.graphics.shapes.CornerRounding,androidx.graphics.shapes.CornerRounding,kotlin.collections.List,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float)`. If null (the default value), inner vertices will use the `https://developer.android.com/reference/androidx/graphics/shapes/package-summary#(androidx.graphics.shapes.RoundedPolygon.Companion).pillStar(kotlin.Float,kotlin.Float,kotlin.Int,kotlin.Float,androidx.graphics.shapes.CornerRounding,androidx.graphics.shapes.CornerRounding,kotlin.collections.List,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float)` or `https://developer.android.com/reference/androidx/graphics/shapes/package-summary#(androidx.graphics.shapes.RoundedPolygon.Companion).pillStar(kotlin.Float,kotlin.Float,kotlin.Int,kotlin.Float,androidx.graphics.shapes.CornerRounding,androidx.graphics.shapes.CornerRounding,kotlin.collections.List,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float)` parameters instead. |
| `https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/graphics/shapes/CornerRounding> perVertexRounding` | The `https://developer.android.com/reference/androidx/graphics/shapes/CornerRounding` properties of every vertex. If this parameter is not null, then it must have the same size as 2 \* `https://developer.android.com/reference/androidx/graphics/shapes/package-summary#(androidx.graphics.shapes.RoundedPolygon.Companion).pillStar(kotlin.Float,kotlin.Float,kotlin.Int,kotlin.Float,androidx.graphics.shapes.CornerRounding,androidx.graphics.shapes.CornerRounding,kotlin.collections.List,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float)`. If this parameter is null, then the polygon will use the `https://developer.android.com/reference/androidx/graphics/shapes/package-summary#(androidx.graphics.shapes.RoundedPolygon.Companion).pillStar(kotlin.Float,kotlin.Float,kotlin.Int,kotlin.Float,androidx.graphics.shapes.CornerRounding,androidx.graphics.shapes.CornerRounding,kotlin.collections.List,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float)` parameter for every vertex instead. The default value is null. |
| `@https://developer.android.com/reference/androidx/annotation/FloatRange(from = 0.0, to = 1.0) float vertexSpacing` | This factor determines how the vertices on the circular ends are laid out along the outline. A value of 0 aligns spaces the inner vertices the same as those along the straight edges, with the outer vertices then being spaced further apart. A value of 1 does the opposite, with the outer vertices spaced the same as the vertices on the straight edges. The default value is .5, which takes the average of these two extremes. |
| `@https://developer.android.com/reference/androidx/annotation/FloatRange(from = 0.0, to = 1.0) float startLocation` | A value from 0 to 1 which determines how far along the perimeter of this shape to start the underlying curves of which it is comprised. This is not usually needed or noticed by the user. But if the caller wants to manually and gradually stroke the path when drawing it, it might matter where that path outline begins and ends. The default value is 0. |
| `float centerX` | The X coordinate of the center of the polygon, around which all vertices will be placed. The default center is at (0,0). |
| `float centerY` | The Y coordinate of the center of the polygon, around which all vertices will be placed. The default center is at (0,0). |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if either `https://developer.android.com/reference/androidx/graphics/shapes/package-summary#(androidx.graphics.shapes.RoundedPolygon.Companion).pillStar(kotlin.Float,kotlin.Float,kotlin.Int,kotlin.Float,androidx.graphics.shapes.CornerRounding,androidx.graphics.shapes.CornerRounding,kotlin.collections.List,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float)` or `https://developer.android.com/reference/androidx/graphics/shapes/package-summary#(androidx.graphics.shapes.RoundedPolygon.Companion).pillStar(kotlin.Float,kotlin.Float,kotlin.Int,kotlin.Float,androidx.graphics.shapes.CornerRounding,androidx.graphics.shapes.CornerRounding,kotlin.collections.List,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float)` are \<= 0 or if `https://developer.android.com/reference/androidx/graphics/shapes/package-summary#(androidx.graphics.shapes.RoundedPolygon.Companion).pillStar(kotlin.Float,kotlin.Float,kotlin.Int,kotlin.Float,androidx.graphics.shapes.CornerRounding,androidx.graphics.shapes.CornerRounding,kotlin.collections.List,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float)` is outside the range of (0, 1\]. |

### rectangle

Artifact: [androidx.graphics:graphics-shapes](https://developer.android.com/jetpack/androidx/releases/graphics) [View Source](https://cs.android.com/search?q=file:androidx/graphics/shapes/Shapes.kt+function:rectangle) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/graphics#1.0.0)

```
public static final @NonNull RoundedPolygon rectangle(
    @NonNull RoundedPolygon.Companion receiver,
    float width,
    float height,
    @NonNull CornerRounding rounding,
    List<@NonNull CornerRounding> perVertexRounding,
    float centerX,
    float centerY
)
```

Creates a rectangular shape with the given width/height around the given center. Optional rounding parameters can be used to create a rounded rectangle instead.

As with all `https://developer.android.com/reference/androidx/graphics/shapes/RoundedPolygon` objects, if this shape is created with default dimensions and center, it is sized to fit within the 2x2 bounding box around a center of (0, 0) and will need to be scaled and moved using `https://developer.android.com/reference/androidx/graphics/shapes/RoundedPolygon#transformed(androidx.graphics.shapes.PointTransformer)` to fit the intended area in a UI.

| Parameters |
|---|---|
| `float width` | The width of the rectangle, default value is 2 |
| `float height` | The height of the rectangle, default value is 2 |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/graphics/shapes/CornerRounding rounding` | The `https://developer.android.com/reference/androidx/graphics/shapes/CornerRounding` properties of every vertex. If some vertices should have different rounding properties, then use `https://developer.android.com/reference/androidx/graphics/shapes/package-summary#(androidx.graphics.shapes.RoundedPolygon.Companion).rectangle(kotlin.Float,kotlin.Float,androidx.graphics.shapes.CornerRounding,kotlin.collections.List,kotlin.Float,kotlin.Float)` instead. The default rounding value is `https://developer.android.com/reference/androidx/graphics/shapes/CornerRounding#Unrounded()`, meaning that the polygon will use the vertices themselves in the final shape and not curves rounded around the vertices. |
| `https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/graphics/shapes/CornerRounding> perVertexRounding` | The `https://developer.android.com/reference/androidx/graphics/shapes/CornerRounding` properties of every vertex. If this parameter is not null, then it must be of size 4 for the four corners of the shape. If this parameter is null, then the polygon will use the `https://developer.android.com/reference/androidx/graphics/shapes/package-summary#(androidx.graphics.shapes.RoundedPolygon.Companion).rectangle(kotlin.Float,kotlin.Float,androidx.graphics.shapes.CornerRounding,kotlin.collections.List,kotlin.Float,kotlin.Float)` parameter for every vertex instead. The default value is null. |
| `float centerX` | The X coordinate of the center of the rectangle, around which all vertices will be placed equidistantly. The default center is at (0,0). |
| `float centerY` | The X coordinate of the center of the rectangle, around which all vertices will be placed equidistantly. The default center is at (0,0). |

### star

Artifact: [androidx.graphics:graphics-shapes](https://developer.android.com/jetpack/androidx/releases/graphics) [View Source](https://cs.android.com/search?q=file:androidx/graphics/shapes/Shapes.kt+function:star) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/graphics#1.0.0)

```
public static final @NonNull RoundedPolygon star(
    @NonNull RoundedPolygon.Companion receiver,
    int numVerticesPerRadius,
    float radius,
    float innerRadius,
    @NonNull CornerRounding rounding,
    CornerRounding innerRounding,
    List<@NonNull CornerRounding> perVertexRounding,
    float centerX,
    float centerY
)
```

Creates a star polygon, which is like a regular polygon except every other vertex is on either an inner or outer radius. The two radii specified in the constructor must both both nonzero. If the radii are equal, the result will be a regular (not star) polygon with twice the number of vertices specified in `https://developer.android.com/reference/androidx/graphics/shapes/package-summary#(androidx.graphics.shapes.RoundedPolygon.Companion).star(kotlin.Int,kotlin.Float,kotlin.Float,androidx.graphics.shapes.CornerRounding,androidx.graphics.shapes.CornerRounding,kotlin.collections.List,kotlin.Float,kotlin.Float)`.

| Parameters |
|---|---|
| `int numVerticesPerRadius` | The number of vertices along each of the two radii. |
| `float radius` | Outer radius for this star shape, must be greater than 0. Default value is 1. |
| `float innerRadius` | Inner radius for this star shape, must be greater than 0 and less than or equal to `https://developer.android.com/reference/androidx/graphics/shapes/package-summary#(androidx.graphics.shapes.RoundedPolygon.Companion).star(kotlin.Int,kotlin.Float,kotlin.Float,androidx.graphics.shapes.CornerRounding,androidx.graphics.shapes.CornerRounding,kotlin.collections.List,kotlin.Float,kotlin.Float)`. Note that equal radii would be the same as creating a `https://developer.android.com/reference/androidx/graphics/shapes/RoundedPolygon` directly, but with 2 \* `https://developer.android.com/reference/androidx/graphics/shapes/package-summary#(androidx.graphics.shapes.RoundedPolygon.Companion).star(kotlin.Int,kotlin.Float,kotlin.Float,androidx.graphics.shapes.CornerRounding,androidx.graphics.shapes.CornerRounding,kotlin.collections.List,kotlin.Float,kotlin.Float)` vertices. Default value is .5. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/graphics/shapes/CornerRounding rounding` | The `https://developer.android.com/reference/androidx/graphics/shapes/CornerRounding` properties of every vertex. If some vertices should have different rounding properties, then use `https://developer.android.com/reference/androidx/graphics/shapes/package-summary#(androidx.graphics.shapes.RoundedPolygon.Companion).star(kotlin.Int,kotlin.Float,kotlin.Float,androidx.graphics.shapes.CornerRounding,androidx.graphics.shapes.CornerRounding,kotlin.collections.List,kotlin.Float,kotlin.Float)` instead. The default rounding value is `https://developer.android.com/reference/androidx/graphics/shapes/CornerRounding#Unrounded()`, meaning that the polygon will use the vertices themselves in the final shape and not curves rounded around the vertices. |
| `https://developer.android.com/reference/androidx/graphics/shapes/CornerRounding innerRounding` | Optional rounding parameters for the vertices on the `https://developer.android.com/reference/androidx/graphics/shapes/package-summary#(androidx.graphics.shapes.RoundedPolygon.Companion).star(kotlin.Int,kotlin.Float,kotlin.Float,androidx.graphics.shapes.CornerRounding,androidx.graphics.shapes.CornerRounding,kotlin.collections.List,kotlin.Float,kotlin.Float)`. If null (the default value), inner vertices will use the `https://developer.android.com/reference/androidx/graphics/shapes/package-summary#(androidx.graphics.shapes.RoundedPolygon.Companion).star(kotlin.Int,kotlin.Float,kotlin.Float,androidx.graphics.shapes.CornerRounding,androidx.graphics.shapes.CornerRounding,kotlin.collections.List,kotlin.Float,kotlin.Float)` or `https://developer.android.com/reference/androidx/graphics/shapes/package-summary#(androidx.graphics.shapes.RoundedPolygon.Companion).star(kotlin.Int,kotlin.Float,kotlin.Float,androidx.graphics.shapes.CornerRounding,androidx.graphics.shapes.CornerRounding,kotlin.collections.List,kotlin.Float,kotlin.Float)` parameters instead. |
| `https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/graphics/shapes/CornerRounding> perVertexRounding` | The `https://developer.android.com/reference/androidx/graphics/shapes/CornerRounding` properties of every vertex. If this parameter is not null, then it must have the same size as 2 \* `https://developer.android.com/reference/androidx/graphics/shapes/package-summary#(androidx.graphics.shapes.RoundedPolygon.Companion).star(kotlin.Int,kotlin.Float,kotlin.Float,androidx.graphics.shapes.CornerRounding,androidx.graphics.shapes.CornerRounding,kotlin.collections.List,kotlin.Float,kotlin.Float)`. If this parameter is null, then the polygon will use the `https://developer.android.com/reference/androidx/graphics/shapes/package-summary#(androidx.graphics.shapes.RoundedPolygon.Companion).star(kotlin.Int,kotlin.Float,kotlin.Float,androidx.graphics.shapes.CornerRounding,androidx.graphics.shapes.CornerRounding,kotlin.collections.List,kotlin.Float,kotlin.Float)` parameter for every vertex instead. The default value is null. |
| `float centerX` | The X coordinate of the center of the polygon, around which all vertices will be placed. The default center is at (0,0). |
| `float centerY` | The Y coordinate of the center of the polygon, around which all vertices will be placed. The default center is at (0,0). |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if either `https://developer.android.com/reference/androidx/graphics/shapes/package-summary#(androidx.graphics.shapes.RoundedPolygon.Companion).star(kotlin.Int,kotlin.Float,kotlin.Float,androidx.graphics.shapes.CornerRounding,androidx.graphics.shapes.CornerRounding,kotlin.collections.List,kotlin.Float,kotlin.Float)` or `https://developer.android.com/reference/androidx/graphics/shapes/package-summary#(androidx.graphics.shapes.RoundedPolygon.Companion).star(kotlin.Int,kotlin.Float,kotlin.Float,androidx.graphics.shapes.CornerRounding,androidx.graphics.shapes.CornerRounding,kotlin.collections.List,kotlin.Float,kotlin.Float)` are \<= 0 or `https://developer.android.com/reference/androidx/graphics/shapes/package-summary#(androidx.graphics.shapes.RoundedPolygon.Companion).star(kotlin.Int,kotlin.Float,kotlin.Float,androidx.graphics.shapes.CornerRounding,androidx.graphics.shapes.CornerRounding,kotlin.collections.List,kotlin.Float,kotlin.Float)`\>`https://developer.android.com/reference/androidx/graphics/shapes/package-summary#(androidx.graphics.shapes.RoundedPolygon.Companion).star(kotlin.Int,kotlin.Float,kotlin.Float,androidx.graphics.shapes.CornerRounding,androidx.graphics.shapes.CornerRounding,kotlin.collections.List,kotlin.Float,kotlin.Float)`. |

### toPath

Artifact: [androidx.graphics:graphics-shapes](https://developer.android.com/jetpack/androidx/releases/graphics) [View Source](https://cs.android.com/search?q=file:androidx/graphics/shapes/Shapes.android.kt+function:toPath)

```
public static final @NonNull Path toPath(@NonNull RoundedPolygon receiver, @NonNull Path path)
```

Gets a `https://developer.android.com/reference/android/graphics/Path.html` representation for a `https://developer.android.com/reference/androidx/graphics/shapes/RoundedPolygon` shape. Note that there is some rounding happening (to the nearest thousandth), to work around rendering artifacts introduced by some points being just slightly off from each other (far less than a pixel). This also allows for a more optimal path, as redundant curves (usually a single point) can be detected and not added to the resulting path.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Path.html path` | an optional `https://developer.android.com/reference/android/graphics/Path.html` object which, if supplied, will avoid the function having to create a new `https://developer.android.com/reference/android/graphics/Path.html` object |

### toPath

Artifact: [androidx.graphics:graphics-shapes](https://developer.android.com/jetpack/androidx/releases/graphics) [View Source](https://cs.android.com/search?q=file:androidx/graphics/shapes/Shapes.android.kt+function:toPath)

```
public static final @NonNull Path toPath(@NonNull Morph receiver, float progress, @NonNull Path path)
```

### transformed

Artifact: [androidx.graphics:graphics-shapes](https://developer.android.com/jetpack/androidx/releases/graphics) [View Source](https://cs.android.com/search?q=file:androidx/graphics/shapes/Shapes.android.kt+function:transformed)

```
public static final @NonNull RoundedPolygon transformed(@NonNull RoundedPolygon receiver, @NonNull Matrix matrix)
```

Transforms a `https://developer.android.com/reference/androidx/graphics/shapes/RoundedPolygon` by the given matrix.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Matrix.html matrix` | The matrix by which the polygon is to be transformed |