views:

500

answers:

2

Is there any way of creating transparent mutable images in JavaME (CLDC 1.1, MIDP 2.0) ?

public static Image createImage(int width, int height)

Creates mutable image but not transparent one (at least not on Nokia phones!)

Any other Image.create* creates immutable immages and I don't know any way of creating mutable image from immutable one.

I need this to create "prerendering" functionality. Join several images into one to make rendering faster (I could join this images once and than draw them all in one call. It saves time and memory since I don't need to keep original images).

Maybe someone can think of any other way of accomplishing the same effect?

Thanks

A: 

Unfotunately no. MIDP does not support transparent mutable Images. You can stil use Image for pre-rendering some content, but you have to work around not having transparent pixels.

Honza
+1  A: 

You can use the Image.getRGB() to get the image data as an int array and process the alpha component and then draw that int[] to the Graphics using Graphics.drawRGB(). This might not work on phones that dont support alpha transparency

Ram
I would have to draw all other png files manually to this int[]. It might work but it's a bit of code to write.Thanks
KermiDT