<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
    <title></title>
  </head>
  <body bgcolor="#ffffff" text="#000000">
    Hi Hannes,<br>
    <br>
    On 3/31/2025 12:48 PM, H. Hirzel via Cuis-dev wrote:
    <blockquote
      cite="mid:23f47278-c129-4130-9d7d-c143235c8c66@gmail.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <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>
    </blockquote>
    <br>
    No, #defaultForm doesn't create an ImageMorph. It just answers a
    sample Form. <br>
    <br>
    <blockquote
      cite="mid:23f47278-c129-4130-9d7d-c143235c8c66@gmail.com"
      type="cite">
      <p> </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 moz-do-not-send="true" 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 moz-do-not-send="true" 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><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>
    </blockquote>
    <br>
    The problem was not in ImageMorph. There was a bug in Layout. Aux
    method #minimumLayoutExtent: should work in owner's coordinates,
    just like #fitInto: . I just pushed a fix that does that.<br>
    <br>
    You can try this, and resize the Layout.:<br>
    A bettern implementation of ImageMorph could behave more like the
    Star and the Smiley, where the Layout resize can rescale them.<br>
    <br>
    Cheers,<br>
    <br>
      labelMorph := LabelMorph new<br>
        contents: 'coffee';<br>
        color: Color red;<br>
        padding: 0.<br>
    <br>
      aForm := ImageMorph defaultForm.<br>
    <br>
      imageMorph := ImageMorph newWith: aForm.<br>
      imageMorph<br>
         borderWidth: 20;<br>
         borderColor: Color black;<br>
         scaleBy: 0.2;<br>
         padding: 0.<br>
    <br>
      layoutMorph := LayoutMorph newColumn<br>
          borderWidth: 2;<br>
          borderColor: Color yellow;<br>
          padding: 0;<br>
          separation: 0;<br>
          addMorph: labelMorph;<br>
          addMorph: imageMorph;<br>
          addMorph: Sample01Star new;<br>
          addMorph: Sample03Smiley new;<br>
          "morphExtent: 300 at 300;"<br>
          openInWorld<br>
    <br>
    <blockquote
      cite="mid:23f47278-c129-4130-9d7d-c143235c8c66@gmail.com"
      type="cite">
      <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>
    </blockquote>
    <br>
    <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>
  </body>
</html>