> Hi Dmitri,
> 
> The code is pretty much as per the example you gave.
> There's no hidden magic.  I am rendering lines and
> gradients mostly if that's any help.  I am running
> with JSE 6 Update N Build 07 at the moment and
> VolatileImage handling is still slower (much slower)
> for what I am doing.  The VI probably gets blasted
> on to the screen more quickly than the BufferedImage
> but my processing of sub-regions is definitely
>  faster with a BI.

The code that Dmitri gave was an example of how to save a copy of a portion of 
the VI into a system memory image.  The advantage of that technique is that the 
system memory image will be persistent as long as you hold a reference to it - 
so you can hold on to it for a long time without losing it.  The disadvantage 
of it is that it requires copying the pixels to main memory - and then back to 
VRAM if you later restore it.  It is not a good technique to use if you need to 
grab and restore the sub-regions often as he mentioned a few posts ago.

If you are doing something performance critical in all of this then it will be 
much faster to copy the sub-regions aside into a VI so that the data stays 
entirely in the graphics memory.  Use the same drawImage call that he 
described, but create the image you are saving it into as a VI instead of a 
"compatible image" as was shown in his code.  The disadvantage of using a VI as 
the temporary image is that you could run out of VRAM (not likely with today's 
high memory cards), and that you could lose the contents of the temporary VI 
since they are volatile (though if you lose those VI contents then you likely 
lost the contents of your main render buffer as well).  All in all, these 
disadvantages are not important if you need the performance.

The type of image you use for your temporary save/restore images will depend on 
which type of image is used for your rendering buffer.  If it's a VI, then use 
a VI for the save/restore images if you want performance and only use a system 
memory image if it must not be volatile.  If the main rendering buffer is a BI 
or a CI then use a BI or CI of the same pixel format.
[Message sent by forum member 'flar' (flar)]

http://forums.java.net/jive/thread.jspa?messageID=246490

===========================================================================
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".

Reply via email to