mMatrix.setRotate(30);
mBitmap = Bitmap.createBitmap(mBitmap, 0, 0, mBitmap.getWidth(), mBitmap.getHeight(), mMatrix, true);
新生成的Bitmap会变大,改怎样调整,求指教

解决方案 »

  1.   

    接代码: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;
        }