[reportlab-users] diagonal ShadedRect and Clipping ?

Dinu Gherman reportlab-users@reportlab.com
Sat, 10 Aug 2002 17:18:41 +0200


Dirk Datzert:
>
> So if we make a basic class for ShadedObject or ShadedShape what will be
> our goal for that object ?

 From my point of view the goal must be to provide a uniform way for
each (existing) solid shape to have shaded filled inner area. Quite
likely that means one or two new attributes like shadedFillStartColor
and -EndColor or start-/endShadedFillColor.

Unfortunately, as Robin has pointed out, there are many ways of in-
terpreting what "shaded" exactly means. This is one thing to speci-
fy first. Then there are different shading modes, like linear, lo-
garithmic, circular, elliptic, and, why not, multi-center shading
with more than two colors.

This is probably fun to generalise all into one concept... especial-
ly, since one might want to do the same with my Grid class, which
could end up as multi-center thingy, too, and could be quite useful
for iso-lines in GIS applications. But to get there you probably
need to solve quite a few differential equations... ;-)

BTW, if you ever need to compute a convex hull for polygons, the
Python Cookbook has a recipe for doing so, which I submitted. ;-)

One should also investigate what libart, PIL and SVG provide as
built-in shading concepts.

>       SolideShape - Rect | Circle | Rect | Ellipse
>      /
> Shape
>      \
>       ShadedShape - ShadedRect | ShadedCircle | ShadedPolygon

Replicated class hierarchies is certainly *not* a good idea.

Dinu