如何使用C/C++本地代码在Android中旋转位图

3
在我的名片识别应用程序中,我得到了高分辨率/大尺寸图像,当我旋转该图像时,有时需要花费更多时间,有时会显示OutOfMemory异常。因此,请帮助我在C/C++本地代码中旋转图像位图。
我使用以下代码进行图像旋转:
private Bitmap rotateBitmap(Bitmap source, int angle) {
        Matrix matrix = new Matrix();
        matrix.postRotate(angle);
        Bitmap createBitmap = Bitmap.createBitmap(source, 0, 0,
                source.getWidth(), source.getHeight(), matrix, true);
        source.recycle();
        return createBitmap;

    }

`

2个回答

0

图像旋转只发生在本地代码中,因此需要重新编写相同的代码。 如果您分享一些代码片段来改进实现,那将非常不错。


0

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接