     unimplemented-color-type ;
 
 : decode-truecolor-alpha ( loading-png -- image )
-    [ <image> ] dip {
-        [ png-image-bytes >>bitmap ]
-        [ [ width>> ] [ height>> ] bi 2array >>dim ]
-        [ drop RGBA >>component-order ubyte-components >>component-type ]
-    } cleave ;
+    loading-png>image RGBA >>component-order ;
 
 ERROR: invalid-color-type/bit-depth loading-png ;
 

    ] map B{ } concat-as ;

: png-image-bytes ( loading-png -- byte-array )
    [ png-bytes-per-pixel ] [ inflate-data ] [ png-group-width ] tri group reverse-png-filter ;

: decode-greyscale ( loading-png -- image )
    unimplemented-color-type ;

: decode-truecolor ( loading-png -- image )
    [ <image> ] dip {
        [ png-image-bytes >>bitmap ]
        [ [ width>> ] [ height>> ] bi 2array >>dim ]
        [ drop RGB >>component-order ubyte-components >>component-type ]
    } cleave ;
    
: decode-indexed-color ( loading-png -- image )
    unimplemented-color-type ;

math math.bitwise math.ranges sequences sorting ;
IN: images.png

TUPLE: png-image < image ;
"png" png-image register-image-class

TUPLE: loading-png
