13,100
社区成员
发帖
与我相关
我的任务
分享
public Image ZoomIn(Image img){
Image out=null;
int[] rgbOutPut=null;
Graphics g=null;
int width=0,height=0;
try{
width=img.getWidth();
height=img.getHeight();
out=Image.createImage(width, height);
int rgbInPut[]=new int[width*height];
rgbOutPut=new int[width*height*4];
img.getRGB(rgbInPut, 0, width, 0, 0, width, height);
img.getRGB(rgbOutPut, 0, width, 0, 0, width, height);
int i,j,k;
k=0;
int temp[][]=new int[width][height];
for(i=0;i<height;i++){
for(j=0;j<width;j++){
temp[i][j]=rgbInPut[k++];
}
}
for(i=0;i<height;i++){
for(j=0;j<width;j++){
rgbOutPut[k]=temp[j][i];
k++;
}
}
g=out.getGraphics();
}catch(Exception e){}
return out.createRGBImage(rgbOutPut, height, width, true);
}