mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
Issue 875 user supplied compile fix
git-svn-id: https://zxing.googlecode.com/svn/trunk@1827 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
0297363cfc
commit
cf0b37c045
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright 2009 ZXing authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
@ -14,13 +14,16 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.google.zxing.multi
|
||||
{
|
||||
package com.google.zxing.multi {
|
||||
import com.google.zxing.BinaryBitmap;
|
||||
import com.google.zxing.Reader;
|
||||
import com.google.zxing.ReaderException;
|
||||
import com.google.zxing.Result;
|
||||
import com.google.zxing.ResultPoint;
|
||||
import com.google.zxing.common.flexdatatypes.ArrayList;
|
||||
import com.google.zxing.common.flexdatatypes.HashTable;
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* <p>Attempts to locate multiple barcodes in an image by repeatedly decoding portion of the image.
|
||||
* After one barcode is found, the areas left, above, right and below the barcode's
|
||||
* {@link com.google.zxing.ResultPoint}s are scanned, recursively.</p>
|
||||
|
@ -34,29 +37,17 @@ package com.google.zxing.multi
|
|||
*
|
||||
* @author Sean Owen
|
||||
*/
|
||||
public final class GenericMultipleBarcodeReader implements MultipleBarcodeReader {
|
||||
|
||||
import Reader;
|
||||
import Result;
|
||||
import BinaryBitmap;
|
||||
import ReaderException;
|
||||
import ResultPoint;
|
||||
import common.flexdatatypes.HashTable;
|
||||
import common.flexdatatypes.ArrayList;
|
||||
|
||||
|
||||
public final class GenericMultipleBarcodeReader implements MultipleBarcodeReader {
|
||||
|
||||
private static var MIN_DIMENSION_TO_RECUR:int = 30;
|
||||
|
||||
private var delegate:Reader;
|
||||
|
||||
public function GenericMultipleBarcodeReader(delegate:Reader ) {
|
||||
public function GenericMultipleBarcodeReader(delegate:Reader) {
|
||||
this.delegate = delegate;
|
||||
}
|
||||
|
||||
|
||||
public function decodeMultiple(image:BinaryBitmap , hints:HashTable=null):Array
|
||||
{
|
||||
public function decodeMultiple(image:BinaryBitmap, hints:HashTable = null):Array {
|
||||
var results:ArrayList = new ArrayList();
|
||||
doDecodeMultiple(image, hints, results, 0, 0);
|
||||
if (results.isEmpty()) {
|
||||
|
@ -70,11 +61,8 @@ import common.flexdatatypes.ArrayList;
|
|||
return resultArray;
|
||||
}
|
||||
|
||||
private function doDecodeMultiple(image:BinaryBitmap,
|
||||
hints:HashTable ,
|
||||
results:ArrayList,
|
||||
xOffset:int,
|
||||
yOffset:int ):void {
|
||||
private function doDecodeMultiple(image:BinaryBitmap, hints:HashTable, results:ArrayList,
|
||||
xOffset:int, yOffset:int):void {
|
||||
var result:Result;
|
||||
try {
|
||||
result = delegate.decode(image, hints);
|
||||
|
@ -135,7 +123,7 @@ import common.flexdatatypes.ArrayList;
|
|||
}
|
||||
}
|
||||
|
||||
private static function translateResultPoints(result:Result , xOffset:int , yOffset:int ):Result {
|
||||
private static function translateResultPoints(result:Result, xOffset:int, yOffset:int):Result {
|
||||
var oldResultPoints:Array = result.getResultPoints();
|
||||
var newResultPoints:Array = new Array(oldResultPoints.length);
|
||||
for (var i:int = 0; i < oldResultPoints.length; i++) {
|
||||
|
@ -145,5 +133,5 @@ import common.flexdatatypes.ArrayList;
|
|||
return new Result(result.getText(), result.getRawBytes(), newResultPoints,
|
||||
result.getBarcodeFormat());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -14,44 +14,48 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.google.zxing.multi.qrcode
|
||||
{
|
||||
package com.google.zxing.multi.qrcode {
|
||||
|
||||
import com.google.zxing.BarcodeFormat;
|
||||
import com.google.zxing.BinaryBitmap;
|
||||
import com.google.zxing.ReaderException;
|
||||
import com.google.zxing.Result;
|
||||
import com.google.zxing.ResultMetadataType;
|
||||
import com.google.zxing.common.DecoderResult;
|
||||
import com.google.zxing.common.flexdatatypes.ArrayList;
|
||||
import com.google.zxing.common.flexdatatypes.HashTable;
|
||||
|
||||
import com.google.zxing.common.DecoderResult;
|
||||
import com.google.zxing.common.flexdatatypes.ArrayList;
|
||||
import com.google.zxing.common.flexdatatypes.HashTable;
|
||||
import com.google.zxing.multi.MultipleBarcodeReader;
|
||||
import com.google.zxing.multi.qrcode.detector.MultiDetector;
|
||||
|
||||
import com.google.zxing.multi.MultipleBarcodeReader;
|
||||
import com.google.zxing.multi.qrcode.detector.MultiDetector;
|
||||
import com.google.zxing.qrcode.QRCodeReader;
|
||||
|
||||
import com.google.zxing.qrcode.QRCodeReader;
|
||||
|
||||
/**
|
||||
/**
|
||||
* This implementation can detect and decode multiple QR Codes in an image.
|
||||
*
|
||||
* @author Sean Owen
|
||||
* @author Hannes Erven
|
||||
*/
|
||||
public final class QRCodeMultiReader extends QRCodeReader implements MultipleBarcodeReader {
|
||||
public final class QRCodeMultiReader extends QRCodeReader implements MultipleBarcodeReader {
|
||||
|
||||
private static var EMPTY_RESULT_ARRAY:Array = new Array(0);
|
||||
|
||||
|
||||
public function decodeMultiple(image:BinaryBitmap , hints:HashTable=null):Array {
|
||||
public function decodeMultiple(image:BinaryBitmap, hints:HashTable = null):Array {
|
||||
var results:ArrayList = new ArrayList();
|
||||
var detectorResult:Array = new MultiDetector(image.getBlackMatrix()).detectMulti(hints);
|
||||
for (var i:int = 0; i < detectorResult.length; i++) {
|
||||
try {
|
||||
var decoderResult:DecoderResult = getDecoder().decode(detectorResult[i].getBits());
|
||||
var points:Array = detectorResult[i].getPoints();
|
||||
var result:Result = new Result(decoderResult.getText(), decoderResult.getRawBytes(), points,
|
||||
var result:Result = new Result(decoderResult.getText(), decoderResult.getRawBytes(),
|
||||
points,
|
||||
BarcodeFormat.QR_CODE);
|
||||
if (decoderResult.getByteSegments() != null) {
|
||||
result.putMetadata(ResultMetadataType.BYTE_SEGMENTS, decoderResult.getByteSegments());
|
||||
}
|
||||
if (decoderResult.getECLevel() != null) {
|
||||
result.putMetadata(ResultMetadataType.ERROR_CORRECTION_LEVEL, decoderResult.getECLevel().toString());
|
||||
result.putMetadata(ResultMetadataType.ERROR_CORRECTION_LEVEL,
|
||||
decoderResult.getECLevel().toString());
|
||||
}
|
||||
results.addElement(result);
|
||||
} catch (re:ReaderException) {
|
||||
|
@ -68,7 +72,5 @@ public final class QRCodeMultiReader extends QRCodeReader implements MultipleBar
|
|||
return resultArray;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue