# IntOffset

Artifact: [androidx.compose.ui:ui-unit](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/unit/IntOffset.kt+class:androidx.compose.ui.unit.IntOffset) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0) Common/AllAndroid/JVM
- Cmn

  ```
  value class IntOffset
  ```

*** ** * ** ***

A two-dimensional position using `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` pixels for units.

To create an `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset`, call the top-level function that accepts an x/y pair of coordinates:

```kotlin
val offset = IntOffset(x, y)
```

The primary constructor of `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset` is intended to be used with the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset#packedValue()` property to allow storing offsets in arrays or collections of primitives without boxing.

## Summary

| ### Nested types |
|---|
| `object https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset.Companion` |

| ### Public companion properties |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset#Max()` | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset#Zero()` | Cmn |

| ### Public constructors |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset#IntOffset(kotlin.Long)(packedValue: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` | Cmn |

| ### Public functions |
|---|---|---|
| `inline operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset#component1()()` | Cmn |
| `inline operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset#component2()()` | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset#copy(kotlin.Int,kotlin.Int)(x: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, y: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Returns a copy of this IntOffset instance optionally overriding the x or y parameter | Cmn |
| `operator https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset#div(kotlin.Float)(operand: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` Division operator. | Cmn |
| `operator https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset#minus(androidx.compose.ui.unit.IntOffset)(other: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset)` Subtract a `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset` from another one. | Cmn |
| `operator https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset#plus(androidx.compose.ui.unit.IntOffset)(other: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset)` Add a `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset` to another one. | Cmn |
| `operator https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset#rem(kotlin.Int)(operand: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Modulo (remainder) operator. | Cmn |
| `operator https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset#times(kotlin.Float)(operand: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` Multiplication operator. | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset#toString()()` | Cmn |
| `operator https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset#unaryMinus()()` Returns a new `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset` representing the negation of this point. | Cmn |

| ### Public properties |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset#packedValue()` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` value encoding the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset#x()` and `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset#y()` components of the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset`. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset#x()` The horizontal aspect of the position in `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` pixels. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset#y()` The vertical aspect of the position in `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` pixels. | Cmn |

| ### Extension functions |
|---|---|---|
| `operator https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset.https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset#(androidx.compose.ui.unit.IntOffset).minus(androidx.compose.ui.geometry.Offset)(offset: https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset)` | Cmn |
| `operator https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset.https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset#(androidx.compose.ui.unit.IntOffset).plus(androidx.compose.ui.geometry.Offset)(offset: https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset)` | Cmn |
| `inline https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset.https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset#(androidx.compose.ui.unit.IntOffset).toOffset()()` Converts the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset` to an `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset`. | Cmn |

## Public companion properties

### Max

Cmn Added in [1.8.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.8.0)

```
val Max: IntOffset
```

### Zero

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
val Zero: IntOffset
```

## Public constructors

### IntOffset

Cmn Added in [1.8.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.8.0)

```
IntOffset(packedValue: Long)
```

| Parameters |
|---|---|
| `packedValue: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` value encoding the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset#x()` and `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset#y()` components of the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset`. Encoded values can be obtained by using the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset#packedValue()` property of existing `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset` instances. |

## Public functions

### component1

Cmn Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.1.0)

```
inline operator fun component1(): Int
```

### component2

Cmn Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.1.0)

```
inline operator fun component2(): Int
```

### copy

Cmn Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.2.0)

```
fun copy(x: Int = unpackInt1(packedValue), y: Int = unpackInt2(packedValue)): IntOffset
```

Returns a copy of this IntOffset instance optionally overriding the x or y parameter

### div

Cmn Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.1.0)

```
operator fun div(operand: Float): IntOffset
```

Division operator.

Returns an IntOffset whose coordinates are the coordinates of the left-hand-side operand (an IntOffset) divided by the scalar right-hand-side operand (a Float). The result is rounded to the nearest integer.

### minus

Cmn Added in [1.10.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.10.0)

```
operator fun minus(other: IntOffset): IntOffset
```

Subtract a `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset` from another one.

### plus

Cmn Added in [1.10.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.10.0)

```
operator fun plus(other: IntOffset): IntOffset
```

Add a `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset` to another one.

### rem

Cmn Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.1.0)

```
operator fun rem(operand: Int): IntOffset
```

Modulo (remainder) operator.

Returns an IntOffset whose coordinates are the remainder of dividing the coordinates of the left-hand-side operand (an IntOffset) by the scalar right-hand-side operand (an Int).

### times

Cmn Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.1.0)

```
operator fun times(operand: Float): IntOffset
```

Multiplication operator.

Returns an IntOffset whose coordinates are the coordinates of the left-hand-side operand (an IntOffset) multiplied by the scalar right-hand-side operand (a Float). The result is rounded to the nearest integer.

### toString

Cmn

```
open fun toString(): String
```

### unaryMinus

Cmn Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.1.0)

```
operator fun unaryMinus(): IntOffset
```

Returns a new `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset` representing the negation of this point.

## Public properties

### packedValue

Cmn Added in [1.8.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.8.0)

```
val packedValue: Long
```

`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` value encoding the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset#x()` and `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset#y()` components of the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset`. Encoded values can be obtained by using the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset#packedValue()` property of existing `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset` instances.

### x

Cmn Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.2.0)

```
val x: Int
```

The horizontal aspect of the position in `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` pixels.

### y

Cmn Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.2.0)

```
val y: Int
```

The vertical aspect of the position in `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` pixels.

## Extension functions

### IntOffset.minus

Cmn Artifact: [androidx.compose.ui:ui-unit](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/unit/IntOffset.kt+function:minus)

```
operator fun IntOffset.minus(offset: Offset): Offset
```

### IntOffset.plus

Cmn Artifact: [androidx.compose.ui:ui-unit](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/unit/IntOffset.kt+function:plus)

```
operator fun IntOffset.plus(offset: Offset): Offset
```

### IntOffset.toOffset

Cmn Artifact: [androidx.compose.ui:ui-unit](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/unit/IntOffset.kt+function:toOffset)

```
inline fun IntOffset.toOffset(): Offset
```

Converts the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset` to an `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset`.