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

QRCode.cs 2.6 kB

10 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /*
  2. * Copyright 2008 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. using System;
  17. using System.Text;
  18. namespace ZXing.QrCode.Internal
  19. {
  20. /// <author>satorux@google.com (Satoru Takabayashi) - creator</author>
  21. /// <author>dswitkin@google.com (Daniel Switkin) - ported from C++</author>
  22. public class QRCode
  23. {
  24. /// <summary>
  25. ///
  26. /// </summary>
  27. public static int NUM_MASK_PATTERNS = 8;
  28. /// <summary>
  29. /// Initializes a new instance of the <see cref="QRCode"/> class.
  30. /// </summary>
  31. public QRCode()
  32. {
  33. MaskPattern = -1;
  34. }
  35. /// <summary>
  36. /// Gets or sets the mode.
  37. /// </summary>
  38. /// <value>
  39. /// The mode.
  40. /// </value>
  41. public Mode Mode { get; set; }
  42. /// <summary>
  43. /// Gets or sets the EC level.
  44. /// </summary>
  45. /// <value>
  46. /// The EC level.
  47. /// </value>
  48. public ErrorCorrectionLevel ECLevel { get; set; }
  49. /// <summary>
  50. /// Gets or sets the version.
  51. /// </summary>
  52. /// <value>
  53. /// The version.
  54. /// </value>
  55. public Version Version { get; set; }
  56. /// <summary>
  57. /// Gets or sets the mask pattern.
  58. /// </summary>
  59. /// <value>
  60. /// The mask pattern.
  61. /// </value>
  62. public int MaskPattern { get; set; }
  63. /// <summary>
  64. /// Gets or sets the matrix.
  65. /// </summary>
  66. /// <value>
  67. /// The matrix.
  68. /// </value>
  69. public ByteMatrix Matrix { get; set; }
  70. /// <summary>
  71. /// Check if "mask_pattern" is valid.
  72. /// </summary>
  73. /// <param name="maskPattern">The mask pattern.</param>
  74. /// <returns>
  75. /// <c>true</c> if [is valid mask pattern] [the specified mask pattern]; otherwise, <c>false</c>.
  76. /// </returns>
  77. public static bool isValidMaskPattern(int maskPattern)
  78. {
  79. return maskPattern >= 0 && maskPattern < NUM_MASK_PATTERNS;
  80. }
  81. }
  82. }