rt,怎么j2me上这么多实现的方法,J2se API查半天没结果,那个要怎么弄????
谢谢。

解决方案 »

  1.   

    楼主是想切了之后保存为新的图片
    还是想切了之后用来显示在界面上?
    如果是在界面上
    那我给你个切的方法 //从指定URL直接读取图片,并剪切出{x,y,width,feight}其中的部分
    public static BufferedImage cut(URL sourceURL, int x, int y, int width, int height) {
    BufferedImage bufImage = null;
    try {
    bufImage = ImageIO.read(sourceURL);
    } catch (IOException e1) {
    e1.printStackTrace();
    }
    bufImage = bufImage.getSubimage(x, y, width, height);
    return bufImage;
    } //将指定的BufferedImage,剪切出{x,y,width,feight}其中的部分
    public static BufferedImage cut(BufferedImage img, int x, int y, int width, int height) {
    BufferedImage bufImage = null;
    bufImage = img.getSubimage(x, y, width, height);
    return bufImage;
    }
      

  2.   

    用 ImageIO.write 可以把切好的图片以指定的编码格式生成图片文件。