×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Regular Contributor
    Join Date
    Aug 2003
    Posts
    127

    Drawing PNG images against Array Images

    I would like to ask You if someone have any idea about efficiency issues those two operations. Lets say i have got an image like PNG size is 30x30 pixels and i am drawing it multiple times while moving and now the next example i have got the same image but in an array representation and i am doing the same thing which of these is faster method.

    2. Is it possible to create an array of exact screen and create scens on the array and after that just paint the whole array (i think not but i might be wrong).

    3. How to create small images and store them in array form??

    I would be very greatful for any hints and answers.

    MChmiel

  2. #2
    Registered User
    Join Date
    Dec 2003
    Posts
    20
    I can answer the third question:


    import java.io.IOException;
    import javax.microedition.lcdui.*;


    private Image[] baseImage = new Image[4];

    for (int i = 0; i < 4; i++) {
    try {
    baseImage[i] = Image.createImage("/man" + i + ".png");
    }
    catch (IOException e) {
    baseImage[i] = null;
    }

    }





    baseImage[0] will contain a image named man0.png
    baseImage[1] will contain a image named man1.png and so on...

  3. #3
    Super Contributor
    Join Date
    Mar 2003
    Location
    Israel
    Posts
    2,280
    I think what you're looking for are the com.nokia.mid.ui.* classes, specially com.nokia.mid.ui.DirectGraphics. It has methods to get an array of pixels out of a Graphics object, and to draw an array of pixels onto a Graphics object. But it will only work on Nokias.

    shmoove

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×