图片的缩放

qianhen136 qianhen136 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
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);
}

有这样一个函数,但是输出的图片怎么和没改变过的一样?
请高手指点一下下,,哪里出了问题。
...全文

相关推荐

评论 3
收藏 已收藏
分享
返回顶部
qianhen136
J2ME 13,096 成员 26,491 内容