Trait figures::ScreenScale

source ·
pub trait ScreenScale {
    type Px;
    type UPx;
    type Lp;

    // Required methods
    fn into_px(self, scale: Fraction) -> Self::Px;
    fn from_px(px: Self::Px, scale: Fraction) -> Self;
    fn into_upx(self, scale: Fraction) -> Self::UPx;
    fn from_upx(px: Self::UPx, scale: Fraction) -> Self;
    fn into_lp(self, scale: Fraction) -> Self::Lp;
    fn from_lp(lp: Self::Lp, scale: Fraction) -> Self;
}
Expand description

Converts this type into its measurement in Px and Lp.

Required Associated Types§

source

type Px

This type when measuring with Px.

source

type UPx

This type when measuring with UPx.

source

type Lp

This type when measuring with Lp.

Required Methods§

source

fn into_px(self, scale: Fraction) -> Self::Px

Converts this value from its current unit into device pixels (Px) using the provided scale factor.

source

fn from_px(px: Self::Px, scale: Fraction) -> Self

Converts from pixels into this type, using the provided scale factor.

source

fn into_upx(self, scale: Fraction) -> Self::UPx

Converts this value from its current unit into device pixels (UPx) using the provided scale factor.

source

fn from_upx(px: Self::UPx, scale: Fraction) -> Self

Converts from unsigned pixels into this type, using the provided scale factor.

source

fn into_lp(self, scale: Fraction) -> Self::Lp

Converts this value from its current unit into device independent pixels (Lp) using the provided scale factor.

source

fn from_lp(lp: Self::Lp, scale: Fraction) -> Self

Converts from Lp into this type, using the provided scale factor.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl ScreenScale for Lp

§

type Lp = Lp

§

type Px = Px

§

type UPx = UPx

source§

impl ScreenScale for Px

§

type Lp = Lp

§

type Px = Px

§

type UPx = UPx

source§

impl ScreenScale for UPx

§

type Lp = Lp

§

type Px = Px

§

type UPx = UPx

source§

impl<Unit> ScreenScale for Point<Unit>where Unit: ScreenScale<Lp = Lp, Px = Px, UPx = UPx>,

§

type Lp = Point<Lp>

§

type Px = Point<Px>

§

type UPx = Point<UPx>

source§

impl<Unit> ScreenScale for Size<Unit>where Unit: ScreenScale<Lp = Lp, Px = Px, UPx = UPx>,

§

type Lp = Size<Lp>

§

type Px = Size<Px>

§

type UPx = Size<UPx>