proc unpack(s: RStream, buf: var seq[byte], width: uint32, height: uint32) {.raises: [IOError, UnpackError].} = ## Unpack PaintShop bitmap. let start_offset = s.getpos let pitch: uint32 = (width + 7) div 8 var eoi_found = false var o: uint32 = 0 var y: uint32 = 0 while not s.atend and y < height: let ctrl = s.read_byte case ctrl of CtrlLineWhite: when RUseCopyMem: zeroMem buf[o].addr, pitch o += pitch else: for _ in 0 ..< pitch: buf[o] = 0x00 inc o inc y # […]