Scalable

Trait Scalable 

Source
pub trait Scalable {
    // Required methods
    fn to_px(&self, scale: Scale) -> Self;
    fn to_dp(&self, scale: Scale) -> Self;
}
Expand description

The Scalable trait describes how coordinates should be translated from display points into pixels and vice versa using a Scale.

Required Methods§

Source

fn to_px(&self, scale: Scale) -> Self

Converts the scalable item from display points into pixels, using the x axis scale factor for coordinates on the x axis and the y axis scale factor for coordinates on the y axis.

Source

fn to_dp(&self, scale: Scale) -> Self

Converts the scalable item from pixels into display points, using the x axis scale factor for coordinates on the x axis and the y axis scale factor for coordinates on the y axis.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Scalable for Insets

Source§

fn to_px(&self, scale: Scale) -> Insets

Converts Insets from display points into pixels, using the x axis scale factor for x0 and x1 and the y axis scale factor for y0 and y1.

Source§

fn to_dp(&self, scale: Scale) -> Insets

Converts Insets from pixels into display points, using the x axis scale factor for x0 and x1 and the y axis scale factor for y0 and y1.

Source§

impl Scalable for Line

Source§

fn to_px(&self, scale: Scale) -> Line

Converts a Line from display points into pixels, using the x axis scale factor for x and the y axis scale factor for y.

Source§

fn to_dp(&self, scale: Scale) -> Line

Converts a Line from pixels into display points, using the x axis scale factor for x and the y axis scale factor for y.

Source§

impl Scalable for Point

Source§

fn to_px(&self, scale: Scale) -> Point

Converts a Point from display points into pixels, using the x axis scale factor for x and the y axis scale factor for y.

Source§

fn to_dp(&self, scale: Scale) -> Point

Converts a Point from pixels into display points, using the x axis scale factor for x and the y axis scale factor for y.

Source§

impl Scalable for Rect

Source§

fn to_px(&self, scale: Scale) -> Rect

Converts a Rect from display points into pixels, using the x axis scale factor for x0 and x1 and the y axis scale factor for y0 and y1.

Source§

fn to_dp(&self, scale: Scale) -> Rect

Converts a Rect from pixels into display points, using the x axis scale factor for x0 and x1 and the y axis scale factor for y0 and y1.

Source§

impl Scalable for Size

Source§

fn to_px(&self, scale: Scale) -> Size

Converts a Size from display points into pixels, using the x axis scale factor for width and the y axis scale factor for height.

Source§

fn to_dp(&self, scale: Scale) -> Size

Converts a Size from pixels into points, using the x axis scale factor for width and the y axis scale factor for height.

Source§

impl Scalable for Vec2

Source§

fn to_px(&self, scale: Scale) -> Vec2

Converts a Vec2 from display points into pixels, using the x axis scale factor for x and the y axis scale factor for y.

Source§

fn to_dp(&self, scale: Scale) -> Vec2

Converts a Vec2 from pixels into display points, using the x axis scale factor for x and the y axis scale factor for y.

Implementors§