A translucent effect is often used in the game. However, the MIDP1.0 seems to have only NOKIA and LG's extended APIs give an API that can handle Alpha channels. Under MIDP2.0, we can get a half-transparent version of a picture with the method provided by the Image class.
Try {image = image.createImage ("/ ken.png"); // Load original} catch (ioException e) {} int [] argb = new int [Image.GetWidth () * image.getHEight ()] ; // Generate an image data array image.GetrGB (Argb, 0, Image.GetWidth (), 0, 0, Image.GetWidth (), Image.getHeight ()); // Get Argb Matrix FOR (INT i = 0; I
The effect of operation is as follows:
This can achieve a translucent effect in the game. Plus your genius creativity, the game will change more dazzling!
This program is passed under Eclipse3.0 EclipseMe0.6 WTK2.2.