Transparency

With the Nokia UI API, you can create a mutable image initialized to any color, including “transparent”.

All devices supporting the Nokia UI API support transparency in the standard MIDP Image.createImage(String) and Image.createImage(byte[], int, int) methods. PNG’s simple transparency (that is, tRNS chunk) is supported, as is the alpha channel, although alpha blending (blending drawn pixels’ colors with background pixels’ colors) may be unsupported.

In practice, this means that if you create your images from PNG-format files or PNG-format byte data with transparency, the transparent pixels are not drawn when the images are displayed. This allows you to have non-rectangular sprites.

com.nokia.mid.ui.DirectGraphics class includes several getPixels and drawPixels methods for doing this, but MIDlets that take full advantage of this feature may sacrifice portability even between Nokia device models.