diff --git a/basis/images/bitmap/bitmap.factor b/basis/images/bitmap/bitmap.factor index 5530fa12b7..c9bb15192b 100755 --- a/basis/images/bitmap/bitmap.factor +++ b/basis/images/bitmap/bitmap.factor @@ -1,10 +1,9 @@ ! Copyright (C) 2007, 2009 Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. USING: accessors alien alien.c-types arrays byte-arrays columns -combinators fry grouping io io.binary io.encodings.binary -io.files kernel libc macros math math.bitwise math.functions -namespaces opengl opengl.gl prettyprint sequences strings -summary ui ui.gadgets.panes images ; +combinators fry grouping io io.binary io.encodings.binary io.files +kernel macros math math.bitwise math.functions namespaces sequences +strings images endian summary ; IN: images.bitmap TUPLE: bitmap-image < image ; @@ -106,8 +105,9 @@ ERROR: unknown-component-order bitmap ; { [ [ width>> ] [ height>> ] bi 2array ] [ bitmap>component-order ] + [ drop little-endian ] ! XXX [ buffer>> ] - } cleave bitmap-image new-image ; + } cleave bitmap-image boa ; M: bitmap-image load-image* ( path bitmap -- bitmap-image ) drop load-bitmap >image ; diff --git a/basis/images/images.factor b/basis/images/images.factor index 5fdc9ee5e9..a2d90cc131 100644 --- a/basis/images/images.factor +++ b/basis/images/images.factor @@ -5,7 +5,9 @@ IN: images SINGLETONS: BGR RGB BGRA RGBA ABGR ARGB RGBX XRGB BGRX XBGR ; -TUPLE: image dim component-order bitmap ; +TUPLE: image dim component-order byte-order bitmap ; + +: ( -- image ) image new ; inline GENERIC: load-image* ( path tuple -- image ) @@ -38,9 +40,3 @@ M: image normalize-scan-line-order ; : normalize-image ( image -- image ) normalize-component-order normalize-scan-line-order ; - -: new-image ( dim component-order bitmap class -- image ) - new - swap >>bitmap - swap >>component-order - swap >>dim ; inline diff --git a/basis/images/loader/loader.factor b/basis/images/loader/loader.factor index 7aeba9f24a..9e3f901269 100644 --- a/basis/images/loader/loader.factor +++ b/basis/images/loader/loader.factor @@ -15,7 +15,4 @@ ERROR: unknown-image-extension extension ; } case ; : load-image ( path -- image ) - dup image-class new load-image* ; - -: ( path -- image ) - load-image normalize-image ; + dup image-class new load-image* normalize-image ; diff --git a/basis/images/tiff/tiff.factor b/basis/images/tiff/tiff.factor index dd4319a474..b4daf675f1 100755 --- a/basis/images/tiff/tiff.factor +++ b/basis/images/tiff/tiff.factor @@ -272,8 +272,9 @@ ERROR: unknown-component-order ifd ; { [ [ image-width find-tag ] [ image-length find-tag ] bi 2array ] [ ifd-component-order ] + [ drop big-endian ] ! XXX [ bitmap>> ] - } cleave tiff-image new-image ; + } cleave tiff-image boa ; : tiff>image ( image -- image ) ifds>> [ ifd>image ] map first ; diff --git a/extra/images/viewer/viewer.factor b/extra/images/viewer/viewer.factor index 0795900150..06e4c686f3 100644 --- a/extra/images/viewer/viewer.factor +++ b/extra/images/viewer/viewer.factor @@ -23,15 +23,15 @@ M: image-gadget draw-gadget* ( gadget -- ) swap >>image ; : image-window ( path -- gadget ) - [ dup ] [ open-window ] bi ; + [ load-image dup ] [ open-window ] bi ; GENERIC: image. ( object -- ) : default-image. ( path -- ) gadget. ; -M: string image. ( image -- ) default-image. ; +M: string image. ( image -- ) load-image default-image. ; -M: pathname image. ( image -- ) default-image. ; +M: pathname image. ( image -- ) load-image default-image. ; M: image image. ( image -- ) default-image. ;