* the image height
* @return an image from an RGB image
*/
public static Image createImage(int[] rgb, int width, int height) {
try {
Image i = new Image(new VirtualImage(rgb, width, height, true));
// its already set so might as well do the test
i.testOpaque(rgb);
return i;
} catch (OutOfMemoryError err) {
// Images have a major bug on many phones where they sometimes throw
// an OOM with no reason. A system.gc followed by the same call over
// solves the problem. This has something to do with the fact that
// there is no Image.dispose method in existance.
System.gc();
System.gc();
return new Image(new VirtualImage(rgb, width, height, true));
}
}