Linewidth of a graphic not working correct

Dar Scott dsc at swcp.com
Wed Jun 11 09:58:01 EDT 2003


On Wednesday, June 11, 2003, at 02:54 AM, tkuypers at pandora.be wrote:

> Version 2.0.1 on both OSX and Windows, only the Windows version seems 
> to
> have this problem...

This was reported with some major problems with lines on OS X, so it 
may have fallen into the crack.

I suggest a workaround to adjust the two wandering edges.  This should 
detect Windows and only do it there.


<begin dar's model of pixels>

Here is how I look at a close up of pixels in Revolution.  Think of 
pixels as squares on a grid

In most cases (well, all I have used), it is helpful to look at 
positions as _between_ the pixels.  A pixel might be, say between 
coordinate 100 and 101.  If you make a rectangle whose left is 100 and 
whose right is 103, it will occupy columns of pixels, 100-101, 101-102, 
102-103.  Note that the real width, 3, and the width property are the 
same.

Note that the center, because of the odd width is at 101.5 and the 
location property is (I think) probably 101.  If you are making fine 
adjustments, don't use the location, use the rectangle property or 
left/top/right/bottom.

In this model, the card origin is just to the upper left of the upper 
left pixel.

A rectangle whose left is 103 and whose top and bottom are the same as 
the one above will butt against the one above.

<end dar's model of pixels>

I'm assuming that odd or even width does not affect this.  You may want 
to run a test.

The workaround is simply to adjust the rectangle.  (You can use custom 
properties, but I'll assume commands and functions.)

Make a function called trueRectangle and a command called 
setTrueRectangle.  Make a function called trueBorderWidth and a command 
called setTrueBorderWidth.

If the platform is Windows...  The command setTrueRectangle adjusts the 
right and bottom one up if the borderWidth is even and then sets the 
rectangle.  The function trueRectangle decreases the right and bottom 
returned by the rectangle before returning that if the borderWidth is 
even.  The command setTrueBorderWidth increases the right and the 
bottom if the borderWidth changes from odd to even and decreases them 
if it changes from even to odd.  It sets the borderWidth, too, of 
course.  Run everything through these.

If you use an alternate model of pixel coordinates, then you have to 
adjust your thinking accordingly.

Dar Scott





More information about the use-livecode mailing list