# ImmutableBox.Companion

Artifact: [androidx.ink:ink-geometry](https://developer.android.com/jetpack/androidx/releases/ink) [View Source](https://cs.android.com/search?q=file:androidx/ink/geometry/ImmutableBox.kt+class:androidx.ink.geometry.ImmutableBox.Companion) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/ink#1.0.0)

*** ** * ** ***


```
public static class ImmutableBox.Companion
```

<br />

*** ** * ** ***

## Summary

| ### Public methods |
|---|---|
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/geometry/ImmutableBox` | `https://developer.android.com/reference/androidx/ink/geometry/ImmutableBox#fromCenterAndDimensions(androidx.ink.geometry.Vec,kotlin.Float,kotlin.Float)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/geometry/Vec center, @https://developer.android.com/reference/androidx/annotation/FloatRange(from = 0.0) float width, @https://developer.android.com/reference/androidx/annotation/FloatRange(from = 0.0) float height )` Constructs an `https://developer.android.com/reference/androidx/ink/geometry/ImmutableBox` with a given `https://developer.android.com/reference/androidx/ink/geometry/ImmutableBox.Companion#fromCenterAndDimensions(androidx.ink.geometry.Vec,kotlin.Float,kotlin.Float)`, `https://developer.android.com/reference/androidx/ink/geometry/ImmutableBox.Companion#fromCenterAndDimensions(androidx.ink.geometry.Vec,kotlin.Float,kotlin.Float)`, and `https://developer.android.com/reference/androidx/ink/geometry/ImmutableBox.Companion#fromCenterAndDimensions(androidx.ink.geometry.Vec,kotlin.Float,kotlin.Float)`. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/geometry/ImmutableBox` | `https://developer.android.com/reference/androidx/ink/geometry/ImmutableBox#fromTwoPoints(androidx.ink.geometry.Vec,androidx.ink.geometry.Vec)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/geometry/Vec point1, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/geometry/Vec point2)` Constructs the smallest `https://developer.android.com/reference/androidx/ink/geometry/ImmutableBox` containing the two given points. |

| ### Extension functions |
|---|---|
| `static final https://developer.android.com/reference/androidx/ink/geometry/ImmutableBox` | `https://developer.android.com/reference/androidx/ink/geometry/AndroidGraphicsConverter.https://developer.android.com/reference/androidx/ink/geometry/ImmutableBox.Companion#(androidx.ink.geometry.ImmutableBox.Companion).from(android.graphics.RectF)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/geometry/ImmutableBox.Companion receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/RectF.html rect )` Constructs an `https://developer.android.com/reference/androidx/ink/geometry/ImmutableBox` with the values from `https://developer.android.com/reference/androidx/ink/geometry/package-summary#(androidx.ink.geometry.ImmutableBox.Companion).from(android.graphics.RectF)`. |

## Public methods

### fromCenterAndDimensions

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

```
public static final @NonNull ImmutableBox fromCenterAndDimensions(
    @NonNull Vec center,
    @FloatRange(from = 0.0) float width,
    @FloatRange(from = 0.0) float height
)
```

Constructs an `https://developer.android.com/reference/androidx/ink/geometry/ImmutableBox` with a given `https://developer.android.com/reference/androidx/ink/geometry/ImmutableBox.Companion#fromCenterAndDimensions(androidx.ink.geometry.Vec,kotlin.Float,kotlin.Float)`, `https://developer.android.com/reference/androidx/ink/geometry/ImmutableBox.Companion#fromCenterAndDimensions(androidx.ink.geometry.Vec,kotlin.Float,kotlin.Float)`, and `https://developer.android.com/reference/androidx/ink/geometry/ImmutableBox.Companion#fromCenterAndDimensions(androidx.ink.geometry.Vec,kotlin.Float,kotlin.Float)`.

### fromTwoPoints

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

```
public static final @NonNull ImmutableBox fromTwoPoints(@NonNull Vec point1, @NonNull Vec point2)
```

Constructs the smallest `https://developer.android.com/reference/androidx/ink/geometry/ImmutableBox` containing the two given points.

## Extension functions

### AndroidGraphicsConverter.from

Artifact: [androidx.ink:ink-geometry](https://developer.android.com/jetpack/androidx/releases/ink) [View Source](https://cs.android.com/search?q=file:androidx/ink/geometry/AndroidGraphicsConversionExtensions.android.kt+function:from)

```
public static final ImmutableBox AndroidGraphicsConverter.from(
    @NonNull ImmutableBox.Companion receiver,
    @NonNull RectF rect
)
```

Constructs an `https://developer.android.com/reference/androidx/ink/geometry/ImmutableBox` with the values from `https://developer.android.com/reference/androidx/ink/geometry/package-summary#(androidx.ink.geometry.ImmutableBox.Companion).from(android.graphics.RectF)`.

If `https://developer.android.com/reference/androidx/ink/geometry/package-summary#(androidx.ink.geometry.ImmutableBox.Companion).from(android.graphics.RectF)` is empty, returns null instead.

Java callers should prefer `AndroidGraphicsConverter.createBox`(`https://developer.android.com/reference/androidx/ink/geometry/package-summary#createBox(android.graphics.RectF)`).