zxing_cpp_no_cmake 0.1.1
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 +0 -0
- data/CHANGELOG.rdoc +6 -0
- data/Gemfile +3 -0
- data/Manifest.txt +375 -0
- data/README.rdoc +141 -0
- data/Rakefile +28 -0
- data/bin/zxd +87 -0
- data/bin/zxe +53 -0
- data/ext/zxing/extconf.rb +20 -0
- data/ext/zxing/zxing-cpp/.gitignore +2 -0
- data/ext/zxing/zxing-cpp/AUTHORS +115 -0
- data/ext/zxing/zxing-cpp/CMakeLists.txt +89 -0
- data/ext/zxing/zxing-cpp/COPYING +201 -0
- data/ext/zxing/zxing-cpp/NOTICE +65 -0
- data/ext/zxing/zxing-cpp/README.md +45 -0
- data/ext/zxing/zxing-cpp/build/CMakeCache.txt +382 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/3.15.4/CMakeCCompiler.cmake +76 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/3.15.4/CMakeCXXCompiler.cmake +79 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/3.15.4/CMakeDetermineCompilerABI_C.bin +0 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/3.15.4/CMakeDetermineCompilerABI_CXX.bin +0 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/3.15.4/CMakeSystem.cmake +15 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/3.15.4/CompilerIdC/CMakeCCompilerId.c +665 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/3.15.4/CompilerIdC/a.out +0 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/3.15.4/CompilerIdCXX/CMakeCXXCompilerId.cpp +644 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/3.15.4/CompilerIdCXX/a.out +0 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/CMakeOutput.log +447 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/Makefile.cmake +125 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/Makefile2 +177 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/TargetDirectories.txt +9 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/cmake.check_cache +1 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/libzxing.dir/CXX.includecache +1892 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/libzxing.dir/DependInfo.cmake +120 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/libzxing.dir/build.make +1584 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/libzxing.dir/cmake_clean.cmake +109 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/libzxing.dir/cmake_clean_target.cmake +3 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/libzxing.dir/depend.internal +1465 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/libzxing.dir/depend.make +1465 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/libzxing.dir/flags.make +10 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/libzxing.dir/link.txt +2 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/libzxing.dir/progress.make +102 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/progress.marks +1 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/testrunner.dir/CXX.includecache +344 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/testrunner.dir/DependInfo.cmake +33 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/testrunner.dir/build.make +266 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/testrunner.dir/cmake_clean.cmake +21 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/testrunner.dir/depend.internal +103 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/testrunner.dir/depend.make +103 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/testrunner.dir/flags.make +10 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/testrunner.dir/link.txt +1 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/testrunner.dir/progress.make +14 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/zxing.dir/CXX.includecache +378 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/zxing.dir/DependInfo.cmake +25 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/zxing.dir/build.make +145 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/zxing.dir/cmake_clean.cmake +13 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/zxing.dir/depend.internal +53 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/zxing.dir/depend.make +53 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/zxing.dir/flags.make +10 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/zxing.dir/link.txt +1 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/zxing.dir/progress.make +6 -0
- data/ext/zxing/zxing-cpp/build/Makefile +3706 -0
- data/ext/zxing/zxing-cpp/build/cmake_install.cmake +73 -0
- data/ext/zxing/zxing-cpp/build/libzxing.a +0 -0
- data/ext/zxing/zxing-cpp/build/testrunner +0 -0
- data/ext/zxing/zxing-cpp/build/zxing +0 -0
- data/ext/zxing/zxing-cpp/cli/src/ImageReaderSource.cpp +113 -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 +105 -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 +175 -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 +415 -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 +447 -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 +497 -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 +329 -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 +303 -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 +228 -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 +70 -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 +665 -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 +715 -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 +428 -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 +315 -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 +109 -0
- data/lib/zxing/version.rb +33 -0
- data/zxing_cpp.gemspec +36 -0
- metadata +515 -0
@@ -0,0 +1,85 @@
|
|
1
|
+
#ifndef __VERSION_H__
|
2
|
+
#define __VERSION_H__
|
3
|
+
|
4
|
+
/*
|
5
|
+
* Version.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/Counted.h>
|
24
|
+
#include <zxing/qrcode/ErrorCorrectionLevel.h>
|
25
|
+
#include <zxing/ReaderException.h>
|
26
|
+
#include <zxing/common/BitMatrix.h>
|
27
|
+
#include <zxing/common/Counted.h>
|
28
|
+
#include <vector>
|
29
|
+
|
30
|
+
namespace zxing {
|
31
|
+
namespace qrcode {
|
32
|
+
|
33
|
+
class ECB {
|
34
|
+
private:
|
35
|
+
int count_;
|
36
|
+
int dataCodewords_;
|
37
|
+
public:
|
38
|
+
ECB(int count, int dataCodewords);
|
39
|
+
int getCount();
|
40
|
+
int getDataCodewords();
|
41
|
+
};
|
42
|
+
|
43
|
+
class ECBlocks {
|
44
|
+
private:
|
45
|
+
int ecCodewords_;
|
46
|
+
std::vector<ECB*> ecBlocks_;
|
47
|
+
public:
|
48
|
+
ECBlocks(int ecCodewords, ECB *ecBlocks);
|
49
|
+
ECBlocks(int ecCodewords, ECB *ecBlocks1, ECB *ecBlocks2);
|
50
|
+
int getECCodewords();
|
51
|
+
std::vector<ECB*>& getECBlocks();
|
52
|
+
~ECBlocks();
|
53
|
+
};
|
54
|
+
|
55
|
+
class Version : public Counted {
|
56
|
+
|
57
|
+
private:
|
58
|
+
int versionNumber_;
|
59
|
+
std::vector<int> &alignmentPatternCenters_;
|
60
|
+
std::vector<ECBlocks*> ecBlocks_;
|
61
|
+
int totalCodewords_;
|
62
|
+
Version(int versionNumber, std::vector<int> *alignmentPatternCenters, ECBlocks *ecBlocks1, ECBlocks *ecBlocks2,
|
63
|
+
ECBlocks *ecBlocks3, ECBlocks *ecBlocks4);
|
64
|
+
|
65
|
+
public:
|
66
|
+
static unsigned int VERSION_DECODE_INFO[];
|
67
|
+
static int N_VERSION_DECODE_INFOS;
|
68
|
+
static std::vector<Ref<Version> > VERSIONS;
|
69
|
+
|
70
|
+
~Version();
|
71
|
+
int getVersionNumber();
|
72
|
+
std::vector<int> &getAlignmentPatternCenters();
|
73
|
+
int getTotalCodewords();
|
74
|
+
int getDimensionForVersion();
|
75
|
+
ECBlocks &getECBlocksForLevel(ErrorCorrectionLevel &ecLevel);
|
76
|
+
static Version *getProvisionalVersionForDimension(int dimension);
|
77
|
+
static Version *getVersionForNumber(int versionNumber);
|
78
|
+
static Version *decodeVersionInformation(unsigned int versionBits);
|
79
|
+
Ref<BitMatrix> buildFunctionPattern();
|
80
|
+
static int buildVersions();
|
81
|
+
};
|
82
|
+
}
|
83
|
+
}
|
84
|
+
|
85
|
+
#endif // __VERSION_H__
|
@@ -0,0 +1,183 @@
|
|
1
|
+
/*
|
2
|
+
* BitMatrixParser.cpp
|
3
|
+
* zxing
|
4
|
+
*
|
5
|
+
* Created by Christian Brunschen on 20/05/2008.
|
6
|
+
* Copyright 2008 ZXing authors 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 <zxing/qrcode/decoder/BitMatrixParser.h>
|
22
|
+
#include <zxing/qrcode/decoder/DataMask.h>
|
23
|
+
|
24
|
+
|
25
|
+
namespace zxing {
|
26
|
+
namespace qrcode {
|
27
|
+
|
28
|
+
int BitMatrixParser::copyBit(size_t x, size_t y, int versionBits) {
|
29
|
+
return bitMatrix_->get(x, y) ? (versionBits << 1) | 0x1 : versionBits << 1;
|
30
|
+
}
|
31
|
+
|
32
|
+
BitMatrixParser::BitMatrixParser(Ref<BitMatrix> bitMatrix) :
|
33
|
+
bitMatrix_(bitMatrix), parsedVersion_(0), parsedFormatInfo_() {
|
34
|
+
size_t dimension = bitMatrix->getHeight();
|
35
|
+
if ((dimension < 21) || (dimension & 0x03) != 1) {
|
36
|
+
throw ReaderException("Dimension must be 1 mod 4 and >= 21");
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
Ref<FormatInformation> BitMatrixParser::readFormatInformation() {
|
41
|
+
if (parsedFormatInfo_ != 0) {
|
42
|
+
return parsedFormatInfo_;
|
43
|
+
}
|
44
|
+
|
45
|
+
// Read top-left format info bits
|
46
|
+
int formatInfoBits1 = 0;
|
47
|
+
for (int i = 0; i < 6; i++) {
|
48
|
+
formatInfoBits1 = copyBit(i, 8, formatInfoBits1);
|
49
|
+
}
|
50
|
+
// .. and skip a bit in the timing pattern ...
|
51
|
+
formatInfoBits1 = copyBit(7, 8, formatInfoBits1);
|
52
|
+
formatInfoBits1 = copyBit(8, 8, formatInfoBits1);
|
53
|
+
formatInfoBits1 = copyBit(8, 7, formatInfoBits1);
|
54
|
+
// .. and skip a bit in the timing pattern ...
|
55
|
+
for (int j = 5; j >= 0; j--) {
|
56
|
+
formatInfoBits1 = copyBit(8, j, formatInfoBits1);
|
57
|
+
}
|
58
|
+
|
59
|
+
// Read the top-right/bottom-left pattern
|
60
|
+
int dimension = bitMatrix_->getHeight();
|
61
|
+
int formatInfoBits2 = 0;
|
62
|
+
int jMin = dimension - 7;
|
63
|
+
for (int j = dimension - 1; j >= jMin; j--) {
|
64
|
+
formatInfoBits2 = copyBit(8, j, formatInfoBits2);
|
65
|
+
}
|
66
|
+
for (int i = dimension - 8; i < dimension; i++) {
|
67
|
+
formatInfoBits2 = copyBit(i, 8, formatInfoBits2);
|
68
|
+
}
|
69
|
+
|
70
|
+
parsedFormatInfo_ = FormatInformation::decodeFormatInformation(formatInfoBits1,formatInfoBits2);
|
71
|
+
if (parsedFormatInfo_ != 0) {
|
72
|
+
return parsedFormatInfo_;
|
73
|
+
}
|
74
|
+
throw ReaderException("Could not decode format information");
|
75
|
+
}
|
76
|
+
|
77
|
+
Version *BitMatrixParser::readVersion() {
|
78
|
+
if (parsedVersion_ != 0) {
|
79
|
+
return parsedVersion_;
|
80
|
+
}
|
81
|
+
|
82
|
+
int dimension = bitMatrix_->getHeight();
|
83
|
+
|
84
|
+
int provisionalVersion = (dimension - 17) >> 2;
|
85
|
+
if (provisionalVersion <= 6) {
|
86
|
+
return Version::getVersionForNumber(provisionalVersion);
|
87
|
+
}
|
88
|
+
|
89
|
+
// Read top-right version info: 3 wide by 6 tall
|
90
|
+
int versionBits = 0;
|
91
|
+
for (int y = 5; y >= 0; y--) {
|
92
|
+
int xMin = dimension - 11;
|
93
|
+
for (int x = dimension - 9; x >= xMin; x--) {
|
94
|
+
versionBits = copyBit(x, y, versionBits);
|
95
|
+
}
|
96
|
+
}
|
97
|
+
|
98
|
+
parsedVersion_ = Version::decodeVersionInformation(versionBits);
|
99
|
+
if (parsedVersion_ != 0 && parsedVersion_->getDimensionForVersion() == dimension) {
|
100
|
+
return parsedVersion_;
|
101
|
+
}
|
102
|
+
|
103
|
+
// Hmm, failed. Try bottom left: 6 wide by 3 tall
|
104
|
+
versionBits = 0;
|
105
|
+
for (int x = 5; x >= 0; x--) {
|
106
|
+
int yMin = dimension - 11;
|
107
|
+
for (int y = dimension - 9; y >= yMin; y--) {
|
108
|
+
versionBits = copyBit(x, y, versionBits);
|
109
|
+
}
|
110
|
+
}
|
111
|
+
|
112
|
+
parsedVersion_ = Version::decodeVersionInformation(versionBits);
|
113
|
+
if (parsedVersion_ != 0 && parsedVersion_->getDimensionForVersion() == dimension) {
|
114
|
+
return parsedVersion_;
|
115
|
+
}
|
116
|
+
throw ReaderException("Could not decode version");
|
117
|
+
}
|
118
|
+
|
119
|
+
ArrayRef<char> BitMatrixParser::readCodewords() {
|
120
|
+
Ref<FormatInformation> formatInfo = readFormatInformation();
|
121
|
+
Version *version = readVersion();
|
122
|
+
|
123
|
+
|
124
|
+
// Get the data mask for the format used in this QR Code. This will exclude
|
125
|
+
// some bits from reading as we wind through the bit matrix.
|
126
|
+
DataMask &dataMask = DataMask::forReference((int)formatInfo->getDataMask());
|
127
|
+
// cout << (int)formatInfo->getDataMask() << endl;
|
128
|
+
int dimension = bitMatrix_->getHeight();
|
129
|
+
dataMask.unmaskBitMatrix(*bitMatrix_, dimension);
|
130
|
+
|
131
|
+
|
132
|
+
// cerr << *bitMatrix_ << endl;
|
133
|
+
// cerr << version->getTotalCodewords() << endl;
|
134
|
+
|
135
|
+
Ref<BitMatrix> functionPattern = version->buildFunctionPattern();
|
136
|
+
|
137
|
+
|
138
|
+
// cout << *functionPattern << endl;
|
139
|
+
|
140
|
+
bool readingUp = true;
|
141
|
+
ArrayRef<char> result(version->getTotalCodewords());
|
142
|
+
int resultOffset = 0;
|
143
|
+
int currentByte = 0;
|
144
|
+
int bitsRead = 0;
|
145
|
+
// Read columns in pairs, from right to left
|
146
|
+
for (int x = dimension - 1; x > 0; x -= 2) {
|
147
|
+
if (x == 6) {
|
148
|
+
// Skip whole column with vertical alignment pattern;
|
149
|
+
// saves time and makes the other code proceed more cleanly
|
150
|
+
x--;
|
151
|
+
}
|
152
|
+
// Read alternatingly from bottom to top then top to bottom
|
153
|
+
for (int counter = 0; counter < dimension; counter++) {
|
154
|
+
int y = readingUp ? dimension - 1 - counter : counter;
|
155
|
+
for (int col = 0; col < 2; col++) {
|
156
|
+
// Ignore bits covered by the function pattern
|
157
|
+
if (!functionPattern->get(x - col, y)) {
|
158
|
+
// Read a bit
|
159
|
+
bitsRead++;
|
160
|
+
currentByte <<= 1;
|
161
|
+
if (bitMatrix_->get(x - col, y)) {
|
162
|
+
currentByte |= 1;
|
163
|
+
}
|
164
|
+
// If we've made a whole byte, save it off
|
165
|
+
if (bitsRead == 8) {
|
166
|
+
result[resultOffset++] = (char)currentByte;
|
167
|
+
bitsRead = 0;
|
168
|
+
currentByte = 0;
|
169
|
+
}
|
170
|
+
}
|
171
|
+
}
|
172
|
+
}
|
173
|
+
readingUp = !readingUp; // switch directions
|
174
|
+
}
|
175
|
+
|
176
|
+
if (resultOffset != version->getTotalCodewords()) {
|
177
|
+
throw ReaderException("Did not read all codewords");
|
178
|
+
}
|
179
|
+
return result;
|
180
|
+
}
|
181
|
+
|
182
|
+
}
|
183
|
+
}
|
@@ -0,0 +1,56 @@
|
|
1
|
+
#ifndef __BIT_MATRIX_PARSER_H__
|
2
|
+
#define __BIT_MATRIX_PARSER_H__
|
3
|
+
|
4
|
+
/*
|
5
|
+
* BitMatrixParser.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/ReaderException.h>
|
24
|
+
#include <zxing/common/BitMatrix.h>
|
25
|
+
#include <zxing/common/Counted.h>
|
26
|
+
#include <zxing/common/Array.h>
|
27
|
+
#include <zxing/qrcode/Version.h>
|
28
|
+
#include <zxing/qrcode/FormatInformation.h>
|
29
|
+
|
30
|
+
namespace zxing {
|
31
|
+
namespace qrcode {
|
32
|
+
|
33
|
+
class BitMatrixParser : public Counted {
|
34
|
+
private:
|
35
|
+
Ref<BitMatrix> bitMatrix_;
|
36
|
+
Version *parsedVersion_;
|
37
|
+
Ref<FormatInformation> parsedFormatInfo_;
|
38
|
+
|
39
|
+
int copyBit(size_t x, size_t y, int versionBits);
|
40
|
+
|
41
|
+
public:
|
42
|
+
BitMatrixParser(Ref<BitMatrix> bitMatrix);
|
43
|
+
Ref<FormatInformation> readFormatInformation();
|
44
|
+
Version *readVersion();
|
45
|
+
ArrayRef<char> readCodewords();
|
46
|
+
|
47
|
+
private:
|
48
|
+
BitMatrixParser(const BitMatrixParser&);
|
49
|
+
BitMatrixParser& operator =(const BitMatrixParser&);
|
50
|
+
|
51
|
+
};
|
52
|
+
|
53
|
+
}
|
54
|
+
}
|
55
|
+
|
56
|
+
#endif // __BIT_MATRIX_PARSER_H__
|
@@ -0,0 +1,118 @@
|
|
1
|
+
/*
|
2
|
+
* DataBlock.cpp
|
3
|
+
* zxing
|
4
|
+
*
|
5
|
+
* Created by Christian Brunschen on 19/05/2008.
|
6
|
+
* Copyright 2008 ZXing authors 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 <zxing/qrcode/decoder/DataBlock.h>
|
22
|
+
#include <zxing/common/IllegalArgumentException.h>
|
23
|
+
|
24
|
+
namespace zxing {
|
25
|
+
namespace qrcode {
|
26
|
+
|
27
|
+
using namespace std;
|
28
|
+
|
29
|
+
DataBlock::DataBlock(int numDataCodewords, ArrayRef<char> codewords) :
|
30
|
+
numDataCodewords_(numDataCodewords), codewords_(codewords) {
|
31
|
+
}
|
32
|
+
|
33
|
+
int DataBlock::getNumDataCodewords() {
|
34
|
+
return numDataCodewords_;
|
35
|
+
}
|
36
|
+
|
37
|
+
ArrayRef<char> DataBlock::getCodewords() {
|
38
|
+
return codewords_;
|
39
|
+
}
|
40
|
+
|
41
|
+
|
42
|
+
std::vector<Ref<DataBlock> > DataBlock::getDataBlocks(ArrayRef<char> rawCodewords, Version *version,
|
43
|
+
ErrorCorrectionLevel &ecLevel) {
|
44
|
+
|
45
|
+
|
46
|
+
// Figure out the number and size of data blocks used by this version and
|
47
|
+
// error correction level
|
48
|
+
ECBlocks &ecBlocks = version->getECBlocksForLevel(ecLevel);
|
49
|
+
|
50
|
+
|
51
|
+
// First count the total number of data blocks
|
52
|
+
int totalBlocks = 0;
|
53
|
+
vector<ECB*> ecBlockArray = ecBlocks.getECBlocks();
|
54
|
+
for (size_t i = 0; i < ecBlockArray.size(); i++) {
|
55
|
+
totalBlocks += ecBlockArray[i]->getCount();
|
56
|
+
}
|
57
|
+
|
58
|
+
// Now establish DataBlocks of the appropriate size and number of data codewords
|
59
|
+
std::vector<Ref<DataBlock> > result(totalBlocks);
|
60
|
+
int numResultBlocks = 0;
|
61
|
+
for (size_t j = 0; j < ecBlockArray.size(); j++) {
|
62
|
+
ECB *ecBlock = ecBlockArray[j];
|
63
|
+
for (int i = 0; i < ecBlock->getCount(); i++) {
|
64
|
+
int numDataCodewords = ecBlock->getDataCodewords();
|
65
|
+
int numBlockCodewords = ecBlocks.getECCodewords() + numDataCodewords;
|
66
|
+
ArrayRef<char> buffer(numBlockCodewords);
|
67
|
+
Ref<DataBlock> blockRef(new DataBlock(numDataCodewords, buffer));
|
68
|
+
result[numResultBlocks++] = blockRef;
|
69
|
+
}
|
70
|
+
}
|
71
|
+
|
72
|
+
// All blocks have the same amount of data, except that the last n
|
73
|
+
// (where n may be 0) have 1 more byte. Figure out where these start.
|
74
|
+
int shorterBlocksTotalCodewords = result[0]->codewords_->size();
|
75
|
+
int longerBlocksStartAt = result.size() - 1;
|
76
|
+
while (longerBlocksStartAt >= 0) {
|
77
|
+
int numCodewords = result[longerBlocksStartAt]->codewords_->size();
|
78
|
+
if (numCodewords == shorterBlocksTotalCodewords) {
|
79
|
+
break;
|
80
|
+
}
|
81
|
+
if (numCodewords != shorterBlocksTotalCodewords + 1) {
|
82
|
+
throw IllegalArgumentException("Data block sizes differ by more than 1");
|
83
|
+
}
|
84
|
+
longerBlocksStartAt--;
|
85
|
+
}
|
86
|
+
longerBlocksStartAt++;
|
87
|
+
|
88
|
+
int shorterBlocksNumDataCodewords = shorterBlocksTotalCodewords - ecBlocks.getECCodewords();
|
89
|
+
// The last elements of result may be 1 element longer;
|
90
|
+
// first fill out as many elements as all of them have
|
91
|
+
int rawCodewordsOffset = 0;
|
92
|
+
for (int i = 0; i < shorterBlocksNumDataCodewords; i++) {
|
93
|
+
for (int j = 0; j < numResultBlocks; j++) {
|
94
|
+
result[j]->codewords_[i] = rawCodewords[rawCodewordsOffset++];
|
95
|
+
}
|
96
|
+
}
|
97
|
+
// Fill out the last data block in the longer ones
|
98
|
+
for (int j = longerBlocksStartAt; j < numResultBlocks; j++) {
|
99
|
+
result[j]->codewords_[shorterBlocksNumDataCodewords] = rawCodewords[rawCodewordsOffset++];
|
100
|
+
}
|
101
|
+
// Now add in error correction blocks
|
102
|
+
int max = result[0]->codewords_->size();
|
103
|
+
for (int i = shorterBlocksNumDataCodewords; i < max; i++) {
|
104
|
+
for (int j = 0; j < numResultBlocks; j++) {
|
105
|
+
int iOffset = j < longerBlocksStartAt ? i : i + 1;
|
106
|
+
result[j]->codewords_[iOffset] = rawCodewords[rawCodewordsOffset++];
|
107
|
+
}
|
108
|
+
}
|
109
|
+
|
110
|
+
if (rawCodewordsOffset != rawCodewords->size()) {
|
111
|
+
throw IllegalArgumentException("rawCodewordsOffset != rawCodewords.length");
|
112
|
+
}
|
113
|
+
|
114
|
+
return result;
|
115
|
+
}
|
116
|
+
|
117
|
+
}
|
118
|
+
}
|
@@ -0,0 +1,50 @@
|
|
1
|
+
#ifndef __DATA_BLOCK_H__
|
2
|
+
#define __DATA_BLOCK_H__
|
3
|
+
|
4
|
+
/*
|
5
|
+
* DataBlock.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 <vector>
|
24
|
+
#include <zxing/common/Counted.h>
|
25
|
+
#include <zxing/common/Array.h>
|
26
|
+
#include <zxing/qrcode/Version.h>
|
27
|
+
#include <zxing/qrcode/ErrorCorrectionLevel.h>
|
28
|
+
|
29
|
+
namespace zxing {
|
30
|
+
namespace qrcode {
|
31
|
+
|
32
|
+
class DataBlock : public Counted {
|
33
|
+
private:
|
34
|
+
int numDataCodewords_;
|
35
|
+
ArrayRef<char> codewords_;
|
36
|
+
|
37
|
+
DataBlock(int numDataCodewords, ArrayRef<char> codewords);
|
38
|
+
|
39
|
+
public:
|
40
|
+
static std::vector<Ref<DataBlock> >
|
41
|
+
getDataBlocks(ArrayRef<char> rawCodewords, Version *version, ErrorCorrectionLevel &ecLevel);
|
42
|
+
|
43
|
+
int getNumDataCodewords();
|
44
|
+
ArrayRef<char> getCodewords();
|
45
|
+
};
|
46
|
+
|
47
|
+
}
|
48
|
+
}
|
49
|
+
|
50
|
+
#endif // __DATA_BLOCK_H__
|