Image.pixels.set: def of gralha-image@0.1.0.1 Import: import gralha-image@0.1.0.1/image.bend as Image Lines 51-65 of gralha-image@0.1.0.1/image.bend: https://jend.leeeet.dev/read.txt?path=gralha-image@0.1.0.1/image.bend&start_line=51&end_line=65 import Base import gralha-text-scan@0.1.0.1/scan.bend as U def pixels.set(+pixels: Pixels, +depth: Nat, +x: U32, +y: U32, +col: Color) -> Pixels: match pixels: case Flat{c}: match depth: case 0n: Flat{col} case 1n+d: pixels.set(Quad{Flat{c}, Flat{c}, Flat{c}, Flat{c}}, 1n+d, x, y, col) case Quad{a, b, c, e}: match depth: case 0n: Flat{col} case 1n+d: +dd = d +half = U32.shln(1, dd) U.branch(Pixels, U32.is_lt(y, half), _ => U.branch(Pixels, U32.is_lt(x, half), _ => pixels.join(pixels.set(a, dd, x, y, col), b, c, e), _ => pixels.join(a, pixels.set(b, dd, (x - half : U32), y, col), c, e)), _ => U.branch(Pixels, U32.is_lt(x, half), _ => pixels.join(a, b, pixels.set(c, dd, x, (y - half : U32), col), e), _ => pixels.join(a, b, c, pixels.set(e, dd, (x - half : U32), (y - half : U32), col)))) Uses (9): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat 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_lt https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.shln https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.sub 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=pixels.join https://jend.leeeet.dev/definition.txt?path=gralha-text-scan@0.1.0.1/scan.bend&name=branch