def raster.scene.tiles
import gralha-svg-render@0.1.0.1/svg.bend as Svgimport Base
import gralha-text-scan@0.1.0.1/scan.bend as U
import gralha-image@0.1.0.1/image.bend as Img
4064def raster.scene.tiles(depth: Nat, +x: U32, +y: U32, +format: Raster, +nodes: List<&2, Scene<Brush>>, +box: Bounds, +aa: U32) -> Img.Pixels:
4065 match depth:
4066 case 0n:
4067 U.branch(Img.Pixels, raster.in.frame(format, x, y) && bounds.overlap(box, raster.tile.box(format, x, y, 1)),
4068 _ => Img.Flat{raster.scene.pixel(format, x, y, nodes, aa)}, _ => Img.Flat{Img.clear()})
4069 case 1n+d:
4070 +dd = d
4071 +half = U32.shln(1, dd)
4072 U.branch(Img.Pixels, raster.in.frame(format, x, y) && bounds.overlap(box, raster.tile.box(format, x, y, (half * 2 : U32))),
4073 _ => Img.pixels.join(raster.scene.tiles(dd, x, y, format, nodes, box, aa), raster.scene.tiles(dd, (x + half : U32), y, format, nodes, box, aa), raster.scene.tiles(dd, x, (y + half : U32), format, nodes, box, aa), raster.scene.tiles(dd, (x + half : U32), (y + half : U32), format, nodes, box, aa)), _ => Img.Flat{Img.clear()})