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


Java BinaryBitmap.isRotateSupported方法代码示例

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


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

示例1: decode

import com.google.zxing.BinaryBitmap; //导入方法依赖的package包/类
@Override
public Result decode(BinaryBitmap image,
                     Map<DecodeHintType,?> hints) throws NotFoundException, FormatException {
  try {
    return doDecode(image, hints);
  } catch (NotFoundException nfe) {
    boolean tryHarder = hints != null && hints.containsKey(DecodeHintType.TRY_HARDER);
    if (tryHarder && image.isRotateSupported()) {
      BinaryBitmap rotatedImage = image.rotateCounterClockwise();
      Result result = doDecode(rotatedImage, hints);
      // Record that we found it rotated 90 degrees CCW / 270 degrees CW
      Map<ResultMetadataType,?> metadata = result.getResultMetadata();
      int orientation = 270;
      if (metadata != null && metadata.containsKey(ResultMetadataType.ORIENTATION)) {
        // But if we found it reversed in doDecode(), add in that result here:
        orientation = (orientation +
            (Integer) metadata.get(ResultMetadataType.ORIENTATION)) % 360;
      }
      result.putMetadata(ResultMetadataType.ORIENTATION, orientation);
      // Update result points
      ResultPoint[] points = result.getResultPoints();
      if (points != null) {
        int height = rotatedImage.getHeight();
        for (int i = 0; i < points.length; i++) {
          points[i] = new ResultPoint(height - points[i].getY() - 1, points[i].getX());
        }
      }
      return result;
    } else {
      throw nfe;
    }
  }
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:34,代码来源:OneDReader.java

示例2: decode

import com.google.zxing.BinaryBitmap; //导入方法依赖的package包/类
public Result decode(BinaryBitmap image, Map<DecodeHintType, ?> hints) throws
        NotFoundException, FormatException {
    Result doDecode;
    try {
        doDecode = doDecode(image, hints);
    } catch (NotFoundException nfe) {
        boolean tryHarder = hints != null && hints.containsKey(DecodeHintType.TRY_HARDER);
        if (tryHarder && image.isRotateSupported()) {
            BinaryBitmap rotatedImage = image.rotateCounterClockwise();
            doDecode = doDecode(rotatedImage, hints);
            Map<ResultMetadataType, ?> metadata = doDecode.getResultMetadata();
            int orientation = 270;
            if (metadata != null && metadata.containsKey(ResultMetadataType.ORIENTATION)) {
                orientation = (((Integer) metadata.get(ResultMetadataType.ORIENTATION))
                        .intValue() + 270) % 360;
            }
            doDecode.putMetadata(ResultMetadataType.ORIENTATION, Integer.valueOf(orientation));
            ResultPoint[] points = doDecode.getResultPoints();
            if (points != null) {
                int height = rotatedImage.getHeight();
                for (int i = 0; i < points.length; i++) {
                    points[i] = new ResultPoint((((float) height) - points[i].getY()) - 1.0f,
                            points[i].getX());
                }
            }
        } else {
            throw nfe;
        }
    }
    return doDecode;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:32,代码来源:OneDReader.java


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