assume 90dpi in #fromFile:resolution: if there is no current display
authorClaus Gittinger <cg@exept.de>
Thu, 02 Dec 1999 16:29:31 +0100
changeset 3059 0895d23678ac
parent 3058 7285e8d1e7fa
child 3060 9b16d027bf7b
assume 90dpi in #fromFile:resolution: if there is no current display
Image.st
--- a/Image.st	Thu Dec 02 16:06:10 1999 +0100
+++ b/Image.st	Thu Dec 02 16:29:31 1999 +0100
@@ -1409,7 +1409,7 @@
 
 fromFile:aFileName resolution:res
     "read an image from a file and (if required) scale the image
-     as appropriate (only with very high resolution displays).
+     as appropriate (only req'd for very high resolution displays).
      Return nil (or whatever a handler returned), 
      if the file is unreadable or does not contain an appropriate image."
 
@@ -1421,7 +1421,7 @@
 
 fromFile:aFileName resolution:dpi on:aDevice
     "read an image from a file and (if required) scale the image
-     as appropriate (only with very high resolution displays).
+     as appropriate (only req'd with very high resolution displays).
      Prepare a device representation.
      Return nil (or whatever a handler returned), 
      if the file is unreadable or does not contain an appropriate image."
@@ -1438,7 +1438,11 @@
         dev := Screen current
     ].
 
-    dpiH := dev horizontalPixelPerInch.
+    dev notNil ifTrue:[
+        dpiH := dev horizontalPixelPerInch.
+    ] ifFalse:[
+	dpiH := 90
+    ].
     ((dpi >= (dpiH * 0.75)) and:[dpi <= (dpiH * 1.5)]) ifTrue:[^ img].
     mag := (dpiH / dpi) rounded.
     mag = 0 ifTrue:[^ img].
@@ -1446,7 +1450,6 @@
 
     img := img magnifiedBy:(mag @ mag).
     aDevice notNil ifTrue:[
-        "should not happen ..."
         ^ img onDevice:aDevice
     ].
     ^ img
@@ -11993,6 +11996,6 @@
 !Image class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/Image.st,v 1.286 1999-11-23 16:47:55 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/Image.st,v 1.287 1999-12-02 15:29:31 cg Exp $'
 ! !
 Image initialize!