<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#ffffff" text="#000000">
    Hi Mark,<br>
    <br>
    (inline and abridged)<br>
    <br>
    On 12/23/2024 10:13 PM, Mark Volkmann via Cuis-dev wrote:
    <blockquote
cite="mid:CAFfRWnXZ6AnJW1b-0mQadRMNY7pcRyCtF57ndOmHhq=UYhO9Wg@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>Thanks so much for taking the time to reply! See my
          feedback inline below.</div>
        <div><br>
        </div>
        ...
        <div class="gmail_quote gmail_quote_container">
          <div><br>
          </div>
          <div>I see the artifacts. After selecting "Restore Display"
            from the World menu, I also see that the star seems to be
            clipped to the rectangle defined by the extent. I think I
            confirmed that by adding the following to the drawOn:
            method.</div>
          <div><br>
          </div>
          <font face="monospace">aCanvas strokeWidth: 2 color: Color red
            do: [<br>
                aCanvas<br>
                    moveTo: 0 @ 0;<br>
          </font><span style="font-family: monospace;">       <span
              class="gmail-Apple-converted-space"> </span></span><font
            face="monospace">lineTo: extent x @ 0;<br>
          </font><span style="font-family: monospace;">       <span
              class="gmail-Apple-converted-space"> </span></span><font
            face="monospace">lineTo: extent x @ extent y;<br>
          </font><span style="font-family: monospace;">       <span
              class="gmail-Apple-converted-space"> </span></span><font
            face="monospace">lineTo: 0 @ extent y;<br>
          </font><span style="font-family: monospace;">       <span
              class="gmail-Apple-converted-space"> </span></span><font
            face="monospace">lineTo: 0 @ 0<br>
            ].</font></div>
        <div class="gmail_quote gmail_quote_container"><font
            face="monospace"><br>
          </font></div>
        <div class="gmail_quote gmail_quote_container"><font
            face="arial, sans-serif">That renders the attached
            screenshot.<br>
          </font>
          <div><br>
          </div>
          <blockquote>
            <div> Your hypothesis is not correct. The system expects the
              shape of a subclass of BoxMorph to be a rectangle confined
              to (0@0 corner: extent), as described in the class
              comment.</div>
          </blockquote>
          <div><br>
          </div>
          <div>Is it wrong to say that a BoxMorph clips its contents to
            the rectangle defined by 0@0 and its extent? </div>
        </div>
      </div>
    </blockquote>
    <br>
    Yes. Clipping is done to submorphs. A morph can state that it wants
    to clips its submorphs to its own shape. But its shape is only
    defined by its #drawOn: method. The exception is that BoxMorph are
    expected to fill their box, and not draw outside of it.<br>
    <br>
    <blockquote
cite="mid:CAFfRWnXZ6AnJW1b-0mQadRMNY7pcRyCtF57ndOmHhq=UYhO9Wg@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div class="gmail_quote gmail_quote_container">
          <div>It seems to do that regardless of what is drawn on the
            BoxMorph. I think the point you are making is that it is
            *bad* to draw outside of a BoxMorph (and violates a
            restriction stated in the class comment) due to the
            artifacts that appear if the morph is dragged.<span
              class="gmail-Apple-converted-space"> I understand that
              now. Thanks for explaining that!</span></div>
          <div><span class="gmail-Apple-converted-space"><br>
            </span></div>
          <blockquote class="gmail_quote" style="margin: 0px 0px 0px
            0.8ex; border-left: 1px solid rgb(204, 204, 204);
            padding-left: 1ex;">
            <div bgcolor="#ffffff">Perhaps what could be added to the
              BoxMorph class comment is that the framework system
              expects that behavior, and will break otherwise.</div>
          </blockquote>
          <div><br>
          </div>
          <div>Where "break" means it will result in drawing artifacts
            only if the morph is dragged?</div>
        </div>
      </div>
    </blockquote>
    <br>
    It will also result in different artifacts if the morph is rotated.
    It will also mean that grabbing the morph with the hand doesn't work
    as expected (you'd only be able to grab it from pixels that are
    actually painted, not if you click on holes). Submorph clipping will
    also be broken. Redisplays because of oclusions may be broken too.
    And other things I don't recall right now. And things that work
    today could break in the future (yes, I know this is always the
    case, but still).<br>
    <br>
    Essentially, you're not respecting the spec, and going to "undefined
    behavior" ( <a class="moz-txt-link-freetext" href="https://en.wikipedia.org/wiki/Undefined_behavior">https://en.wikipedia.org/wiki/Undefined_behavior</a> ).
    "Misuse will void your warranty", as they say. In theory, Cuis could
    crash, your PC could be set on fire, whatever. <br>
    <br>
    Just don't use BoxMorph outside its spec. Not worth the trouble.
    Just use PlacedMorph instead.<br>
    <br>
    <blockquote
cite="mid:CAFfRWnXZ6AnJW1b-0mQadRMNY7pcRyCtF57ndOmHhq=UYhO9Wg@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div class="gmail_quote gmail_quote_container">
          <div> </div>
          <blockquote class="gmail_quote" style="margin: 0px 0px 0px
            0.8ex; border-left: 1px solid rgb(204, 204, 204);
            padding-left: 1ex;">
            <div bgcolor="#ffffff">And that the reason is to allow for
              simple, high performance implementation of SystemWindow
              and other simple rectangular morphs, where these
              assumptions mean that the framework doesn't need to do the
              extra work for arbitrary shapes to work correctly.<br>
            </div>
          </blockquote>
          <div><br>
          </div>
          <div>Got it.</div>
          <div> </div>
          <blockquote class="gmail_quote" style="margin: 0px 0px 0px
            0.8ex; border-left: 1px solid rgb(204, 204, 204);
            padding-left: 1ex;">
            <div bgcolor="#ffffff">As a last comment, play with
              Sample07Clipping. Grab the inner star with the brown
              handle and move it around a bit. This will show the kind
              of expensive stuff that regular morphs do, but BoxMorphs
              avoid.<br>
            </div>
          </blockquote>
          <div><br>
          </div>
          <div>Nice! </div>
          <div> </div>
        </div>
        <span class="gmail_signature_prefix">-- </span><br>
        <div dir="ltr" class="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>
    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>
  </body>
</html>