Size

data class Size(var width: Int = 0, var height: Int = 0)(source)

Mutable pixel dimensions used by the recovered SDK APIs.

A dimension is considered empty when either value is zero or negative. The default instance is therefore empty.

Constructors

Link copied to clipboard
constructor(width: Int = 0, height: Int = 0)

Types

Link copied to clipboard
object Companion

Factory and conversion helpers for Size.

Properties

Link copied to clipboard
var height: Int

vertical dimension in pixels

Link copied to clipboard
var width: Int

horizontal dimension in pixels

Functions

Link copied to clipboard
fun equals(w: Int, h: Int): Boolean

Returns whether this instance has exactly the supplied w and h dimensions.

Link copied to clipboard
fun getOrElse(defaultValue: () -> Size): Size

Returns this non-empty instance, or a value produced by defaultValue when it is empty.

Link copied to clipboard

Returns true when width or height is not positive.

Link copied to clipboard

Returns true when the height is greater than the width.

Link copied to clipboard
fun key(): String

Returns a stable text key containing the current dimensions.

Link copied to clipboard
fun ratioPageSize(maxPageSize: Size): RectF

Returns a rectangle whose dimensions fit within maxPageSize without changing orientation or aspect ratio. Sizes that already fit are returned at their original dimensions.

Link copied to clipboard
fun setHeight(height: Int): Size

Sets height and returns this mutable instance for call chaining.

Link copied to clipboard
fun setWidth(width: Int): Size

Sets width and returns this mutable instance for call chaining.

Link copied to clipboard
fun toRect(): Rect

Returns an integer rectangle from the origin to this size.

Link copied to clipboard
fun toRectF(): RectF

Returns a floating-point rectangle from the origin to this size.