<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Hi Juan</p>
<p>the solution you provide is good as it is a good workaround.
Looks a bit clumsy however constructing two ImageMorph objects as
you start with a jpg form. And Mark wants to include this example
in a booklet about Morphic.<br>
</p>
<p>Reading a JPG picture into an instance of Form, scaling it and
constructing an ImageMorph object works fine as example [1b] in
this<br>
</p>
<p><a class="moz-txt-link-freetext" href="https://lists.cuis.st/mailman/archives/cuis-dev/2025-March/010742.html">https://lists.cuis.st/mailman/archives/cuis-dev/2025-March/010742.html</a></p>
<p>thread shows.</p>
<p>So I'd like to draw your attention that on the fact that
shrinking an ImageMorph object does not work as example 2 in the
same thread shows.</p>
<p>The solution to make ImageMorph>>shrinkBy: work provided
by Weslleymberg Lisboa is shown in this mail</p>
<p><a class="moz-txt-link-freetext" href="https://lists.cuis.st/mailman/archives/cuis-dev/2025-March/010745.html">https://lists.cuis.st/mailman/archives/cuis-dev/2025-March/010745.html</a></p>
<p><br>
</p>
<pre>Current ImageMorph>>minimumExtent implementation
````
minimumExtent
^ image extent + (2 * self interiorOrigin)
````
-------------------------------------------------------------------------------------------
Weslleymberg proposal for ImageMorph>>minimumExtent
````
minimumExtent
^ image extent + (2 * self interiorOrigin) * self scale
-------------------------------------------------------------------------------------------</pre>
<p></p>
<p><br>
</p>
<p>Seems to be pretty straightforward though it took him a
considerable time to come up this it. What do you think about this
solution? Are there side-effects about this fix? If not I suggest
that it should be included.<br>
</p>
<p>Kind regards</p>
<p>Hannes<br>
</p>
<p><br>
</p>
<div class="moz-cite-prefix">On 30/03/2025 8:29 pm, Juan Vuletich
via Cuis-dev wrote:<br>
</div>
<blockquote type="cite" cite="mid:67E98D72.8080201@cuis.st">
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
On 3/19/2025 6:11 PM, Mark Volkmann via Cuis-dev wrote:
<blockquote
cite="mid:CAFfRWnVD6s=EgXmV5KFQWBOZ8QTYFnn_U6T4NOXkPQRaf+TtEw@mail.gmail.com"
type="cite">
<div dir="ltr">
<div>What is the proper way (minimum code) to scale an
ImageMorph?</div>
<div>Do I have to scale both the form into which the image
file is loaded AND the ImageMorph like this?</div>
<div><br>
</div>
<div>filePath :=
'/Users/volkmannm/Pictures/images/altitude1600.jpg'.<br>
percent := 0.75.<br>
form := Form fromFileNamed: filePath :: magnifyBy: percent.<br>
morph := ImageMorph newWith: form :: scaleBy: percent.<br>
</div>
<div><br>
</div>
<div>When I add this morph to a SystemWindow, the image is
scaled, but there is an orange rectangle of the original
size behind the image. See the attached screenshot.</div>
<div><br>
</div>
<span class="gmail_signature_prefix">-- </span><br>
<div dir="ltr" class="gmail_signature"
data-smartmail="gmail_signature">
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">
<div dir="ltr">
<div><font face="arial, helvetica, sans-serif">R.
Mark Volkmann</font></div>
<div><span style="font-size: 12.8px;"><font
face="arial, helvetica, sans-serif">Object
Computing, Inc.</font></span></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<br>
Just scale the form prior to using it: `(ImageMorph newWith:
(ImageMorph defaultForm magnifyBy: 0.5)) openInWorld.`<br>
<br>
A new kind of morph that is not part of the BoxMorph hierarchy
would give better flexibility, by not using an `extent` instance
variable. But may be the simplest solution works for you.<br>
<br>
Cheers,<br>
<pre class="moz-signature" cols="72">--
Juan Vuletich
cuis.st
github.com/jvuletich
researchgate.net/profile/Juan-Vuletich
independent.academia.edu/JuanVuletich
patents.justia.com/inventor/juan-manuel-vuletich
linkedin.com/in/juan-vuletich-75611b3
twitter.com/JuanVuletich</pre>
<br>
<fieldset class="moz-mime-attachment-header"></fieldset>
</blockquote>
</body>
</html>