code_junkie

How to create transparent images in Java ME

Nov 13th, 2011
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. int width = 50, height = 50;
  2. Image image = Image.createImage(width,height);
  3.  
  4. int[] rgbArr = new int[width * height];
  5.  
  6. image.getRGB(rgbArr, 0, width, 0, 0, width, height);
  7.  
  8. for (int i = 0; i < rgbArr.length; i++) {
  9.  
  10. if(rgbArr[i] == 0xFFFFFFFF){
  11.  
  12. rgbArr[i] = 0x00000000;
  13.  
  14. }
  15.  
  16. }
  17.  
  18. Image transImage = Image.createRGBImage(rgbArr, width, height, true);
Add Comment
Please, Sign In to add comment