Bug 87776 - GC API for intersecting a new clipping with the current
Summary: GC API for intersecting a new clipping with the current
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 enhancement with 5 votes (vote)
Target Milestone: ---   Edit
Assignee: Silenio Quarti CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
: 312242 (view as bug list)
Depends on:
Blocks: 238595
  Show dependency tree
 
Reported: 2005-03-11 10:35 EST by Randy Hudson CLA
Modified: 2019-09-24 13:49 EDT (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Randy Hudson CLA 2005-03-11 10:35:27 EST
GC has setClipping(something), which overwrites the clipping. We would like 
API to intersect "something" with the existing "something".  For example:

gc.setClipping(dirtyRect);
...
gc.clip(myObject.getRectangularBounds());
myObject.goPaintOn(gc);
..

The effects of gc.clip(..) would be the same as
gc.setClipping(r1.intersect(r2));

Of course we can do this ourselves if it's just a bunch of rectangles. But 
once you mix in paths and regions, it's impossible to do.
Comment 1 Veronika Irvine CLA 2005-03-11 13:05:08 EST
Region already has an intersect() method for both Regions and Rectangles.   
The only thing which is not supported is Path.
Comment 2 Randy Hudson CLA 2005-03-11 13:18:37 EST
Yes, region has intersect, but what is the current region in the current 
transformation? It's not available. If I set a region, then rotate the GC, I 
cannot get back the rotated region.
Comment 3 Michael Baehr CLA 2005-07-15 15:23:50 EDT
Is somebody looking at that?

I developed a library to render PDFs using Java2D. Right now, I'm converting it
into a pure SWT implementation.

Unfortunately, there is no equivalent for the java.awt.Graphics API
"clip(Shape s) Intersects the current Clip with the interior of the specified
Shape and sets the Clip to the resulting intersection." in SWT.

For now, I save the last clipping path, convert it to a Java2D shape, do the
intersecting and then convert the resulting Shape back into a Path ...

I think we need the clipping functionalty mentioned in this bug report and also
a way to intersect arbitrary Paths.
Comment 4 Zhiqiang Qian CLA 2006-04-20 03:17:00 EDT
Yes, we are also wondering how to intersect two Path, or Path with Region.
Comment 5 Elfi Heck CLA 2007-01-11 07:47:55 EST
+1.
We have a PDF rendering library too.
Comment 6 Mike Schrag CLA 2008-06-29 09:19:01 EDT
Another vote on this one ... Mixing paths and non-paths in the clipping system is currently impossible without writing platform-specific SWT code (bleagh).  I don't know about other OS's, but on OS X, clipping is actually intersecting by default, so the current code in SWT works AROUND this feature by calling setClipping(0) prior to clipping to the specified Path.

I second the gc.clip(...) API suggestion.
Comment 7 antti.tirkkonen CLA 2010-05-10 08:17:02 EDT
*** Bug 312242 has been marked as a duplicate of this bug. ***
Comment 8 Lars Vogel CLA 2019-09-24 13:49:46 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.