[reportlab-users] diagonal ShadedRect and Clipping ?
Robin Becker
reportlab-users@reportlab.com
Sat, 10 Aug 2002 11:48:25 +0100
well, I hope you're using the latest renderPM code Dirk. I left in some
experimental stuff during the release of 1.15. The current clipping
philosophy is as follows.
1) We assume positive rotations are +1 so a unit square in order
(0,0) (0,1) (1,1) (1,0) (0,0)
has area 1.
2) We demand that paths have a non-negative area. So if you put in the
above square as
(0,0) (1,0) (1,1) (0,1) (0,0)
we find the area as -1 and reverse the drawing order. This applies to
more complex cases where one part of a curve has to have a negative area
eg
definePath((('moveTo',10,10),('lineTo',10,110),
('lineTo',110,110),('lineTo',110,10),'closePath',
('moveTo',20,20),('lineTo',100,20),('lineTo',100,100),
('lineTo',20,100),'closePath'),
strokeColor=red,fillColor=yellow)
if you orient this wrong we assume you meant to have a positive area.
And reverse it.
3) clip paths are forced have non-negative area as well.
4) The libart intersection code then seems to work very well.
As for the shaded object problem I prefer a single ShadedObject.
I think The general Polygon problem is quite hard. However, the
following should be considered. If we consider a single color axis then
the 50-50% mix should occur at the centroid of the polygon. The
difficulty is in getting both the 100-0% & 0-100% values since for
general polygons & angles the extreme points will in general not lie on
the variation axis. From experience choosing the points which are
furthest apart on the shading axis to be 100-0% and 0-100% may result in
an unfair look. It should be a fairly easy task to compute both kinds of
distribution.
Like Dinu I fail to understand the need for the extra direction
indicator.
--
Robin Becker