 : validate-truecolor-alpha ( loading-png -- loading-png )
     { 8 16 } validate-bit-depth ;
 
+: decode-greyscale-alpha ( loading-image -- byte-array' )
+    [ raw-bytes ] [ bit-depth>> ] bi 16 = [
+        3 group [ first3 swapd 3array ] map B{ } concat-as
+    ] when ;
+
 : loading-png>bitmap ( loading-png -- bytes component-order )
     dup color-type>> {
         { greyscale [

    } case ;

: scale-greyscale ( byte-array loading-png -- byte-array' )
    bit-depth>> dup 8 >= [
        drop
    ] [
        scale-factor '[ _ * ] B{ } map-as
    ] if ;

: decode-greyscale ( loading-png -- byte-array )
    [ raw-bytes ] keep scale-greyscale ;

USING: accessors arrays checksums checksums.crc32 combinators
compression.inflate fry grouping images images.loader io
io.binary io.encodings.ascii io.encodings.string kernel locals
math math.bitwise math.ranges sequences sorting assocs ;
QUALIFIED-WITH: bitstreams bs
IN: images.png

