所以我试图旋转用后置摄像头拍摄的照片然后旋转它。但是,当我尝试旋转它时,应用程序崩溃了。
代码我用来旋转文件中的图片
private Bitmap rotatePhoto(File f)
{
bmp = BitmapFactory.decodeFile(f.getAbsolutePath());
matrix = new Matrix();
matrix.setRotate(270);
bmp = Bitmap.createBitmap(bmp, 0, 0, bmp.getWidth(), bmp.getHeight(), matrix, true);
return bmp;
}
logcat的
09-21 10:24:55.112: E/QCameraHWI_Parm(24875): android::status_t android::QCameraHardwareInterface::setFocusAreas(const android::CameraParameters&): no autofocus support
09-21 10:24:55.112: W/QCameraHWI_Parm(24875): Auto Focus 6
09-21 10:24:55.112: E/QCameraHWI_Parm(24875): auto exposure value: NULL
09-21 10:24:57.174: W/QCameraHWI_Parm(24875): Auto Focus 0
09-21 10:24:57.204: E/QCameraHWI_Parm(24875): auto exposure value: NULL
09-21 10:25:01.509: E/QCameraHWI_Parm(24875): android::status_t android::QCameraHardwareInterface::setFocusAreas(const android::CameraParameters&): no autofocus support
09-21 10:25:01.509: W/QCameraHWI_Parm(24875): Auto Focus 6
09-21 10:25:01.509: E/QCameraHWI_Parm(24875): auto exposure value: NULL
09-21 10:25:03.791: I/dalvikvm(28721): at com.example.autotakecamera.ImagePreview.rotatePhoto(ImagePreview.java:54)
09-21 10:25:03.791: I/dalvikvm(28721): at com.example.autotakecamera.ImagePreview.initUI(ImagePreview.java:46)
09-21 10:25:03.791: I/dalvikvm(28721): at com.example.autotakecamera.ImagePreview.onCreate(ImagePreview.java:29)
09-21 10:25:03.801: E/AndroidRuntime(28721): at com.example.autotakecamera.ImagePreview.rotatePhoto(ImagePreview.java:54)
09-21 10:25:03.801: E/AndroidRuntime(28721): at com.example.autotakecamera.ImagePreview.initUI(ImagePreview.java:46)
09-21 10:25:03.801: E/AndroidRuntime(28721): at com.example.autotakecamera.ImagePreview.onCreate(ImagePreview.java:29)