Skip to main content

LcdMaskBuilder

Struct LcdMaskBuilder 

Source
pub struct LcdMaskBuilder { /* private fields */ }
Expand description

Accumulator for an LcdMask. Build the gray buffer with one or more with_paths calls (each opens an AGG rasterizer scope), then finalize to apply the 5-tap filter and produce the packed mask.

Implementations§

Source§

impl LcdMaskBuilder

Source

pub fn new(mask_w: u32, mask_h: u32) -> Self

Allocate a zeroed builder for an mask_w × mask_h output mask. The internal gray buffer is (3 × mask_w) × mask_h bytes.

Source

pub fn with_clip(self, clip: Option<(f64, f64, f64, f64)>) -> Self

Set a clip rectangle in screen-space (mask pixel coords). All subsequent with_paths calls render only inside the clip; pixels outside it stay zero in the gray buffer (and therefore produce zero coverage in the final filtered mask). Builder-style; chain after new.

Source

pub fn with_paths<F>(&mut self, transform: &TransAffine, f: F)
where F: FnOnce(&mut dyn FnMut(&mut PathStorage)),

Open an AGG rasterizer scope and let f add as many paths as it likes via the supplied &mut FnMut(&mut PathStorage). All paths share transform, with X supersampled by 3 inside the scope. Lifetimes prevent us from keeping the renderer alive across separate method calls (it borrows self.gray), so the closure pattern scopes the borrow precisely.

Source

pub fn finalize(self) -> LcdMask

Apply the 5-tap low-pass filter to the gray buffer and return the packed mask. Consumes the builder; callers usually composite the result via LcdBuffer::composite_mask or composite_lcd_mask.

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> 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, 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.