Struct Wide

Source
pub struct Wide<const MODE: u8 = MODE_CPU> {
    pub width: u16,
    pub height: u16,
    pub tiles: Vec<WideTile<MODE>>,
    layer_stack: Vec<Layer>,
    clip_stack: Vec<Clip>,
}
Expand description

A container for wide tiles.

Fields§

§width: u16

The width of the container.

§height: u16

The height of the container.

§tiles: Vec<WideTile<MODE>>

The wide tiles in the container.

§layer_stack: Vec<Layer>

The stack of layers.

§clip_stack: Vec<Clip>

The stack of active clip regions.

Implementations§

Source§

impl Wide<MODE_CPU>

Source

pub fn new(width: u16, height: u16) -> Self

Create a new container for wide tiles.

Source§

impl Wide<MODE_HYBRID>

Source

pub fn new(width: u16, height: u16) -> Self

Create a new container for wide tiles.

Source§

impl<const MODE: u8> Wide<MODE>

Source

fn new_internal(width: u16, height: u16) -> Self

Create a new container for wide tiles.

Source

pub fn has_layers(&self) -> bool

Whether there are any existing layers that haven’t been popped yet.

Source

pub fn reset(&mut self)

Reset all tiles in the container.

Source

pub fn width_tiles(&self) -> u16

Return the number of horizontal tiles.

Source

pub fn height_tiles(&self) -> u16

Return the number of vertical tiles.

Source

pub fn get(&self, x: u16, y: u16) -> &WideTile<MODE>

Get the wide tile at a certain index.

Panics if the index is out-of-range.

Source

pub fn get_mut(&mut self, x: u16, y: u16) -> &mut WideTile<MODE>

Get mutable access to the wide tile at a certain index.

Panics if the index is out-of-range.

Source

pub fn tiles(&self) -> &[WideTile<MODE>]

Return a reference to all wide tiles.

Source

pub fn generate( &mut self, strip_buf: &[Strip], fill_rule: Fill, paint: Paint, thread_idx: u8, )

Generate wide tile commands from the strip buffer.

This method processes a buffer of strips that represent a path, applies the fill rule, and generates appropriate drawing commands for each affected wide tile.

§Algorithm overview:
  1. For each strip in the buffer:
    • Calculate its position and width in pixels
    • Determine which wide tiles the strip intersects
    • Generate alpha fill commands for the intersected wide tiles
  2. For active fill regions (determined by fill rule):
    • Generate solid fill commands for the regions between strips
Source

pub fn push_layer( &mut self, clip_path: Option<(impl Into<Box<[Strip]>>, Fill)>, blend_mode: BlendMode, mask: Option<Mask>, opacity: f32, thread_idx: u8, )

Push a new layer with the given properties.

Source

pub fn pop_layer(&mut self)

Pop a previously pushed layer.

Source

pub fn push_clip( &mut self, strips: impl Into<Box<[Strip]>>, fill_rule: Fill, thread_idx: u8, )

Adds a clipping region defined by the provided strips.

This method takes a vector of strips representing a clip path, calculates the intersection with the current clip region, and updates the clip stack.

§Algorithm overview:
  1. Calculate bounding box of the clip path
  2. Intersect with current clip bounding box
  3. For each tile in the intersected bounding box:
    • If covered by zero winding: push_zero_clip
    • If fully covered by non-zero winding: do nothing (clip is a no-op)
    • If partially covered: push_clip
Source

fn get_bbox(&self) -> Bbox

Get the bounding box of the current clip region or the entire viewport if no clip regions are active.

Source

fn pop_clip(&mut self)

Removes the most recently added clip region.

This is the inverse operation of push_clip, carefully undoing all the clipping operations while also handling any rendering needed for the clip region itself.

§Algorithm overview:
  1. Retrieve the top clip from the stack
  2. For each wide tile in the clip’s bounding box:
    • If covered by zero winding: pop_zero_clip
    • If fully covered by non-zero winding: do nothing (was no-op)
    • If partially covered: render the clip and pop_clip

This operation must be symmetric with push_clip to maintain a balanced clip stack.

Trait Implementations§

Source§

impl<const MODE: u8> Debug for Wide<MODE>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<const MODE: u8> Freeze for Wide<MODE>

§

impl<const MODE: u8> RefUnwindSafe for Wide<MODE>

§

impl<const MODE: u8> Send for Wide<MODE>

§

impl<const MODE: u8> Sync for Wide<MODE>

§

impl<const MODE: u8> Unpin for Wide<MODE>

§

impl<const MODE: u8> UnwindSafe for Wide<MODE>

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<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, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(value: T, _simd: S) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.