本文整理汇总了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;
}
}
}
示例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;
}