- From: Don Blaheta <blahedo blahedo org>
- To: dia-list gnome org
- Subject: Rounded corners
- Date: Wed, 28 May 2008 22:37:20 -0500
I've been playing around with lib/diagdkrenderer.c to try and work on
bug #534275. I noticed the changes made in the recent SVN update, which
partially solve the problem, but there are a few problems still. The
biggest, I think, is that "corner radius" is being used to mean two
different things: the radius of rounding for a rounded rectangle, and
the radius of rounding for the cap of a regular rectangle. The former
it is reasonable to measure from the control points (as it is), although
measuring from the inside or outside edge would also be reasonable; the
latter really must be measured from the outside edge.
The current workaround is to say that if the given radius is less than
half the width of the line, treat it as a cap and measure from the
outside edge, and otherwise measure from the control points. I had to
go into the code to figure out what was going on there, because it
seemed buggy when I was just playing with it: if you compare two boxes
with line width 4, one with corner radius 2 and one with radius 1.99,
they look very different! I don't think this will work. (It's also not
mirrored in the zigzagline or polylines.)
I see three possible solutions:
* Treat rounded rectangles as different objects from regular boxes. A
rounded rectangle has a corner radius that works as the box corner
radius does now; a regular box has a "cap radius" that measures from
the outside edge of the line. If the cap radius is zero, the cap is a
square cap. The cap radius cannot be larger than the line width.
A rounded rectangle with corner radius zero would look like a regular
box with cap radius of half the linewidth. Polylines and Zigzaglines
would be made to match the regular box behaviour; as it stands they
already can't have a corner radius that rounds more than just the
* Treat all rectangles as the same, but always measure the corner radius
from the outside edge of the line. This is probably ok, but it does
mean that the curve of the corner changes when the line width does.
Polylines and zigzaglines are modified to match.
* Revert the behaviour of rounded rectangles to always measure the
corner radius from the control points, but add a boolean flag to boxes
that chooses rounded vs square cap; it would be greyed out if the
corner radius is other than zero. "Rounded" would make a radius of
exactly half the linewidth. Polylines and zigzaglines get the
checkbox as well instead of a corner radius option.
How do Visio and other such programs handle any of this?
-=-Don Blaheta-=-=-blahedo blahedo org-=-=-=-<http://www.blahedo.org/>-=-
Isn't it interesting that the same people who laugh at science fiction
listen to weather forecasts and economists? --Kelvin Throop III
] [Thread Prev