Re: Puzzling image drift

2002-01-26 Thread PEChumbley


To illustrate the situation in one dimension, if a line is 99 pixels wide, 
its centerpoint is at 50 with 49 pixels before and 49 pixels after the 
centerpoint.  But if the line is 100 pixels wide, the centerpoint is actually 
at 50 1/2.  Since you can't center the line on a half pixel, the line would 
be shifted slightly right or left from true center (depending whether you 
round up or truncate the number) so the image is now offset.  If you now make 
the line 99 pixels wide again it will stay centered in the same place but 
switching it back to 100 pixels wide again will shift it once again.  If the 
half-way points are rounded up (ie. 50 1/2 --> 51), the effect would be that 
a line would drift to the left or an image to the upper left.  To correct for 
that, simply read the location of the first image into a variable (oldLoc) 
and include a line saying:

set the loc of image myImage to oldLoc

after setting the filename.  Be aware that you may see the image "jump" 
slightly.  If that is unacceptable, make the image invisible, set the 
fileName to the new name, set the loc to the oldLoc , and then make it 
visible.  In my application I use two images.  While viewing one, I set the 
file name of the invisible one and reposition it and then hide one and show 
the other.

Hope this helps.

Philip Chumbley
___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard



Re: Puzzling image drift

2002-01-26 Thread Jeanne A. E. DeVoto

At 12:40 PM -0800 1/26/2002, John Vokey wrote:
>I have a stack that presents a series of disk-based images by replacing
>the file name of the image object on the card.  The images are not the
>same size, and over images the object appears to drift up and to the
>left.  As this effect does not happen with identically-sized images, I
>suspect it has something to do with how MC determines the location of
>new image when replacing the previous one of a different size.  I had
>assumed that the loc (top-left) of an image object was fixed, and all
>subsequent images would be displayed using that loc, but apparently
>not.  So, what gives?

The loc of an image is its center, not its top left. This point remains
constant (unless you change the loc or rect or a related property) when you
change the image's fileName.

--
Jeanne A. E. DeVoto ~ [EMAIL PROTECTED]
http://www.runrev.com/
Runtime Revolution Limited - Power to the Developer!


___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard



Puzzling image drift

2002-01-26 Thread John Vokey

I have a stack that presents a series of disk-based images by replacing 
the file name of the image object on the card.  The images are not the 
same size, and over images the object appears to drift up and to the 
left.  As this effect does not happen with identically-sized images, I 
suspect it has something to do with how MC determines the location of 
new image when replacing the previous one of a different size.  I had 
assumed that the loc (top-left) of an image object was fixed, and all 
subsequent images would be displayed using that loc, but apparently 
not.  So, what gives?  MC 2.4.1, Mac OS 10.1.2.

John R. Vokey

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard