當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。