下面列出了怎么用com.google.zxing.aztec.decoder.Decoder的API类实例代码及写法,或者点击链接到github查看源代码。
@Override
public Result decode(BinaryBitmap image, Map<DecodeHintType,?> hints)
throws NotFoundException, FormatException {
AztecDetectorResult detectorResult = new Detector(image.getBlackMatrix()).detect();
ResultPoint[] points = detectorResult.getPoints();
if (hints != null) {
ResultPointCallback rpcb = (ResultPointCallback) hints.get(DecodeHintType.NEED_RESULT_POINT_CALLBACK);
if (rpcb != null) {
for (ResultPoint point : points) {
rpcb.foundPossibleResultPoint(point);
}
}
}
DecoderResult decoderResult = new Decoder().decode(detectorResult);
Result result = new Result(decoderResult.getText(), decoderResult.getRawBytes(), points, BarcodeFormat.AZTEC);
List<byte[]> byteSegments = decoderResult.getByteSegments();
if (byteSegments != null) {
result.putMetadata(ResultMetadataType.BYTE_SEGMENTS, byteSegments);
}
String ecLevel = decoderResult.getECLevel();
if (ecLevel != null) {
result.putMetadata(ResultMetadataType.ERROR_CORRECTION_LEVEL, ecLevel);
}
return result;
}
public Result decode(BinaryBitmap binarybitmap, Map map)
{
AztecDetectorResult aztecdetectorresult = (new Detector(binarybitmap.getBlackMatrix())).detect();
com.google.zxing.ResultPoint aresultpoint[] = aztecdetectorresult.getPoints();
if (map != null)
{
ResultPointCallback resultpointcallback = (ResultPointCallback)map.get(DecodeHintType.NEED_RESULT_POINT_CALLBACK);
if (resultpointcallback != null)
{
int i = aresultpoint.length;
for (int j = 0; j < i; j++)
{
resultpointcallback.foundPossibleResultPoint(aresultpoint[j]);
}
}
}
DecoderResult decoderresult = (new Decoder()).decode(aztecdetectorresult);
Result result = new Result(decoderresult.getText(), decoderresult.getRawBytes(), aresultpoint, BarcodeFormat.AZTEC);
java.util.List list = decoderresult.getByteSegments();
if (list != null)
{
result.putMetadata(ResultMetadataType.BYTE_SEGMENTS, list);
}
String s = decoderresult.getECLevel();
if (s != null)
{
result.putMetadata(ResultMetadataType.ERROR_CORRECTION_LEVEL, s);
}
return result;
}