基于MIDP2.0实现图片的缩放功能[7]

[入库:2006年2月23日] [更新:2007年3月24日]

本文简介:

 

 

 

 

 

 

/*
 * Created on 2004-12-24
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package com.j2medev.image;

import java.io.IOException;

import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.Image;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;


public class TestMIDlet extends MIDlet
{
    private Display display;

    private Form form;

    protected void startApp() throws MIDletStateChangeException
    {
       
        display = Display.getDisplay(this);
        Image srcImage = null;
        try
        {
            srcImage = Image.createImage("/welcome.png");

        } catch (IOException e)
        {
        }
        ImageUtil iu = new ImageUtil();
        form = new Form("Image");
        int width = form.getWidth();
        int height = form.getHeight();
        Image destImage = iu.resizeImage(srcImage, width, height,
                ImageUtil.MODE_POINT_SAMPLE);
        form.append(destImage);
        display.setCurrent(form);

    }


    protected void pauseApp()
    {
      
    }


    protected void destroyApp(boolean arg0) throws MIDletStateChangeException
    {
       

    }

}

本文关键:基于MIDP2.0实现图片的缩放功能
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top