minor refactoring
parent
4bc6b302cf
commit
033892dc10
|
@ -82,12 +82,18 @@ ERROR: unimplemented-color-type image ;
|
||||||
: inflate-data ( loading-png -- bytes )
|
: inflate-data ( loading-png -- bytes )
|
||||||
find-compressed-bytes zlib-inflate ;
|
find-compressed-bytes zlib-inflate ;
|
||||||
|
|
||||||
: png-group-width ( loading-png -- n )
|
: scale-bit-depth ( loading-png -- n ) bit-depth>> 8 / ; inline
|
||||||
|
|
||||||
|
: png-bytes-per-pixel ( loading-png -- n )
|
||||||
dup color-type>> {
|
dup color-type>> {
|
||||||
{ 2 [ [ bit-depth>> 8 / 3 * ] [ width>> ] bi * 1 + ] }
|
{ 2 [ scale-bit-depth 3 * ] }
|
||||||
{ 6 [ [ bit-depth>> 8 / 4 * ] [ width>> ] bi * 1 + ] }
|
{ 6 [ scale-bit-depth 4 * ] }
|
||||||
[ unknown-color-type ]
|
[ unknown-color-type ]
|
||||||
} case ;
|
} case ; inline
|
||||||
|
|
||||||
|
: png-group-width ( loading-png -- n )
|
||||||
|
! 1 + is for the filter type, 1 byte preceding each line
|
||||||
|
[ png-bytes-per-pixel ] [ width>> ] bi * 1 + ;
|
||||||
|
|
||||||
:: paeth ( a b c -- p )
|
:: paeth ( a b c -- p )
|
||||||
a b + c - { a b c } [ [ - abs ] keep 2array ] with map
|
a b + c - { a b c } [ [ - abs ] keep 2array ] with map
|
||||||
|
|
Loading…
Reference in New Issue