Svg.raster.format: def of gralha-svg-render@0.1.0.1 Import: import gralha-svg-render@0.1.0.1/svg.bend as Svg Lines 4018-4029 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=4018&end_line=4029 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 raster.format(box: Bounds, requested: F32) -> Raster: Bounds{x0, y0, x1, y1} = box +x = x0 +y = y0 +right = x1 +bottom = y1 +step = U.max(U.max(requested, 0.000001), (U.max((right - x : F32), (bottom - y : F32)) / 1022.0 : F32)) +ox = (F32.floor((x / step : F32)) * step : F32) +oy = (F32.floor((y / step : F32)) * step : F32) +w = F32.to_u32(U.clamp(F32.ceil(((right - ox) / step : F32)), 0.0, 1024.0)) +h = F32.to_u32(U.clamp(F32.ceil(((bottom - oy) / step : F32)), 0.0, 1024.0)) Raster{Point{ox, oy}, step, w, h, raster.depth(U.choose(U32, U32.is_gt(w, h), w, h), 1, 0n), False{}, Img.Flat{Img.clear()}} Uses (19): 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.ceil https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=F32.div https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=F32.floor https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=F32.mul https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=F32.sub https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=F32.to_u32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.is_gt https://jend.leeeet.dev/definition.txt?path=gralha-image@0.1.0.1/image.bend&name=Pixels https://jend.leeeet.dev/definition.txt?path=gralha-image@0.1.0.1/image.bend&name=clear https://jend.leeeet.dev/definition.txt?path=gralha-svg-render@0.1.0.1/svg.bend&name=Bounds 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=raster.depth https://jend.leeeet.dev/definition.txt?path=gralha-text-scan@0.1.0.1/scan.bend&name=choose https://jend.leeeet.dev/definition.txt?path=gralha-text-scan@0.1.0.1/scan.bend&name=clamp https://jend.leeeet.dev/definition.txt?path=gralha-text-scan@0.1.0.1/scan.bend&name=max