Matrix图片操作放大缩小mark

来源:互联网 发布:每年车祸数据 编辑:程序博客网 时间:2024/05/20 06:30
//获得Bitmap的高和宽   int bmpWidth=bmp.getWidth();   int bmpHeight=bmp.getHeight();   //设置缩小比例   double scale=0.8;   //计算出这次要缩小的比例   scaleWidth=(float)(scaleWidth*scale);   scaleHeight=(float)(scaleHeight*scale);   //产生resize后的Bitmap对象   Matrix matrix=new Matrix();   matrix.postScale(scaleWidth, scaleHeight);   Bitmap resizeBmp=Bitmap.createBitmap(bmp, 0, 0, bmpWidth, bmpHeight, matrix, true);

原创粉丝点击