images.http: make it easier to image. stuff.
parent
4bfcc86cc4
commit
7a5142e0ca
|
@ -1,8 +1,8 @@
|
||||||
! Copyright (C) 2009 Doug Coleman.
|
! Copyright (C) 2009 Doug Coleman.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors assocs http.client images.loader
|
USING: accessors assocs combinators.short-circuit http.client
|
||||||
images.loader.private images.viewer io.pathnames kernel
|
images.loader images.loader.private images.viewer io.pathnames
|
||||||
namespaces present sequences ;
|
kernel namespaces present sequences strings urls ;
|
||||||
IN: images.http
|
IN: images.http
|
||||||
|
|
||||||
<PRIVATE
|
<PRIVATE
|
||||||
|
@ -18,5 +18,12 @@ PRIVATE>
|
||||||
[ present file-extension ] bi or
|
[ present file-extension ] bi or
|
||||||
(image-class) load-image* ;
|
(image-class) load-image* ;
|
||||||
|
|
||||||
|
M: string set-image
|
||||||
|
dup { [ "http://" head? ] [ "https://" head? ] } 1||
|
||||||
|
[ load-http-image ] [ load-image ] if >>image ;
|
||||||
|
|
||||||
|
M: url set-image
|
||||||
|
protocol>> load-http-image >>image ;
|
||||||
|
|
||||||
: http-image. ( path -- )
|
: http-image. ( path -- )
|
||||||
load-http-image image. ;
|
load-http-image image. ;
|
||||||
|
|
Loading…
Reference in New Issue