mask draw errors in monochrome images
authortz
Fri, 23 Jan 1998 14:21:15 +0100
changeset 677 5ad4237e7686
parent 676 fd7918a3e6e6
child 678 9afa8810a8be
mask draw errors in monochrome images
ImageView.st
--- a/ImageView.st	Fri Jan 23 13:40:58 1998 +0100
+++ b/ImageView.st	Fri Jan 23 14:21:15 1998 +0100
@@ -189,25 +189,20 @@
     "set the image - show a wait cursor, since image dithering may take a while"
 
     image := anImage.
-
     self cursor:Cursor wait.
-    shown ifTrue:[
+    (image notNil and: [image device ~~ device]) 
+    ifTrue: 
+    [
+        image := image on:device
+    ].
+    shown 
+    ifTrue:
+    [
         self clear.
         self invalidate
     ].
     self contentsChanged.
-    self cursor:(Cursor normal).
-
-    "
-     ImageView new realize image:(Image fromFile:'bitmaps/claus.gif')
-
-     |f|
-     f := Image fromFile:'bitmaps/SBrowser.xbm'.
-     f colorMap:(Array with:Color red with:Color yellow).
-     ImageView new realize image:f
-    "
-
-    "Modified: 17.3.1997 / 12:13:30 / cg"
+    self cursor: Cursor normal
 ! !
 
 !ImageView methodsFor:'drawing'!
@@ -226,25 +221,16 @@
             xI := yI := margin
         ].
 
-        image device ~~ device ifTrue:[
-            "/ this may take some time (allocating colors & dithering
-
-            self displayRectangleX:x y:y width:w height:h.
-            self withWaitCursorDo:[
-                image := image on:device.
-            ]
-        ].
-
         ((depth := image depth) == 1) ifTrue:[
             self paint:(image colorFromValue:1)
                     on:(image colorFromValue:0).
         ].
 
-        (depth ~~ 1
-        and:[image mask notNil]) ifTrue:[
+        (depth == 1
+        and:[image mask isNil]) ifFalse:[
             self clearRectangleX:x y:y width:w height:h.
             self displayForm:image x:xI y:yI 
-        ] ifFalse:[
+        ] ifTrue:[
             self displayOpaqueForm:image x:xI y:yI 
         ].
 
@@ -296,5 +282,5 @@
 !ImageView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/ImageView.st,v 1.34 1998-01-22 14:14:27 tz Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/ImageView.st,v 1.35 1998-01-23 13:21:15 tz Exp $'
 ! !