Jesse,

Your approach sounds correct and should result in accelerated
images in general.  Some things that could affect this are:
        - the platform you are running on (I know we support
        bitmask transparent accelerated images on Windows
        currently, I'd have to check on the other platforms)
        - the operations you are doing with those images
        (rendering to the images will go through software
        routines and will be no faster than similar
        operations on BufferedImages; rendering from the images
        to other accelerated images like the back buffer or
        screen should go at hw-accelerated speeds).  Note
        that animated images will not benefit from acceleration
        because we cannot use the hardware accelerated version
        of the image if the primary version is being constantly
        updated.  Note also that if you do any operation that gets
        access to the raster or data buffer of the image that we
        may give up on acceleration.
        - the bit depth you are running in (I do not believe we
        currently support transparent images in 8 bits per pixel mode).

This is the approach we use in our demos (such as the DukeRoids
demo if you've seen that): create a bitmask transparent image,
render to it once, and copy it to the back buffer after that.
As of the second copy, we run at hardware speeds on these
type of images.

If all of this makes sense and you think your images still should
be accelerated, perhaps you could send me a small test case
that shows the problem I can see what's going wrong.

Thanks,
Chet Haase.
(Java2D)

"Grosjean, Jesse" wrote:
>
> I'm using Component.createImage(int, int) to create accelerated images, and this
> is working well for creating opaque images, but it does not work for transparent
> images. I don't believe that fully transparent images can be accelerated with
> Java yet (let me know if i'm wrong) but i have read that 1-bit transparency
> images can be accelerated. Is this the case, and if so how is it done? Right now
> I have the following createAcceleratedImage that i'm trying to use:
>
>         public static Image createAcceleratedImage(Image image) {
>                 if (image instanceof AcceleratedOffScreenImage)
>                         return image;
>
> // this works but the accelerate images are always opaque, so comment it out.
> //              Image result = myComponent.createImage(image.getWidth(null),
> image.getHeight(null));
>
> // This makes images will transparency, but they seem the same speed as normal
> buffered images with transparent regions.
>                 GraphicsConfiguration graphicsConfiguration =
> GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDe
> faultConfiguration();
>                 BufferedImage result =
> (BufferedImage)graphicsConfiguration.createCompatibleImage(image.getWidth(null),
> image.getHeight(null), Transparency.BITMASK);
>                 Graphics2D g2 = (Graphics2D) result.getGraphics();
>                 g2.setColor(new Color(0, 0, 0, 0));
>                 g2.setPaintMode();
>                 g2.fillRect(0, 0, image.getWidth(null), image.getWidth(null));
>                 g2 = (Graphics2D) result.getGraphics();
>                 g2.drawImage(image, 0, 0, null);
>                 return result;
>         }
>
> But the images (when using the Transparency.BITMASK) code do not seem
> accelerated.
>
> So is it possible to get accelerated images with a BITMASK?
>
> Thanks,
> Jesse
>
> ===========================================================================
> 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