当前位置: 首页>>代码示例>>Java>>正文


Java ExifInterface.ORIENTATION_FLIP_VERTICAL属性代码示例

本文整理汇总了Java中android.media.ExifInterface.ORIENTATION_FLIP_VERTICAL属性的典型用法代码示例。如果您正苦于以下问题:Java ExifInterface.ORIENTATION_FLIP_VERTICAL属性的具体用法?Java ExifInterface.ORIENTATION_FLIP_VERTICAL怎么用?Java ExifInterface.ORIENTATION_FLIP_VERTICAL使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.media.ExifInterface的用法示例。


在下文中一共展示了ExifInterface.ORIENTATION_FLIP_VERTICAL属性的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getExifOrientationDegrees

/**
 * Get the # of degrees an image must be rotated to match the given exif orientation.
 *
 * @param exifOrientation The exif orientation [1-8]
 * @return the number of degrees to rotate
 */
public static int getExifOrientationDegrees(int exifOrientation) {
  final int degreesToRotate;
  switch (exifOrientation) {
    case ExifInterface.ORIENTATION_TRANSPOSE:
    case ExifInterface.ORIENTATION_ROTATE_90:
      degreesToRotate = 90;
      break;
    case ExifInterface.ORIENTATION_ROTATE_180:
    case ExifInterface.ORIENTATION_FLIP_VERTICAL:
      degreesToRotate = 180;
      break;
    case ExifInterface.ORIENTATION_TRANSVERSE:
    case ExifInterface.ORIENTATION_ROTATE_270:
      degreesToRotate = 270;
      break;
    default:
      degreesToRotate = 0;
      break;
  }
  return degreesToRotate;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:27,代码来源:TransformationUtils.java

示例2: 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;
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:18,代码来源:JpegTranscoder.java

示例3: exifToDegrees

public static int exifToDegrees(int exifOrientation) {
    int rotation;
    switch (exifOrientation) {
        case ExifInterface.ORIENTATION_ROTATE_90:
        case ExifInterface.ORIENTATION_TRANSPOSE:
            rotation = 90;
            break;
        case ExifInterface.ORIENTATION_ROTATE_180:
        case ExifInterface.ORIENTATION_FLIP_VERTICAL:
            rotation = 180;
            break;
        case ExifInterface.ORIENTATION_ROTATE_270:
        case ExifInterface.ORIENTATION_TRANSVERSE:
            rotation = 270;
            break;
        default:
            rotation = 0;
    }
    return rotation;
}
 
开发者ID:Alcatraz323,项目名称:MaterialOCR,代码行数:20,代码来源:BitmapLoadUtils.java

示例4: 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.
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:30,代码来源:TransformationUtils.java

示例5: 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;
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:18,代码来源:TransformationUtils.java

示例6: 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.
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:31,代码来源:TransformationUtils.java

示例7: 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);
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:40,代码来源:OrientedDrawable.java

示例8: testCreation_flipVertical

@Test
public void testCreation_flipVertical() {
  OrientedDrawable drawable =
      new OrientedDrawable(mDrawable, 0, ExifInterface.ORIENTATION_FLIP_VERTICAL);
  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);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:OrientedDrawableTest.java

示例9: 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);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:33,代码来源:BaseImageDecoder.java

示例10: 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;
}
 
开发者ID:Alcatraz323,项目名称:MaterialOCR,代码行数:14,代码来源:BitmapLoadUtils.java

示例11: 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;
    }
}
 
开发者ID:florent37,项目名称:CameraFragment,代码行数:41,代码来源:ImageLoader.java

示例12: 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;
        }

    }
 
开发者ID:johnhany,项目名称:MOAAP,代码行数:43,代码来源:MainActivity.java


注:本文中的android.media.ExifInterface.ORIENTATION_FLIP_VERTICAL属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。