Skip to main content

Quad

Struct Quad 

Source
#[repr(C)]
pub struct Quad { pub rect: Rect, pub color: Color, pub border_color: Color, pub radius: [f32; 4], pub border_w: f32, pub blur: f32, pub kind: QuadKind, pub clip: ClipId, pub uv: [u32; 4], }

Fields§

§rect: Rect

Physical pixels.

§color: Color§border_color: Color§radius: [f32; 4]

Corner radii in physical pixels, clockwise from the top-left: [tl, tr, br, bl].

§border_w: f32§blur: f32

QuadKind::Shadow only: the blur radius in physical pixels, which is also how far rect is inflated past the shape being blurred. Zero elsewhere.

§kind: QuadKind§clip: ClipId

Which entry of DisplayList::clips clips this quad: pixels outside that rect — and outside its rounded corners, when it has any — are discarded.

An index rather than the clip itself because a clip is thirty-two bytes and a frame has a handful of them: every quad under one card names the same entry, and a frame that clips nothing names one entry from every quad it has. Carrying the rect and its four radii on the quad cost 32 of the 124 bytes each, on a struct written once per quad and then walked again by the fade pass, the backend’s upload and the previous frame depart keeps. The same reasoning put a fragment’s parameters in DisplayList::fragments.

§uv: [u32; 4]

Atlas texels: x, y, w, h. For QuadKind::Segment the two endpoints instead, as f32 bits (see Quad::segment_ends).

Implementations§

Source§

impl Quad

Source

pub fn segment_ends(&self) -> [f32; 4]

A QuadKind::Segment’s endpoints, [x0, y0, x1, y1] in physical px, decoded from the bits uv carries. Meaningless for any other kind.

Source

pub fn segment_uv(ends: [f32; 4]) -> [u32; 4]

The uv a QuadKind::Segment carries for these endpoints.

Trait Implementations§

Source§

impl Clone for Quad

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for Quad

Source§

impl Debug for Quad

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Quad

§

impl RefUnwindSafe for Quad

§

impl Send for Quad

§

impl Sync for Quad

§

impl Unpin for Quad

§

impl UnsafeUnpin for Quad

§

impl UnwindSafe for Quad

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.