On Mon, 6 Sep 2004 22:57:40 -0700, Dmitri Trembovetski
<[EMAIL PROTECTED]> wrote:
> On Mon, Sep 06, 2004 at 01:10:02PM -0400, Gregory Pierce wrote:
> > Note: What is attached below is a copy from the Apple java-dev mailing
> > list to provide additional insight into the problem:
> >
> > I have started looking at solving this problem 3 ways:
> >
> > 1) Cheat and get a point on the bounding box and draw the line from that
> > point. It will look funky, but quite possibly no one but me will notice
> > since the arcs are only 10 pixels in width and height. I have a sneaking
> > suspicion this will be the fastest way until the number of shapes and links
> > being drawn gets large. Since this is something I expect it will be an
> > interesting control for the others.
>
> Speaking of cheating. How about this: render the lines first, then
> render RR2Ds with the background color to remove the unneeded parts
> of the lines, and then render the translucent RR2Ds..
> (and if you want to get the most benefit, it may be better to render
> all of the lines first, then all of the opaque RR2Ds, and then all of
> the translucent ones).
>
> Of course, this works only if you have a single-colored background.
>
Yeah I did that EXACTLY. That was done as a variant of #3. It was
actually slower than using the clipArea - probably because of the
extra draws into the frame buffer. All of the RR2Ds are translucent so
it becomes a basic (pseudo coding here)
Iterator lineIterator = lines.iterator();
while (lineIterator.hasNext())
{
WidgetIF widget = (WidgetIF) lineIterator.next();
widget.draw( g2d );
}
Iterator nodeIterator = widgets.iterator();
while (nodeIterator.hasNext())
{
WidgetIF widget = (WidgetIF) nodeIterator.next();
widget.setColor( backgroundColor );
widget.draw( g2d );
widget.setColor( translucentColor );
}
Iterator nodeIterator = widgets.iterator();
while (nodeIterator.hasNext())
{
WidgetIF widget = (WidgetIF) nodeIterator.next();
widget.draw( g2d );
}
I'll get more precise numbers this afternoon. Right now I can't tell
how all of this stuff is implemented under the covers but its a lot
slower than anything I've done in raw GL and when I worked on the JOGL
port for OSX I was able to do similar a lot faster. I'm hoping that I
don't have to rely on my own native layer to do the drawing :(
===========================================================================
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".