Size
open class Size : OffsetBase
kotlin.Any  
↳  androidx.ui.engine.geometry.Size 
Holds a 2D floatingpoint size.
You can think of this as an Offset from the origin.
Summary
Public constructors 


Holds a 2D floatingpoint size. 
Public methods 


Offset 
bottomCenter(origin: Offset) The offset to the center of the bottom edge of the rectangle described by the given offset (which is interpreted as the topleft corner) and this size. 
Offset 
bottomLeft(origin: Offset) The offset to the intersection of the bottom and left edges of the rectangle described by the given offset (which is interpreted as the topleft corner) and this size. 
Offset 
bottomRight(origin: Offset) The offset to the intersection of the bottom and right edges of the rectangle described by the given offset (which is interpreted as the topleft corner) and this size. 
Offset 
The offset to the point halfway between the left and right and the top and bottom edges of the rectangle described by the given offset (which is interpreted as the topleft corner) and this size. 
Offset 
centerLeft(origin: Offset) The offset to the center of the left edge of the rectangle described by the given offset (which is interpreted as the topleft corner) and this size. 
Offset 
centerRight(origin: Offset) The offset to the center of the right edge of the rectangle described by the given offset (which is interpreted as the topleft corner) and this size. 
Boolean 
Whether the point specified by the given offset (which is assumed to be relative to the top left of the size) lies between the left and right and the top and bottom edges of a rectangle of this size. 
operator Size 
Division operator. 
open Boolean  
Size  
Float  
Float  
open Int 
hashCode() 
Boolean 
isEmpty() Whether this size encloses a nonzero area. 
operator Size 
Binary subtraction operator for Size. 
operator Offset  
operator Size  
operator Size 
Modulo (remainder) operator. 
operator Size 
Multiplication operator. 
open String 
toString() 
Offset 
The offset to the center of the top edge of the rectangle described by the given offset (which is interpreted as the topleft corner) and this size. 
Offset 
The offset to the intersection of the top and left edges of the rectangle described by the given Offset (which is interpreted as the topleft corner) and this Size. 
Offset 
The offset to the intersection of the top and right edges of the rectangle described by the given offset (which is interpreted as the topleft corner) and this size. 
Size 
Integer (truncating) division operator. 
Companion functions 


Size 
Creates an instance of Size that has the same values as another. 
Size 
fromHeight(height: Float) 
Size 
fromRadius(radius: Float) Creates a square Size whose width and height are twice the given dimension. 
Size  
Size? 
Linearly interpolate between two sizes 
Size 
Creates a square Size whose width and height are the given dimension. 
Inherited functions 


Properties 


open Float  
open Float  
Float  
Float 
Companion properties 


