Skip to main content

sample

Function sample 

Source
fn sample<F>(
    coord: i32,
    size: u16,
    edge_mode: EdgeMode,
    sample_fn: F,
) -> PremulRgba8
where F: FnOnce(u16) -> PremulRgba8,
Expand description

Sample a pixel with edge mode handling (generic implementation).

Handles both horizontal and vertical sampling based on the provided closure. The sample_fn closure receives the clamped/extended coordinate and returns the pixel. For EdgeMode::None, returns transparent black if the coordinate is out of bounds.