Skip to main content

MaskSource

Trait MaskSource 

Source
pub trait MaskSource: Send {
    // Required method
    fn get_row(&mut self, y: u32, row_buf: &mut [u8]);
}
Expand description

Caller-supplied source for a 1-bit image mask: one row at a time.

Each row is delivered as MSB-first packed bytes: src_width.div_ceil(8) bytes per row. Bit 7 of the first byte is the leftmost pixel; bit 0 of the last byte is the rightmost (with unused padding bits set to 0).

The mask is immediately unpacked to one u8 per pixel (0 or 255) for simpler scaling arithmetic, matching the C++ scaleMask convention.

Matches SplashImageMaskSource from splash/SplashTypes.h.

Required Methods§

Source

fn get_row(&mut self, y: u32, row_buf: &mut [u8])

Fill row_buf with 1-bit packed mono mask data (MSB-first).

row_buf.len() equals src_width.div_ceil(8). Implementors must write every byte; unused padding bits in the final byte should be 0.

Implementors§