# CompositionSettings.Builder

Artifact: [androidx.camera:camera-core](https://developer.android.com/jetpack/androidx/releases/camera) [View Source](https://cs.android.com/search?q=file:androidx/camera/core/CompositionSettings.java+class:androidx.camera.core.CompositionSettings.Builder) Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/camera#1.5.0)

*** ** * ** ***


```
class CompositionSettings.Builder
```

<br />

*** ** * ** ***

A builder for `https://developer.android.com/reference/kotlin/androidx/camera/core/CompositionSettings` instances.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/core/CompositionSettings.Builder#Builder()()` Creates a new `https://developer.android.com/reference/kotlin/androidx/camera/core/CompositionSettings.Builder`. |

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/core/CompositionSettings` | `https://developer.android.com/reference/kotlin/androidx/camera/core/CompositionSettings.Builder#build()()` Builds the `https://developer.android.com/reference/kotlin/androidx/camera/core/CompositionSettings`. |
| `https://developer.android.com/reference/kotlin/androidx/camera/core/CompositionSettings.Builder` | `https://developer.android.com/reference/kotlin/androidx/camera/core/CompositionSettings.Builder#setAlpha(float)(alpha: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0, to = 1) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` Sets the alpha. |
| `https://developer.android.com/reference/kotlin/androidx/camera/core/CompositionSettings.Builder` | `https://developer.android.com/reference/kotlin/androidx/camera/core/CompositionSettings.Builder#setBorderColor(int)(borderColor: @https://developer.android.com/reference/kotlin/androidx/annotation/ColorInt https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Sets the border color. |
| `https://developer.android.com/reference/kotlin/androidx/camera/core/CompositionSettings.Builder` | `https://developer.android.com/reference/kotlin/androidx/camera/core/CompositionSettings.Builder#setBorderWidthRatio(float)(borderWidthRatio: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0, to = 1) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` Sets the border width as a normalized ratio from 0 to 1. |
| `https://developer.android.com/reference/kotlin/androidx/camera/core/CompositionSettings.Builder` | `https://developer.android.com/reference/kotlin/androidx/camera/core/CompositionSettings.Builder#setOffset(float,float)( offsetX: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = "-1", to = 1) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, offsetY: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = "-1", to = 1) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html )` Sets the offset. |
| `https://developer.android.com/reference/kotlin/androidx/camera/core/CompositionSettings.Builder` | `https://developer.android.com/reference/kotlin/androidx/camera/core/CompositionSettings.Builder#setRoundedCornerRatio(float)( roundedCornerRatio: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0, to = 1) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html )` Sets the rounded corner ratio as a normalized value from 0 to 1. |
| `https://developer.android.com/reference/kotlin/androidx/camera/core/CompositionSettings.Builder` | `https://developer.android.com/reference/kotlin/androidx/camera/core/CompositionSettings.Builder#setScale(float,float)(scaleX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, scaleY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` Sets the scale. |
| `https://developer.android.com/reference/kotlin/androidx/camera/core/CompositionSettings.Builder` | `https://developer.android.com/reference/kotlin/androidx/camera/core/CompositionSettings.Builder#setZOrder(int)(zOrder: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Sets the z-order. |

## Public constructors

### Builder

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/camera#1.5.0)

```
Builder()
```

Creates a new `https://developer.android.com/reference/kotlin/androidx/camera/core/CompositionSettings.Builder`.

The default alpha is 1.0f, the default offset is (0.0f, 0.0f), the default scale is (1.0f, 1.0f), the default rounded corner ratio is 0.0f, the default border width ratio is 0, and the default border color is `https://developer.android.com/reference/android/graphics/Color.html#WHITE`.

## Public functions

### build

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/camera#1.5.0)

```
fun build(): CompositionSettings
```

Builds the `https://developer.android.com/reference/kotlin/androidx/camera/core/CompositionSettings`.

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/core/CompositionSettings` | `https://developer.android.com/reference/kotlin/androidx/camera/core/CompositionSettings`. |

### setAlpha

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/camera#1.5.0)

```
fun setAlpha(alpha: @FloatRange(from = 0, to = 1) Float): CompositionSettings.Builder
```

Sets the alpha. 0 means fully transparent, 1 means fully opaque.

| Parameters |
|---|---|
| `alpha: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0, to = 1) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | alpha value. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/core/CompositionSettings.Builder` | Builder instance. |

### setBorderColor

Added in [1.7.0-rc02](https://developer.android.com/jetpack/androidx/releases/camera#1.7.0-rc02)

```
fun setBorderColor(borderColor: @ColorInt Int): CompositionSettings.Builder
```

Sets the border color.

| Parameters |
|---|---|
| `borderColor: @https://developer.android.com/reference/kotlin/androidx/annotation/ColorInt https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | border color value. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/core/CompositionSettings.Builder` | Builder instance. |

### setBorderWidthRatio

Added in [1.7.0-rc02](https://developer.android.com/jetpack/androidx/releases/camera#1.7.0-rc02)

```
fun setBorderWidthRatio(borderWidthRatio: @FloatRange(from = 0, to = 1) Float): CompositionSettings.Builder
```

Sets the border width as a normalized ratio from 0 to 1.

0 means no border. 1 means the border width equals half of the smaller dimension of the frame, which causes the borders to meet at the center and fill the smaller dimension. The ratio is relative to half of the smaller dimension of the frame, consistent with `https://developer.android.com/reference/kotlin/androidx/camera/core/CompositionSettings.Builder#setRoundedCornerRatio(float)`.

| Parameters |
|---|---|
| `borderWidthRatio: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0, to = 1) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | border width ratio value. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/core/CompositionSettings.Builder` | Builder instance. |

### setOffset

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/camera#1.5.0)

```
fun setOffset(
    offsetX: @FloatRange(from = "-1", to = 1) Float,
    offsetY: @FloatRange(from = "-1", to = 1) Float
): CompositionSettings.Builder
```

Sets the offset.

| Parameters |
|---|---|
| `offsetX: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = "-1", to = 1) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | offset X value. |
| `offsetY: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = "-1", to = 1) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | offset Y value. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/core/CompositionSettings.Builder` | Builder instance. |

### setRoundedCornerRatio

Added in [1.7.0-rc02](https://developer.android.com/jetpack/androidx/releases/camera#1.7.0-rc02)

```
fun setRoundedCornerRatio(
    roundedCornerRatio: @FloatRange(from = 0, to = 1) Float
): CompositionSettings.Builder
```

Sets the rounded corner ratio as a normalized value from 0 to 1.

0 means no rounding (sharp corners). 1 means fully rounded (the radius of the rounded corners equals half of the smaller dimension of the frame, making the frame a circle if it's square, or pill-shaped if it's rectangular). Values in between provide partial rounding proportional to half of the smaller dimension of the frame.

| Parameters |
|---|---|
| `roundedCornerRatio: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0, to = 1) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | rounded corner ratio value. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/core/CompositionSettings.Builder` | Builder instance. |

### setScale

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/camera#1.5.0)

```
fun setScale(scaleX: Float, scaleY: Float): CompositionSettings.Builder
```

Sets the scale.

| Parameters |
|---|---|
| `scaleX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | scale X value. |
| `scaleY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | scale Y value. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/core/CompositionSettings.Builder` | Builder instance. |

### setZOrder

Added in [1.7.0-rc02](https://developer.android.com/jetpack/androidx/releases/camera#1.7.0-rc02)

```
fun setZOrder(zOrder: @IntRange(from = 0) Int): CompositionSettings.Builder
```

Sets the z-order. Larger z-order means rendered later (appears on top). Must be non-negative.

| Parameters |
|---|---|
| `zOrder: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | z-order value. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/core/CompositionSettings.Builder` | Builder instance. |