本文整理汇总了Java中android.media.ExifInterface.ORIENTATION_NORMAL属性的典型用法代码示例。如果您正苦于以下问题:Java ExifInterface.ORIENTATION_NORMAL属性的具体用法?Java ExifInterface.ORIENTATION_NORMAL怎么用?Java ExifInterface.ORIENTATION_NORMAL使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.media.ExifInterface
的用法示例。
在下文中一共展示了ExifInterface.ORIENTATION_NORMAL属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getExifRotateDegrees
private static int getExifRotateDegrees(int exifOrientation) {
int degrees = 0;
switch (exifOrientation) {
case ExifInterface.ORIENTATION_NORMAL:
degrees = 0;
break;
case ExifInterface.ORIENTATION_ROTATE_90:
degrees = 90;
break;
case ExifInterface.ORIENTATION_ROTATE_180:
degrees = 180;
break;
case ExifInterface.ORIENTATION_ROTATE_270:
degrees = 270;
break;
}
return degrees;
}
示例2: setMatrixOrientation
private void setMatrixOrientation(Matrix m, int o) {
switch (o) {
case ExifInterface.ORIENTATION_NORMAL:
break;
case ExifInterface.ORIENTATION_ROTATE_180:
m.postRotate(180);
break;
case ExifInterface.ORIENTATION_ROTATE_270:
m.postRotate(270);
break;
case ExifInterface.ORIENTATION_ROTATE_90:
m.postRotate(90);
break;
default:
break;
}
}
示例3: getOrientation
public static int getOrientation(String filepath) {
int orientation = ExifInterface.ORIENTATION_NORMAL;
int degree;
try {
ExifInterface exif = new ExifInterface(filepath);
orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION,
ExifInterface.ORIENTATION_NORMAL);
} catch (Exception e) {
e.printStackTrace();
}
switch (orientation) {
case ExifInterface.ORIENTATION_NORMAL:
degree = 0;
break;
case ExifInterface.ORIENTATION_ROTATE_90:
degree = 90;
break;
case ExifInterface.ORIENTATION_ROTATE_180:
degree = 180;
break;
case ExifInterface.ORIENTATION_ROTATE_270:
degree = 270;
break;
default:
degree = 0;
break;
}
return degree;
}
示例4: getOrientation
public int getOrientation() {
int o = Integer.parseInt(this.orientation);
if (o == ExifInterface.ORIENTATION_NORMAL) {
return 0;
} else if (o == ExifInterface.ORIENTATION_ROTATE_90) {
return 90;
} else if (o == ExifInterface.ORIENTATION_ROTATE_180) {
return 180;
} else if (o == ExifInterface.ORIENTATION_ROTATE_270) {
return 270;
} else {
return 0;
}
}
示例5: setOrientation
public void setOrientation() throws IOException {
if (TextUtils.isEmpty(getAbsoluteImagePath())) {
return;
}
BitmapFactory.Options bmOptions = new BitmapFactory.Options();
Bitmap bitmap = BitmapFactory.decodeFile(getAbsoluteImagePath(), bmOptions);
ExifInterface ei = new ExifInterface(getAbsoluteImagePath());
int orientation = ei.getAttributeInt(ExifInterface.TAG_ORIENTATION,
ExifInterface.ORIENTATION_UNDEFINED);
switch (orientation) {
case ExifInterface.ORIENTATION_ROTATE_90:
writeFile(rotateImage(bitmap, 90));
break;
case ExifInterface.ORIENTATION_ROTATE_180:
writeFile(rotateImage(bitmap, 180));
break;
case ExifInterface.ORIENTATION_ROTATE_270:
writeFile(rotateImage(bitmap, 270));
break;
case ExifInterface.ORIENTATION_NORMAL:
default:
break;
}
}
示例6: getOrientationExifValue
private static int getOrientationExifValue(int orientation) {
switch (orientation) {
case 90:
return ExifInterface.ORIENTATION_ROTATE_90;
case 180:
return ExifInterface.ORIENTATION_ROTATE_180;
case 270:
return ExifInterface.ORIENTATION_ROTATE_270;
default:
return ExifInterface.ORIENTATION_NORMAL;
}
}
示例7: getAutoRotateAngleFromOrientation
/**
* Determines auto-rotate angle based on orientation information.
*
* @param orientation orientation information read from APP1 EXIF (TIFF) block.
* @return orientation: 1/3/6/8 -> 0/180/90/270. Returns 0 for inverted orientations (2/4/5/7).
*/
public static int getAutoRotateAngleFromOrientation(int orientation) {
switch (orientation) {
case ExifInterface.ORIENTATION_NORMAL:
case ExifInterface.ORIENTATION_UNDEFINED:
return 0;
case ExifInterface.ORIENTATION_ROTATE_180:
return 180;
case ExifInterface.ORIENTATION_ROTATE_90:
return 90;
case ExifInterface.ORIENTATION_ROTATE_270:
return 270;
}
return 0;
}
示例8: setUp
@Before
public void setUp() {
mBitmap = Bitmap.createBitmap(WIDTH, HEIGHT, Bitmap.Config.ARGB_8888);
ResourceReleaser<Bitmap> releaser = SimpleBitmapReleaser.getInstance();
mCloseableStaticBitmap =
new CloseableStaticBitmap(
mBitmap,
releaser,
ImmutableQualityInfo.FULL_QUALITY,
0,
ExifInterface.ORIENTATION_NORMAL);
}
示例9: draw
@Override
public void draw(Canvas canvas) {
if (mRotationAngle <= 0
&& (mExifOrientation == ExifInterface.ORIENTATION_UNDEFINED
|| mExifOrientation == ExifInterface.ORIENTATION_NORMAL)) {
super.draw(canvas);
return;
}
int saveCount = canvas.save();
canvas.concat(mRotationMatrix);
super.draw(canvas);
canvas.restoreToCount(saveCount);
}
示例10: testCreation_invalidAngle
@Test
public void testCreation_invalidAngle() {
try {
new OrientedDrawable(mDrawable, 20, ExifInterface.ORIENTATION_NORMAL);
fail();
} catch (IllegalArgumentException e) {
// Do nothing, expected.
}
}
示例11: 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);
}
示例12: getOrientationFromImage
private static int getOrientationFromImage(Context context, Uri imageUri) {
Cursor cursor = context.getContentResolver().query(imageUri,
new String[]{MediaStore.Images.ImageColumns.ORIENTATION}, null, null, null);
if (cursor == null || cursor.getCount() != 1) {
if (cursor != null) cursor.close();
Log.d("ImageUtils", "Could not image orientation: " + imageUri.toString());
return ExifInterface.ORIENTATION_UNDEFINED;
}
cursor.moveToFirst();
int orientationDegrees = cursor.getInt(0);
cursor.close();
if (orientationDegrees == 90) {
Log.d("ImageUtils", "Image orientation is 90 degrees");
return ExifInterface.ORIENTATION_ROTATE_90;
} else if (orientationDegrees == 180) {
Log.d("ImageUtils", "Image orientation is 180 degrees");
return ExifInterface.ORIENTATION_ROTATE_180;
} else if (orientationDegrees == 270) {
Log.d("ImageUtils", "Image orientation is 270 degrees");
return ExifInterface.ORIENTATION_ROTATE_270;
} else {
Log.d("ImageUtils", "Image orientation is 0 degrees.");
return ExifInterface.ORIENTATION_NORMAL;
}
}
示例13: checkExifAndFixImageRotation
private void checkExifAndFixImageRotation() {
try {
ExifInterface ei = new ExifInterface(new File(FileUtil.getImageAttachmentDir(this), mImageAttachment.getImageFilename()).getAbsolutePath());
int orientation = ei.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_UNDEFINED);
switch (orientation) {
case ExifInterface.ORIENTATION_ROTATE_90:
mRotation = 90;
applyPendingRotation();
break;
case ExifInterface.ORIENTATION_ROTATE_180:
mRotation = 180;
applyPendingRotation();
break;
case ExifInterface.ORIENTATION_ROTATE_270:
mRotation = 270;
applyPendingRotation();
break;
case ExifInterface.ORIENTATION_NORMAL:
//Good!
default:
break;
}
//ei.setAttribute(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL);
}catch (IOException e) {
/*Do nothing*/
}
}
示例14: resetOrientation
public void resetOrientation() {
this.orientation = "" + ExifInterface.ORIENTATION_NORMAL;
}
示例15: showImageViewDialog
/**
* show dialog for Google drive image
*/
private void showImageViewDialog() {
int rotate = 0;
String fileName = getFilesDir().getPath() + "/temp.jpg";
try {
ExifInterface exif = new ExifInterface(fileName);
int exifOrientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, 0);
switch (exifOrientation) {
case ExifInterface.ORIENTATION_NORMAL: rotate = 0; break;
case ExifInterface.ORIENTATION_ROTATE_90: rotate = 90; break;
case ExifInterface.ORIENTATION_ROTATE_180: rotate = 180; break;
case ExifInterface.ORIENTATION_ROTATE_270: rotate = 270; break;
}
} catch (IOException e) {
e.printStackTrace();
return;
}
// create bitmap from file
Bitmap bitmap = BitmapFactory.decodeFile(fileName);
if (bitmap == null) {
return;
}
// rotate by orientation
Matrix mat = new Matrix();
mat.postRotate(rotate);
bitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), mat, true);
// create dialog
final Dialog dialog = new Dialog(this, android.R.style.Theme_Translucent_NoTitleBar_Fullscreen);
dialog.setContentView(R.layout.dialog_image_view);
ImageView imageView = (ImageView) dialog.findViewById(R.id.image_view);
imageView.setImageBitmap(bitmap);
imageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dialog.dismiss();
}
});
dialog.show();
}