I can't display a numer of Forms on a Form

Trygve Reenskaug trygver at ifi.uio.no
Thu Apr 8 13:40:44 UTC 2004


I'm stupid -- again.

I want to display a number of pictures on aForm scaled and moved to fit 
within given rectangles.

In the simplified example below, I expected the red and blue forms to 
overlap the red since they are displayed within the same viewPorts. The 
critical method is
    WindowingTransformation class>>window: aWindow viewport: aViewport
         "Answer an instance of me with a scale and translation based on
         aWindow and aViewport. The scale and translation are computed such
         that aWindow, when transformed, coincides with aViewport."
Here's the code. The resulting red and blue rectangles are o different in 
both size and position.

Image is my working image based on Sq3.6-5429-comp.

Thanks
--Trygve

buildObjectsCompositeForm2
    " R23CompositeMorph buildObjectsCompositeForm2 "
    | form frames |
    frames :=  { 6 at 2   corner: 449 at 238.
               186 at 210 corner: 434 at 390.
               505 at 218 corner: 653 at 388. }.
    form := Form extent:  700 at 500 depth: 8.
    form fillWithColor: Color yellow.
   frames  do:
       [:frame || subForm |
       subForm := Form extent: frame extent depth: 8.
       subForm fillWithColor: Color red.
       subForm
          displayOn: form
          transformation:
             (WindowingTransformation window: subForm boundingBox viewport: 
frame)
          clippingBox: (form boundingBox)].
   frames  do:
       [:frame || subForm |
       subForm := Form extent: frame extent * 2 depth: 8.
       subForm fillWithColor: Color blue.
       subForm
          displayOn: form
          transformation:
             (WindowingTransformation window: subForm boundingBox viewport: 
frame)
          clippingBox: (form boundingBox)].

    form displayAt: 10 at 10.











-- 

Trygve Reenskaug      mailto: trygver at ifi.uio.no
Morgedalsvn. 5A       http://heim.ifi.uio.no/~trygver
N-0378 Oslo           Tel: (+47) 22 49 57 27
Norway





More information about the Squeak-dev mailing list