How can I create an editable but transparent image in Java ME?
A:
If you want to create the transparent image programmatically then following is the snippet.
int width = 50, height = 50;
Image image = Image.createImage(width,height);
int[] rgbArr = new int[width * height];
image.getRGB(rgbArr, 0, width, 0, 0, width, height);
for (int i = 0; i < rgbArr.length; i++) {
if(rgbArr[i] == 0xFFFFFFFF){
rgbArr[i] = 0x00000000;
}
}
Image transImage = Image.createRGBImage(rgbArr, width, height, true);
Now you can get the graphics object on the transImage and paint whatever you want.
Vijay C
2010-09-16 08:48:40