ImageEditor.st
changeset 3196 830d70ff1d54
parent 3195 32e373ae50fa
child 3200 eae3e88c5cb1
--- a/ImageEditor.st	Thu Feb 26 23:04:44 2015 +0100
+++ b/ImageEditor.st	Fri Feb 27 17:03:53 2015 +0100
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 1997-1998 by eXept Software AG
               All Rights Reserved
@@ -6488,8 +6490,9 @@
 doMagnifyImage
     "magnifies the current image to a new size"
 
-    |box newSize image|
-
+    |box newSize image antiAliased|
+
+    antiAliased := false asValue.
     image := imageEditView image.
 
     box := EnterBox new.
@@ -6497,15 +6500,21 @@
     box okText:(resources string:'OK').
     box abortText:(resources string:'Cancel').
     box initialText:image extent printString.
+    box addCheckBox:(resources string:'Antialiased') on:antiAliased.
     box showAtPointer.
+
     (box accepted 
     and: [(newSize := self pointFromString:(box contents)) notNil])
     ifTrue:[
         newSize isPoint ifFalse:[
-            self warn:'please enter the new size as ''x @ y''.'.
+            self warn:'Please enter the new size as ''x @ y''.'.
             ^ self.    
         ].
-        imageEditView magnifyImageTo:newSize.
+        antiAliased value ifTrue:[
+            imageEditView magnifyAntiAliasedImageTo:newSize.
+        ] ifFalse:[
+            imageEditView magnifyImageTo:newSize.
+        ].
     ].
 
     self updateInfoLabel
@@ -6514,15 +6523,22 @@
 doMagnifyImageBy
     "magnifies the current image (by a scale)"
 
-    |box oldSize newSize scaleString scale image|
+    |oldSize newSize scaleString scale image antiAliased|
 
     image := imageEditView image.
     oldSize := image extent.
 
-    scaleString := Dialog 
+    antiAliased := false asValue.
+
+    Dialog modifyingBoxWith:[:box |
+        box addCheckBox:(resources string:'Antialiased') on:antiAliased.
+    ] do:[
+        scaleString := Dialog 
                    request:(resources string:'Scale factor (<1 to shrink; >1 to magnify):') 
                    initialAnswer:'1'
                    list:#('0.25' '0.5' '2' '4').     
+    ].
+    scaleString isNil ifTrue:[^ self].
 
 "/    box := EnterBox new.
 "/    box title:(resources string:'Scale factor (<1 to shrink; >1 to magnify):').
@@ -6542,7 +6558,11 @@
             ^ self.    
         ].
         newSize := oldSize * scale.
-        imageEditView magnifyImageTo:newSize.
+        antiAliased value ifTrue:[
+            imageEditView magnifyAntiAliasedImageTo:newSize.
+        ] ifFalse:[
+            imageEditView magnifyImageTo:newSize.
+        ].
     ].
 
     self updateInfoLabel