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


Java ExifInterface.ORIENTATION_UNDEFINED属性代码示例

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


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

示例1: getExifRotation

public static int getExifRotation(File imageFile) {
    if (imageFile == null) return 0;
    try {
        ExifInterface exif = new ExifInterface(imageFile.getAbsolutePath());
        // We only recognize a subset of orientation tag values
        switch (exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_UNDEFINED)) {
            case ExifInterface.ORIENTATION_ROTATE_90:
                return 90;
            case ExifInterface.ORIENTATION_ROTATE_180:
                return 180;
            case ExifInterface.ORIENTATION_ROTATE_270:
                return 270;
            default:
                return ExifInterface.ORIENTATION_UNDEFINED;
        }
    } catch (IOException e) {
        return 0;
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:19,代码来源:CropUtil.java

示例2: getExifRotation

public static int getExifRotation(File imageFile) {
    if (imageFile == null) return 0;
    try {
        ExifInterface exif = new ExifInterface(imageFile.getAbsolutePath());
        // We only recognize a subset of orientation tag values
        switch (exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_UNDEFINED)) {
            case ExifInterface.ORIENTATION_ROTATE_90:
                return 90;
            case ExifInterface.ORIENTATION_ROTATE_180:
                return 180;
            case ExifInterface.ORIENTATION_ROTATE_270:
                return 270;
            default:
                return ExifInterface.ORIENTATION_UNDEFINED;
        }
    } catch (IOException e) {
        Log.e("Error getting Exif data", e);
        return 0;
    }
}
 
开发者ID:mityung,项目名称:XERUNG,代码行数:20,代码来源:CropUtil.java

示例3: getExifRotation

public static int getExifRotation(File imageFile) {
    if (imageFile == null) return 0;
    try {
        ExifInterface exif = new ExifInterface(imageFile.getAbsolutePath());
        // We only recognize a subset of orientation tag values
        switch (exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_UNDEFINED)) {
            case ExifInterface.ORIENTATION_ROTATE_90:
                return 90;
            case ExifInterface.ORIENTATION_ROTATE_180:
                return 180;
            case ExifInterface.ORIENTATION_ROTATE_270:
                return 270;
            default:
                return ExifInterface.ORIENTATION_UNDEFINED;
        }
    } catch (IOException e) {
        Log.e("Error getting Exif data", String.valueOf(e));
        return 0;
    }
}
 
开发者ID:liuyanggithub,项目名称:SuperSelector,代码行数:20,代码来源:CropUtil.java

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

示例5: getOrientation

/**
 * Get orientation information from jpeg input stream.
 *
 * @param is the input stream of jpeg image
 * @return orientation: 1/8/3/6. Returns {@value
 *     android.media.ExifInterface#ORIENTATION_UNDEFINED} if there is no valid orientation
 *     information.
 */
public static int getOrientation(InputStream is) {
  try {
    int length = moveToAPP1EXIF(is);
    if (length == 0) {
      return ExifInterface.ORIENTATION_UNDEFINED;
    }
    return TiffUtil.readOrientationFromTIFF(is, length);
  } catch (IOException ioe) {
    return ExifInterface.ORIENTATION_UNDEFINED;
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:19,代码来源:JfifUtil.java

示例6: CloseableStaticBitmap

/**
 * Creates a new instance of a CloseableStaticBitmap.
 *
 * @param bitmap the bitmap to wrap
 * @param resourceReleaser ResourceReleaser to release the bitmap to
 */
public CloseableStaticBitmap(
    Bitmap bitmap,
    ResourceReleaser<Bitmap> resourceReleaser,
    QualityInfo qualityInfo,
    int rotationAngle) {
  this(bitmap, resourceReleaser, qualityInfo, rotationAngle, ExifInterface.ORIENTATION_UNDEFINED);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:CloseableStaticBitmap.java

示例7: setup

@Before
public void setup() {
  MockitoAnnotations.initMocks(this);
  mCloseableStaticBitmap =
      new CloseableStaticBitmap(
          mBitmap,
          mResourceReleaser,
          ImmutableQualityInfo.FULL_QUALITY,
          0,
          ExifInterface.ORIENTATION_UNDEFINED);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:11,代码来源:CloseableBitmapTest.java

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

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

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

示例11: getExifOrientation

public static int getExifOrientation(@NonNull Context context, @NonNull Uri imageUri) {
    int orientation = ExifInterface.ORIENTATION_UNDEFINED;
    try {
        InputStream stream = context.getContentResolver().openInputStream(imageUri);
        if (stream == null) {
            return orientation;
        }
        orientation = new ImageHeaderParser(stream).getOrientation();
        close(stream);
    } catch (IOException e) {
        Log.e(TAG, "getExifOrientation: " + imageUri.toString(), e);
    }
    return orientation;
}
 
开发者ID:Alcatraz323,项目名称:MaterialOCR,代码行数:14,代码来源:BitmapLoadUtils.java

示例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;
    }
}
 
开发者ID:suomenriistakeskus,项目名称:oma-riista-android,代码行数:28,代码来源:ImageUtils.java

示例13: hasTransformableExifOrientation

private static boolean hasTransformableExifOrientation(
    CloseableStaticBitmap closeableStaticBitmap) {
  return closeableStaticBitmap.getExifOrientation() != ExifInterface.ORIENTATION_NORMAL
      && closeableStaticBitmap.getExifOrientation() != ExifInterface.ORIENTATION_UNDEFINED;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:5,代码来源:PipelineDraweeController.java

示例14: OrientedDrawable

/**
 * Creates a new OrientedDrawable.
 *
 * @param rotationAngle multiples of 90 or -1 if the angle is unknown
 */
public OrientedDrawable(Drawable drawable, int rotationAngle) {
  this(drawable, rotationAngle, ExifInterface.ORIENTATION_UNDEFINED);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:OrientedDrawable.java


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