旋转后,android图像变得模糊

时间:2016-08-30 02:43:24

标签: android image bitmap blur

当我称这种代码安静时,我的位图会失去质量并变得模糊

public static Bitmap rotateBitmap( Bitmap source, double rotation ) {
        // No rotation specified, just return the original
    if ( rotation == 0.0 )          return ( source );

    try {
            // Setup the matrix for translation
        Matrix matrix = new Matrix();
        matrix.reset();
        if (source.getWidth() > source.getHeight())
        matrix.postRotate( (float)rotation );
            // Rotate the bitmap
        Bitmap rotatedBitmap = Bitmap.createBitmap( source, 0, 0, source.getWidth(), source.getHeight(), matrix, false );
        return ( rotatedBitmap );
    }
    catch ( Exception e ) {
        return ( null );
    }
}

0 个答案:

没有答案