support .tif, start 96 bpp
parent
cd82735dea
commit
753cfcfd05
|
@ -1,9 +1,11 @@
|
|||
! Copyright (C) 2009 Doug Coleman.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: kernel accessors grouping sequences combinators ;
|
||||
USING: kernel accessors grouping sequences combinators
|
||||
math specialized-arrays.direct.uint byte-arrays ;
|
||||
IN: images
|
||||
|
||||
SINGLETONS: BGR RGB BGRA RGBA ABGR ARGB RGBX XRGB BGRX XBGR ;
|
||||
SINGLETONS: BGR RGB BGRA RGBA ABGR ARGB RGBX XRGB BGRX XBGR
|
||||
32R32G32B ;
|
||||
|
||||
TUPLE: image dim component-order byte-order bitmap ;
|
||||
|
||||
|
@ -15,6 +17,14 @@ GENERIC: load-image* ( path tuple -- image )
|
|||
dup component-order>>
|
||||
{
|
||||
{ RGBA [ ] }
|
||||
{ 32R32G32B [
|
||||
[
|
||||
! >byte-array
|
||||
! dup length 4 /i <direct-uint-array> [ 32 2^ /i ] map
|
||||
! >byte-array
|
||||
! 4 <sliced-groups> le> [ 32 2^ /i ] map concat
|
||||
] change-bitmap
|
||||
] }
|
||||
{ BGRA [
|
||||
[
|
||||
4 <sliced-groups> dup [ [ 0 3 ] dip <slice> reverse-here ] each
|
||||
|
|
|
@ -10,6 +10,7 @@ ERROR: unknown-image-extension extension ;
|
|||
: image-class ( path -- class )
|
||||
file-extension >lower {
|
||||
{ "bmp" [ bitmap-image ] }
|
||||
{ "tif" [ tiff-image ] }
|
||||
{ "tiff" [ tiff-image ] }
|
||||
[ unknown-image-extension ]
|
||||
} case ;
|
||||
|
|
|
@ -276,9 +276,10 @@ ERROR: unhandled-compression compression ;
|
|||
ERROR: unknown-component-order ifd ;
|
||||
|
||||
: ifd-component-order ( ifd -- byte-order )
|
||||
bits-per-sample find-tag sum {
|
||||
{ 32 [ RGBA ] }
|
||||
{ 24 [ RGB ] }
|
||||
bits-per-sample find-tag {
|
||||
{ { 32 32 32 } [ 32R32G32B ] }
|
||||
{ { 8 8 8 8 } [ RGBA ] }
|
||||
{ { 8 8 8 } [ RGB ] }
|
||||
[ unknown-component-order ]
|
||||
} case ;
|
||||
|
||||
|
|
Loading…
Reference in New Issue