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,72 @@
|
|
1
|
+
// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
|
2
|
+
|
3
|
+
#ifndef __DECODED_BIT_STREAM_PARSER_H__
|
4
|
+
#define __DECODED_BIT_STREAM_PARSER_H__
|
5
|
+
|
6
|
+
/*
|
7
|
+
* DecodedBitStreamParser.h
|
8
|
+
* zxing
|
9
|
+
*
|
10
|
+
* Copyright 2010 ZXing authors All rights reserved.
|
11
|
+
*
|
12
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
13
|
+
* you may not use this file except in compliance with the License.
|
14
|
+
* You may obtain a copy of the License at
|
15
|
+
*
|
16
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
17
|
+
*
|
18
|
+
* Unless required by applicable law or agreed to in writing, software
|
19
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
20
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
21
|
+
* See the License for the specific language governing permissions and
|
22
|
+
* limitations under the License.
|
23
|
+
*/
|
24
|
+
|
25
|
+
#include <string>
|
26
|
+
#include <sstream>
|
27
|
+
#include <map>
|
28
|
+
#include <zxing/qrcode/decoder/Mode.h>
|
29
|
+
#include <zxing/common/BitSource.h>
|
30
|
+
#include <zxing/common/Counted.h>
|
31
|
+
#include <zxing/common/Array.h>
|
32
|
+
#include <zxing/common/DecoderResult.h>
|
33
|
+
#include <zxing/common/CharacterSetECI.h>
|
34
|
+
#include <zxing/DecodeHints.h>
|
35
|
+
|
36
|
+
namespace zxing {
|
37
|
+
namespace qrcode {
|
38
|
+
|
39
|
+
class DecodedBitStreamParser {
|
40
|
+
public:
|
41
|
+
typedef std::map<DecodeHintType, std::string> Hashtable;
|
42
|
+
|
43
|
+
private:
|
44
|
+
static char const ALPHANUMERIC_CHARS[];
|
45
|
+
static char toAlphaNumericChar(size_t value);
|
46
|
+
|
47
|
+
static void decodeHanziSegment(Ref<BitSource> bits, std::string &result, int count);
|
48
|
+
static void decodeKanjiSegment(Ref<BitSource> bits, std::string &result, int count);
|
49
|
+
static void decodeByteSegment(Ref<BitSource> bits, std::string &result, int count);
|
50
|
+
static void decodeByteSegment(Ref<BitSource> bits_,
|
51
|
+
std::string& result,
|
52
|
+
int count,
|
53
|
+
zxing::common::CharacterSetECI* currentCharacterSetECI,
|
54
|
+
ArrayRef< ArrayRef<char> >& byteSegments,
|
55
|
+
Hashtable const& hints);
|
56
|
+
static void decodeAlphanumericSegment(Ref<BitSource> bits, std::string &result, int count, bool fc1InEffect);
|
57
|
+
static void decodeNumericSegment(Ref<BitSource> bits, std::string &result, int count);
|
58
|
+
|
59
|
+
static void append(std::string &ost, const char *bufIn, size_t nIn, const char *src);
|
60
|
+
static void append(std::string &ost, std::string const& in, const char *src);
|
61
|
+
|
62
|
+
public:
|
63
|
+
static Ref<DecoderResult> decode(ArrayRef<char> bytes,
|
64
|
+
Version *version,
|
65
|
+
ErrorCorrectionLevel const& ecLevel,
|
66
|
+
Hashtable const& hints);
|
67
|
+
};
|
68
|
+
|
69
|
+
}
|
70
|
+
}
|
71
|
+
|
72
|
+
#endif // __DECODED_BIT_STREAM_PARSER_H__
|
@@ -0,0 +1,107 @@
|
|
1
|
+
// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
|
2
|
+
/*
|
3
|
+
* Decoder.cpp
|
4
|
+
* zxing
|
5
|
+
*
|
6
|
+
* Created by Christian Brunschen on 20/05/2008.
|
7
|
+
* Copyright 2008 ZXing authors All rights reserved.
|
8
|
+
*
|
9
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
10
|
+
* you may not use this file except in compliance with the License.
|
11
|
+
* You may obtain a copy of the License at
|
12
|
+
*
|
13
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
14
|
+
*
|
15
|
+
* Unless required by applicable law or agreed to in writing, software
|
16
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
17
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
18
|
+
* See the License for the specific language governing permissions and
|
19
|
+
* limitations under the License.
|
20
|
+
*/
|
21
|
+
|
22
|
+
#include <zxing/qrcode/decoder/Decoder.h>
|
23
|
+
#include <zxing/qrcode/decoder/BitMatrixParser.h>
|
24
|
+
#include <zxing/qrcode/ErrorCorrectionLevel.h>
|
25
|
+
#include <zxing/qrcode/Version.h>
|
26
|
+
#include <zxing/qrcode/decoder/DataBlock.h>
|
27
|
+
#include <zxing/qrcode/decoder/DecodedBitStreamParser.h>
|
28
|
+
#include <zxing/ReaderException.h>
|
29
|
+
#include <zxing/ChecksumException.h>
|
30
|
+
#include <zxing/common/reedsolomon/ReedSolomonException.h>
|
31
|
+
|
32
|
+
using zxing::qrcode::Decoder;
|
33
|
+
using zxing::DecoderResult;
|
34
|
+
using zxing::Ref;
|
35
|
+
|
36
|
+
// VC++
|
37
|
+
using zxing::ArrayRef;
|
38
|
+
using zxing::BitMatrix;
|
39
|
+
|
40
|
+
Decoder::Decoder() :
|
41
|
+
rsDecoder_(GenericGF::QR_CODE_FIELD_256) {
|
42
|
+
}
|
43
|
+
|
44
|
+
void Decoder::correctErrors(ArrayRef<char> codewordBytes, int numDataCodewords) {
|
45
|
+
int numCodewords = codewordBytes->size();
|
46
|
+
ArrayRef<int> codewordInts(numCodewords);
|
47
|
+
for (int i = 0; i < numCodewords; i++) {
|
48
|
+
codewordInts[i] = codewordBytes[i] & 0xff;
|
49
|
+
}
|
50
|
+
int numECCodewords = numCodewords - numDataCodewords;
|
51
|
+
|
52
|
+
try {
|
53
|
+
rsDecoder_.decode(codewordInts, numECCodewords);
|
54
|
+
} catch (ReedSolomonException const& ignored) {
|
55
|
+
(void)ignored;
|
56
|
+
throw ChecksumException();
|
57
|
+
}
|
58
|
+
|
59
|
+
for (int i = 0; i < numDataCodewords; i++) {
|
60
|
+
codewordBytes[i] = (char)codewordInts[i];
|
61
|
+
}
|
62
|
+
}
|
63
|
+
|
64
|
+
Ref<DecoderResult> Decoder::decode(Ref<BitMatrix> bits) {
|
65
|
+
// Construct a parser and read version, error-correction level
|
66
|
+
BitMatrixParser parser(bits);
|
67
|
+
|
68
|
+
// std::cerr << *bits << std::endl;
|
69
|
+
|
70
|
+
Version *version = parser.readVersion();
|
71
|
+
ErrorCorrectionLevel &ecLevel = parser.readFormatInformation()->getErrorCorrectionLevel();
|
72
|
+
|
73
|
+
|
74
|
+
// Read codewords
|
75
|
+
ArrayRef<char> codewords(parser.readCodewords());
|
76
|
+
|
77
|
+
|
78
|
+
// Separate into data blocks
|
79
|
+
std::vector<Ref<DataBlock> > dataBlocks(DataBlock::getDataBlocks(codewords, version, ecLevel));
|
80
|
+
|
81
|
+
|
82
|
+
// Count total number of data bytes
|
83
|
+
int totalBytes = 0;
|
84
|
+
for (size_t i = 0; i < dataBlocks.size(); i++) {
|
85
|
+
totalBytes += dataBlocks[i]->getNumDataCodewords();
|
86
|
+
}
|
87
|
+
ArrayRef<char> resultBytes(totalBytes);
|
88
|
+
int resultOffset = 0;
|
89
|
+
|
90
|
+
|
91
|
+
// Error-correct and copy data blocks together into a stream of bytes
|
92
|
+
for (size_t j = 0; j < dataBlocks.size(); j++) {
|
93
|
+
Ref<DataBlock> dataBlock(dataBlocks[j]);
|
94
|
+
ArrayRef<char> codewordBytes = dataBlock->getCodewords();
|
95
|
+
int numDataCodewords = dataBlock->getNumDataCodewords();
|
96
|
+
correctErrors(codewordBytes, numDataCodewords);
|
97
|
+
for (int i = 0; i < numDataCodewords; i++) {
|
98
|
+
resultBytes[resultOffset++] = codewordBytes[i];
|
99
|
+
}
|
100
|
+
}
|
101
|
+
|
102
|
+
return DecodedBitStreamParser::decode(resultBytes,
|
103
|
+
version,
|
104
|
+
ecLevel,
|
105
|
+
DecodedBitStreamParser::Hashtable());
|
106
|
+
}
|
107
|
+
|
@@ -0,0 +1,46 @@
|
|
1
|
+
#ifndef __DECODER_H__
|
2
|
+
#define __DECODER_H__
|
3
|
+
|
4
|
+
/*
|
5
|
+
* Decoder.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 <zxing/common/reedsolomon/ReedSolomonDecoder.h>
|
24
|
+
#include <zxing/common/Counted.h>
|
25
|
+
#include <zxing/common/Array.h>
|
26
|
+
#include <zxing/common/DecoderResult.h>
|
27
|
+
#include <zxing/common/BitMatrix.h>
|
28
|
+
|
29
|
+
namespace zxing {
|
30
|
+
namespace qrcode {
|
31
|
+
|
32
|
+
class Decoder {
|
33
|
+
private:
|
34
|
+
ReedSolomonDecoder rsDecoder_;
|
35
|
+
|
36
|
+
void correctErrors(ArrayRef<char> bytes, int numDataCodewords);
|
37
|
+
|
38
|
+
public:
|
39
|
+
Decoder();
|
40
|
+
Ref<DecoderResult> decode(Ref<BitMatrix> bits);
|
41
|
+
};
|
42
|
+
|
43
|
+
}
|
44
|
+
}
|
45
|
+
|
46
|
+
#endif // __DECODER_H__
|
@@ -0,0 +1,90 @@
|
|
1
|
+
// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
|
2
|
+
/*
|
3
|
+
* Mode.cpp
|
4
|
+
* zxing
|
5
|
+
*
|
6
|
+
* Created by Christian Brunschen on 19/05/2008.
|
7
|
+
* Copyright 2008 ZXing authors All rights reserved.
|
8
|
+
*
|
9
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
10
|
+
* you may not use this file except in compliance with the License.
|
11
|
+
* You may obtain a copy of the License at
|
12
|
+
*
|
13
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
14
|
+
*
|
15
|
+
* Unless required by applicable law or agreed to in writing, software
|
16
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
17
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
18
|
+
* See the License for the specific language governing permissions and
|
19
|
+
* limitations under the License.
|
20
|
+
*/
|
21
|
+
|
22
|
+
#include <zxing/ZXing.h>
|
23
|
+
#include <zxing/qrcode/decoder/Mode.h>
|
24
|
+
#include <zxing/common/Counted.h>
|
25
|
+
#include <zxing/ReaderException.h>
|
26
|
+
#include <zxing/qrcode/Version.h>
|
27
|
+
#include <sstream>
|
28
|
+
|
29
|
+
using zxing::qrcode::Mode;
|
30
|
+
using std::ostringstream;
|
31
|
+
|
32
|
+
// VC++
|
33
|
+
using zxing::qrcode::Version;
|
34
|
+
|
35
|
+
Mode Mode::TERMINATOR(0, 0, 0, 0x00, "TERMINATOR");
|
36
|
+
Mode Mode::NUMERIC(10, 12, 14, 0x01, "NUMERIC");
|
37
|
+
Mode Mode::ALPHANUMERIC(9, 11, 13, 0x02, "ALPHANUMERIC");
|
38
|
+
Mode Mode::STRUCTURED_APPEND(0, 0, 0, 0x03, "STRUCTURED_APPEND");
|
39
|
+
Mode Mode::BYTE(8, 16, 16, 0x04, "BYTE");
|
40
|
+
Mode Mode::ECI(0, 0, 0, 0x07, "ECI");
|
41
|
+
Mode Mode::KANJI(8, 10, 12, 0x08, "KANJI");
|
42
|
+
Mode Mode::FNC1_FIRST_POSITION(0, 0, 0, 0x05, "FNC1_FIRST_POSITION");
|
43
|
+
Mode Mode::FNC1_SECOND_POSITION(0, 0, 0, 0x09, "FNC1_SECOND_POSITION");
|
44
|
+
Mode Mode::HANZI(8, 10, 12, 0x0D, "HANZI");
|
45
|
+
|
46
|
+
Mode::Mode(int cbv0_9, int cbv10_26, int cbv27, int /* bits */, char const* name) :
|
47
|
+
characterCountBitsForVersions0To9_(cbv0_9), characterCountBitsForVersions10To26_(cbv10_26),
|
48
|
+
characterCountBitsForVersions27AndHigher_(cbv27), name_(name) {
|
49
|
+
}
|
50
|
+
|
51
|
+
Mode& Mode::forBits(int bits) {
|
52
|
+
switch (bits) {
|
53
|
+
case 0x0:
|
54
|
+
return TERMINATOR;
|
55
|
+
case 0x1:
|
56
|
+
return NUMERIC;
|
57
|
+
case 0x2:
|
58
|
+
return ALPHANUMERIC;
|
59
|
+
case 0x3:
|
60
|
+
return STRUCTURED_APPEND;
|
61
|
+
case 0x4:
|
62
|
+
return BYTE;
|
63
|
+
case 0x5:
|
64
|
+
return FNC1_FIRST_POSITION;
|
65
|
+
case 0x7:
|
66
|
+
return ECI;
|
67
|
+
case 0x8:
|
68
|
+
return KANJI;
|
69
|
+
case 0x9:
|
70
|
+
return FNC1_SECOND_POSITION;
|
71
|
+
case 0xD:
|
72
|
+
// 0xD is defined in GBT 18284-2000, may not be supported in foreign country
|
73
|
+
return HANZI;
|
74
|
+
default:
|
75
|
+
ostringstream s;
|
76
|
+
s << "Illegal mode bits: " << bits;
|
77
|
+
throw ReaderException(s.str().c_str());
|
78
|
+
}
|
79
|
+
}
|
80
|
+
|
81
|
+
int Mode::getCharacterCountBits(Version *version) {
|
82
|
+
int number = version->getVersionNumber();
|
83
|
+
if (number <= 9) {
|
84
|
+
return characterCountBitsForVersions0To9_;
|
85
|
+
} else if (number <= 26) {
|
86
|
+
return characterCountBitsForVersions10To26_;
|
87
|
+
} else {
|
88
|
+
return characterCountBitsForVersions27AndHigher_;
|
89
|
+
}
|
90
|
+
}
|
@@ -0,0 +1,57 @@
|
|
1
|
+
// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
|
2
|
+
#ifndef __MODE_H__
|
3
|
+
#define __MODE_H__
|
4
|
+
|
5
|
+
/*
|
6
|
+
* Mode.h
|
7
|
+
* zxing
|
8
|
+
*
|
9
|
+
* Copyright 2010 ZXing authors All rights reserved.
|
10
|
+
*
|
11
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
12
|
+
* you may not use this file except in compliance with the License.
|
13
|
+
* You may obtain a copy of the License at
|
14
|
+
*
|
15
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
16
|
+
*
|
17
|
+
* Unless required by applicable law or agreed to in writing, software
|
18
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
19
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
20
|
+
* See the License for the specific language governing permissions and
|
21
|
+
* limitations under the License.
|
22
|
+
*/
|
23
|
+
|
24
|
+
#include <zxing/common/Counted.h>
|
25
|
+
#include <zxing/qrcode/Version.h>
|
26
|
+
|
27
|
+
namespace zxing {
|
28
|
+
namespace qrcode {
|
29
|
+
|
30
|
+
class Mode {
|
31
|
+
private:
|
32
|
+
int characterCountBitsForVersions0To9_;
|
33
|
+
int characterCountBitsForVersions10To26_;
|
34
|
+
int characterCountBitsForVersions27AndHigher_;
|
35
|
+
std::string name_;
|
36
|
+
|
37
|
+
Mode(int cbv0_9, int cbv10_26, int cbv27, int bits, char const* name);
|
38
|
+
|
39
|
+
public:
|
40
|
+
static Mode TERMINATOR;
|
41
|
+
static Mode NUMERIC;
|
42
|
+
static Mode ALPHANUMERIC;
|
43
|
+
static Mode STRUCTURED_APPEND;
|
44
|
+
static Mode BYTE;
|
45
|
+
static Mode ECI;
|
46
|
+
static Mode KANJI;
|
47
|
+
static Mode FNC1_FIRST_POSITION;
|
48
|
+
static Mode FNC1_SECOND_POSITION;
|
49
|
+
static Mode HANZI;
|
50
|
+
|
51
|
+
static Mode& forBits(int bits);
|
52
|
+
int getCharacterCountBits(Version *version);
|
53
|
+
};
|
54
|
+
}
|
55
|
+
}
|
56
|
+
|
57
|
+
#endif // __MODE_H__
|
@@ -0,0 +1,47 @@
|
|
1
|
+
// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
|
2
|
+
/*
|
3
|
+
* AlignmentPattern.cpp
|
4
|
+
* zxing
|
5
|
+
*
|
6
|
+
* Created by Christian Brunschen on 13/05/2008.
|
7
|
+
* Copyright 2008 ZXing authors All rights reserved.
|
8
|
+
*
|
9
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
10
|
+
* you may not use this file except in compliance with the License.
|
11
|
+
* You may obtain a copy of the License at
|
12
|
+
*
|
13
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
14
|
+
*
|
15
|
+
* Unless required by applicable law or agreed to in writing, software
|
16
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
17
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
18
|
+
* See the License for the specific language governing permissions and
|
19
|
+
* limitations under the License.
|
20
|
+
*/
|
21
|
+
|
22
|
+
#include <zxing/qrcode/detector/AlignmentPattern.h>
|
23
|
+
|
24
|
+
using std::abs;
|
25
|
+
using zxing::Ref;
|
26
|
+
using zxing::qrcode::AlignmentPattern;
|
27
|
+
|
28
|
+
AlignmentPattern::AlignmentPattern(float posX, float posY, float estimatedModuleSize) :
|
29
|
+
ResultPoint(posX,posY), estimatedModuleSize_(estimatedModuleSize) {
|
30
|
+
}
|
31
|
+
|
32
|
+
bool AlignmentPattern::aboutEquals(float moduleSize, float i, float j) const {
|
33
|
+
if (abs(i - getY()) <= moduleSize && abs(j - getX()) <= moduleSize) {
|
34
|
+
float moduleSizeDiff = abs(moduleSize - estimatedModuleSize_);
|
35
|
+
return moduleSizeDiff <= 1.0f || moduleSizeDiff <= estimatedModuleSize_;
|
36
|
+
}
|
37
|
+
return false;
|
38
|
+
}
|
39
|
+
|
40
|
+
Ref<AlignmentPattern> AlignmentPattern::combineEstimate(float i, float j, float newModuleSize) const {
|
41
|
+
float combinedX = (getX() + j) / 2.0f;
|
42
|
+
float combinedY = (getY() + i) / 2.0f;
|
43
|
+
float combinedModuleSize = (estimatedModuleSize_ + newModuleSize) / 2.0f;
|
44
|
+
Ref<AlignmentPattern> result
|
45
|
+
(new AlignmentPattern(combinedX, combinedY, combinedModuleSize));
|
46
|
+
return result;
|
47
|
+
}
|
@@ -0,0 +1,45 @@
|
|
1
|
+
// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
|
2
|
+
|
3
|
+
#ifndef __ALIGNMENT_PATTERN_H__
|
4
|
+
#define __ALIGNMENT_PATTERN_H__
|
5
|
+
|
6
|
+
/*
|
7
|
+
* AlignmentPattern.h
|
8
|
+
* zxing
|
9
|
+
*
|
10
|
+
* Copyright 2010 ZXing authors All rights reserved.
|
11
|
+
*
|
12
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
13
|
+
* you may not use this file except in compliance with the License.
|
14
|
+
* You may obtain a copy of the License at
|
15
|
+
*
|
16
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
17
|
+
*
|
18
|
+
* Unless required by applicable law or agreed to in writing, software
|
19
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
20
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
21
|
+
* See the License for the specific language governing permissions and
|
22
|
+
* limitations under the License.
|
23
|
+
*/
|
24
|
+
|
25
|
+
#include <zxing/ResultPoint.h>
|
26
|
+
#include <cmath>
|
27
|
+
|
28
|
+
namespace zxing {
|
29
|
+
namespace qrcode {
|
30
|
+
|
31
|
+
class AlignmentPattern : public ResultPoint {
|
32
|
+
private:
|
33
|
+
float estimatedModuleSize_;
|
34
|
+
|
35
|
+
public:
|
36
|
+
AlignmentPattern(float posX, float posY, float estimatedModuleSize);
|
37
|
+
bool aboutEquals(float moduleSize, float i, float j) const;
|
38
|
+
Ref<AlignmentPattern> combineEstimate(float i, float j,
|
39
|
+
float newModuleSize) const;
|
40
|
+
};
|
41
|
+
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
#endif // __ALIGNMENT_PATTERN_H__
|