Size  
Size 
An empty size, one with a zero width and a zero height. 
Public constructors
<init>
Size(
width: Float,
height: Float)
Holds a 2D floatingpoint size.
You can think of this as an Offset from the origin.
Public methods
bottomCenter
fun bottomCenter(origin: Offset): Offset
The offset to the center of the bottom edge of the rectangle described by the given offset (which is interpreted as the topleft corner) and this size.
See also Rect.bottomLeft.
bottomLeft
fun bottomLeft(origin: Offset): Offset
The offset to the intersection of the bottom and left edges of the rectangle described by the given offset (which is interpreted as the topleft corner) and this size.
See also Rect.bottomLeft.
bottomRight
fun bottomRight(origin: Offset): Offset
The offset to the intersection of the bottom and right edges of the rectangle described by the given offset (which is interpreted as the topleft corner) and this size.
See also Rect.bottomRight.
center
fun center(origin: Offset): Offset
The offset to the point halfway between the left and right and the top and bottom edges of the rectangle described by the given offset (which is interpreted as the topleft corner) and this size.
See also Rect.center.
centerLeft
fun centerLeft(origin: Offset): Offset
The offset to the center of the left edge of the rectangle described by the given offset (which is interpreted as the topleft corner) and this size.
See also Rect.centerLeft.
centerRight
fun centerRight(origin: Offset): Offset
The offset to the center of the right edge of the rectangle described by the given offset (which is interpreted as the topleft corner) and this size.
See also Rect.centerLeft.
contains
fun contains(offset: Offset): Boolean
Whether the point specified by the given offset (which is assumed to be relative to the top left of the size) lies between the left and right and the top and bottom edges of a rectangle of this size.
Rectangles include their top and left edges but exclude their bottom and right edges.
div
operator fun div(operand: Float): Size
Division operator.
Returns a Size whose dimensions are the dimensions of the lefthandside operand (a Size) divided by the scalar righthandside operand (a Float).
getLongestSide
fun getLongestSide(): Float
getShortestSide
fun getShortestSide(): Float
hashCode
open fun hashCode(): Int
isEmpty
fun isEmpty(): Boolean
Whether this size encloses a nonzero area.
Negative areas are considered empty.
minus
operator fun minus(other: Offset): Size
Binary subtraction operator for Size.
Subtracting a Size from a Size returns the Offset that describes how
much bigger the lefthandside operand is than the righthandside
operand. Adding that resulting Offset to the Size that was the
righthandside operand would return a Size equal to the Size that was
the lefthandside operand. (i.e. if sizeA  sizeB > offsetA
, then
offsetA + sizeB > sizeA
)
Subtracting an Offset from a Size returns the Size that is smaller than the Size operand by the difference given by the Offset operand. In other words, the returned Size has a width consisting of the width of the lefthandside operand minus the Offset.dx dimension of the righthandside operand, and a height consisting of the height of the lefthandside operand minus the Offset.dy dimension of the righthandside operand.
plus
operator fun plus(other: Offset): Size
Binary addition operator for adding an Offset to a Size.
Returns a Size whose width is the sum of the width of the lefthandside operand, a Size, and the Offset.dx dimension of the righthandside operand, an Offset, and whose height is the sum of the height of the lefthandside operand and the Offset.dy dimension of the righthandside operand.
rem
operator fun rem(operand: Float): Size
Modulo (remainder) operator.
Returns a Size whose dimensions are the remainder of dividing the lefthandside operand (a Size) by the scalar righthandside operand (a Float).
times
operator fun times(operand: Float): Size
Multiplication operator.
Returns a Size whose dimensions are the dimensions of the lefthandside operand (a Size) multiplied by the scalar righthandside operand (a Float).
toString
open fun toString(): String
topCenter
fun topCenter(origin: Offset): Offset
The offset to the center of the top edge of the rectangle described by the given offset (which is interpreted as the topleft corner) and this size.
See also Rect.topCenter.
topLeft
fun topLeft(origin: Offset): Offset
The offset to the intersection of the top and left edges of the rectangle described by the given Offset (which is interpreted as the topleft corner) and this Size.
See also Rect.topLeft.
topRight
fun topRight(origin: Offset): Offset
The offset to the intersection of the top and right edges of the rectangle described by the given offset (which is interpreted as the topleft corner) and this size.
See also Rect.topRight.
truncDiv
fun truncDiv(operand: Float): Size
Integer (truncating) division operator.
Returns a Size whose dimensions are the dimensions of the lefthandside operand (a Size) divided by the scalar righthandside operand (a Float), rounded towards zero.
Properties
dx
open val dx: Float
dy
open val dy: Float
height
val height: Float
width
val width: Float
Companion functions
fromRadius
fun fromRadius(radius: Float): Size
Creates a square Size whose width and height are twice the given dimension.
This is a square that contains a circle with the given radius.
See also:
 new Size.square, which creates a square with the given dimension.
lerp
fun lerp(
start: Size,
stop: Size,
fraction: Float
): Size?
Linearly interpolate between two sizes
The fraction argument represents position on the timeline, with 0.0 meaning that the interpolation has not started, returning start (or something equivalent to start), 1.0 meaning that the interpolation has finished, returning stop (or something equivalent to stop), and values in between meaning that the interpolation is at the relevant point on the timeline between start and stop. The interpolation can be extrapolated beyond 0.0 and 1.0, so negative values and values greater than 1.0 are valid (and can easily be generated by curves).
Values for fraction are usually obtained from an Animation, such as
an AnimationController
.
square
fun square(dimension: Float): Size
Creates a square Size whose width and height are the given dimension.
See also:
 new Size.fromRadius, which is more convenient when the available size is the radius of a circle.
Companion properties
infinite
val infinite: Size
A size whose width and height are infinite.
See also:
 isInfinite, which checks whether either dimension is infinite.
 isFinite, which checks whether both dimensions are finite.