zng::layout

Type Alias PxCornerRadius

Source
pub type PxCornerRadius = CornerRadius2D<Px, Px>;
Expand description

Corner-radius in device pixels.

Aliased Type§

struct PxCornerRadius {
    pub top_left: Size2D<Px, Px>,
    pub top_right: Size2D<Px, Px>,
    pub bottom_right: Size2D<Px, Px>,
    pub bottom_left: Size2D<Px, Px>,
}

Fields§

§top_left: Size2D<Px, Px>

Top-left corner radius.

§top_right: Size2D<Px, Px>

Top-right corner radius.

§bottom_right: Size2D<Px, Px>

Bottom-right corner radius.

§bottom_left: Size2D<Px, Px>

Bottom-left corner radius.

Implementations

Source§

impl<T, U> CornerRadius2D<T, U>
where T: Copy + Zero,

Source

pub fn new( top_left: Size2D<T, U>, top_right: Size2D<T, U>, bottom_right: Size2D<T, U>, bottom_left: Size2D<T, U>, ) -> CornerRadius2D<T, U>

New with distinct values.

Source

pub fn new_all(radius: Size2D<T, U>) -> CornerRadius2D<T, U>

New all corners same radius.

Source

pub fn zero() -> CornerRadius2D<T, U>

All zeros.

Source

pub fn inflate(self, offsets: SideOffsets2D<T, U>) -> CornerRadius2D<T, U>
where T: AddAssign,

Calculate the corner radius of an outer border around self to perfectly fit.

Source

pub fn deflate(self, offsets: SideOffsets2D<T, U>) -> CornerRadius2D<T, U>
where T: SubAssign + PartialOrd,

Calculate the corner radius of an inner border inside self to perfectly fit.

Trait Implementations

Source§

impl<T, U> Clone for CornerRadius2D<T, U>
where T: Clone,

Source§

fn clone(&self) -> CornerRadius2D<T, U>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T, U> Debug for CornerRadius2D<T, U>
where T: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<T, U> Default for CornerRadius2D<T, U>
where T: Default,

Source§

fn default() -> CornerRadius2D<T, U>

Returns the “default value” for a type. Read more
Source§

impl<'de, T, U> Deserialize<'de> for CornerRadius2D<T, U>
where T: Deserialize<'de>,

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<CornerRadius2D<T, U>, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl IntoVar<CornerRadius> for CornerRadius2D<Px, Px>

Source§

fn into_var(self) -> <CornerRadius2D<Px, Px> as IntoVar<CornerRadius>>::Var

From layout corner-radius.

Source§

type Var = LocalVar<CornerRadius>

Variable type that will wrap the T value. Read more
Source§

fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>
where Self: Sized,

Converts into BoxedVar<T>. Read more
Source§

impl<T, U> PartialEq for CornerRadius2D<T, U>
where T: PartialEq,

Source§

fn eq(&self, other: &CornerRadius2D<T, U>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PxToDip for CornerRadius2D<Px, Px>

Source§

type AsDip = CornerRadius2D<Dip, Dip>

Self equivalent in Dip units.
Source§

fn to_dip( self, scale_factor: Factor, ) -> <CornerRadius2D<Px, Px> as PxToDip>::AsDip

Divide the Px self by the scale.
Source§

impl PxToWr for CornerRadius2D<Px, Px>

Source§

fn to_wr(self) -> BorderRadius

Convert to webrender border radius.

Source§

type AsLayout = BorderRadius

Self equivalent in webrender::units::LayoutPixel units.
Source§

type AsDevice = ()

Self equivalent in webrender::units::DevicePixel units.
Source§

type AsWorld = ()

Self equivalent in `webrender::units::WorldPixel units.
Source§

fn to_wr_device(self) -> <CornerRadius2D<Px, Px> as PxToWr>::AsDevice

Returns self in webrender::units::DevicePixel units.
Source§

fn to_wr_world(self) -> <CornerRadius2D<Px, Px> as PxToWr>::AsWorld

Returns self in webrender::units::WorldPixel units.
Source§

impl<T, U> Serialize for CornerRadius2D<T, U>
where T: Serialize,

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<T, U> Transitionable for CornerRadius2D<T, U>
where T: Transitionable, U: Send + Sync + Any,

Source§

fn lerp(self, to: &CornerRadius2D<T, U>, step: Factor) -> CornerRadius2D<T, U>

Sample the linear interpolation from self -> to by step.
Source§

impl<T, U> Copy for CornerRadius2D<T, U>
where T: Copy,

Source§

impl<T, U> Eq for CornerRadius2D<T, U>
where T: Eq,

Source§

impl IntoValue<CornerRadius> for CornerRadius2D<Px, Px>