def pixels.get
gralha-image@0.1.0.1 · image.bend:39
import gralha-image@0.1.0.1/image.bend as Image
import Base
import gralha-text-scan@0.1.0.1/scan.bend as U
39def pixels.get(xs: Pixels, +size: U32, +x: U32, +y: U32) -> Color:
40 match xs:
41 case Flat{c}: c
42 case Quad{a, b, c, d}:
43 +half = (size / 2 : U32)
44 pixels.get(U.choose(Pixels, U32.is_lt(y, half), U.choose(Pixels, U32.is_lt(x, half), a, b), U.choose(Pixels, U32.is_lt(x, half), c, d)), half, U32.mod(x, half), U32.mod(y, half))
45
46@unsafe