AztecEncodingOptions.cs 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. * Copyright 2013 ZXing.Net 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.Collections.Generic;
  18. namespace FastReport.Barcode.Aztec
  19. {
  20. /// <summary>
  21. /// The class holds the available options for the AztecWriter
  22. /// </summary>
  23. [Serializable]
  24. internal class AztecEncodingOptions : EncodingOptions
  25. {
  26. /// <summary>
  27. /// Representing the minimal percentage of error correction words.
  28. /// Note: an Aztec symbol should have a minimum of 25% EC words.
  29. /// </summary>
  30. public int? ErrorCorrection
  31. {
  32. get
  33. {
  34. if (Hints.ContainsKey(EncodeHintType.ERROR_CORRECTION))
  35. {
  36. return (int)Hints[EncodeHintType.ERROR_CORRECTION];
  37. }
  38. return null;
  39. }
  40. set
  41. {
  42. if (value == null)
  43. {
  44. if (Hints.ContainsKey(EncodeHintType.ERROR_CORRECTION))
  45. Hints.Remove(EncodeHintType.ERROR_CORRECTION);
  46. }
  47. else
  48. {
  49. Hints[EncodeHintType.ERROR_CORRECTION] = value;
  50. }
  51. }
  52. }
  53. /// <summary>
  54. /// Specifies the required number of layers for an Aztec code:
  55. /// a negative number (-1, -2, -3, -4) specifies a compact Aztec code
  56. /// 0 indicates to use the minimum number of layers (the default)
  57. /// a positive number (1, 2, .. 32) specifies a normal (non-compact) Aztec code
  58. /// </summary>
  59. public int? Layers
  60. {
  61. get
  62. {
  63. if (Hints.ContainsKey(EncodeHintType.AZTEC_LAYERS))
  64. {
  65. return (int)Hints[EncodeHintType.AZTEC_LAYERS];
  66. }
  67. return null;
  68. }
  69. set
  70. {
  71. if (value == null)
  72. {
  73. if (Hints.ContainsKey(EncodeHintType.AZTEC_LAYERS))
  74. Hints.Remove(EncodeHintType.AZTEC_LAYERS);
  75. }
  76. else
  77. {
  78. Hints[EncodeHintType.AZTEC_LAYERS] = value;
  79. }
  80. }
  81. }
  82. }
  83. }