如果在横向模式下捕获图像/视频,我该如何旋转?
在此图片上显示
而不是
答案 0 :(得分:0)
public Bitmap rotateBitmap(Bitmap source, float angle) {
Matrix matrix = new Matrix();
// Perform matrix rotations/mirrors depending on camera that took the photo
if (cameraCurrentID == Camera.CameraInfo.CAMERA_FACING_FRONT) {
float[] mirrorY = { -1, 0, 0, 0, 1, 0, 0, 0, 1};
Matrix matrixMirrorY = new Matrix();
matrixMirrorY.setValues(mirrorY);
matrix.postConcat(matrixMirrorY);
}
matrix.postRotate(angle);
return Bitmap.createBitmap(source, 0, 0, source.getWidth(),
source.getHeight(), matrix, false);
}