def image.of

gralha-svg-render@0.1.0.1 · svg.bend:5819

import gralha-svg-render@0.1.0.1/svg.bend as Svg
import Base

5819def image.of(a: Array<U32>, depth: Nat, +x: U32, +y: U32, +side: U32, next: Array<U32> -> Image -> Image) -> Image:
5820  match depth:
5821    case 0n: packed.then(Image, Array.get(U32, a, (y * side + x : U32)), a1 => v => next(a1)(Pix{v}))
5822    case 1n+d:
5823      +dd = d
5824      +half = U32.shln(1, dd)
5825      image.of(a, dd, x, y, side, a1 => ia => image.of(a1, dd, (x + half : U32), y, side, a2 => ib => image.of(a2, dd, x, (y + half : U32), side,
5826        a3 => ic => image.of(a3, dd, (x + half : U32), (y + half : U32), side, a4 => id => next(a4)(Qua{ia, ib, ic, id})))))

Uses (9)

Used by (1)