Android Bitmap 旋转可以通过 Matrix 类实现,Matrix 类是一个 3x3 的矩阵,可以用来对图像进行旋转、缩放、错切、平移等操作。
Android Bitmap 旋转可以通过 Matrix 类实现,Matrix 类是一个 3x3 的矩阵,可以用来对图像进行旋转、缩放、错切、平移等操作。
以下是一个简单的代码示例,该示例将 bitmap 旋转 90 度:
// 初始化 Bitmap 和 Matrix
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.bitmap);
Matrix matrix = new Matrix();
// 设置旋转角度
matrix.setRotate(90);
// 生成旋转后的 Bitmap
Bitmap rotatedBitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
本站系公益性非盈利分享网址,本文来自用户投稿,不代表码文网立场,如若转载,请注明出处
评论列表(64条)