Ted,

There is no inherent native performance advantage of loaded images
versus BufferedImages - they both currently run through the same native software
loops when copying data back and forth.  The only advantage you might
see would be due to the type of BufferedImage you are creating.  That is,
if you create the same type of BufferedImage as the loaded image is
using, the performanced should be the same.  But if you create a
BufferedImage that is less optimal than the image type
created internally when loading an image, then performance will
suffer in the BufferedImage case.

One thing to keep in mind when creating images is the type of image that
you will be copying data to and from.  For example, if you are creating
an image whose data will be copied to the screen (such as a back
buffer or a sprite), then creating an image of the same depth/type as
the screen will give you the best performance (i.e., our copy loops
won't have to translate between your image representation and the
screen's; they can just copy the data as is).

The easiest way to achieve this similarity between your offscreen image
and the screen representation is to simply use the createImage(w, h)
method.  This method is guranteed to return you an image that has the
same depth as the screen.

As a side note, we are currently working on enabling hardware acceleration
for offscreen images.  These acceleratable images would also be created
through the createImage(w, h) API (or through similar methods) and
not necessarily through manually-created BufferedImage objects.  The more
control you hand over to Java2D in creating and manipulating the images
(e.g., letting us create the most appropriate image for you instead
of creating your own), the more possibility there is for Java2D to
accelerate operations on that image (because we can make more assumptions
about the data and representation of that image).

I hope this helps.

Chet Haase.

> Content-Transfer-Encoding: 7bit
> From: Ted Eiles <[EMAIL PROTECTED]>
> Subject: [JAVA2D] Performance: Windows Image -vs- BufferedImage
> To: [EMAIL PROTECTED]
>
> Assumptions:
>
> When I load an image from a file I'm getting a platform/native optimized
> implementation.  When I create a BufferedImage I get an all-Java
> implementation.
>
> Questions:
>
> What are the speed and  memory tradeoffs between the two implementations?
>
> Would saving dynamically create images (using BufferedImage ) to disk and
> then reading them back as native images give me better memory/speed
> performance in the long run?
>
>
> Thanks --- Ted
>
> ===========================================================================
> 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".

Reply via email to