 : uncompress-bytes ( loading-png -- bitstream )
     [ inflate-data ] [ interlace-method>> ] bi reverse-interlace ;
 
+ERROR: bad-filter n ;
+
 :: raw-bytes ( loading-png -- array )
     loading-png uncompress-bytes :> bs
     loading-png width>> :> width

    ] when

    height [
        8 bs bs:read
        count [ depth bs bs:read ] replicate swap prefix
        8 bs bs:align
    ] replicate

: decode-indexed-color ( loading-image -- byte-array )
    [ raw-bytes ] keep "PLTE" find-chunk data>> verify-PLTE
    3 group '[ _ nth ] { } map-as B{ } concat-as ; inline

ERROR: invalid-color-type/bit-depth loading-png ;

: validate-bit-depth ( loading-png seq -- loading-png )
