• Cmn
    value class Size

Holds a 2D floating-point size.

You can think of this as an Offset from the origin.

Summary

Nested types

Public companion properties

Size

A size whose width and height are unspecified.

Cmn
Size

An empty size, one with a zero width and a zero height.

Cmn

Public functions

inline operator Float
Cmn
inline operator Float
Cmn
Size
copy(width: Float, height: Float)

Returns a copy of this Size instance optionally overriding the width or height parameter

Cmn
operator Size
div(operand: Float)

Division operator.

Cmn
Boolean

Whether this size encloses a non-zero area.

Cmn
operator Size
times(operand: Float)

Multiplication operator.

Cmn
open String
Cmn

Public properties

Float
Cmn
Float

The greater of the magnitudes of the width and the height.

Cmn
Float

The lesser of the magnitudes of the width and the height.

Cmn
Float
Cmn

Extension functions

operator Size
Size.div(scaleFactor: ScaleFactor)

Division operator with Size

Cmn
operator Size
Size.times(scaleFactor: ScaleFactor)

Multiplication operator with Size.

Cmn
inline Size
Size.takeOrElse(block: () -> Size)

If this Size isSpecified then this is returned, otherwise block is executed and its result is returned.

Cmn
Rect

Convert a Size to a Rect.

Cmn

Extension properties

Offset

Returns the Offset of the center of the rect from the point of 0, 0 with this Size.

Cmn
Boolean

false when this is Size.Unspecified.

Cmn
Boolean

true when this is Size.Unspecified.

Cmn

Public companion properties

Unspecified

val UnspecifiedSize

A size whose width and height are unspecified. This is a sentinel value used to initialize a non-null parameter. Access to width or height on an unspecified size is not allowed.

Zero

val ZeroSize

An empty size, one with a zero width and a zero height.

Public functions

component1

inline operator fun component1(): Float

component2

inline operator fun component2(): Float

copy

fun copy(
    width: Float = unpackFloat1(packedValue),
    height: Float = unpackFloat2(packedValue)
): Size

Returns a copy of this Size instance optionally overriding the width or height parameter

div

operator fun div(operand: Float): Size

Division operator.

Returns a Size whose dimensions are the dimensions of the left-hand-side operand (a Size) divided by the scalar right-hand-side operand (a Float).

isEmpty

fun isEmpty(): Boolean

Whether this size encloses a non-zero area.

Negative areas are considered empty.

times

operator fun times(operand: Float): Size

Multiplication operator.

Returns a Size whose dimensions are the dimensions of the left-hand-side operand (a Size) multiplied by the scalar right-hand-side operand (a Float).

toString

open fun toString(): String

Public properties

height

val heightFloat

maxDimension

val maxDimensionFloat

The greater of the magnitudes of the width and the height.

minDimension

val minDimensionFloat

The lesser of the magnitudes of the width and the height.

width

val widthFloat

Extension functions

operator fun Size.div(scaleFactor: ScaleFactor): Size

Division operator with Size

Return a new Size with the width and height divided by ScaleFactor.scaleX and ScaleFactor.scaleY respectively

times

operator fun Size.times(scaleFactor: ScaleFactor): Size

Multiplication operator with Size.

Return a new Size with the width and height multiplied by the ScaleFactor.scaleX and ScaleFactor.scaleY respectively

takeOrElse

inline fun Size.takeOrElse(block: () -> Size): Size

If this Size isSpecified then this is returned, otherwise block is executed and its result is returned.

fun Size.toRect(): Rect

Convert a Size to a Rect.

Extension properties

val Size.centerOffset

Returns the Offset of the center of the rect from the point of 0, 0 with this Size.

isSpecified

val Size.isSpecifiedBoolean

false when this is Size.Unspecified.

isUnspecified

val Size.isUnspecifiedBoolean

true when this is Size.Unspecified.