Hello people, first I list my environment then the question.

Environment -
Device: Nokia E61
OS: Symbian OS v9.1
Platform: S60 3rd Edition
Memory Card: 32MB minimum (I think)

The package "com.nokia.mid.ui.DirectGraphics" and "javax.microedition.lcdui.Graphics" both have methods for drawing images directly from byte arrays;

Nokia:
Code:
drawPixels(byte[] pixels,
           byte[] transparencyMask,
           int offset,
           int scanlength,
           int x,
           int y,
           int width,
           int height,
           int manipulation,
           int format)
MIDP2.0:
Code:
drawRGB(int[] rgbData,
        int offset,
        int scanlength,
        int x,
        int y,
        int width,
        int height,
        boolean processAlpha)
Now, I was wondering, does it save memory to draw images directly from a byte array rather than from Image objects? I ask because, I have an image intensive application and I have been encountering memory problems. My idea was to convert all of the images to byte arrays and place them into a resource file. The following steps would be carried out to draw a paricular image;

1.open resource file and use index table to offset of image
2.read the size of the byte array
3.create byte array of specified size
4.load image data read into array
5.now draw images using either "drawPixel()" or "drawRGB()" methods

If one were to use the traditional method it would require a call to "Image.createImage(String)" which allocates an Image object. I don't know the overhead for Image objects but i seems like it would need to subclass "Object" inadditon to the actual image data and it has static methods of which I don't know the cost in memory would be. One benefit I know from using byte arrays is that all of the images would be in one resource file which should compress very well. If the file is too large I can always compress it before I jar and decompress it as I read it's contents using a J2ME GZip library, freeware!, that I found on the Internet.

I don't know which of the two methods is better; Nokia's "drawPixel()" or MIDP's "drawRGB", however, I assume that "drawRGB()" pack RGB+Alpha into an integer. Which one is better of the two. When I say better it means requires less memory and draws the fastest?

Thanks!