CLIM mail archive
[Prev][Next][Index][Thread]
Rendering of shapes and line style thickness
CLIM2 beta2
ACL 4.2beta2
Sun
Hi:
I am trying to draw concentric shapes (such as rectangles, ellipses,
etc.) and am having problems with making them be drawn *truly*
concentric. It seems that very often I am wrong by one pixel on two
of the axes depending on the line style thickness that I use to draw
the (unfilled) shape. I presume that CLIM's rendering model is biting
me here.
So, is the below analysis correct?
Assume that I have a line style thickness of 3.
The "x" symbol denotes the corner of the rectangle.
Is the outline for the rectangle is then drawn as follows?
.......................
.x...................x.
.......................
... ...
... ...
... ...
... ...
... ...
.......................
.x...................x.
.......................
Assume that I have a line style thickness of 2. Is the outline then
drawn as follows? That is, the inside of the shape does *not* include
the bottom row or right column of pixels? (Section 12.4 of the CLIM2
spec on rendering conventions for geometric shapes.)
........................
.x...................x..
.. ..
.. ..
.. ..
.. ..
.. ..
.. ..
.. ..
.x x..
........................
........................
What I really want to do is draw an outline around the *outside* of a
rectangle. Something like:
...........................
...........................
...........................
...x x...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
...x x...
...........................
...........................
...........................
And:
.........................
.........................
..x x..
.. ..
.. ..
.. ..
.. ..
.. ..
.. ..
.. ..
..x x..
.........................
.........................
So, for line odd line thicknesses, I have to adjust the left, top,
right and bottom coordinates that I draw at by:
(1+ (- (floor line-thickness 2)))
and for even line thickesses I have to adjust the left and top
coordinates that I draw at by:
(- (floor line-thickness 2))
Is this correct? Is there some other mechanism that I'm missing here?
I presume that this will work similarly for ellipses?
Thanks
ba
Brian H. Anderson (206) 234-0881
Boeing Commercial Airplane Co. bha@ata.ca.boeing.com
P.O. Box 3707 M.S. 6A-PX
Seattle, Wa. 98124-2207
Follow-Ups:
Main Index |
Thread Index