抓取图像像素到int数组

 

代码
int w=im.getWidth(this);
int h=im.getHeight(this);
int[] pixels=new int[w*h];

public int[] Image2intAarry(Image im){
try{
PixelGrabber pg
=new PixelGrabber(im,0,0,w,h,pixels,0,w);
pg.grabPixels();
}
catch(InterruptedException e){
e.printStackTrace();
}
return pixels;
}

 

 

 

posted @ 2010-06-27 21:14  xngeer  阅读(287)  评论(0编辑  收藏  举报