Re: [JAVA2D] Drawing to an off screen buffer

2008-09-25 Thread java2d
You don't need a BufferStrategy or VolatileImage unless you are doing live animation. It was hard to tell from your message if that was the case. I usually use a BufferedImage that you get from createCompatibleImage and draw using Java2D to the graphics context you get from it. When the plot

Re: [JAVA2D] Drawing to an off screen buffer

2008-09-25 Thread java2d
Use the Canvas if you need hardware double-buffering badly enough that you're willing to deal with the Z-ordering issues that you get from mixing Swing and AWT widgets. Otherwise, use a JPanel. You cannot use a Canvas inside of a JScrollPane, for one thing. Rendering outside of the event

Re: [JAVA2D] Drawing to an off screen buffer

2008-09-25 Thread Ken Warner
Do you get reasonable animation with this method? How many frames a second do you get using invokeLater()? [EMAIL PROTECTED] wrote: You don't need a BufferStrategy or VolatileImage unless you are doing live animation. It was hard to tell from your message if that was the case. I usually use

Re: [JAVA2D] Drawing to an off screen buffer

2008-09-25 Thread java2d
Looking at some BufferStrategy examples, it seems that the pattern is to do rendering in a timed loop, something like this: [code] // Render loop while (!done) { Graphics g = strategy.getDrawGraphics(); render(g); g.dispose(); strategy.show(); try { Thread.sleep(100); }

Re: [JAVA2D] Drawing to an off screen buffer

2008-09-25 Thread java2d
I recommend using something similar to the Foxtrot API. It is not recommended to perform time intensive processes in the event queue. [Message sent by forum member 'bcorbett8769' (bcorbett8769)] http://forums.java.net/jive/thread.jspa?messageID=301665

Re: [JAVA2D] Drawing to an off screen buffer

2008-09-25 Thread java2d
Well, lets clarify/assume a few things. You have some data source, constantly producing data, right? While that data source happily produces data the user is also looking at a representation of that data, right? And the user can interactively select (scrolling, zooming) which portion of the

[JAVA2D] Drawing to an off screen buffer

2008-09-24 Thread java2d
Hi, I'm trying to build a little program that draws complicated time-consuming plots. I'd like to avoid having my UI freeze up while I'm rendering, so I don't want to do the rendering on the event dispatch thread. So, what's the modern (well, Java 5 level of modern) way of doing this? First,