[][src]Struct druid_shell::ScaledArea

pub struct ScaledArea { /* fields omitted */ }

A specific area scaling state.

This holds the platform area size in pixels and the logical area size in display points.

The platform area size in pixels tends to be limited to integers and ScaledArea works under that assumption.

The logical area size in display points is an unrounded conversion, which means that it is often not limited to integers. This allows for accurate calculations of the platform area pixel boundaries from the logical area using a Scale.

Even though the logical area size can be fractional, the integer boundaries of that logical area will still match up with the platform area pixel boundaries as often as the scale factor allows.

A copy of ScaledArea will be stale as soon as the platform area size changes.

Implementations

impl ScaledArea[src]

pub fn from_px<T: Into<Size>>(size: T, scale: &Scale) -> ScaledArea[src]

Create a new scaled area from pixels.

pub fn from_dp<T: Into<Size>>(size: T, scale: &Scale) -> ScaledArea[src]

Create a new scaled area from display points.

The calculated size in pixels is rounded away from zero to integers. That means that the scaled area size in display points isn't always the same as the size given to this function. To find out the new size in points use size_dp.

pub fn size_dp(&self) -> Size[src]

Returns the scaled area size in display points.

pub fn size_px(&self) -> Size[src]

Returns the scaled area size in pixels.

Trait Implementations

impl Clone for ScaledArea[src]

impl Copy for ScaledArea[src]

impl Debug for ScaledArea[src]

impl Default for ScaledArea[src]

impl PartialEq<ScaledArea> for ScaledArea[src]

impl StructuralPartialEq for ScaledArea[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> RoundFrom<T> for T

impl<T, U> RoundInto<U> for T where
    U: RoundFrom<T>, 

impl<T> Sealed<T> for T where
    T: ?Sized

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.