Skip to main content

ShapeRecord

Struct ShapeRecord 

Source
#[repr(C)]
pub struct ShapeRecord { pub rect: [f32; 4], pub radii: [f32; 4], pub color: [f32; 4], pub stroke_width: f32, pub flags: u32, pub brush: u32, pub reserved: u32, pub arc: [f32; 4], pub arc_band: [f32; 4], pub arc_normalized: [f32; 4], }
Expand description

One complete recorded shape in the draw command’s local space. Every value the app passed is kept verbatim, so the record materialises back into the exact DrawPrimitive the call described, and the derived arc values the fragment stage needs sit beside them.

Fields§

§rect: [f32; 4]

The primitive’s rect: the app’s rect for rects; for arcs the band’s tight bounds, or, when Self::has_loose_rect, the disc around the band that the tight bounds are derived from on demand.

§radii: [f32; 4]

Rects: the corner radii, top-left, top-right, bottom-right, bottom-left. Arcs: the band’s trig, see arc_trig.

§color: [f32; 4]

The solid colour, or the first stop of a gradient brush.

§stroke_width: f32

The stroke width when Self::is_stroked.

§flags: u32

Kind, stroke, cap, join, blend mode and arc facts, packed; read them through the accessors.

§brush: u32

0 for a solid brush, otherwise one plus the index into the recording’s brush table.

§reserved: u32

Keeps the record at a whole number of 16-byte rows.

§arc: [f32; 4]

Arcs: centre x, centre y, radius and inner radius as the app drew them.

§arc_band: [f32; 4]

Arcs: start angle and sweep as the app drew them, then the normalised band’s inner and outer radius.

§arc_normalized: [f32; 4]

Arcs: the normalised start angle and sweep, then where the band’s strip starts and the padded sweep it covers.

Implementations§

Source§

impl ShapeRecord

Source

pub fn kind(&self) -> u32

Source

pub fn is_stroked(&self) -> bool

Source

pub fn fragment_kind(&self) -> u32

Which coverage program the fragment stage runs for this record.

Source

pub fn stroke(&self) -> Option<Stroke>

Source

pub fn blend_mode(&self) -> BlendMode

Source

pub fn band_cap(&self) -> StrokeCap

The cap of the normalised arc band.

Source

pub fn is_degenerate_arc(&self) -> bool

An arc whose band draws nothing: zero sweep, zero width or a non-finite input. The GPU path collapses it; the primitive still materialises as the app drew it.

Source

pub fn is_gradient(&self) -> bool

Source

pub fn is_banded(&self) -> bool

An arc wide enough to draw as a band strip from the vertex stage; its band class sits in its flags.

Source

pub fn band_class(&self) -> usize

The band class this record was filed in: the index into ARC_BUCKET_SEGMENTS of the strip segments it draws with when Self::is_banded, zero otherwise.

Source

pub fn band_segments(&self) -> u32

The strip segments this record draws with when Self::is_banded.

Source

pub fn has_loose_rect(&self) -> bool

An arc recorded by the draw scope: its rect is the disc around the band, and the tight cap-aware bounds the primitive carries are derived when asked for, never on the recording path.

Source

pub fn stored_rect(&self) -> Rect

The rect as stored: loose for a scope-recorded arc.

Source

pub fn rect_value(&self) -> Rect

The rect the materialised primitive carries: the tight band bounds for a scope-recorded arc, the stored rect otherwise.

Source

pub fn coverage_rect(&self) -> Rect

The rect this record’s pixels can reach: its rect grown by half the stroke width.

Source

pub fn arc_geometry(&self) -> Option<ArcGeometry>

The normalised band the fragment stage draws; None for rects.

Trait Implementations§

Source§

impl Clone for ShapeRecord

Source§

fn clone(&self) -> ShapeRecord

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 ShapeRecord

Source§

impl Debug for ShapeRecord

Source§

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

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

impl PartialEq for ShapeRecord

Source§

fn eq(&self, other: &ShapeRecord) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl Pod for ShapeRecord

Source§

impl StructuralPartialEq for ShapeRecord

Source§

impl Zeroable for ShapeRecord

Source§

fn zeroed() -> Self

Auto Trait Implementations§

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> AnyBitPattern for T
where T: Pod,

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<T> CheckedBitPattern for T
where T: AnyBitPattern,

Source§

type Bits = T

Self must have the same layout as the specified Bits except for the possible invalid bit patterns being checked during is_valid_bit_pattern.
Source§

fn is_valid_bit_pattern(_bits: &T) -> bool

If this function returns true, then it must be valid to reinterpret bits as &Self.
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> NoUninit for T
where T: Pod,

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.