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.

QRCodeDecoderMetaData.cs 2.0 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * Copyright 2013 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. namespace ZXing.QrCode.Internal
  17. {
  18. /// <summary>
  19. /// Meta-data container for QR Code decoding. Instances of this class may be used to convey information back to the
  20. /// decoding caller. Callers are expected to process this.
  21. /// </summary>
  22. public sealed class QRCodeDecoderMetaData
  23. {
  24. private readonly bool mirrored;
  25. /// <summary>
  26. /// Initializes a new instance of the <see cref="QRCodeDecoderMetaData"/> class.
  27. /// </summary>
  28. /// <param name="mirrored">if set to <c>true</c> [mirrored].</param>
  29. public QRCodeDecoderMetaData(bool mirrored)
  30. {
  31. this.mirrored = mirrored;
  32. }
  33. /// <summary>
  34. /// true if the QR Code was mirrored.
  35. /// </summary>
  36. public bool IsMirrored
  37. {
  38. get { return mirrored; }
  39. }
  40. /// <summary>
  41. /// Apply the result points' order correction due to mirroring.
  42. /// </summary>
  43. /// <param name="points">Array of points to apply mirror correction to.</param>
  44. public void applyMirroredCorrection(ResultPoint[] points)
  45. {
  46. if (!mirrored || points == null || points.Length < 3)
  47. {
  48. return;
  49. }
  50. ResultPoint bottomLeft = points[0];
  51. points[0] = points[2];
  52. points[2] = bottomLeft;
  53. // No need to 'fix' top-left and alignment pattern.
  54. }
  55. }
  56. }