Building Mobile Enterprise Applications : Using webMethods Mobile Designer : Coding a Mobile Application : Image Caching : Copying an Image for Drawing
Copying an Image for Drawing
While in most cases, cached Images are desirable, if the developer wishes to alter a single instance of an Image that has been created through Image.loadImage() it should be copied to a separate instance of the Image. A simple way to do this is illustrated below. With a non-null Image oldImage.
//AARRGGBB data
int[] imageData = new int[oldImage.getWidth() * oldImage.getHeight()];
oldImage.getRGB(imageData, 0, oldImage.getWidth(), 0, 0, oldImage.getWidth(),
oldImage.getHeight());
Image newImage = Image.createRGBImage(imageData, oldImage.getWidth(),
oldImage.getHeight(), true);
Copyright © 2007-2017 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback