Help in J2ME for creating image and parse it

Posted by HAMED on Stack Overflow See other posts from Stack Overflow or by HAMED
Published on 2009-05-02T04:19:45Z Indexed on 2010/03/23 15:03 UTC
Read the original article Hit count: 299

Filed under:

Can anyone tell me how i can parse a png image into many png images in J2ME???

for examole:I just wnat to have a source image 150*150 pixel and parse it to 10 image with 15*15 pixel.

I write an elemantary code that have exeption.

This is my code:

public class HelloMIDlet extends MIDlet implements CommandListener {
private boolean midletPaused = false;

private Command exitCommand;
private Form form;
private StringItem stringItem;
Image im , im2;
Form form1 = null;

public HelloMIDlet() {
    try {
        // create source image
        im = Image.createImage("/image1.JPG");

        int height = im.getHeight() ;
        int width = im.getWidth() ;
        int x = 0 ;
        int y = 0 ;

        while ( y < height ){

             while ( x < width ){

                 // create 15*15 pixel of source image
                 im2 = im.createImage(im, x, y, 15, 15, Sprite.TRANS_NONE) ;
                 x += 15 ;
             }

             y += 15 ;
             x = 0 ;
        }          
    } 
    catch (IOException ex) {
        ex.printStackTrace();
    }

}

please help me to make it right....It's emergency!

Thanks a lot guys...

© Stack Overflow or respective owner

Related posts about java-me