def png.pass

gralha-png-decode@0.1.0.1 · png.bend:121

import gralha-png-decode@0.1.0.1/png.bend as Png
import Base
import gralha-text-scan@0.1.0.1/scan.bend as U

121def png.pass(+w: U32, +h: U32, bits: U32, channels: U32, +index: U32, +interlaced: Bool, offset: U32) -> PNGPass:
122  +x = U.choose(U32, interlaced, U.uints.nth(Con{0, Con{4, Con{0, Con{2, Con{0, Con{1, Con{0, Nil{}}}}}}}}, U32.to_nat(index), 0), 0)
123  +y = U.choose(U32, interlaced, U.uints.nth(Con{0, Con{0, Con{4, Con{0, Con{2, Con{0, Con{1, Nil{}}}}}}}}, U32.to_nat(index), 0), 0)
124  +dx = U.choose(U32, interlaced, U.uints.nth(Con{8, Con{8, Con{4, Con{4, Con{2, Con{2, Con{1, Nil{}}}}}}}}, U32.to_nat(index), 1), 1)
125  +dy = U.choose(U32, interlaced, U.uints.nth(Con{8, Con{8, Con{8, Con{4, Con{4, Con{2, Con{2, Nil{}}}}}}}}, U32.to_nat(index), 1), 1)
126  +width = png.pass.size(w, x, dx)
127  PNGPass{width, png.pass.size(h, y, dy), x, y, dx, dy, ((width * channels * bits + 7) / 8 : U32), offset}

Uses (11)

Used by (1)