dont scale 8,16 bit greyscale pngs. greyscale-alpha pngs are 8,16 bit already, so don't scale them either.
parent
77f968fad6
commit
2945393965
|
@ -180,24 +180,14 @@ ERROR: unknown-component-type n ;
|
||||||
{ 1 [ 255 ] }
|
{ 1 [ 255 ] }
|
||||||
{ 2 [ 127 ] }
|
{ 2 [ 127 ] }
|
||||||
{ 4 [ 17 ] }
|
{ 4 [ 17 ] }
|
||||||
{ 8 [ 1 ] }
|
|
||||||
} case ;
|
} case ;
|
||||||
|
|
||||||
: scale-greyscale ( byte-array loading-png -- byte-array' )
|
: scale-greyscale ( byte-array loading-png -- byte-array' )
|
||||||
[ bit-depth>> ] [ color-type>> ] bi {
|
bit-depth>> dup 8 >= [
|
||||||
{ greyscale [
|
drop
|
||||||
dup 16 = [
|
] [
|
||||||
drop
|
scale-factor '[ _ * ] B{ } map-as
|
||||||
] [
|
] if ;
|
||||||
scale-factor '[ _ * ] B{ } map-as
|
|
||||||
] if
|
|
||||||
] }
|
|
||||||
{ greyscale-alpha [
|
|
||||||
[ 8 group ] dip '[
|
|
||||||
[ [ 0 5 ] dip <slice> [ _ * ] change-each ] keep
|
|
||||||
] map B{ } concat-as
|
|
||||||
] }
|
|
||||||
} case ;
|
|
||||||
|
|
||||||
: decode-greyscale ( loading-png -- byte-array )
|
: decode-greyscale ( loading-png -- byte-array )
|
||||||
[ raw-bytes ] keep scale-greyscale ;
|
[ raw-bytes ] keep scale-greyscale ;
|
||||||
|
@ -235,7 +225,7 @@ ERROR: invalid-color-type/bit-depth loading-png ;
|
||||||
validate-indexed-color unimplemented-color-type
|
validate-indexed-color unimplemented-color-type
|
||||||
] }
|
] }
|
||||||
{ greyscale-alpha [
|
{ greyscale-alpha [
|
||||||
validate-greyscale-alpha decode-greyscale LA
|
validate-greyscale-alpha raw-bytes LA
|
||||||
] }
|
] }
|
||||||
{ truecolor-alpha [
|
{ truecolor-alpha [
|
||||||
validate-truecolor-alpha raw-bytes RGBA
|
validate-truecolor-alpha raw-bytes RGBA
|
||||||
|
|
Loading…
Reference in New Issue