better warnings on unsupported bmp formats
parent
89c0dd21dd
commit
4cd8bba92e
|
@ -8,6 +8,9 @@ IN: graphics.bitmap.tests
|
||||||
: test-bitmap24 ( -- path )
|
: test-bitmap24 ( -- path )
|
||||||
"resource:extra/graphics/bitmap/test-images/thiswayup24.bmp" ;
|
"resource:extra/graphics/bitmap/test-images/thiswayup24.bmp" ;
|
||||||
|
|
||||||
|
: test-bitmap16 ( -- path )
|
||||||
|
"resource:extra/graphics/bitmap/test-images/rgb16bit.bmp" ;
|
||||||
|
|
||||||
: test-bitmap8 ( -- path )
|
: test-bitmap8 ( -- path )
|
||||||
"resource:extra/graphics/bitmap/test-images/rgb8bit.bmp" ;
|
"resource:extra/graphics/bitmap/test-images/rgb8bit.bmp" ;
|
||||||
|
|
||||||
|
|
|
@ -39,20 +39,18 @@ MACRO: (nbits>bitmap) ( bits -- )
|
||||||
[ rgb-quads>> 4 <sliced-groups> [ 3 head-slice ] map ]
|
[ rgb-quads>> 4 <sliced-groups> [ 3 head-slice ] map ]
|
||||||
[ color-index>> >array ] bi [ swap nth ] with map concat ;
|
[ color-index>> >array ] bi [ swap nth ] with map concat ;
|
||||||
|
|
||||||
: 4bit>array ( bitmap -- array )
|
ERROR: bmp-not-supported n ;
|
||||||
[ rgb-quads>> 4 <sliced-groups> [ 3 head-slice ] map ]
|
|
||||||
[ color-index>> >array ] bi [ swap nth ] with map concat ;
|
|
||||||
|
|
||||||
: raw-bitmap>array ( bitmap -- array )
|
: raw-bitmap>array ( bitmap -- array )
|
||||||
dup bit-count>>
|
dup bit-count>>
|
||||||
{
|
{
|
||||||
{ 32 [ color-index>> ] }
|
{ 32 [ color-index>> ] }
|
||||||
{ 24 [ color-index>> ] }
|
{ 24 [ color-index>> ] }
|
||||||
{ 16 [ "16bit" throw ] }
|
{ 16 [ bmp-not-supported ] }
|
||||||
{ 8 [ 8bit>array ] }
|
{ 8 [ 8bit>array ] }
|
||||||
{ 4 [ 4bit>array ] }
|
{ 4 [ bmp-not-supported ] }
|
||||||
{ 2 [ "2bit" throw ] }
|
{ 2 [ bmp-not-supported ] }
|
||||||
{ 1 [ "1bit" throw ] }
|
{ 1 [ bmp-not-supported ] }
|
||||||
} case >byte-array ;
|
} case >byte-array ;
|
||||||
|
|
||||||
ERROR: bitmap-magic ;
|
ERROR: bitmap-magic ;
|
||||||
|
|
Loading…
Reference in New Issue