hello friends,
i have created a mutable image of the size 1920x160 pixels..
but i want to remove the one particular color from the image. but when i do the getRGB for the mutable image it says "Out of Memory Error" ... ?
My code goes as belows..
Image mapImage = Image.createImage(1920, 160);
int[] pixels = new int [mapImage.getWidth() * mapImage.getHeight()];
System.out.println("pixelDataArr length -- > " + pixelDataArr.length);
System.out.println(" free memory after : " + Runtime.getRuntime().freeMemory());
mapImage.getRGB(pixels,0,mapImage.getWidth(),0,0,mapImage.getWidth(),mapImage.getHeight());
for(int i=0;i<pixels.length;i++)
{
if(pixels[i]==0xFFFF00FF)
{
pixels[i]=0x00000000;
}
}
//and then create the image with a transparent background
//mapImage=Image.createRGBImage(pixels,mMapWidth << 4, 2 << 4,true);
mapImage=Image.createRGBImage(pixels,mapImage.getWidth(),mapImage.getHeight(),true);

Reply With Quote


