--- a/ImageEditor.st Tue Aug 21 17:52:48 2001 +0200
+++ b/ImageEditor.st Wed Aug 22 18:39:03 2001 +0200
@@ -1062,6 +1062,12 @@
#activeHelpKey: #editMagnifyImage
)
#(#MenuItem
+ #label: 'Magnify By...'
+ #translateLabel: true
+ #value: #doMagnifyImageBy
+ #activeHelpKey: #editMagnifyImage
+ )
+ #(#MenuItem
#label: 'Rotate...'
#translateLabel: true
#value: #doRotateImage
@@ -2854,7 +2860,7 @@
!
doMagnifyImage
- "magnifies current image"
+ "magnifies the current image to a new size"
|box newSize image|
@@ -2869,6 +2875,39 @@
(box accepted
and: [(newSize := Object readFromString:(box contents) onError:nil) notNil])
ifTrue:[
+ newSize isPoint ifFalse:[
+ self warn:'please enter the new size as ''x @ y''.'.
+ ^ self.
+ ].
+ imageEditView magnifyImageTo:newSize.
+ ].
+
+ self updateInfoLabel
+!
+
+doMagnifyImageBy
+ "magnifies the current image (by a scale)"
+
+ |box oldSize newSize scale image|
+
+ image := imageEditView image.
+ oldSize := image extent.
+
+ box := EnterBox new.
+ box title:(resources string:'Scale factor (<1 to shrink; >1 to magnify):').
+ box okText:(resources string:'OK').
+ box abortText:(resources string:'Cancel').
+ box initialText:1 printString.
+ box showAtPointer.
+
+ (box accepted
+ and: [(scale := Object readFromString:(box contents) onError:nil) notNil])
+ ifTrue:[
+ scale isNumber ifFalse:[
+ self warn:'please enter a scale factor (<1 to shrink; >1 to magnify).'.
+ ^ self.
+ ].
+ newSize := oldSize * scale.
imageEditView magnifyImageTo:newSize.
].