def png.inflate

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

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
import gralha-bytes@0.1.0.1/bytes.bend as Bin
import gralha-image@0.1.0.1/image.bend as Img

181def png.inflate(result: Maybe<&2, Bin.Bytes>, +info: PNGInfo, passes: List<&2, PNGPass>) -> Img.Picture:
182  match result:
183    case None{}: Img.Picture{0, 0, 0n, Img.Flat{Img.clear()}}
184    case Some{raw}:
185      PNGInfo{w, h, depth, kind, interlace, palette, alpha, compressed, valid} = info
186      +dd = Img.picture.depth(U.choose(U32, U32.is_gt(w, h), w, h), 1, 0n)
187      png.raster(png.decode.passes(passes, info, raw, U.choose(U32, U32.is_lt(depth, 8), 1, (png.channels(kind) * depth / 8 : U32)), dd, Img.Flat{Img.clear()}), w, h, dd)

Uses (18)

Used by (1)