Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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 ZXByteMatrix;
  17. @interface ZXQRCodeMaskUtil : NSObject
  18. /**
  19. * Apply mask penalty rule 1 and return the penalty. Find repetitive cells with the same color and
  20. * give penalty to them. Example: 00000 or 11111.
  21. */
  22. + (int)applyMaskPenaltyRule1:(ZXByteMatrix *)matrix;
  23. /**
  24. * Apply mask penalty rule 2 and return the penalty. Find 2x2 blocks with the same color and give
  25. * penalty to them. This is actually equivalent to the spec's rule, which is to find MxN blocks and give a
  26. * penalty proportional to (M-1)x(N-1), because this is the number of 2x2 blocks inside such a block.
  27. */
  28. + (int)applyMaskPenaltyRule2:(ZXByteMatrix *)matrix;
  29. /**
  30. * Apply mask penalty rule 3 and return the penalty. Find consecutive runs of 1:1:3:1:1:4
  31. * starting with black, or 4:1:1:3:1:1 starting with white, and give penalty to them. If we
  32. * find patterns like 000010111010000, we give penalty once.
  33. */
  34. + (int)applyMaskPenaltyRule3:(ZXByteMatrix *)matrix;
  35. /**
  36. * Apply mask penalty rule 4 and return the penalty. Calculate the ratio of dark cells and give
  37. * penalty if the ratio is far from 50%. It gives 10 penalty for 5% distance.
  38. */
  39. + (int)applyMaskPenaltyRule4:(ZXByteMatrix *)matrix;
  40. /**
  41. * Return the mask bit for "getMaskPattern" at "x" and "y". See 8.8 of JISX0510:2004 for mask
  42. * pattern conditions.
  43. */
  44. + (BOOL)dataMaskBit:(int)maskPattern x:(int)x y:(int)y;
  45. @end