Skip to content

Size

Size #

A 2D size with width and height.

aspect_ratio #

aspect_ratio: float

Returns the aspect ratio (width / height).

height #

height: Number

width #

width: Number

copy #

copy(source: Size) -> Size

Creates a copy of the given Size object.

copy_with #

copy_with(
    *,
    width: Number | None = None,
    height: Number | None = None,
) -> Size

Returns a copy of this object with the specified properties overridden.

from_height #

from_height(height: Number) -> Size

Creates a Size with the given height and an infinite width.

from_radius #

from_radius(radius: Number) -> Size

Creates a square Size whose width and height are twice the given radius.

from_width #

from_width(width: Number) -> Size

Creates a Size with the given width and an infinite height.

infinite #

infinite()

is_finite #

is_finite() -> bool

Checks if both dimensions are finite.

is_infinite #

is_infinite() -> bool

Checks if either dimension is infinite.

square #

square(dimension: Number) -> Size

Creates a square Size where width and height are the same.

zero #

zero()