public Result[] decodeMultiple(BinaryBitmap image, System.Collections.Hashtable hints) { System.Collections.ArrayList results = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(10)); DetectorResult[] detectorResult = new MultiDetector(image.BlackMatrix).detectMulti(hints); for (int i = 0; i < detectorResult.Length; i++) { try { DecoderResult decoderResult = Decoder.decode(detectorResult[i].Bits); ResultPoint[] points = detectorResult[i].Points; Result result = new Result(decoderResult.Text, decoderResult.RawBytes, points, BarcodeFormat.QR_CODE); if (decoderResult.ByteSegments != null) { result.putMetadata(ResultMetadataType.BYTE_SEGMENTS, decoderResult.ByteSegments); } if (decoderResult.ECLevel != null) { result.putMetadata(ResultMetadataType.ERROR_CORRECTION_LEVEL, decoderResult.ECLevel.ToString()); } results.Add(result); } catch (ReaderException) { // ignore and continue } } if ((results.Count == 0)) { return EMPTY_RESULT_ARRAY; } else { Result[] resultArray = new Result[results.Count]; for (int i = 0; i < results.Count; i++) { resultArray[i] = (Result) results[i]; } return resultArray; } }
public Result decode(BinaryBitmap image, System.Collections.Hashtable hints) { DecoderResult decoderResult; ResultPoint[] points; if (hints != null && hints.ContainsKey(DecodeHintType.PURE_BARCODE)) { BitMatrix bits = extractPureBits(image.BlackMatrix); decoderResult = decoder.decode(bits); points = NO_POINTS; } else { DetectorResult detectorResult = new Detector(image.BlackMatrix).detect(); decoderResult = decoder.decode(detectorResult.Bits); points = detectorResult.Points; } Result result = new Result(decoderResult.Text, decoderResult.RawBytes, points, BarcodeFormat.DATAMATRIX); if (decoderResult.ByteSegments != null) { result.putMetadata(ResultMetadataType.BYTE_SEGMENTS, decoderResult.ByteSegments); } if (decoderResult.ECLevel != null) { result.putMetadata(ResultMetadataType.ERROR_CORRECTION_LEVEL, decoderResult.ECLevel.ToString()); } return result; }