You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ZXQRCodeBitMatrixParser.h 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  2. * Copyright 2012 ZXing authors
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. @class ZXBitMatrix, ZXByteArray, ZXQRCodeFormatInformation, ZXQRCodeVersion;
  17. @interface ZXQRCodeBitMatrixParser : NSObject
  18. /**
  19. * @param bitMatrix ZXBitMatrix to parse
  20. * @return nil if dimension is not >= 21 and 1 mod 4
  21. */
  22. - (id)initWithBitMatrix:(ZXBitMatrix *)bitMatrix error:(NSError **)error;
  23. /**
  24. * Reads format information from one of its two locations within the QR Code.
  25. *
  26. * @return ZXFormatInformation encapsulating the QR Code's format info
  27. * @return nil if both format information locations cannot be parsed as
  28. * the valid encoding of format information
  29. */
  30. - (ZXQRCodeFormatInformation *)readFormatInformationWithError:(NSError **)error;
  31. /**
  32. * Reads version information from one of its two locations within the QR Code.
  33. *
  34. * @return ZXQRCodeVersion encapsulating the QR Code's version or nil
  35. * if both version information locations cannot be parsed as
  36. * the valid encoding of version information
  37. */
  38. - (ZXQRCodeVersion *)readVersionWithError:(NSError **)error;
  39. /**
  40. * Reads the bits in the ZXBitMatrix representing the finder pattern in the
  41. * correct order in order to reconstruct the codewords bytes contained within the
  42. * QR Code.
  43. *
  44. * @return bytes encoded within the QR Code or nil if the exact number of bytes expected is not read
  45. */
  46. - (ZXByteArray *)readCodewordsWithError:(NSError **)error;
  47. /**
  48. * Revert the mask removal done while reading the code words. The bit matrix should revert to its original state.
  49. */
  50. - (void)remask;
  51. /**
  52. * Prepare the parser for a mirrored operation.
  53. * This flag has effect only on the readFormatInformation and the
  54. * readVersion. Before proceeding with readCodewords the
  55. * mirror method should be called.
  56. *
  57. * @param mirror Whether to read version and format information mirrored.
  58. */
  59. - (void)setMirror:(BOOL)mirror;
  60. /** Mirror the bit matrix in order to attempt a second reading. */
  61. - (void)mirror;
  62. @end