Matrix旋转Bitmap之后 Bitmap变大
mMatrix.setRotate(30);mBitmap = Bitmap.createBitmap(mBitmap, 0, 0, mBitmap.getWidth(), mBitmap.getHeight(), mMatrix, true);
新生成的Bitmap会变大,改怎样调整,求指教 --------------------编程问答-------------------- 接代码:
--------------------编程问答-------------------- 谢谢大方的分享喔
public Bitmap zoomBitmap(Bitmap bitmap, int newWidth, int newHeight) {
Matrix matrix = new Matrix();
float sx = newWidth * 1.0f / bitmap.getWidth();
float sy = newHeight * 1.0f / bitmap.getHeight();
matrix.postScale(sx, sy);
Bitmap newBitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(),
bitmap.getHeight(), matrix, true);
return newBitmap;
}
补充:移动开发 , Android