images.*: remove usage of io.streams.limited

db4
Slava Pestov 2011-09-01 22:29:14 -07:00
parent a8633d28c7
commit cf238b4c7d
3 changed files with 15 additions and 19 deletions

View File

@ -1,7 +1,7 @@
! (c)2010 Joe Groff bsd license
USING: accessors alien.data cocoa cocoa.classes cocoa.messages
combinators core-foundation.data core-graphics.types fry images
images.loader io kernel literals math sequences ;
images.loader io kernel math sequences ;
IN: images.cocoa
SINGLETON: ns-image
@ -36,9 +36,9 @@ ERROR: ns-image-planar-images-not-supported ;
: check-return ( n -- )
{
{ $ NSImageRepLoadStatusUnknownType [ ns-image-unknown-type ] }
{ $ NSImageRepLoadStatusInvalidData [ ns-image-invalid-data ] }
{ $ NSImageRepLoadStatusUnexpectedEOF [ ns-image-unexpected-eof ] }
{ NSImageRepLoadStatusUnknownType [ ns-image-unknown-type ] }
{ NSImageRepLoadStatusInvalidData [ ns-image-invalid-data ] }
{ NSImageRepLoadStatusUnexpectedEOF [ ns-image-unexpected-eof ] }
[ drop ]
} case ;

View File

@ -1,9 +1,8 @@
! (c)2010 Joe Groff bsd license
USING: accessors alien.c-types alien.data alien.enums
classes.struct destructors images images.loader
io.streams.limited kernel locals math windows.com
windows.gdiplus windows.streams windows.types typed
byte-arrays grouping sequences ;
classes.struct destructors images images.loader kernel locals
math windows.com windows.gdiplus windows.streams windows.types
typed byte-arrays grouping sequences ;
IN: images.gdiplus
SINGLETON: gdi+-image

View File

@ -1,9 +1,8 @@
! Copyright (C) 2009 Doug Coleman, Daniel Ehrenberg.
! See http://factorcode.org/license.txt for BSD license.
USING: assocs byte-arrays io.encodings.binary io.files
io.pathnames io.streams.byte-array io.streams.limited
io.streams.throwing kernel namespaces sequences strings
unicode.case fry ;
USING: ascii assocs byte-arrays io.encodings.binary io.files
io.pathnames io.streams.byte-array kernel namespaces sequences
strings fry ;
IN: images.loader
ERROR: unknown-image-extension extension ;
@ -19,9 +18,6 @@ types [ H{ } clone ] initialize
: image-class ( path -- class )
file-extension (image-class) ;
: open-image-file ( path -- stream )
binary <limited-file-reader> ;
PRIVATE>
! Image Decode
@ -34,16 +30,18 @@ GENERIC: stream>image ( stream class -- image )
swap types get set-at ;
: load-image ( path -- image )
[ open-image-file ] [ image-class ] bi load-image* ;
[ binary <file-reader> ] [ image-class ] bi load-image* ;
M: object load-image* stream>image ;
M: byte-array load-image*
[ binary <byte-reader> ] dip stream>image ;
M: string load-image* [ open-image-file ] dip stream>image ;
M: string load-image*
[ binary <file-reader> ] dip stream>image ;
M: pathname load-image* [ open-image-file ] dip stream>image ;
M: pathname load-image*
[ binary <file-reader> ] dip stream>image ;
! Image Encode
@ -52,4 +50,3 @@ GENERIC: image>stream ( image class -- )
: save-graphic-image ( image path -- )
[ image-class ] [ ] bi
binary [ image>stream ] with-file-writer ;