dont forget to flip mask.
authorClaus Gittinger <cg@exept.de>
Tue, 22 Apr 1997 19:24:17 +0200
changeset 1628 204f3a5afc2a
parent 1627 e7ba6be03b14
child 1629 7735e52e84f0
dont forget to flip mask. removed obsolete code in #paletteImageAsPseudoForm
Depth8Image.st
--- a/Depth8Image.st	Tue Apr 22 14:27:36 1997 +0200
+++ b/Depth8Image.st	Tue Apr 22 19:24:17 1997 +0200
@@ -278,41 +278,20 @@
     ].
 
     fit ifFalse:[
-"/        |tree|
-"/
-"/        "/ first, create an octTree containing colors which we got ...
-"/        tree := ColorOctree new.
-"/
-"/        usedColors from:1 to:lastOK do:[:aColorIndex |
-"/            tree insert:(colorMap at:aColorIndex + 1).
-"/        ].
-"/
-"/        "/ then, remap remaining, using nearest from those already allocated
-"/
-"/        usedColors from:(lastOK+1) to:(usedColors size) do:[:aColorIndex |      
-"/            |mapIndex|
-"/
-"/            mapIndex := aColorIndex + 1.
-"/            imgMap at:mapIndex put:(tree findBest:(colorMap at:mapIndex))
-"/        ].
+        ('Depth8Image [info]: got %1 exact colors (out of %2)' bindWith:lastOK with:usedColors size) infoPrintCR.
 
-        fit ifFalse:[
-            ('Depth8Image [info]: got %1 exact colors (out of %2)' bindWith:lastOK with:usedColors size) infoPrintCR.
-            DitherAlgorithm == #floydSteinberg ifTrue:[
-                dColors := colorMap asArray collect:[:clr | clr isNil ifTrue:[clr]
-                                                              ifFalse:[clr nearestOn:aDevice]].
-                dColors := dColors select:[:clr | clr notNil].
-                dColors := dColors asSet.
-                ditherColors := aDevice availableDitherColors.
-                ditherColors notNil ifTrue:[
-                    dColors addAll:ditherColors.
-                ].
-                dColors := dColors asArray.
+        DitherAlgorithm == #floydSteinberg ifTrue:[
+            dColors := colorMap asArray collect:[:clr | clr isNil ifTrue:[clr]
+                                                          ifFalse:[clr nearestOn:aDevice]].
+            dColors := dColors select:[:clr | clr notNil].
+            dColors := dColors asSet.
+            ditherColors := aDevice availableDitherColors.
+            ditherColors notNil ifTrue:[
+                dColors addAll:ditherColors.
+            ].
+            dColors := dColors asArray.
 
-"/                ^ self asFloydSteinbergDitheredPseudoFormUsing:(Color allocatedColorsOn:aDevice) on:aDevice
-"/                ^ self asFloydSteinbergDitheredPseudoFormUsing:(imgMap , Color ditherColors) on:aDevice
-                ^ self asFloydSteinbergDitheredPseudoFormUsing:dColors on:aDevice
-            ]
+            ^ self asFloydSteinbergDitheredPseudoFormUsing:dColors on:aDevice
         ].
 
         "
@@ -511,7 +490,7 @@
 
     ^ f
 
-    "Modified: 15.1.1997 / 18:08:38 / cg"
+    "Modified: 22.4.1997 / 11:26:10 / cg"
 !
 
 paletteImageAsTrueColorFormOn:aDevice
@@ -1248,13 +1227,18 @@
 
     index := 1.
     0 to:h do:[:row |
-	buffer replaceFrom:1 to:width with:bytes startingAt:index.
-	buffer reverse.
-	bytes replaceFrom:index to:index+w with:buffer startingAt:1.
-	index := index + w + 1.
+        buffer replaceFrom:1 to:width with:bytes startingAt:index.
+        buffer reverse.
+        bytes replaceFrom:index to:index+w with:buffer startingAt:1.
+        index := index + w + 1.
+    ].
+    mask notNil ifTrue:[
+        mask flipHorizontal
     ].
     "flush device info"
     self restored
+
+    "Modified: 22.4.1997 / 12:31:58 / cg"
 !
 
 hardMagnifiedBy:scalePoint
@@ -1655,5 +1639,5 @@
 !Depth8Image class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/Depth8Image.st,v 1.67 1997-04-16 23:21:57 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/Depth8Image.st,v 1.68 1997-04-22 17:24:17 cg Exp $'
 ! !