clean up some image code

db4
Doug Coleman 2009-02-10 18:52:28 -06:00
parent 1d5f6901c1
commit 7d60fcc598
2 changed files with 10 additions and 8 deletions

View File

@ -5,7 +5,6 @@ images.bitmap math ;
IN: images.backend
SINGLETONS: BGR RGB BGRA RGBA ABGR ARGB RGBX XRGB BGRX XBGR ;
! RGBA
TUPLE: image dim component-order bitmap ;
@ -42,9 +41,9 @@ GENERIC: normalize-scan-line-order ( image -- image )
M: image normalize-scan-line-order ;
M: bitmap-image normalize-scan-line-order
dup
[ bitmap>> ] [ dim>> first 4 * ] bi <sliced-groups> reverse concat
>>bitmap ;
dup dim>> '[
_ first 4 * <sliced-groups> reverse concat
] change-bitmap ;
: normalize-image ( image -- image )
normalize-component-order

View File

@ -25,10 +25,13 @@ M: image-gadget draw-gadget* ( gadget -- )
: image-window ( path -- gadget )
[ <image> <image-gadget> dup ] [ open-window ] bi ;
GENERIC: image. ( image -- )
GENERIC: image. ( object -- )
M: string image. ( image -- ) <image> <image-gadget> gadget. ;
: default-image. ( path -- )
<image-gadget> gadget. ;
M: pathname image. ( image -- ) <image> <image-gadget> gadget. ;
M: string image. ( image -- ) <image> default-image. ;
M: image image. ( image -- ) <image-gadget> gadget. ;
M: pathname image. ( image -- ) <image> default-image. ;
M: image image. ( image -- ) default-image. ;