{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}

IntOffset

value public final class IntOffset


A two-dimensional position using Int pixels for units

Summary

Nested types

public static class IntOffset.Companion

Public methods

final int
final int
final @NonNull IntOffset
copy(int x, int y)

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

final @NonNull IntOffset
div(float operand)

Division operator.

final int

The horizontal aspect of the position in Int pixels.

final int

The vertical aspect of the position in Int pixels.

final @NonNull IntOffset

Subtract a IntOffset from another one.

final @NonNull IntOffset

Add a IntOffset to another one.

final @NonNull IntOffset
rem(int operand)

Modulo (remainder) operator.

final @NonNull IntOffset
times(float operand)

Multiplication operator.

@NonNull String
final @NonNull IntOffset

Returns a new IntOffset representing the negation of this point.

Extension functions

final @NonNull Offset
final @NonNull Offset
final @NonNull Offset

Converts the IntOffset to an Offset.

Public methods

component1

public final int component1()

component2

public final int component2()

copy

public final @NonNull IntOffset copy(int x, int y)

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

div

public final @NonNull IntOffset div(float operand)

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.

getX

public final int getX()

The horizontal aspect of the position in Int pixels.

getY

public final int getY()

The vertical aspect of the position in Int pixels.

minus

public final @NonNull IntOffset minus(@NonNull IntOffset other)

Subtract a IntOffset from another one.

plus

public final @NonNull IntOffset plus(@NonNull IntOffset other)

Add a IntOffset to another one.

rem

public final @NonNull IntOffset rem(int operand)

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

public final @NonNull IntOffset times(float operand)

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

public @NonNull String toString()

unaryMinus

public final @NonNull IntOffset unaryMinus()

Returns a new IntOffset representing the negation of this point.

Extension functions

IntOffsetKt.minus

public final @NonNull Offset IntOffsetKt.minus(@NonNull IntOffset receiver, @NonNull Offset offset)

IntOffsetKt.plus

public final @NonNull Offset IntOffsetKt.plus(@NonNull IntOffset receiver, @NonNull Offset offset)

IntOffsetKt.toOffset

public final @NonNull Offset IntOffsetKt.toOffset(@NonNull IntOffset receiver)

Converts the IntOffset to an Offset.