Bounds

@JsonClass(generateAdapter = true)
data class Bounds(@Json(name = "x") val x: Int, @Json(name = "y") val y: Int, @Json(name = "width") val width: Int, @Json(name = "height") val height: Int) : Codable, Scalable<Bounds>

Constructors

Link copied to clipboard
constructor(rect: Rect)
constructor(rect: RectF)
constructor(region: Region)
constructor(rect: Rect)
constructor(@Json(name = "x") x: Int, @Json(name = "y") y: Int, @Json(name = "width") width: Int, @Json(name = "height") height: Int)

Properties

Link copied to clipboard

The center point of this bounds.

Link copied to clipboard
val height: Int
Link copied to clipboard
val width: Int
Link copied to clipboard
val x: Int
Link copied to clipboard
val y: Int

Functions

Link copied to clipboard
fun area(): Int
Link copied to clipboard
fun distance(other: Bounds): Double

Computes the distance in px between the centers of this bounds and another.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean

Checks if the other object equals this object.

Link copied to clipboard
open override fun hashCode(): Int

Returns a hashcode based on x, y, width and height.

Link copied to clipboard
open override fun height(): Int

Returns the height to be used when scaling

Link copied to clipboard
fun intersects(other: Bounds, diameter: Int): Boolean

Determines whether:

Link copied to clipboard
open override fun scale(factor: Double): Bounds

Scale Bounds using the given factor. Affects: x, y, width and height

open fun scale(maxWidth: Int, maxHeight: Int): Bounds

Scale T to fit within the given maxWidth and maxHeight.

Link copied to clipboard
open fun toJSON(): String

Helper method to convert an object to JSON

Link copied to clipboard
fun toRect(): Rect
Link copied to clipboard
open override fun width(): Int

Returns the width to be used when scaling