How do I create a EncodedImage from a javax.microedition.lcdui.Image
I am developing a j2me application for the BlackBerry. I download a large GIF and now want to scale the image to fit the screen. I am looking for better performance开发者_运维百科 that scaling the image using by using approaches like this.
I haven't used the microedition Image myself, but I've worked with RIM's Image class recently, and it seems the least-common-denominator representation is an array of RGB values. I see that lcdui.Image has a method
getRGB(int[] rgbData, int offset, int scanlength, int x, int y, int width, int height)
which should give the array you need. You can then get a RIM Bitmap or Image or PNGEncodedImage with
Bitmap.setARGB(int[] data, int offset, int scanLength, int left, int top, int width, int height)
ImageFactory.createImage(Bitmap bitmap)
PNGEncodedImage.encode(Bitmap bitmap)
精彩评论