本文整理汇总了Java中android.media.ExifInterface.ORIENTATION_FLIP_HORIZONTAL属性的典型用法代码示例。如果您正苦于以下问题:Java ExifInterface.ORIENTATION_FLIP_HORIZONTAL属性的具体用法?Java ExifInterface.ORIENTATION_FLIP_HORIZONTAL怎么用?Java ExifInterface.ORIENTATION_FLIP_HORIZONTAL使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.media.ExifInterface
的用法示例。
在下文中一共展示了ExifInterface.ORIENTATION_FLIP_HORIZONTAL属性的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isExifOrientationAllowed
/**
* @return true if and only if given value is a valid EXIF orientation
*/
public static boolean isExifOrientationAllowed(int exifOrientation) {
switch (exifOrientation) {
case ExifInterface.ORIENTATION_NORMAL:
case ExifInterface.ORIENTATION_ROTATE_90:
case ExifInterface.ORIENTATION_ROTATE_180:
case ExifInterface.ORIENTATION_ROTATE_270:
case ExifInterface.ORIENTATION_FLIP_HORIZONTAL:
case ExifInterface.ORIENTATION_FLIP_VERTICAL:
case ExifInterface.ORIENTATION_TRANSPOSE:
case ExifInterface.ORIENTATION_TRANSVERSE:
return true;
default:
return false;
}
}
示例2: initializeMatrixForRotation
static void initializeMatrixForRotation(int exifOrientation, Matrix matrix) {
switch (exifOrientation) {
case ExifInterface.ORIENTATION_FLIP_HORIZONTAL:
matrix.setScale(-1, 1);
break;
case ExifInterface.ORIENTATION_ROTATE_180:
matrix.setRotate(180);
break;
case ExifInterface.ORIENTATION_FLIP_VERTICAL:
matrix.setRotate(180);
matrix.postScale(-1, 1);
break;
case ExifInterface.ORIENTATION_TRANSPOSE:
matrix.setRotate(90);
matrix.postScale(-1, 1);
break;
case ExifInterface.ORIENTATION_ROTATE_90:
matrix.setRotate(90);
break;
case ExifInterface.ORIENTATION_TRANSVERSE:
matrix.setRotate(-90);
matrix.postScale(-1, 1);
break;
case ExifInterface.ORIENTATION_ROTATE_270:
matrix.setRotate(-90);
break;
default:
// Do nothing.
}
}
示例3: isExifOrientationRequired
/**
* Returns {@code true} if the given exif orientation indicates that a transformation is necessary
* and {@code false} otherwise.
*/
public static boolean isExifOrientationRequired(int exifOrientation) {
switch (exifOrientation) {
case ExifInterface.ORIENTATION_FLIP_HORIZONTAL:
case ExifInterface.ORIENTATION_ROTATE_180:
case ExifInterface.ORIENTATION_FLIP_VERTICAL:
case ExifInterface.ORIENTATION_TRANSPOSE:
case ExifInterface.ORIENTATION_ROTATE_90:
case ExifInterface.ORIENTATION_TRANSVERSE:
case ExifInterface.ORIENTATION_ROTATE_270:
return true;
default:
return false;
}
}
示例4: initializeMatrixForRotation
@VisibleForTesting
static void initializeMatrixForRotation(int exifOrientation, Matrix matrix) {
switch (exifOrientation) {
case ExifInterface.ORIENTATION_FLIP_HORIZONTAL:
matrix.setScale(-1, 1);
break;
case ExifInterface.ORIENTATION_ROTATE_180:
matrix.setRotate(180);
break;
case ExifInterface.ORIENTATION_FLIP_VERTICAL:
matrix.setRotate(180);
matrix.postScale(-1, 1);
break;
case ExifInterface.ORIENTATION_TRANSPOSE:
matrix.setRotate(90);
matrix.postScale(-1, 1);
break;
case ExifInterface.ORIENTATION_ROTATE_90:
matrix.setRotate(90);
break;
case ExifInterface.ORIENTATION_TRANSVERSE:
matrix.setRotate(-90);
matrix.postScale(-1, 1);
break;
case ExifInterface.ORIENTATION_ROTATE_270:
matrix.setRotate(-90);
break;
default:
// Do nothing.
}
}
示例5: testRotateUsingExifOrientationOnly
@Test
public void testRotateUsingExifOrientationOnly() throws Exception {
whenResizingEnabled();
int exifOrientation = ExifInterface.ORIENTATION_FLIP_HORIZONTAL;
whenRequestsRotationFromMetadataWithoutDeferring();
provideFinalResult(DefaultImageFormats.JPEG, 10, 10, 0, exifOrientation);
verifyZeroJpegTranscoderInteractions();
verifyJpegTranscoderExifOrientationInteractions(8, exifOrientation);
}
示例6: onBoundsChange
@Override
protected void onBoundsChange(Rect bounds) {
Drawable underlyingDrawable = getCurrent();
if (mRotationAngle > 0
|| (mExifOrientation != ExifInterface.ORIENTATION_UNDEFINED
&& mExifOrientation != ExifInterface.ORIENTATION_NORMAL)) {
switch (mExifOrientation) {
case ExifInterface.ORIENTATION_FLIP_HORIZONTAL:
mRotationMatrix.setScale(-1, 1);
break;
case ExifInterface.ORIENTATION_FLIP_VERTICAL:
mRotationMatrix.setScale(1, -1);
break;
case ExifInterface.ORIENTATION_TRANSPOSE:
mRotationMatrix.setRotate(270, bounds.centerX(), bounds.centerY());
mRotationMatrix.postScale(1, -1);
break;
case ExifInterface.ORIENTATION_TRANSVERSE:
mRotationMatrix.setRotate(270, bounds.centerX(), bounds.centerY());
mRotationMatrix.postScale(-1, 1);
break;
default:
mRotationMatrix.setRotate(mRotationAngle, bounds.centerX(), bounds.centerY());
break;
}
// Set the rotated bounds on the underlying drawable
mTempMatrix.reset();
mRotationMatrix.invert(mTempMatrix);
mTempRectF.set(bounds);
mTempMatrix.mapRect(mTempRectF);
underlyingDrawable.setBounds(
(int) mTempRectF.left,
(int) mTempRectF.top,
(int) mTempRectF.right,
(int) mTempRectF.bottom);
} else {
underlyingDrawable.setBounds(bounds);
}
}
示例7: testCreation_flipHorizontal
@Test
public void testCreation_flipHorizontal() {
OrientedDrawable drawable =
new OrientedDrawable(mDrawable, 0, ExifInterface.ORIENTATION_FLIP_HORIZONTAL);
drawable.setBounds(mBounds);
drawable.draw(mCanvas);
Matrix expectedMatrix = new Matrix();
expectedMatrix.setScale(-1, 1);
assertFalse(drawable.mRotationMatrix.isIdentity());
AndroidGraphicsTestUtils.assertEquals(expectedMatrix, drawable.mRotationMatrix);
verifySetBounds(expectedMatrix);
}
示例8: defineExifOrientation
protected ExifInfo defineExifOrientation(String imageUri) {
int rotation = 0;
boolean flip = false;
try {
ExifInterface exif = new ExifInterface(Scheme.FILE.crop(imageUri));
int exifOrientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL);
switch (exifOrientation) {
case ExifInterface.ORIENTATION_FLIP_HORIZONTAL:
flip = true;
case ExifInterface.ORIENTATION_NORMAL:
rotation = 0;
break;
case ExifInterface.ORIENTATION_TRANSVERSE:
flip = true;
case ExifInterface.ORIENTATION_ROTATE_90:
rotation = 90;
break;
case ExifInterface.ORIENTATION_FLIP_VERTICAL:
flip = true;
case ExifInterface.ORIENTATION_ROTATE_180:
rotation = 180;
break;
case ExifInterface.ORIENTATION_TRANSPOSE:
flip = true;
case ExifInterface.ORIENTATION_ROTATE_270:
rotation = 270;
break;
}
} catch (IOException e) {
L.w("Can't read EXIF tags from file [%s]", imageUri);
}
return new ExifInfo(rotation, flip);
}
示例9: exifToTranslation
public static int exifToTranslation(int exifOrientation) {
int translation;
switch (exifOrientation) {
case ExifInterface.ORIENTATION_FLIP_HORIZONTAL:
case ExifInterface.ORIENTATION_FLIP_VERTICAL:
case ExifInterface.ORIENTATION_TRANSPOSE:
case ExifInterface.ORIENTATION_TRANSVERSE:
translation = -1;
break;
default:
translation = 1;
}
return translation;
}
示例10: rotateBitmap
private Bitmap rotateBitmap(Bitmap bitmap, int orientation) {
Matrix matrix = new Matrix();
switch (orientation) {
case ExifInterface.ORIENTATION_NORMAL:
return bitmap;
case ExifInterface.ORIENTATION_FLIP_HORIZONTAL:
matrix.setScale(-1, 1);
break;
case ExifInterface.ORIENTATION_ROTATE_180:
matrix.setRotate(180);
break;
case ExifInterface.ORIENTATION_FLIP_VERTICAL:
matrix.setRotate(180);
matrix.postScale(-1, 1);
break;
case ExifInterface.ORIENTATION_TRANSPOSE:
matrix.setRotate(90);
matrix.postScale(-1, 1);
break;
case ExifInterface.ORIENTATION_ROTATE_90:
matrix.setRotate(90);
break;
case ExifInterface.ORIENTATION_TRANSVERSE:
matrix.setRotate(-90);
matrix.postScale(-1, 1);
break;
case ExifInterface.ORIENTATION_ROTATE_270:
matrix.setRotate(-90);
break;
default:
return bitmap;
}
try {
Bitmap bmRotated = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
bitmap.recycle();
return bmRotated;
} catch (OutOfMemoryError ignore) {
return null;
}
}
示例11: rotateBitmap
public static Bitmap rotateBitmap(Bitmap bitmap, int orientation) {
Matrix matrix = new Matrix();
switch (orientation) {
case ExifInterface.ORIENTATION_NORMAL:
return bitmap;
case ExifInterface.ORIENTATION_FLIP_HORIZONTAL:
matrix.setScale(-1, 1);
break;
case ExifInterface.ORIENTATION_ROTATE_180:
matrix.setRotate(180);
break;
case ExifInterface.ORIENTATION_FLIP_VERTICAL:
matrix.setRotate(180);
matrix.postScale(-1, 1);
break;
case ExifInterface.ORIENTATION_TRANSPOSE:
matrix.setRotate(90);
matrix.postScale(-1, 1);
break;
case ExifInterface.ORIENTATION_ROTATE_90:
matrix.setRotate(90);
break;
case ExifInterface.ORIENTATION_TRANSVERSE:
matrix.setRotate(-90);
matrix.postScale(-1, 1);
break;
case ExifInterface.ORIENTATION_ROTATE_270:
matrix.setRotate(-90);
break;
default:
return bitmap;
}
try {
Bitmap bmRotated = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
bitmap.recycle();
return bmRotated;
} catch (OutOfMemoryError e) {
e.printStackTrace();
return null;
}
}