Throw if toBitmap is called with a DNG file

pull/691/head
Mattia Iavarone 6 years ago
parent 659f6063bb
commit 34af906220
  1. 9
      cameraview/src/main/java/com/otaliastudios/cameraview/PictureResult.java

@ -135,8 +135,13 @@ public class PictureResult {
* @param callback a callback to be notified of image decoding
*/
public void toBitmap(int maxWidth, int maxHeight, @NonNull BitmapCallback callback) {
CameraUtils.decodeBitmap(getData(), maxWidth, maxHeight, new BitmapFactory.Options(),
rotation, callback);
if (format == PictureFormat.JPEG) {
CameraUtils.decodeBitmap(getData(), maxWidth, maxHeight, new BitmapFactory.Options(),
rotation, callback);
} else {
throw new UnsupportedOperationException("PictureResult.toBitmap() does not support "
+ "this picture format: " + format);
}
}
/**

Loading…
Cancel
Save