zxing_cpp 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +13 -0
- data/.gitmodules +3 -0
- data/CHANGELOG.rdoc +6 -0
- data/Gemfile +3 -0
- data/Manifest.txt +331 -0
- data/README.rdoc +138 -0
- data/Rakefile +28 -0
- data/bin/zxd +87 -0
- data/bin/zxe +53 -0
- data/ext/zxing/extconf.rb +27 -0
- data/ext/zxing/zxing-cpp/.gitignore +4 -0
- data/ext/zxing/zxing-cpp/AUTHORS +115 -0
- data/ext/zxing/zxing-cpp/CMakeLists.txt +84 -0
- data/ext/zxing/zxing-cpp/COPYING +201 -0
- data/ext/zxing/zxing-cpp/NOTICE +65 -0
- data/ext/zxing/zxing-cpp/README.md +50 -0
- data/ext/zxing/zxing-cpp/cli/src/ImageReaderSource.cpp +112 -0
- data/ext/zxing/zxing-cpp/cli/src/ImageReaderSource.h +40 -0
- data/ext/zxing/zxing-cpp/cli/src/jpgd.cpp +3174 -0
- data/ext/zxing/zxing-cpp/cli/src/jpgd.h +319 -0
- data/ext/zxing/zxing-cpp/cli/src/lodepng.cpp +6261 -0
- data/ext/zxing/zxing-cpp/cli/src/lodepng.h +1695 -0
- data/ext/zxing/zxing-cpp/cli/src/main.cpp +297 -0
- data/ext/zxing/zxing-cpp/cmake/FindCPPUNIT.cmake +54 -0
- data/ext/zxing/zxing-cpp/cmake/FindIconv.cmake +57 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/.gitignore +6 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/BigInteger.cc +405 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/BigInteger.hh +215 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/BigIntegerAlgorithms.cc +70 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/BigIntegerAlgorithms.hh +25 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/BigIntegerLibrary.hh +8 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/BigIntegerUtils.cc +50 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/BigIntegerUtils.hh +72 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/BigUnsigned.cc +697 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/BigUnsigned.hh +418 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/BigUnsignedInABase.cc +125 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/BigUnsignedInABase.hh +122 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/ChangeLog +146 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/Makefile +73 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/NumberlikeArray.hh +177 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/README +71 -0
- data/ext/zxing/zxing-cpp/core/src/win32/zxing/iconv.h +14 -0
- data/ext/zxing/zxing-cpp/core/src/win32/zxing/stdint.h +247 -0
- data/ext/zxing/zxing-cpp/core/src/win32/zxing/win_iconv.c +2035 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/BarcodeFormat.cpp +40 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/BarcodeFormat.h +60 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/Binarizer.cpp +45 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/Binarizer.h +50 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/BinaryBitmap.cpp +70 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/BinaryBitmap.h +56 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/ChecksumException.cpp +28 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/ChecksumException.h +34 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/DecodeHints.cpp +142 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/DecodeHints.h +85 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/Exception.cpp +43 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/Exception.h +51 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/FormatException.cpp +41 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/FormatException.h +37 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/IllegalStateException.h +35 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/InvertedLuminanceSource.cpp +68 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/InvertedLuminanceSource.h +48 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/LuminanceSource.cpp +86 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/LuminanceSource.h +59 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/MultiFormatReader.cpp +124 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/MultiFormatReader.h +48 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/NotFoundException.h +35 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/Reader.cpp +31 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/Reader.h +40 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/ReaderException.h +37 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/Result.cpp +61 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/Result.h +55 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/ResultIO.cpp +34 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/ResultPoint.cpp +108 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/ResultPoint.h +55 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/ResultPointCallback.cpp +26 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/ResultPointCallback.h +39 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/ZXing.h +133 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/aztec/AztecDetectorResult.cpp +54 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/aztec/AztecDetectorResult.h +48 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/aztec/AztecReader.cpp +68 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/aztec/AztecReader.h +49 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/aztec/decoder/Decoder.cpp +489 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/aztec/decoder/Decoder.h +69 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/aztec/detector/Detector.cpp +548 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/aztec/detector/Detector.h +92 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/Array.h +170 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/BitArray.cpp +155 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/BitArray.h +81 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/BitArrayIO.cpp +31 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/BitMatrix.cpp +143 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/BitMatrix.h +91 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/BitSource.cpp +76 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/BitSource.h +74 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/CharacterSetECI.cpp +104 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/CharacterSetECI.h +53 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/Counted.h +140 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/DecoderResult.cpp +46 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/DecoderResult.h +51 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/DetectorResult.cpp +39 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/DetectorResult.h +43 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/GlobalHistogramBinarizer.cpp +212 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/GlobalHistogramBinarizer.h +48 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/GreyscaleLuminanceSource.cpp +80 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/GreyscaleLuminanceSource.h +53 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/GreyscaleRotatedLuminanceSource.cpp +81 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/GreyscaleRotatedLuminanceSource.h +46 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/GridSampler.cpp +122 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/GridSampler.h +45 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/HybridBinarizer.cpp +226 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/HybridBinarizer.h +67 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/IllegalArgumentException.cpp +27 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/IllegalArgumentException.h +36 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/PerspectiveTransform.cpp +107 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/PerspectiveTransform.h +49 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/Point.h +47 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/Str.cpp +61 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/Str.h +51 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/StringUtils.cpp +198 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/StringUtils.h +52 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/detector/JavaMath.h +43 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/detector/MathUtils.h +57 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/detector/MonochromeRectangleDetector.cpp +174 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/detector/MonochromeRectangleDetector.h +62 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/detector/WhiteRectangleDetector.cpp +330 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/detector/WhiteRectangleDetector.h +59 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/reedsolomon/GenericGF.cpp +150 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/reedsolomon/GenericGF.h +73 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/reedsolomon/GenericGFPoly.cpp +218 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/reedsolomon/GenericGFPoly.h +56 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/reedsolomon/ReedSolomonDecoder.cpp +174 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/reedsolomon/ReedSolomonDecoder.h +49 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/reedsolomon/ReedSolomonException.cpp +30 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/reedsolomon/ReedSolomonException.h +33 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/DataMatrixReader.cpp +54 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/DataMatrixReader.h +45 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/Version.cpp +199 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/Version.h +87 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/decoder/BitMatrixParser.cpp +361 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/decoder/BitMatrixParser.h +59 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/decoder/DataBlock.cpp +113 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/decoder/DataBlock.h +49 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/decoder/DecodedBitStreamParser.cpp +416 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/decoder/DecodedBitStreamParser.h +104 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/decoder/Decoder.cpp +93 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/decoder/Decoder.h +49 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/detector/CornerPoint.cpp +46 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/detector/CornerPoint.h +43 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/detector/Detector.cpp +446 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/detector/Detector.h +94 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/detector/DetectorException.cpp +23 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/detector/DetectorException.h +23 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/multi/ByQuadrantReader.cpp +75 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/multi/ByQuadrantReader.h +42 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/multi/GenericMultipleBarcodeReader.cpp +137 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/multi/GenericMultipleBarcodeReader.h +51 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/multi/MultipleBarcodeReader.cpp +29 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/multi/MultipleBarcodeReader.h +41 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/multi/qrcode/QRCodeMultiReader.cpp +58 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/multi/qrcode/QRCodeMultiReader.h +36 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/multi/qrcode/detector/MultiDetector.cpp +47 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/multi/qrcode/detector/MultiDetector.h +37 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/multi/qrcode/detector/MultiFinderPatternFinder.cpp +236 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/multi/qrcode/detector/MultiFinderPatternFinder.h +47 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/CodaBarReader.cpp +340 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/CodaBarReader.h +57 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/Code128Reader.cpp +496 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/Code128Reader.h +48 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/Code39Reader.cpp +328 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/Code39Reader.h +63 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/Code93Reader.cpp +293 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/Code93Reader.h +58 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/EAN13Reader.cpp +85 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/EAN13Reader.h +49 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/EAN8Reader.cpp +65 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/EAN8Reader.h +47 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/ITFReader.cpp +337 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/ITFReader.h +54 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/MultiFormatOneDReader.cpp +96 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/MultiFormatOneDReader.h +38 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/MultiFormatUPCEANReader.cpp +110 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/MultiFormatUPCEANReader.h +41 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/OneDReader.cpp +227 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/OneDReader.h +81 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/OneDResultPoint.cpp +28 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/OneDResultPoint.h +35 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/UPCAReader.cpp +71 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/UPCAReader.h +50 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/UPCEANReader.cpp +309 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/UPCEANReader.h +88 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/UPCEReader.cpp +146 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/UPCEReader.h +47 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/PDF417Reader.cpp +170 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/PDF417Reader.h +49 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/BitMatrixParser.cpp +997 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/BitMatrixParser.h +84 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/DecodedBitStreamParser.cpp +563 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/DecodedBitStreamParser.h +84 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/Decoder.cpp +118 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/Decoder.h +62 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/ec/ErrorCorrection.cpp +214 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/ec/ErrorCorrection.h +71 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/ec/ModulusGF.cpp +120 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/ec/ModulusGF.h +72 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/ec/ModulusPoly.cpp +284 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/ec/ModulusPoly.h +68 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/detector/Detector.cpp +664 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/detector/Detector.h +106 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/detector/LinesSampler.cpp +714 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/detector/LinesSampler.h +122 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/ErrorCorrectionLevel.cpp +65 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/ErrorCorrectionLevel.h +52 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/FormatInformation.cpp +117 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/FormatInformation.h +54 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/QRCodeReader.cpp +52 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/QRCodeReader.h +48 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/Version.cpp +560 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/Version.h +85 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/BitMatrixParser.cpp +183 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/BitMatrixParser.h +56 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/DataBlock.cpp +118 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/DataBlock.h +50 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/DataMask.cpp +159 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/DataMask.h +50 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/DecodedBitStreamParser.cpp +425 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/DecodedBitStreamParser.h +72 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/Decoder.cpp +107 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/Decoder.h +46 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/Mode.cpp +90 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/Mode.h +57 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/AlignmentPattern.cpp +47 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/AlignmentPattern.h +45 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/AlignmentPatternFinder.cpp +208 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/AlignmentPatternFinder.h +68 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/Detector.cpp +314 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/Detector.h +69 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/FinderPattern.cpp +69 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/FinderPattern.h +48 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/FinderPatternFinder.cpp +559 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/FinderPatternFinder.h +76 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/FinderPatternInfo.cpp +41 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/FinderPatternInfo.h +47 -0
- data/ext/zxing/zxing-cpp/core/tests/src/TestRunner.cpp +30 -0
- data/ext/zxing/zxing-cpp/core/tests/src/common/BitArrayTest.cpp +216 -0
- data/ext/zxing/zxing-cpp/core/tests/src/common/BitArrayTest.h +61 -0
- data/ext/zxing/zxing-cpp/core/tests/src/common/BitMatrixTest.cpp +106 -0
- data/ext/zxing/zxing-cpp/core/tests/src/common/BitMatrixTest.h +55 -0
- data/ext/zxing/zxing-cpp/core/tests/src/common/BitSourceTest.cpp +49 -0
- data/ext/zxing/zxing-cpp/core/tests/src/common/BitSourceTest.h +42 -0
- data/ext/zxing/zxing-cpp/core/tests/src/common/CountedTest.cpp +58 -0
- data/ext/zxing/zxing-cpp/core/tests/src/common/CountedTest.h +46 -0
- data/ext/zxing/zxing-cpp/core/tests/src/common/PerspectiveTransformTest.cpp +69 -0
- data/ext/zxing/zxing-cpp/core/tests/src/common/PerspectiveTransformTest.h +47 -0
- data/ext/zxing/zxing-cpp/core/tests/src/common/reedsolomon/ReedSolomonTest.cpp +129 -0
- data/ext/zxing/zxing-cpp/core/tests/src/common/reedsolomon/ReedSolomonTest.h +62 -0
- data/ext/zxing/zxing-cpp/core/tests/src/qrcode/ErrorCorrectionLevelTest.cpp +47 -0
- data/ext/zxing/zxing-cpp/core/tests/src/qrcode/ErrorCorrectionLevelTest.h +45 -0
- data/ext/zxing/zxing-cpp/core/tests/src/qrcode/FormatInformationTest.cpp +88 -0
- data/ext/zxing/zxing-cpp/core/tests/src/qrcode/FormatInformationTest.h +47 -0
- data/ext/zxing/zxing-cpp/core/tests/src/qrcode/VersionTest.cpp +88 -0
- data/ext/zxing/zxing-cpp/core/tests/src/qrcode/VersionTest.h +49 -0
- data/ext/zxing/zxing-cpp/core/tests/src/qrcode/decoder/DataMaskTest.cpp +132 -0
- data/ext/zxing/zxing-cpp/core/tests/src/qrcode/decoder/DataMaskTest.h +91 -0
- data/ext/zxing/zxing-cpp/core/tests/src/qrcode/decoder/ModeTest.cpp +52 -0
- data/ext/zxing/zxing-cpp/core/tests/src/qrcode/decoder/ModeTest.h +47 -0
- data/ext/zxing/zxing.cc +224 -0
- data/lib/zxing.rb +50 -0
- data/lib/zxing/.gitignore +2 -0
- data/lib/zxing/aztec.rb +5 -0
- data/lib/zxing/aztec/aztec_reader.rb +14 -0
- data/lib/zxing/bad_image_exception.rb +4 -0
- data/lib/zxing/binarizer.rb +8 -0
- data/lib/zxing/binary_bitmap.rb +15 -0
- data/lib/zxing/checksum_exception.rb +4 -0
- data/lib/zxing/common.rb +7 -0
- data/lib/zxing/common/bit_matrix.rb +9 -0
- data/lib/zxing/common/hybrid_binarizer.rb +17 -0
- data/lib/zxing/common/illegal_argument_exception.rb +4 -0
- data/lib/zxing/datamatrix.rb +5 -0
- data/lib/zxing/datamatrix/data_matrix_reader.rb +14 -0
- data/lib/zxing/decodable.rb +11 -0
- data/lib/zxing/exception.rb +4 -0
- data/lib/zxing/ffi.rb +20 -0
- data/lib/zxing/ffi/aztec.rb +6 -0
- data/lib/zxing/ffi/aztec/aztec_reader.rb +9 -0
- data/lib/zxing/ffi/binarizer.rb +25 -0
- data/lib/zxing/ffi/binary_bitmap.rb +15 -0
- data/lib/zxing/ffi/common.rb +8 -0
- data/lib/zxing/ffi/common/bit_matrix.rb +12 -0
- data/lib/zxing/ffi/common/greyscale_luminance_source.rb +30 -0
- data/lib/zxing/ffi/common/hybrid_binarizer.rb +10 -0
- data/lib/zxing/ffi/datamatrix.rb +6 -0
- data/lib/zxing/ffi/datamatrix/data_matrix_reader.rb +9 -0
- data/lib/zxing/ffi/library.rb +102 -0
- data/lib/zxing/ffi/luminance_source.rb +18 -0
- data/lib/zxing/ffi/multi_format_reader.rb +9 -0
- data/lib/zxing/ffi/oned.rb +6 -0
- data/lib/zxing/ffi/oned/code_39_reader.rb +10 -0
- data/lib/zxing/ffi/qrcode.rb +8 -0
- data/lib/zxing/ffi/qrcode/decoder.rb +10 -0
- data/lib/zxing/ffi/qrcode/detector.rb +10 -0
- data/lib/zxing/ffi/reader.rb +58 -0
- data/lib/zxing/ffi/result.rb +23 -0
- data/lib/zxing/format_exception.rb +4 -0
- data/lib/zxing/illegal_argument_exception.rb +4 -0
- data/lib/zxing/image.rb +15 -0
- data/lib/zxing/luminance_source.rb +18 -0
- data/lib/zxing/multi_format_reader.rb +11 -0
- data/lib/zxing/not_found_exception.rb +4 -0
- data/lib/zxing/oned.rb +5 -0
- data/lib/zxing/oned/code_39_reader.rb +15 -0
- data/lib/zxing/qrcode.rb +8 -0
- data/lib/zxing/qrcode/decoder.rb +14 -0
- data/lib/zxing/qrcode/detector.rb +14 -0
- data/lib/zxing/qrcode/encoder.rb +8 -0
- data/lib/zxing/qrcode/encoder/byte_matrix.rb +18 -0
- data/lib/zxing/qrcode/encoder/encoder.rb +9 -0
- data/lib/zxing/qrcode/encoder/qrcode.rb +18 -0
- data/lib/zxing/reader.rb +8 -0
- data/lib/zxing/reader_exception.rb +4 -0
- data/lib/zxing/reed_solomon_exception.rb +2 -0
- data/lib/zxing/result.rb +18 -0
- data/lib/zxing/rmagick.rb +5 -0
- data/lib/zxing/rmagick/image.rb +104 -0
- data/lib/zxing/version.rb +33 -0
- data/test/qrcode.png +0 -0
- data/test/test_helper.rb +5 -0
- data/test/test_zxing.rb +58 -0
- data/test/vendor.rb +360 -0
- data/test/zxing/test_decodable.rb +38 -0
- data/zxing_cpp.gemspec +48 -0
- metadata +473 -0
@@ -0,0 +1,106 @@
|
|
1
|
+
/*
|
2
|
+
* BitMatrixTest.cpp
|
3
|
+
* zxing
|
4
|
+
*
|
5
|
+
* Created by Christian Brunschen on 12/05/2008.
|
6
|
+
* Copyright 2008 Google UK. All rights reserved.
|
7
|
+
*
|
8
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
9
|
+
* you may not use this file except in compliance with the License.
|
10
|
+
* You may obtain a copy of the License at
|
11
|
+
*
|
12
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
13
|
+
*
|
14
|
+
* Unless required by applicable law or agreed to in writing, software
|
15
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
16
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
17
|
+
* See the License for the specific language governing permissions and
|
18
|
+
* limitations under the License.
|
19
|
+
*/
|
20
|
+
|
21
|
+
#include "BitMatrixTest.h"
|
22
|
+
#include <limits>
|
23
|
+
#include <stdlib.h>
|
24
|
+
#include <unistd.h>
|
25
|
+
|
26
|
+
namespace zxing {
|
27
|
+
using namespace std;
|
28
|
+
|
29
|
+
CPPUNIT_TEST_SUITE_REGISTRATION(BitMatrixTest);
|
30
|
+
|
31
|
+
BitMatrixTest::BitMatrixTest() {
|
32
|
+
srand(getpid());
|
33
|
+
}
|
34
|
+
|
35
|
+
void BitMatrixTest::testGetSet() {
|
36
|
+
const int bits = BitMatrix::bitsPerWord;
|
37
|
+
BitMatrix matrix(bits + 1);
|
38
|
+
CPPUNIT_ASSERT_EQUAL(bits + 1, matrix.getHeight());
|
39
|
+
for (int i = 0; i < bits + 1; i++) {
|
40
|
+
for (int j = 0; j < bits + 1; j++) {
|
41
|
+
if (i * j % 3 == 0) {
|
42
|
+
matrix.set(i, j);
|
43
|
+
}
|
44
|
+
}
|
45
|
+
}
|
46
|
+
for (int i = 0; i < bits + 1; i++) {
|
47
|
+
for (int j = 0; j < bits + 1; j++) {
|
48
|
+
CPPUNIT_ASSERT_EQUAL(i * j % 3 == 0, matrix.get(i, j));
|
49
|
+
}
|
50
|
+
}
|
51
|
+
}
|
52
|
+
|
53
|
+
void BitMatrixTest::testSetRegion() {
|
54
|
+
BitMatrix matrix(5);
|
55
|
+
matrix.setRegion(1, 1, 3, 3);
|
56
|
+
for (int i = 0; i < 5; i++) {
|
57
|
+
for (int j = 0; j < 5; j++) {
|
58
|
+
CPPUNIT_ASSERT_EQUAL(i >= 1 && i <= 3 && j >= 1 && j <= 3,
|
59
|
+
matrix.get(i, j));
|
60
|
+
}
|
61
|
+
}
|
62
|
+
}
|
63
|
+
|
64
|
+
void BitMatrixTest::testGetRow0() {
|
65
|
+
const int width = 2;
|
66
|
+
const int height = 2;
|
67
|
+
runBitMatrixGetRowTest(width, height);
|
68
|
+
}
|
69
|
+
|
70
|
+
void BitMatrixTest::testGetRow1() {
|
71
|
+
const int width = 98;
|
72
|
+
const int height = 76;
|
73
|
+
runBitMatrixGetRowTest(width, height);
|
74
|
+
}
|
75
|
+
|
76
|
+
void BitMatrixTest::testGetRow2() {
|
77
|
+
const int width = 320;
|
78
|
+
const int height = 320;
|
79
|
+
runBitMatrixGetRowTest(width, height);
|
80
|
+
}
|
81
|
+
|
82
|
+
void BitMatrixTest::testGetRow3() {
|
83
|
+
const int width = 17;
|
84
|
+
const int height = 23;
|
85
|
+
runBitMatrixGetRowTest(width, height);
|
86
|
+
}
|
87
|
+
|
88
|
+
void BitMatrixTest::runBitMatrixGetRowTest(int width, int height) {
|
89
|
+
BitMatrix mat(width, height);
|
90
|
+
for (int y = 0; y < height; y++) {
|
91
|
+
for (int x = 0; x < width; x++) {
|
92
|
+
bool v = ((rand() & 0x01) != 0);
|
93
|
+
if (v) {
|
94
|
+
mat.set(x, y);
|
95
|
+
}
|
96
|
+
}
|
97
|
+
}
|
98
|
+
Ref<BitArray> row(new BitArray(width));
|
99
|
+
for (int y = 0; y < height; y++) {
|
100
|
+
row = mat.getRow(y, row);
|
101
|
+
for (int x = 0; x < width; x++) {
|
102
|
+
CPPUNIT_ASSERT_EQUAL(row->get(x), mat.get(x,y));
|
103
|
+
}
|
104
|
+
}
|
105
|
+
}
|
106
|
+
}
|
@@ -0,0 +1,55 @@
|
|
1
|
+
#ifndef __BIT_MATRIX_TEST_H__
|
2
|
+
#define __BIT_MATRIX_TEST_H__
|
3
|
+
|
4
|
+
/*
|
5
|
+
* BitMatrixTest.h
|
6
|
+
* zxing
|
7
|
+
*
|
8
|
+
* Copyright 2010 ZXing authors All rights reserved.
|
9
|
+
*
|
10
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
11
|
+
* you may not use this file except in compliance with the License.
|
12
|
+
* You may obtain a copy of the License at
|
13
|
+
*
|
14
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
15
|
+
*
|
16
|
+
* Unless required by applicable law or agreed to in writing, software
|
17
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
18
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
19
|
+
* See the License for the specific language governing permissions and
|
20
|
+
* limitations under the License.
|
21
|
+
*/
|
22
|
+
|
23
|
+
#include <cppunit/TestFixture.h>
|
24
|
+
#include <cppunit/extensions/HelperMacros.h>
|
25
|
+
#include <zxing/common/BitMatrix.h>
|
26
|
+
|
27
|
+
namespace zxing {
|
28
|
+
class BitMatrixTest : public CPPUNIT_NS::TestFixture {
|
29
|
+
CPPUNIT_TEST_SUITE(BitMatrixTest);
|
30
|
+
CPPUNIT_TEST(testGetSet);
|
31
|
+
CPPUNIT_TEST(testSetRegion);
|
32
|
+
CPPUNIT_TEST(testGetRow0);
|
33
|
+
CPPUNIT_TEST(testGetRow1);
|
34
|
+
CPPUNIT_TEST(testGetRow2);
|
35
|
+
CPPUNIT_TEST(testGetRow3);
|
36
|
+
CPPUNIT_TEST_SUITE_END();
|
37
|
+
|
38
|
+
public:
|
39
|
+
BitMatrixTest();
|
40
|
+
|
41
|
+
protected:
|
42
|
+
void testGetSet();
|
43
|
+
void testSetRegion();
|
44
|
+
void testGetRow0();
|
45
|
+
void testGetRow1();
|
46
|
+
void testGetRow2();
|
47
|
+
void testGetRow3();
|
48
|
+
|
49
|
+
private:
|
50
|
+
void runBitMatrixGetRowTest(int width, int height);
|
51
|
+
};
|
52
|
+
}
|
53
|
+
|
54
|
+
|
55
|
+
#endif // __BIT_MATRIX_TEST_H__
|
@@ -0,0 +1,49 @@
|
|
1
|
+
/*
|
2
|
+
* BitSourceTest.cpp
|
3
|
+
* zxing
|
4
|
+
*
|
5
|
+
* Created by Christian Brunschen on 09/05/2008.
|
6
|
+
* Copyright 2008 Google UK. All rights reserved.
|
7
|
+
*
|
8
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
9
|
+
* you may not use this file except in compliance with the License.
|
10
|
+
* You may obtain a copy of the License at
|
11
|
+
*
|
12
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
13
|
+
*
|
14
|
+
* Unless required by applicable law or agreed to in writing, software
|
15
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
16
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
17
|
+
* See the License for the specific language governing permissions and
|
18
|
+
* limitations under the License.
|
19
|
+
*/
|
20
|
+
|
21
|
+
#include "BitSourceTest.h"
|
22
|
+
|
23
|
+
namespace zxing {
|
24
|
+
|
25
|
+
CPPUNIT_TEST_SUITE_REGISTRATION(BitSourceTest);
|
26
|
+
|
27
|
+
typedef char byte;
|
28
|
+
|
29
|
+
void BitSourceTest::testSource() {
|
30
|
+
byte rawBytes[] = {(byte) 1, (byte) 2, (byte) 3, (byte) 4, (byte) 5};
|
31
|
+
ArrayRef<byte> bytes(rawBytes, 5);
|
32
|
+
BitSource source(bytes);
|
33
|
+
CPPUNIT_ASSERT_EQUAL(40, source.available());
|
34
|
+
CPPUNIT_ASSERT_EQUAL(0, source.readBits(1));
|
35
|
+
CPPUNIT_ASSERT_EQUAL(39, source.available());
|
36
|
+
CPPUNIT_ASSERT_EQUAL(0, source.readBits(6));
|
37
|
+
CPPUNIT_ASSERT_EQUAL(33, source.available());
|
38
|
+
CPPUNIT_ASSERT_EQUAL(1, source.readBits(1));
|
39
|
+
CPPUNIT_ASSERT_EQUAL(32, source.available());
|
40
|
+
CPPUNIT_ASSERT_EQUAL(2, source.readBits(8));
|
41
|
+
CPPUNIT_ASSERT_EQUAL(24, source.available());
|
42
|
+
CPPUNIT_ASSERT_EQUAL(12, source.readBits(10));
|
43
|
+
CPPUNIT_ASSERT_EQUAL(14, source.available());
|
44
|
+
CPPUNIT_ASSERT_EQUAL(16, source.readBits(8));
|
45
|
+
CPPUNIT_ASSERT_EQUAL(6, source.available());
|
46
|
+
CPPUNIT_ASSERT_EQUAL(5, source.readBits(6));
|
47
|
+
CPPUNIT_ASSERT_EQUAL(0, source.available());
|
48
|
+
}
|
49
|
+
}
|
@@ -0,0 +1,42 @@
|
|
1
|
+
#ifndef __BIT_SOURCE_TEST_H__
|
2
|
+
#define __BIT_SOURCE_TEST_H__
|
3
|
+
|
4
|
+
/*
|
5
|
+
* BitSourceTest.h
|
6
|
+
* zxing
|
7
|
+
*
|
8
|
+
* Copyright 2010 ZXing authors All rights reserved.
|
9
|
+
*
|
10
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
11
|
+
* you may not use this file except in compliance with the License.
|
12
|
+
* You may obtain a copy of the License at
|
13
|
+
*
|
14
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
15
|
+
*
|
16
|
+
* Unless required by applicable law or agreed to in writing, software
|
17
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
18
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
19
|
+
* See the License for the specific language governing permissions and
|
20
|
+
* limitations under the License.
|
21
|
+
*/
|
22
|
+
|
23
|
+
#include <cppunit/TestFixture.h>
|
24
|
+
#include <cppunit/extensions/HelperMacros.h>
|
25
|
+
#include <zxing/common/BitSource.h>
|
26
|
+
|
27
|
+
namespace zxing {
|
28
|
+
class BitSourceTest : public CPPUNIT_NS::TestFixture {
|
29
|
+
CPPUNIT_TEST_SUITE(BitSourceTest);
|
30
|
+
CPPUNIT_TEST(testSource);
|
31
|
+
CPPUNIT_TEST_SUITE_END();
|
32
|
+
|
33
|
+
public:
|
34
|
+
|
35
|
+
protected:
|
36
|
+
void testSource();
|
37
|
+
|
38
|
+
private:
|
39
|
+
};
|
40
|
+
}
|
41
|
+
|
42
|
+
#endif // __BIT_SOURCE_TEST_H__
|
@@ -0,0 +1,58 @@
|
|
1
|
+
/*
|
2
|
+
* CountedTest.cpp
|
3
|
+
* zxing
|
4
|
+
*
|
5
|
+
* Created by Christian Brunschen on 08/05/2008.
|
6
|
+
* Copyright 2008 Google UK. All rights reserved.
|
7
|
+
*
|
8
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
9
|
+
* you may not use this file except in compliance with the License.
|
10
|
+
* You may obtain a copy of the License at
|
11
|
+
*
|
12
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
13
|
+
*
|
14
|
+
* Unless required by applicable law or agreed to in writing, software
|
15
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
16
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
17
|
+
* See the License for the specific language governing permissions and
|
18
|
+
* limitations under the License.
|
19
|
+
*/
|
20
|
+
|
21
|
+
#include "CountedTest.h"
|
22
|
+
#include <zxing/common/Counted.h>
|
23
|
+
#include <iostream>
|
24
|
+
|
25
|
+
using namespace std;
|
26
|
+
using namespace CPPUNIT_NS;
|
27
|
+
|
28
|
+
namespace zxing {
|
29
|
+
|
30
|
+
class Foo : public Counted {
|
31
|
+
public:
|
32
|
+
void foo() {
|
33
|
+
cout << "foo!\n";
|
34
|
+
}
|
35
|
+
};
|
36
|
+
|
37
|
+
//CPPUNIT_TEST_SUITE_REGISTRATION(CountedTest);
|
38
|
+
|
39
|
+
void CountedTest::setUp() {}
|
40
|
+
void CountedTest::tearDown() {}
|
41
|
+
|
42
|
+
void CountedTest::test() {
|
43
|
+
Foo foo;
|
44
|
+
CPPUNIT_ASSERT_EQUAL(0, foo.count());
|
45
|
+
foo.retain();
|
46
|
+
CPPUNIT_ASSERT_EQUAL(1, foo.count());
|
47
|
+
Ref<Foo> foobar(new Foo);
|
48
|
+
CPPUNIT_ASSERT_EQUAL(1, foobar->count());
|
49
|
+
{
|
50
|
+
Ref<Foo> secondRef(foobar);
|
51
|
+
CPPUNIT_ASSERT_EQUAL(1, foo.count());
|
52
|
+
CPPUNIT_ASSERT_EQUAL(2, foobar->count());
|
53
|
+
}
|
54
|
+
CPPUNIT_ASSERT_EQUAL(1, foo.count());
|
55
|
+
CPPUNIT_ASSERT_EQUAL(1, foobar->count());
|
56
|
+
}
|
57
|
+
|
58
|
+
}
|
@@ -0,0 +1,46 @@
|
|
1
|
+
#ifndef __COUNTED_TEST_H__
|
2
|
+
#define __COUNTED_TEST_H__
|
3
|
+
|
4
|
+
/*
|
5
|
+
* CountedTest.h
|
6
|
+
* zxing
|
7
|
+
*
|
8
|
+
* Copyright 2010 ZXing authors All rights reserved.
|
9
|
+
*
|
10
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
11
|
+
* you may not use this file except in compliance with the License.
|
12
|
+
* You may obtain a copy of the License at
|
13
|
+
*
|
14
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
15
|
+
*
|
16
|
+
* Unless required by applicable law or agreed to in writing, software
|
17
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
18
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
19
|
+
* See the License for the specific language governing permissions and
|
20
|
+
* limitations under the License.
|
21
|
+
*/
|
22
|
+
|
23
|
+
#include <cppunit/TestFixture.h>
|
24
|
+
#include <cppunit/extensions/HelperMacros.h>
|
25
|
+
|
26
|
+
using namespace std;
|
27
|
+
|
28
|
+
namespace zxing {
|
29
|
+
|
30
|
+
class CountedTest : public CppUnit::TestFixture {
|
31
|
+
CPPUNIT_TEST_SUITE(CountedTest);
|
32
|
+
CPPUNIT_TEST(test);
|
33
|
+
CPPUNIT_TEST_SUITE_END();
|
34
|
+
|
35
|
+
public:
|
36
|
+
void setUp();
|
37
|
+
void tearDown();
|
38
|
+
|
39
|
+
protected:
|
40
|
+
void test();
|
41
|
+
|
42
|
+
private:
|
43
|
+
};
|
44
|
+
}
|
45
|
+
|
46
|
+
#endif // __COUNTED_TEST_H__
|
@@ -0,0 +1,69 @@
|
|
1
|
+
/*
|
2
|
+
* PerspectiveTransformTest.cpp
|
3
|
+
* zxing
|
4
|
+
*
|
5
|
+
* Created by Christian Brunschen on 12/05/2008.
|
6
|
+
* Copyright 2008 Google UK. All rights reserved.
|
7
|
+
*
|
8
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
9
|
+
* you may not use this file except in compliance with the License.
|
10
|
+
* You may obtain a copy of the License at
|
11
|
+
*
|
12
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
13
|
+
*
|
14
|
+
* Unless required by applicable law or agreed to in writing, software
|
15
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
16
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
17
|
+
* See the License for the specific language governing permissions and
|
18
|
+
* limitations under the License.
|
19
|
+
*/
|
20
|
+
|
21
|
+
#include "PerspectiveTransformTest.h"
|
22
|
+
|
23
|
+
namespace zxing {
|
24
|
+
using namespace std;
|
25
|
+
|
26
|
+
static float EPSILON = 0.0001f;
|
27
|
+
|
28
|
+
CPPUNIT_TEST_SUITE_REGISTRATION(PerspectiveTransformTest);
|
29
|
+
|
30
|
+
void PerspectiveTransformTest::testSquareToQuadrilateral() {
|
31
|
+
Ref<PerspectiveTransform> pt
|
32
|
+
(PerspectiveTransform::squareToQuadrilateral
|
33
|
+
(2.0f, 3.0f, 10.0f, 4.0f, 16.0f, 15.0f, 4.0f, 9.0f));
|
34
|
+
assertPointEquals(2.0f, 3.0f, 0.0f, 0.0f, pt);
|
35
|
+
assertPointEquals(10.0f, 4.0f, 1.0f, 0.0f, pt);
|
36
|
+
assertPointEquals(4.0f, 9.0f, 0.0f, 1.0f, pt);
|
37
|
+
assertPointEquals(16.0f, 15.0f, 1.0f, 1.0f, pt);
|
38
|
+
assertPointEquals(6.535211f, 6.8873234f, 0.5f, 0.5f, pt);
|
39
|
+
assertPointEquals(48.0f, 42.42857f, 1.5f, 1.5f, pt);
|
40
|
+
}
|
41
|
+
|
42
|
+
void PerspectiveTransformTest::testQuadrilateralToQuadrilateral() {
|
43
|
+
Ref<PerspectiveTransform> pt
|
44
|
+
(PerspectiveTransform::quadrilateralToQuadrilateral
|
45
|
+
(2.0f, 3.0f, 10.0f, 4.0f, 16.0f, 15.0f, 4.0f, 9.0f,
|
46
|
+
103.0f, 110.0f, 300.0f, 120.0f, 290.0f, 270.0f, 150.0f, 280.0f));
|
47
|
+
assertPointEquals(103.0f, 110.0f, 2.0f, 3.0f, pt);
|
48
|
+
assertPointEquals(300.0f, 120.0f, 10.0f, 4.0f, pt);
|
49
|
+
assertPointEquals(290.0f, 270.0f, 16.0f, 15.0f, pt);
|
50
|
+
assertPointEquals(150.0f, 280.0f, 4.0f, 9.0f, pt);
|
51
|
+
assertPointEquals(7.1516876f, -64.60185f, 0.5f, 0.5f, pt);
|
52
|
+
assertPointEquals(328.09116f, 334.16385f, 50.0f, 50.0f, pt);
|
53
|
+
}
|
54
|
+
|
55
|
+
void PerspectiveTransformTest::assertPointEquals(float expectedX,
|
56
|
+
float expectedY,
|
57
|
+
float sourceX,
|
58
|
+
float sourceY,
|
59
|
+
Ref<PerspectiveTransform> pt) {
|
60
|
+
vector<float> points(2);
|
61
|
+
points[0] = sourceX;
|
62
|
+
points[1] = sourceY;
|
63
|
+
pt->transformPoints(points);
|
64
|
+
CPPUNIT_ASSERT_DOUBLES_EQUAL(expectedX, points[0], EPSILON);
|
65
|
+
CPPUNIT_ASSERT_DOUBLES_EQUAL(expectedY, points[1], EPSILON);
|
66
|
+
|
67
|
+
}
|
68
|
+
|
69
|
+
}
|
@@ -0,0 +1,47 @@
|
|
1
|
+
#ifndef __PERSPECTIVE_TRANSFORM_TEST_H__
|
2
|
+
#define __PERSPECTIVE_TRANSFORM_TEST_H__
|
3
|
+
|
4
|
+
/*
|
5
|
+
* PerspectiveTransformTest.h
|
6
|
+
* zxing
|
7
|
+
*
|
8
|
+
* Copyright 2010 ZXing authors All rights reserved.
|
9
|
+
*
|
10
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
11
|
+
* you may not use this file except in compliance with the License.
|
12
|
+
* You may obtain a copy of the License at
|
13
|
+
*
|
14
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
15
|
+
*
|
16
|
+
* Unless required by applicable law or agreed to in writing, software
|
17
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
18
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
19
|
+
* See the License for the specific language governing permissions and
|
20
|
+
* limitations under the License.
|
21
|
+
*/
|
22
|
+
|
23
|
+
#include <cppunit/TestFixture.h>
|
24
|
+
#include <cppunit/extensions/HelperMacros.h>
|
25
|
+
#include <zxing/common/PerspectiveTransform.h>
|
26
|
+
|
27
|
+
namespace zxing {
|
28
|
+
class PerspectiveTransformTest : public CPPUNIT_NS::TestFixture {
|
29
|
+
CPPUNIT_TEST_SUITE(PerspectiveTransformTest);
|
30
|
+
CPPUNIT_TEST(testSquareToQuadrilateral);
|
31
|
+
CPPUNIT_TEST(testQuadrilateralToQuadrilateral);
|
32
|
+
CPPUNIT_TEST_SUITE_END();
|
33
|
+
|
34
|
+
public:
|
35
|
+
|
36
|
+
protected:
|
37
|
+
void testSquareToQuadrilateral();
|
38
|
+
void testQuadrilateralToQuadrilateral();
|
39
|
+
|
40
|
+
private:
|
41
|
+
static void assertPointEquals(float expectedX, float expectedY,
|
42
|
+
float sourceX, float sourceY,
|
43
|
+
Ref<PerspectiveTransform> pt);
|
44
|
+
};
|
45
|
+
}
|
46
|
+
|
47
|
+
#endif // __PERSPECTIVE_TRANSFORM_TEST_H__
|