Size

data class Size(val width: Dimension, val height: Dimension)

Represents the target size of an image request.

Each Size is composed of two Dimensions, width and height. Each dimension determines by how much the source image should be scaled. A Dimension can either be a fixed pixel value or Dimension.Undefined. Examples:

  • Given Size(400, 600), the image should be loaded to fit/fill a width of 400 pixels and a height of 600 pixels.

  • Given Size(400, Dimension.Undefined), the image should be loaded to fit/fill a width of 400 pixels.

  • Given Size(Dimension.Undefined, Dimension.Undefined), the image should not be scaled to fit/fill either width or height. i.e. it will be loaded at its original width/height.

See also

Constructors

Link copied to clipboard
constructor(width: Dimension, height: Dimension)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard

Return true if this size is equal to Size.ORIGINAL. Else, return false.

Link copied to clipboard

Functions

Link copied to clipboard
inline fun Size.heightPx(scale: Scale, original: () -> Int): Int
Link copied to clipboard
inline fun Size.widthPx(scale: Scale, original: () -> Int): Int