Skip to content

Commit 9f41f81

Browse files
author
Alex Knop
committed
remove unused rotateimage
Signed-off-by: Alex Knop <[email protected]>
1 parent 1e06ea5 commit 9f41f81

File tree

1 file changed

+0
-67
lines changed

1 file changed

+0
-67
lines changed

app/src/main/java/com/owncloud/android/utils/BitmapUtils.java

Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -240,73 +240,6 @@ public static Bitmap scaleBitmap(Bitmap bitmap, int width, int height) {
240240
return Bitmap.createScaledBitmap(bitmap, width, height, true);
241241
}
242242

243-
/**
244-
* Rotate bitmap according to EXIF orientation. Cf. http://www.daveperrett.com/articles/2012/07/28/exif-orientation-handling-is-a-ghetto/
245-
*
246-
* @param bitmap Bitmap to be rotated
247-
* @param storagePath Path to source file of bitmap. Needed for EXIF information.
248-
* @return correctly EXIF-rotated bitmap
249-
*/
250-
public static Bitmap rotateImage(Bitmap bitmap, String storagePath) {
251-
Bitmap resultBitmap = bitmap;
252-
253-
try {
254-
ExifInterface exifInterface = new ExifInterface(storagePath);
255-
int orientation = exifInterface.getAttributeInt(ExifInterface.TAG_ORIENTATION, 1);
256-
257-
if (orientation != ExifInterface.ORIENTATION_NORMAL) {
258-
Matrix matrix = new Matrix();
259-
switch (orientation) {
260-
// 2
261-
case ExifInterface.ORIENTATION_FLIP_HORIZONTAL: {
262-
matrix.postScale(-1.0f, 1.0f);
263-
break;
264-
}
265-
// 3
266-
case ExifInterface.ORIENTATION_ROTATE_180: {
267-
matrix.postRotate(180);
268-
break;
269-
}
270-
// 4
271-
case ExifInterface.ORIENTATION_FLIP_VERTICAL: {
272-
matrix.postScale(1.0f, -1.0f);
273-
break;
274-
}
275-
// 5
276-
case ExifInterface.ORIENTATION_TRANSPOSE: {
277-
matrix.postRotate(-90);
278-
matrix.postScale(1.0f, -1.0f);
279-
break;
280-
}
281-
// 6
282-
case ExifInterface.ORIENTATION_ROTATE_90: {
283-
matrix.postRotate(90);
284-
break;
285-
}
286-
// 7
287-
case ExifInterface.ORIENTATION_TRANSVERSE: {
288-
matrix.postRotate(90);
289-
matrix.postScale(1.0f, -1.0f);
290-
break;
291-
}
292-
// 8
293-
case ExifInterface.ORIENTATION_ROTATE_270: {
294-
matrix.postRotate(270);
295-
break;
296-
}
297-
}
298-
299-
// Rotate the bitmap
300-
resultBitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
301-
if (!resultBitmap.equals(bitmap)) {
302-
bitmap.recycle();
303-
}
304-
}
305-
} catch (Exception exception) {
306-
Log_OC.e("BitmapUtil", "Could not rotate the image: " + storagePath);
307-
}
308-
return resultBitmap;
309-
}
310243

311244
/**
312245
* Detect if Image will be rotated according to EXIF orientation. Cf. http://www.daveperrett.com/articles/2012/07/28/exif-orientation-handling-is-a-ghetto/

0 commit comments

Comments
 (0)