#FEATURE by cg
authorClaus Gittinger <cg@exept.de>
Wed, 13 Sep 2017 13:36:50 +0200
changeset 8176 33f71b59070d
parent 8175 a6bf93e434e4
child 8177 481a5ef90d18
#FEATURE by cg class: Image added: #magnifiedTo:smooth:
Image.st
--- a/Image.st	Wed Sep 13 10:26:19 2017 +0200
+++ b/Image.st	Wed Sep 13 13:36:50 2017 +0200
@@ -12678,6 +12678,35 @@
     "
 !
 
+magnifiedTo:anExtent smooth:aBoolean
+    "return a new image magnified to have the size specified by extent.
+     This may distort the image if the arguments ratio is not the images ratio.
+     See also #magnifiedPreservingRatioTo: and #magnifiedBy:"
+
+    |mag|
+
+    mag := (anExtent / self extent).
+    aBoolean ifTrue:[
+        ^ self smoothingMagnifiedBy:mag
+    ].    
+    ^ self magnifiedBy:mag
+
+    "
+     (Image fromFile:'../../goodies/bitmaps/gifImages/garfield.gif') magnifiedTo:100@100 smooth:true
+
+    in contrast to:
+
+     (Image fromFile:'../../goodies/bitmaps/gifImages/garfield.gif') magnifiedTo:100@100 smooth:false
+
+    and:
+     ((Image fromFile:'../../goodies/bitmaps/gifImages/garfield.gif') magnifiedPreservingRatioTo:100@100)
+    and:
+     ((Image fromFile:'../../goodies/bitmaps/gifImages/garfield.gif') magnifiedPreservingRatioTo:100@100 smooth:true)
+    "
+
+    "Created: / 13-09-2017 / 13:32:09 / cg"
+!
+
 mixed:amount with:aColor
     "return a new image which is blended with some color;
      amount determines how much of the blending color is applied (0..)