checkin from browser
authorClaus Gittinger <cg@exept.de>
Fri, 14 Jun 1996 16:09:51 +0200
changeset 853 93598e697248
parent 852 318a6190e31d
child 854 36f47b36b463
checkin from browser
Depth1Image.st
Depth8Image.st
--- a/Depth1Image.st	Fri Jun 14 16:08:24 1996 +0200
+++ b/Depth1Image.st	Fri Jun 14 16:09:51 1996 +0200
@@ -244,26 +244,43 @@
 
 !Depth1Image methodsFor:'converting greyscale images'!
 
-greyImageAsFormOn:aDevice
+asFormOn:aDevice
     "convert a greyscale image to a device form"
 
     |f|
 
+    ((aDevice == device) and:[deviceForm notNil]) ifTrue:[^ deviceForm].
+
     f := Form width:width height:height fromArray:bytes on:aDevice.
     f notNil ifTrue:[
-        photometric == #blackIs0 ifTrue:[
-	    f function:#xor.
-	    f paint:(Color colorId:1).
-	    f fillRectangleX:0 y:0 width:width height:height
-	]
+        f colorMap:(Array with:(self colorFromValue:0)
+                          with:(self colorFromValue:1))
+"/        photometric == #blackIs0 ifTrue:[
+"/            f function:#xor.
+"/            f paint:(Color colorId:1).
+"/            f fillRectangleX:0 y:0 width:width height:height
+"/        ]
     ].
     ^ f
+
+    "Modified: 14.6.1996 / 15:13:53 / cg"
+    "Created: 14.6.1996 / 15:20:00 / cg"
+!
+
+greyImageAsFormOn:aDevice
+    "convert a greyscale image to a device form"
+
+    ^ self asFormOn:aDevice
+
+    "Modified: 14.6.1996 / 15:21:04 / cg"
 !
 
 greyImageAsMonoFormOn:aDevice
     "convert to a monochrome form - thats easy"
 
-    ^ self greyImageAsFormOn:aDevice
+    ^ self asFormOn:aDevice
+
+    "Modified: 14.6.1996 / 15:21:09 / cg"
 ! !
 
 !Depth1Image methodsFor:'converting palette images'!
@@ -296,19 +313,9 @@
 paletteImageAsPseudoFormOn:aDevice
     "return a pseudo-deviceForm from the palette image."
 
-    |f|
+    ^ self asFormOn:aDevice
 
-    "
-     this is easy, since Form already supports colorMaps
-    "
-    f := Form width:width height:height fromArray:bytes.
-    f notNil ifTrue:[
-        f colorMap:(Array with:(self colorFromValue:0)
-                          with:(self colorFromValue:1)).
-    ].
-    ^ f
-
-    "Modified: 10.6.1996 / 14:52:02 / cg"
+    "Modified: 14.6.1996 / 15:21:33 / cg"
 !
 
 paletteImageAsTrueColorFormOn:aDevice
@@ -316,7 +323,7 @@
      a 2-entry colormap is implemented by ST/X's drawForm methods,
      we can do this on all color devices as a palette image."
 
-    ^ self paletteImageAsPseudoFormOn:aDevice
+    ^ self asFormOn:aDevice
 
     "
      |i|
@@ -336,7 +343,7 @@
      i inspect.
     "
 
-    "Modified: 10.6.1996 / 14:54:10 / cg"
+    "Modified: 14.6.1996 / 15:21:37 / cg"
 ! !
 
 !Depth1Image methodsFor:'enumerating'!
@@ -627,5 +634,5 @@
 !Depth1Image class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/Depth1Image.st,v 1.25 1996-06-10 17:23:46 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/Depth1Image.st,v 1.26 1996-06-14 14:09:51 cg Exp $'
 ! !
--- a/Depth8Image.st	Fri Jun 14 16:08:24 1996 +0200
+++ b/Depth8Image.st	Fri Jun 14 16:09:51 1996 +0200
@@ -111,23 +111,7 @@
 
 !Depth8Image methodsFor:'converting palette images'!
 
-asGrayFormOn:aDevice
-    "get a gray device form.
-     Redefined, since we can do it with simple translate, 
-     if the depth matches my depth."
-
-    (aDevice visualType == #StaticGray) ifTrue:[
-        (aDevice depth == 8) ifTrue:[
-            ^ self asGray8FormOn:aDevice
-        ].
-    ].
-    ^ super asGrayFormOn:aDevice
-
-    "Created: 10.6.1996 / 18:51:19 / cg"
-    "Modified: 10.6.1996 / 18:54:36 / cg"
-!
-
-asGrey8FormOn:aDevice
+asGray8FormOn:aDevice
     "return an 8-bit greyForm from the 8-bit receiver image.
      Redefined, since only a translation has to be done here."
 
@@ -156,8 +140,24 @@
 
     ^ self makeDeviceGrayPixmapOn:aDevice depth:8 fromArray:greyBits
 
-    "Created: 10.6.1996 / 18:51:50 / cg"
     "Modified: 10.6.1996 / 20:10:14 / cg"
+    "Created: 14.6.1996 / 15:23:09 / cg"
+!
+
+asGrayFormOn:aDevice
+    "get a gray device form.
+     Redefined, since we can do it with simple translate, 
+     if the depth matches my depth."
+
+    (aDevice visualType == #StaticGray) ifTrue:[
+        (aDevice depth == 8) ifTrue:[
+            ^ self asGray8FormOn:aDevice
+        ].
+    ].
+    ^ super asGrayFormOn:aDevice
+
+    "Created: 10.6.1996 / 18:51:19 / cg"
+    "Modified: 10.6.1996 / 18:54:36 / cg"
 !
 
 paletteImageAsDitheredPseudoFormOn:aDevice
@@ -1522,5 +1522,5 @@
 !Depth8Image class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/Depth8Image.st,v 1.48 1996-06-12 16:56:49 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/Depth8Image.st,v 1.49 1996-06-14 14:09:25 cg Exp $'
 ! !