androidx.compose.ui.unit

IntOffset

Value class · from org.jetbrains.compose.ui:ui-unit:1.12.2

No hand-written docs yet.

A two-dimensional position using Int pixels for units.

value class IntOffset(
    packedValue: Long,
)

How to get one

Create it

Ready-made values and functions that return it

Used by

Parameters that take a IntOffset.

Properties

x

val x: Int

The horizontal aspect of the position in Int pixels.

y

val y: Int

The vertical aspect of the position in Int pixels.

Zero

val Zero: IntOffset

Max

val Max: IntOffset

packedValue

val packedValue: Long

Functions

component1

fun component1(): Int

component2

fun component2(): Int

copy

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

minus

fun minus(other: IntOffset): IntOffset

Subtract a IntOffset from another one.

plus

fun plus(other: IntOffset): IntOffset

Add a IntOffset to another one.

unaryMinus

fun unaryMinus(): IntOffset

Returns a new IntOffset representing the negation of this point.

times

fun times(operand: Float): IntOffset

Multiplication operator.

div

fun div(operand: Float): IntOffset

Division operator.

rem

fun rem(operand: Int): IntOffset

Modulo (remainder) operator.

Library docs

A two-dimensional position using Int pixels for units.

To create an IntOffset, call the top-level function that accepts an x/y pair of coordinates:

val offset = IntOffset(x, y)

The primary constructor of IntOffset is intended to be used with the packedValue property to allow storing offsets in arrays or collections of primitives without boxing.