SizeFCompat
class SizeFCompat
Immutable class for describing width and height dimensions in some arbitrary unit. Width and height are finite values stored as a floating point representation.
This is a backward-compatible version of SizeF.
Summary
Public constructors |
|---|
SizeFCompat(width: Float, height: Float) |
Public functions |
|
|---|---|
Boolean |
|
Float |
Get the height of the size (as an arbitrary unit). |
Float |
getWidth()Get the width of the size (as an arbitrary unit). |
Int |
hashCode() |
SizeF |
@RequiresApi(value = 21)Converts this |
java-static SizeFCompat |
@RequiresApi(value = 21)Converts this |
String |
toString() |
Extension functions |
|
|---|---|
inline operator Float |
Returns "width", the first component of this |
inline operator Float |
Returns "height", the second component of this |
Public constructors
Public functions
getHeight
fun getHeight(): Float
Get the height of the size (as an arbitrary unit).
| Returns | |
|---|---|
Float |
height |
getWidth
fun getWidth(): Float
Get the width of the size (as an arbitrary unit).
| Returns | |
|---|---|
Float |
width |
toSizeF
@RequiresApi(value = 21)
fun toSizeF(): SizeF
Converts this SizeFCompat into a SizeF.
toSizeFCompat
@RequiresApi(value = 21)
java-static fun toSizeFCompat(size: SizeF): SizeFCompat
Converts this SizeF into a SizeFCompat.
Extension functions
component1
inline operator fun SizeFCompat.component1(): Float
Returns "width", the first component of this SizeFCompat.
This method allows to use destructuring declarations when working with sizes, for example:
val (w, h) = mySize
component2
inline operator fun SizeFCompat.component2(): Float
Returns "height", the second component of this SizeFCompat.
This method allows to use destructuring declarations when working with sizes, for example:
val (w, h) = mySize