~/bend-docscommunity

png.bend checks

raw source on the hub · import element-image@0.1.0.1/png.bend as Png

3 imports
import Base
import ./deflate_rgb.bend as Rgb
import element-compress@0.1.0.1/checksum.bend as Ck

Definitions

def pick source · line 12 · raw

@c:Bool -> @a:U32 -> @b:U32 -> U32

def crc32 source · line 17 · raw

@+bs:List<&2, U32> -> U32

def adler32 source · line 20 · raw

@+bs:List<&2, U32> -> U32

def be32 source · line 25 · raw

@+x:U32 -> List<&2, U32>

def le16 source · line 28 · raw

@+x:U32 -> List<&2, U32>

def ascii source · line 31 · raw

@s:String -> List<&2, U32>

def len source · line 38 · raw

@xs:List<&2, U32> -> U32

def chunk source · line 42 · raw

@+typ:String -> @+data:List<&2, U32> -> List<&2, U32>

A chunk: length, type, data, CRC of type + data.

def stored_go source · line 50 · raw

@k:Nat -> @+bs:List<&2, U32> -> @+remaining:U32 -> List<&2, U32>

Deflate stored blocks of at most 65535 bytes; the last one has BFINAL set. Carry the length: rescanning the remaining bytes twice per block made this quadratic in image size even though the stored representation is linear.

def stored source · line 64 · raw

@k:Nat -> @+bs:List<&2, U32> -> List<&2, U32>

def zlib source · line 67 · raw

@+bs:List<&2, U32> -> List<&2, U32>

def rgb source · line 73 · raw

@+c:U32 -> List<&2, U32>

def row_bytes source · line 76 · raw

@xs:List<&2, U32> -> List<&2, U32>

def scanlines source · line 84 · raw

@rows:List<&2, List<&2, U32>> -> List<&2, U32>

Each scanline: filter type 0, then R G B per pixel.

def image source · line 93 · raw

@+w:U32 -> @+h:U32 -> @data:List<&2, U32> -> List<&2, U32>

def png source · line 102 · raw

@w:U32 -> @h:U32 -> @rows:List<&2, List<&2, U32>> -> List<&2, U32>

Established stored-block API, including its exact-byte fixture law.

def compact source · line 107 · raw

@w:U32 -> @h:U32 -> @rows:List<&2, List<&2, U32>> -> List<&2, U32>

Lossless fixed-Huffman RGB-run encoding for browser screenshots. Both encoders expose the same RGB pixels; only their compressed bytes differ.