IntOffset
-
Cmn
value class IntOffset
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.
Summary
Nested types |
|---|
object IntOffset.Companion |
Public functions |
||
|---|---|---|
inline operator Int |
Cmn
|
|
inline operator Int |
Cmn
|
|
IntOffset |
Returns a copy of this IntOffset instance optionally overriding the x or y parameter |
Cmn
|
operator IntOffset |
Division operator. |
Cmn
|
operator IntOffset |
Subtract a |
Cmn
|
operator IntOffset |
Add a |
Cmn
|
operator IntOffset |
Modulo (remainder) operator. |
Cmn
|
operator IntOffset |
Multiplication operator. |
Cmn
|
open String |
toString() |
Cmn
|
operator IntOffset |
Returns a new |
Cmn
|
Public properties |
||
|---|---|---|
Long |
|
Cmn
|
Int |
The horizontal aspect of the position in |
Cmn
|
Int |
The vertical aspect of the position in |
Cmn
|
Public functions
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
div
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.
rem
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
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.
unaryMinus
operator fun unaryMinus(): IntOffset
Returns a new IntOffset representing the negation of this point.
Public properties
packedValue
val packedValue: Long
Long value encoding the x and y components of the IntOffset. Encoded values can be obtained by using the packedValue property of existing IntOffset instances.