[BUG]Off-centerMorphs

Jerome Peace peace_the_dreamer at hotmail.com
Wed Feb 27 00:32:49 UTC 2002








Fun with off-center morphs.


Symptoms: flipped skectchMorphs lose the right or bottom row of pixels
depending on whether they are vetically or horizontally flipped.

Rectangles (I'm using rulerMorphs to debug) when rotated 90 degrees will 
lose the bottom (left rotation) or right (rotation) row of pixels
Iff the rectangles extent is odd at even or even at odd.


Some analysis:  The inspectors show that the transformationMorph is using an 
offset of -xxx.5 at -yyy.5 and the rulerMorph bound is usually -xx at -yy corner 
xx+1 at yy or corner xx at yy+1. Where the extent is equally odd or even the 
problem isn't visible. So somewhere I believe the truncation of the offset 
squeeze a row or column out of the picture.

Looking at the morph in a holder with the cursor indicating shows there are 
extra transparent pixels on the left or top and the final rows seem to be 
shifted out of the clipping box.

Possible solutions:
1) the eight special cases (4 rotations including identity and there flipped 
counter parts) should be caught and handled specially. This has the great 
virtue of preserving your color form and form extent ( I'm assuming the 
special cases are handled by permuting the rectangle innerCorner quad before 
it is fed to warpBlt)

2)Since TransformMorph is padding the form anyway why not have it make pad 
the odd even extents so they are even at even or odd at odd. Odd at odd would have 
the same "center" as the odd even extents.

3)Thought about why this is occurring should be given. I believe it is 
actually a symptom of several off-by one errors in the drawing and 
transforming routines.

****


Useful tests to see what's going on:
I exported some rulerMorphs of various sizes as gifs and read them back in 
as sketch morphs. The problem when using rotation styles #vertical or 
#horizontal occurred regardless of the oddness/evenness of the height and 
width.

I put the morphs in a holder and to my delight realized the holder 
surrounded the drawn morph form with its cursor.

Generally the morph was being displayed with width and height increased by 
2 at 2. And the form was getting the extra pixels on the left and top then 
clipping the significant pixels on the right and bottom.

Further investigation showed that the off-centering was not confined to 
sketch morphs but applied to any transformed morph as well.

Try rotating an ellipse in the holder and you will see how bad the 
accumulation of errors can get (at some 45 degree angles particularly).

***



Yours in service,
Jerome Peace






_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com




More information about the Squeak-dev mailing list