当前位置:编程学习 > wap >>

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
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,