images.*: remove usage of io.streams.limited
parent
a8633d28c7
commit
cf238b4c7d
|
@ -1,7 +1,7 @@
|
||||||
! (c)2010 Joe Groff bsd license
|
! (c)2010 Joe Groff bsd license
|
||||||
USING: accessors alien.data cocoa cocoa.classes cocoa.messages
|
USING: accessors alien.data cocoa cocoa.classes cocoa.messages
|
||||||
combinators core-foundation.data core-graphics.types fry images
|
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
|
IN: images.cocoa
|
||||||
|
|
||||||
SINGLETON: ns-image
|
SINGLETON: ns-image
|
||||||
|
@ -36,9 +36,9 @@ ERROR: ns-image-planar-images-not-supported ;
|
||||||
|
|
||||||
: check-return ( n -- )
|
: check-return ( n -- )
|
||||||
{
|
{
|
||||||
{ $ NSImageRepLoadStatusUnknownType [ ns-image-unknown-type ] }
|
{ NSImageRepLoadStatusUnknownType [ ns-image-unknown-type ] }
|
||||||
{ $ NSImageRepLoadStatusInvalidData [ ns-image-invalid-data ] }
|
{ NSImageRepLoadStatusInvalidData [ ns-image-invalid-data ] }
|
||||||
{ $ NSImageRepLoadStatusUnexpectedEOF [ ns-image-unexpected-eof ] }
|
{ NSImageRepLoadStatusUnexpectedEOF [ ns-image-unexpected-eof ] }
|
||||||
[ drop ]
|
[ drop ]
|
||||||
} case ;
|
} case ;
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
! (c)2010 Joe Groff bsd license
|
! (c)2010 Joe Groff bsd license
|
||||||
USING: accessors alien.c-types alien.data alien.enums
|
USING: accessors alien.c-types alien.data alien.enums
|
||||||
classes.struct destructors images images.loader
|
classes.struct destructors images images.loader kernel locals
|
||||||
io.streams.limited kernel locals math windows.com
|
math windows.com windows.gdiplus windows.streams windows.types
|
||||||
windows.gdiplus windows.streams windows.types typed
|
typed byte-arrays grouping sequences ;
|
||||||
byte-arrays grouping sequences ;
|
|
||||||
IN: images.gdiplus
|
IN: images.gdiplus
|
||||||
|
|
||||||
SINGLETON: gdi+-image
|
SINGLETON: gdi+-image
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
! Copyright (C) 2009 Doug Coleman, Daniel Ehrenberg.
|
! Copyright (C) 2009 Doug Coleman, Daniel Ehrenberg.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: assocs byte-arrays io.encodings.binary io.files
|
USING: ascii assocs byte-arrays io.encodings.binary io.files
|
||||||
io.pathnames io.streams.byte-array io.streams.limited
|
io.pathnames io.streams.byte-array kernel namespaces sequences
|
||||||
io.streams.throwing kernel namespaces sequences strings
|
strings fry ;
|
||||||
unicode.case fry ;
|
|
||||||
IN: images.loader
|
IN: images.loader
|
||||||
|
|
||||||
ERROR: unknown-image-extension extension ;
|
ERROR: unknown-image-extension extension ;
|
||||||
|
@ -19,9 +18,6 @@ types [ H{ } clone ] initialize
|
||||||
: image-class ( path -- class )
|
: image-class ( path -- class )
|
||||||
file-extension (image-class) ;
|
file-extension (image-class) ;
|
||||||
|
|
||||||
: open-image-file ( path -- stream )
|
|
||||||
binary <limited-file-reader> ;
|
|
||||||
|
|
||||||
PRIVATE>
|
PRIVATE>
|
||||||
|
|
||||||
! Image Decode
|
! Image Decode
|
||||||
|
@ -34,16 +30,18 @@ GENERIC: stream>image ( stream class -- image )
|
||||||
swap types get set-at ;
|
swap types get set-at ;
|
||||||
|
|
||||||
: load-image ( path -- image )
|
: 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: object load-image* stream>image ;
|
||||||
|
|
||||||
M: byte-array load-image*
|
M: byte-array load-image*
|
||||||
[ binary <byte-reader> ] dip stream>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
|
! Image Encode
|
||||||
|
|
||||||
|
@ -52,4 +50,3 @@ GENERIC: image>stream ( image class -- )
|
||||||
: save-graphic-image ( image path -- )
|
: save-graphic-image ( image path -- )
|
||||||
[ image-class ] [ ] bi
|
[ image-class ] [ ] bi
|
||||||
binary [ image>stream ] with-file-writer ;
|
binary [ image>stream ] with-file-writer ;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue