Przemyslaw Zych
Przemyslaw Zych

Reputation: 2060

How to create transparent mutable Image in JavaME?

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 images 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 then 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?

Upvotes: 1

Views: 1773

Answers (2)

Prabhu R
Prabhu R

Reputation: 14222

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

Upvotes: 2

Honza
Honza

Reputation: 4409

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.

Upvotes: 0

Related Questions