def raster.pixel

gralha-svg-render@0.1.0.1 · svg.bend:2250

import gralha-svg-render@0.1.0.1/svg.bend as Svg
import Base
import gralha-text-scan@0.1.0.1/scan.bend as U
import gralha-image@0.1.0.1/image.bend as Img

2250def raster.pixel(+r: Raster, +x: F32, +y: F32) -> Img.Color:
2251  Raster{origin, step, width, height, depth, pixelsLinear, pixels} = r
2252  U.branch(Img.Color, F32.is_ge(x, 0.0) && F32.is_ge(y, 0.0) && F32.is_lt(x, U32.to_f32(width)) && F32.is_lt(y, U32.to_f32(height)),
2253    _ => Img.pixels.get(pixels, U32.shln(1, depth), F32.to_u32(x), F32.to_u32(y)), _ => Img.clear())

Uses (12)

Used by (3)