Draw2D and non rectangular clipaths [message #245472] |
Fri, 12 September 2008 12:15 |
Eclipse User |
|
|
|
I see from the code of SWTGraphics that if I push the state of the
graphics and have a non rectangular clip path my drawing code will fail.
I have a fairly basic requirement to display elliptical figures with
elliptical child figures which users can move around. Rather than
constrain them to be in some rectangular client area I would like the
users to be able to move them around within the bounding box of the
parent, but clip them within its boundary.
Has anyone tried this sort of thing?
Is there a standard approach?
The 3 approaches I can think of are after looking at other articles are:
1) Create a new version of Draw2D LWS Control and DeferredUpdater classes
that use an Java 2D Graphics2D context to draw on the background. ( for
example http://www.holongate.org/ )
2) Create a figure which draws on a Java2D canvas and them paint that onto
the figure at the end. In essence a version of 1 which is localized in its
changes
3) Create a subclass of Draw2D Graphics which does its own clipping and
intersection using an abstract graphics package to calculate the
intersections ( if I wanted to go beyond ellipses to arbitrary polygons ),
for example http://www.cs.man.ac.uk/~toby/alan/software/
Thanks, I appreciate non rectangular clipping is a performance issue
|
|
|
Powered by
FUDForum. Page generated in 0.15954 seconds