Svg.bitmap.sample: def of gralha-svg-render@0.1.0.1 Import: import gralha-svg-render@0.1.0.1/svg.bend as Svg Lines 2311-2318 of gralha-svg-render@0.1.0.1/svg.bend: https://jend.leeeet.dev/read.txt?path=gralha-svg-render@0.1.0.1/svg.bend&start_line=2311&end_line=2318 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 def bitmap.sample(+raster: Raster, +p: Point, +center: Point, nearest: Bool) -> Img.Color: Raster{origin, step, width, height, depth, linear, pixels} = raster Point{x, y} = p Point{cx, cy} = center +w = U32.to_f32(width) +h = U32.to_f32(height) U.branch(Img.Color, nearest, _ => raster.pixel(raster, U.clamp(bitmap.nearest(cx), 0.0, (w - 1.0 : F32)), U.clamp(bitmap.nearest(cy), 0.0, (h - 1.0 : F32))), _ => raster.sample(raster, Point{U.clamp(cx, 0.5, (w - 0.5 : F32)), U.clamp(cy, 0.5, (h - 0.5 : F32))})) Uses (12): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=F32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=F32.sub https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.to_f32 https://jend.leeeet.dev/definition.txt?path=gralha-image@0.1.0.1/image.bend&name=Color https://jend.leeeet.dev/definition.txt?path=gralha-svg-render@0.1.0.1/svg.bend&name=Point https://jend.leeeet.dev/definition.txt?path=gralha-svg-render@0.1.0.1/svg.bend&name=Raster https://jend.leeeet.dev/definition.txt?path=gralha-svg-render@0.1.0.1/svg.bend&name=bitmap.nearest https://jend.leeeet.dev/definition.txt?path=gralha-svg-render@0.1.0.1/svg.bend&name=raster.pixel https://jend.leeeet.dev/definition.txt?path=gralha-svg-render@0.1.0.1/svg.bend&name=raster.sample https://jend.leeeet.dev/definition.txt?path=gralha-text-scan@0.1.0.1/scan.bend&name=branch https://jend.leeeet.dev/definition.txt?path=gralha-text-scan@0.1.0.1/scan.bend&name=clamp