Hi Gregory, please see my comments below.
On Fri, Sep 03, 2004 at 09:52:59PM -0400, Gregory Pierce wrote: > Okay here is the scenario (and I'm hoping there is something in the > API that permits this because at this point I haven't found anything). > > What I have are two RoundRectangle2Ds that have an alpha of 50 > percent. I want to draw a line connecting the centers of both of these > RoundRectangle2Ds. > > A----B > > If the RR2Ds were opaque I wouldn't have a problem, I would just draw > all of the links first and then draw all of the RR2Ds. Piece of cake. > However since the RR2Ds allow you to see through them, this clearly > won't work. > > I've looked at using Graphics2D.setClip(), but this will only allow me > to clip the line against one of the shapes. I also looked into solving > the problem using CAG, but Area doesn't work with lines (though I will > try to adapt my pathing algorithms to use rectangles if that solves my > drawing problem (here's hoping). > > It would be nice if there was a way to do a Graphics2D.addClip(Shape) > so that I could clip the graphics region by a near infinite number of > shapes. Same for intersect() and the like. I may be missing something, but why can't you construct a clip Area by subtracting (Area.subtract) the two RR2Ds you have from a rectangular clip, and set that area as the clip? Something along the lines of Area clipA = new Area(new Rectangle2D.Float(0, 0, winWidth, winHeight)); clipA.subtract(new Area(rr2d_1)); // cut out rr2d_1, which is the first RoundRect2D clipA.subtract(new Area(rr2d_2)); // ... the second ... g2d.setClip(clipA); g2d.drawLine(...) Or take a look at demo/jfc/Java2D/src/java2d/demos/Clipping.. Thanks, Dmitri > > Would be nice to see the OpenGL statemachine style of rendering start > bubbling up to Java2D. Now that you're accelerating it via OpenGL, > expect to see a lot of requests :) > > =========================================================================== > To unsubscribe, send email to [EMAIL PROTECTED] and include in the body > of the message "signoff JAVA2D-INTEREST". For general help, send email to > [EMAIL PROTECTED] and include in the body of the message "help". =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA2D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".