Svg.filter.draw.pixel: def of gralha-svg-render@0.1.0.1 Import: import gralha-svg-render@0.1.0.1/svg.bend as Svg Lines 4789-4796 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=4789&end_line=4796 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 filter.draw.pixel(+format: Raster, +x: U32, +y: U32, op: FilterOp, a: FilterInput, b: FilterInput, +window: FilterWindow, linear: Bool, +aa: U32, span: U32) -> Img.Pixels: +c = filter.op.sample(op, a, b, raster.position(format, (U32.to_f32(x) + 0.5 : F32), (U32.to_f32(y) + 0.5 : F32)), linear) # Intermediate offscreens include each pixel intersecting the hard clipping # region; the final filter region clips by the pixel's covered fraction. +covered = U.branch(F32, filter.window.exact(window) && filter.window.aligned(window), _ => filter.window.area(window, raster.tile.box(format, x, y, 1)), _ => (filter.window.samples(U32.to_nat((aa * aa : U32)), 0, aa, window, raster.position(format, U32.to_f32(x), U32.to_f32(y)), (raster.scale(format) / U32.to_f32(aa) : F32), 0.0) / U32.to_f32((aa * aa : U32)) : F32)) Img.Flat{U.branch(Img.Color, U32.is_eq(span, 1), _ => c, _ => U.choose(Img.Color, filter.window.exact(window), color.fade(c, covered), U.choose(Img.Color, F32.is_gt(covered, 0.0), c, Img.clear())))} Uses (29): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool.and https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=F32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=F32.add 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.is_gt 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_eq https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.mul https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.to_f32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.to_nat 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-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=FilterInput https://jend.leeeet.dev/definition.txt?path=gralha-svg-render@0.1.0.1/svg.bend&name=FilterOp https://jend.leeeet.dev/definition.txt?path=gralha-svg-render@0.1.0.1/svg.bend&name=FilterWindow 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=color.fade https://jend.leeeet.dev/definition.txt?path=gralha-svg-render@0.1.0.1/svg.bend&name=filter.op.sample https://jend.leeeet.dev/definition.txt?path=gralha-svg-render@0.1.0.1/svg.bend&name=filter.window.aligned https://jend.leeeet.dev/definition.txt?path=gralha-svg-render@0.1.0.1/svg.bend&name=filter.window.area https://jend.leeeet.dev/definition.txt?path=gralha-svg-render@0.1.0.1/svg.bend&name=filter.window.exact https://jend.leeeet.dev/definition.txt?path=gralha-svg-render@0.1.0.1/svg.bend&name=filter.window.samples https://jend.leeeet.dev/definition.txt?path=gralha-svg-render@0.1.0.1/svg.bend&name=raster.position https://jend.leeeet.dev/definition.txt?path=gralha-svg-render@0.1.0.1/svg.bend&name=raster.scale https://jend.leeeet.dev/definition.txt?path=gralha-svg-render@0.1.0.1/svg.bend&name=raster.tile.box 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=choose