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


Java ExifInterface.ORIENTATION_TRANSVERSE属性代码示例

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


在下文中一共展示了ExifInterface.ORIENTATION_TRANSVERSE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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:benniaobuguai,项目名称:android-project-gallery,代码行数:33,代码来源:BaseImageDecoder.java

示例8: getHeight

/**
 * @return height of the image
 */
@Override
public int getHeight() {
  if (mRotationAngle % 180 != 0
      || mExifOrientation == ExifInterface.ORIENTATION_TRANSPOSE
      || mExifOrientation == ExifInterface.ORIENTATION_TRANSVERSE) {
    return getBitmapWidth(mBitmap);
  }
  return getBitmapHeight(mBitmap);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:12,代码来源:CloseableStaticBitmap.java

示例9: getSoftwareNumerator

private static int getSoftwareNumerator(
    ImageRequest imageRequest,
    EncodedImage encodedImage,
    boolean resizingEnabled) {
  if (!resizingEnabled) {
    return JpegTranscoder.SCALE_DENOMINATOR;
  }
  final ResizeOptions resizeOptions = imageRequest.getResizeOptions();
  if (resizeOptions == null) {
    return JpegTranscoder.SCALE_DENOMINATOR;
  }

  final int rotationAngle = getRotationAngle(imageRequest.getRotationOptions(), encodedImage);
  int exifOrientation = ExifInterface.ORIENTATION_UNDEFINED;
  if (INVERTED_EXIF_ORIENTATIONS.contains(encodedImage.getExifOrientation())) {
    exifOrientation =
        getForceRotatedInvertedExifOrientation(imageRequest.getRotationOptions(), encodedImage);
  }

  final boolean swapDimensions =
      rotationAngle == 90
          || rotationAngle == 270
          || exifOrientation == ExifInterface.ORIENTATION_TRANSPOSE
          || exifOrientation == ExifInterface.ORIENTATION_TRANSVERSE;
  final int widthAfterRotation = swapDimensions ? encodedImage.getHeight() :
          encodedImage.getWidth();
  final int heightAfterRotation = swapDimensions ? encodedImage.getWidth() :
          encodedImage.getHeight();

  float ratio = determineResizeRatio(resizeOptions, widthAfterRotation, heightAfterRotation);
  int numerator = roundNumerator(ratio, resizeOptions.roundUpFraction);
  if (numerator > MAX_JPEG_SCALE_NUMERATOR) {
    return MAX_JPEG_SCALE_NUMERATOR;
  }
  return (numerator < 1) ? 1 : numerator;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:36,代码来源:ResizeAndRotateProducer.java

示例10: getIntrinsicWidth

@Override
public int getIntrinsicWidth() {
  if (mExifOrientation == ExifInterface.ORIENTATION_TRANSPOSE
      || mExifOrientation == ExifInterface.ORIENTATION_TRANSVERSE
      || mRotationAngle % 180 != 0) {
    return super.getIntrinsicHeight();
  } else {
    return super.getIntrinsicWidth();
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:OrientedDrawable.java

示例11: getIntrinsicHeight

@Override
public int getIntrinsicHeight() {
  if (mExifOrientation == ExifInterface.ORIENTATION_TRANSPOSE
      || mExifOrientation == ExifInterface.ORIENTATION_TRANSVERSE
      || mRotationAngle % 180 != 0) {
    return super.getIntrinsicWidth();
  } else {
    return super.getIntrinsicHeight();
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:OrientedDrawable.java

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

示例13: 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:BrandonVargas,项目名称:AndroidOCRFforID,代码行数:14,代码来源:BitmapLoadUtils.java

示例14: 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

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