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
impl LcdMaskBuilder
Sourcepub fn new(mask_w: u32, mask_h: u32) -> Self
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.
Sourcepub fn with_clip(self, clip: Option<(f64, f64, f64, f64)>) -> Self
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.
Sourcepub fn with_paths<F>(&mut self, transform: &TransAffine, f: F)
pub fn with_paths<F>(&mut self, transform: &TransAffine, f: F)
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.
Sourcepub fn finalize(self) -> LcdMask
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.