chillerlan-QRCode-Common-MaskPattern.html 69 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Documentation</title>
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <base href="../">
  8. <link rel="icon" href="images/favicon.ico"/>
  9. <link rel="stylesheet" href="css/normalize.css">
  10. <link rel="stylesheet" href="css/base.css">
  11. <link rel="preconnect" href="https://fonts.gstatic.com">
  12. <link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@400;600;700&display=swap" rel="stylesheet">
  13. <link href="https://fonts.googleapis.com/css2?family=Source+Code+Pro:wght@400;600;700&display=swap" rel="stylesheet">
  14. <link rel="stylesheet" href="css/template.css">
  15. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.0/css/all.min.css" integrity="sha256-ybRkN9dBjhcS2qrW1z+hfCxq+1aBdwyQM5wlQoQVt/0=" crossorigin="anonymous" />
  16. <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/themes/prism-okaidia.css">
  17. <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-numbers/prism-line-numbers.css">
  18. <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-highlight/prism-line-highlight.css">
  19. <script src="https://cdn.jsdelivr.net/npm/fuse.js@3.4.6"></script>
  20. <script src="https://cdn.jsdelivr.net/npm/css-vars-ponyfill@2"></script>
  21. <script src="js/search.js"></script>
  22. <script defer src="js/searchIndex.js"></script>
  23. </head>
  24. <body id="top">
  25. <header class="phpdocumentor-header phpdocumentor-section">
  26. <h1 class="phpdocumentor-title"><a href="" class="phpdocumentor-title__link">Documentation</a></h1>
  27. <input class="phpdocumentor-header__menu-button" type="checkbox" id="menu-button" name="menu-button" />
  28. <label class="phpdocumentor-header__menu-icon" for="menu-button">
  29. <i class="fas fa-bars"></i>
  30. </label>
  31. <section data-search-form class="phpdocumentor-search">
  32. <label>
  33. <span class="visually-hidden">Search for</span>
  34. <svg class="phpdocumentor-search__icon" width="21" height="20" viewBox="0 0 21 20" fill="none" xmlns="http://www.w3.org/2000/svg">
  35. <circle cx="7.5" cy="7.5" r="6.5" stroke="currentColor" stroke-width="2"/>
  36. <line x1="12.4892" y1="12.2727" x2="19.1559" y2="18.9393" stroke="currentColor" stroke-width="3"/>
  37. </svg>
  38. <input type="search" class="phpdocumentor-field phpdocumentor-search__field" placeholder="Loading .." disabled />
  39. </label>
  40. </section>
  41. <nav class="phpdocumentor-topnav">
  42. <ul class="phpdocumentor-topnav__menu">
  43. </ul>
  44. </nav>
  45. </header>
  46. <main class="phpdocumentor">
  47. <div class="phpdocumentor-section">
  48. <input class="phpdocumentor-sidebar__menu-button" type="checkbox" id="sidebar-button" name="sidebar-button" />
  49. <label class="phpdocumentor-sidebar__menu-icon" for="sidebar-button">
  50. Menu
  51. </label>
  52. <aside class="phpdocumentor-column -four phpdocumentor-sidebar">
  53. <section class="phpdocumentor-sidebar__category">
  54. <h2 class="phpdocumentor-sidebar__category-header">Namespaces</h2>
  55. <h4 class="phpdocumentor-sidebar__root-namespace">
  56. <a href="namespaces/chillerlan.html" class="">chillerlan</a>
  57. </h4>
  58. <ul class="phpdocumentor-list">
  59. <li>
  60. <a href="namespaces/chillerlan-qrcode.html" class="">QRCode</a>
  61. </li>
  62. <li>
  63. <a href="namespaces/chillerlan-qrcodetest.html" class="">QRCodeTest</a>
  64. </li>
  65. </ul>
  66. </section>
  67. <section class="phpdocumentor-sidebar__category">
  68. <h2 class="phpdocumentor-sidebar__category-header">Packages</h2>
  69. <h4 class="phpdocumentor-sidebar__root-namespace">
  70. <a href="packages/Application.html" class="">Application</a>
  71. </h4>
  72. </section>
  73. <section class="phpdocumentor-sidebar__category">
  74. <h2 class="phpdocumentor-sidebar__category-header">Reports</h2>
  75. <h3 class="phpdocumentor-sidebar__root-package"><a href="reports/deprecated.html">Deprecated</a></h3>
  76. <h3 class="phpdocumentor-sidebar__root-package"><a href="reports/errors.html">Errors</a></h3>
  77. <h3 class="phpdocumentor-sidebar__root-package"><a href="reports/markers.html">Markers</a></h3>
  78. </section>
  79. <section class="phpdocumentor-sidebar__category">
  80. <h2 class="phpdocumentor-sidebar__category-header">Indices</h2>
  81. <h3 class="phpdocumentor-sidebar__root-package"><a href="indices/files.html">Files</a></h3>
  82. </section>
  83. </aside>
  84. <div class="phpdocumentor-column -eight phpdocumentor-content">
  85. <ul class="phpdocumentor-breadcrumbs">
  86. <li class="phpdocumentor-breadcrumb"><a href="namespaces/chillerlan.html">chillerlan</a></li>
  87. <li class="phpdocumentor-breadcrumb"><a href="namespaces/chillerlan-qrcode.html">QRCode</a></li>
  88. <li class="phpdocumentor-breadcrumb"><a href="namespaces/chillerlan-qrcode-common.html">Common</a></li>
  89. </ul>
  90. <article class="phpdocumentor-element -class">
  91. <h2 class="phpdocumentor-content__title">
  92. MaskPattern
  93. <div class="phpdocumentor-element__package">
  94. in package
  95. <ul class="phpdocumentor-breadcrumbs">
  96. <li class="phpdocumentor-breadcrumb"><a href="packages/Application.html">Application</a></li>
  97. </ul>
  98. </div>
  99. </h2>
  100. <aside class="phpdocumentor-element-found-in">
  101. <abbr class="phpdocumentor-element-found-in__file" title="src/Common/MaskPattern.php"><a href="files/src-common-maskpattern.html"><abbr title="src/Common/MaskPattern.php">MaskPattern.php</abbr></a></abbr>
  102. :
  103. <span class="phpdocumentor-element-found-in__line">26</span>
  104. </aside>
  105. <p class="phpdocumentor-summary">ISO/IEC 18004:2000 Section 8.8.1
  106. ISO/IEC 18004:2000 Section 8.8.2 - Evaluation of masking results</p>
  107. <h5 class="phpdocumentor-tag-list__heading" id="tags">
  108. Tags
  109. <a href="#tags" class="headerlink"><i class="fas fa-link"></i></a>
  110. </h5>
  111. <dl class="phpdocumentor-tag-list">
  112. <dt class="phpdocumentor-tag-list__entry">
  113. <span class="phpdocumentor-tag__name">see</span>
  114. </dt>
  115. <dd class="phpdocumentor-tag-list__definition">
  116. <span class="phpdocumentor-tag-link"><a href="http://www.thonky.com/qr-code-tutorial/data-masking"><abbr title="http://www.thonky.com/qr-code-tutorial/data-masking">http://www.thonky.com/qr-code-tutorial/data-masking</abbr></a></span>
  117. </dd>
  118. <dt class="phpdocumentor-tag-list__entry">
  119. <span class="phpdocumentor-tag__name">see</span>
  120. </dt>
  121. <dd class="phpdocumentor-tag-list__definition">
  122. <span class="phpdocumentor-tag-link"><a href="https://github.com/zxing/zxing/blob/e9e2bd280bcaeabd59d0f955798384fe6c018a6c/core/src/main/java/com/google/zxing/qrcode/encoder/MaskUtil.java"><abbr title="https://github.com/zxing/zxing/blob/e9e2bd280bcaeabd59d0f955798384fe6c018a6c/core/src/main/java/com/google/zxing/qrcode/encoder/MaskUtil.java">https://github.com/zxing/zxing/blob/e9e2bd280bcaeabd59d0f955798384fe6c018a6c/core/src/main/java/com/google/zxing/qrcode/encoder/MaskUtil.java</abbr></a></span>
  123. </dd>
  124. </dl>
  125. <h3 id="toc">
  126. Table of Contents
  127. <a href="#toc" class="headerlink"><i class="fas fa-link"></i></a>
  128. </h3>
  129. <dl class="phpdocumentor-table-of-contents">
  130. <dt class="phpdocumentor-table-of-contents__entry -constant -public">
  131. <a href="classes/chillerlan-QRCode-Common-MaskPattern.html#constant_PATTERN_000">PATTERN_000</a>
  132. <span>
  133. &nbsp;= 0b0 </span>
  134. </dt>
  135. <dd></dd>
  136. <dt class="phpdocumentor-table-of-contents__entry -constant -public">
  137. <a href="classes/chillerlan-QRCode-Common-MaskPattern.html#constant_PATTERN_001">PATTERN_001</a>
  138. <span>
  139. &nbsp;= 0b1 </span>
  140. </dt>
  141. <dd></dd>
  142. <dt class="phpdocumentor-table-of-contents__entry -constant -public">
  143. <a href="classes/chillerlan-QRCode-Common-MaskPattern.html#constant_PATTERN_010">PATTERN_010</a>
  144. <span>
  145. &nbsp;= 0b10 </span>
  146. </dt>
  147. <dd></dd>
  148. <dt class="phpdocumentor-table-of-contents__entry -constant -public">
  149. <a href="classes/chillerlan-QRCode-Common-MaskPattern.html#constant_PATTERN_011">PATTERN_011</a>
  150. <span>
  151. &nbsp;= 0b11 </span>
  152. </dt>
  153. <dd></dd>
  154. <dt class="phpdocumentor-table-of-contents__entry -constant -public">
  155. <a href="classes/chillerlan-QRCode-Common-MaskPattern.html#constant_PATTERN_100">PATTERN_100</a>
  156. <span>
  157. &nbsp;= 0b100 </span>
  158. </dt>
  159. <dd></dd>
  160. <dt class="phpdocumentor-table-of-contents__entry -constant -public">
  161. <a href="classes/chillerlan-QRCode-Common-MaskPattern.html#constant_PATTERN_101">PATTERN_101</a>
  162. <span>
  163. &nbsp;= 0b101 </span>
  164. </dt>
  165. <dd></dd>
  166. <dt class="phpdocumentor-table-of-contents__entry -constant -public">
  167. <a href="classes/chillerlan-QRCode-Common-MaskPattern.html#constant_PATTERN_110">PATTERN_110</a>
  168. <span>
  169. &nbsp;= 0b110 </span>
  170. </dt>
  171. <dd></dd>
  172. <dt class="phpdocumentor-table-of-contents__entry -constant -public">
  173. <a href="classes/chillerlan-QRCode-Common-MaskPattern.html#constant_PATTERN_111">PATTERN_111</a>
  174. <span>
  175. &nbsp;= 0b111 </span>
  176. </dt>
  177. <dd></dd>
  178. <dt class="phpdocumentor-table-of-contents__entry -constant -public">
  179. <a href="classes/chillerlan-QRCode-Common-MaskPattern.html#constant_PATTERNS">PATTERNS</a>
  180. <span>
  181. &nbsp;= [self::PATTERN_000, self::PATTERN_001, self::PATTERN_010, self::PATTERN_011, self::PATTERN_100, self::PATTERN_101, self::PATTERN_110, self::PATTERN_111] </span>
  182. </dt>
  183. <dd></dd>
  184. <dt class="phpdocumentor-table-of-contents__entry -property -private">
  185. <a href="classes/chillerlan-QRCode-Common-MaskPattern.html#property_maskPattern">$maskPattern</a>
  186. <span>
  187. &nbsp;: int </span>
  188. </dt>
  189. <dd>The current mask pattern value (0-7)</dd>
  190. <dt class="phpdocumentor-table-of-contents__entry -method -public">
  191. <a href="classes/chillerlan-QRCode-Common-MaskPattern.html#method___construct">__construct()</a>
  192. <span>
  193. &nbsp;: mixed </span>
  194. </dt>
  195. <dd>MaskPattern constructor.</dd>
  196. <dt class="phpdocumentor-table-of-contents__entry -method -public">
  197. <a href="classes/chillerlan-QRCode-Common-MaskPattern.html#method_getBestPattern">getBestPattern()</a>
  198. <span>
  199. &nbsp;: self </span>
  200. </dt>
  201. <dd>Evaluates the matrix of the given data interface and returns a new mask pattern instance for the best result</dd>
  202. <dt class="phpdocumentor-table-of-contents__entry -method -public">
  203. <a href="classes/chillerlan-QRCode-Common-MaskPattern.html#method_getMask">getMask()</a>
  204. <span>
  205. &nbsp;: <abbr title="\Closure">Closure</abbr> </span>
  206. </dt>
  207. <dd>Returns a closure that applies the mask for the chosen mask pattern.</dd>
  208. <dt class="phpdocumentor-table-of-contents__entry -method -public">
  209. <a href="classes/chillerlan-QRCode-Common-MaskPattern.html#method_getPattern">getPattern()</a>
  210. <span>
  211. &nbsp;: int </span>
  212. </dt>
  213. <dd>Returns the current mask pattern</dd>
  214. <dt class="phpdocumentor-table-of-contents__entry -method -public">
  215. <a href="classes/chillerlan-QRCode-Common-MaskPattern.html#method_testRule1">testRule1()</a>
  216. <span>
  217. &nbsp;: int </span>
  218. </dt>
  219. <dd>Apply mask penalty rule 1 and return the penalty. Find repetitive cells with the same color and
  220. give penalty to them. Example: 00000 or 11111.</dd>
  221. <dt class="phpdocumentor-table-of-contents__entry -method -public">
  222. <a href="classes/chillerlan-QRCode-Common-MaskPattern.html#method_testRule2">testRule2()</a>
  223. <span>
  224. &nbsp;: int </span>
  225. </dt>
  226. <dd>Apply mask penalty rule 2 and return the penalty. Find 2x2 blocks with the same color and give
  227. penalty to them. This is actually equivalent to the spec&#039;s rule, which is to find MxN blocks and give a
  228. penalty proportional to (M-1)x(N-1), because this is the number of 2x2 blocks inside such a block.</dd>
  229. <dt class="phpdocumentor-table-of-contents__entry -method -public">
  230. <a href="classes/chillerlan-QRCode-Common-MaskPattern.html#method_testRule3">testRule3()</a>
  231. <span>
  232. &nbsp;: int </span>
  233. </dt>
  234. <dd>Apply mask penalty rule 3 and return the penalty. Find consecutive runs of 1:1:3:1:1:4
  235. starting with black, or 4:1:1:3:1:1 starting with white, and give penalty to them. If we
  236. find patterns like 000010111010000, we give penalty once.</dd>
  237. <dt class="phpdocumentor-table-of-contents__entry -method -public">
  238. <a href="classes/chillerlan-QRCode-Common-MaskPattern.html#method_testRule4">testRule4()</a>
  239. <span>
  240. &nbsp;: int </span>
  241. </dt>
  242. <dd>Apply mask penalty rule 4 and return the penalty. Calculate the ratio of dark cells and give
  243. penalty if the ratio is far from 50%. It gives 10 penalty for 5% distance.</dd>
  244. <dt class="phpdocumentor-table-of-contents__entry -method -private">
  245. <a href="classes/chillerlan-QRCode-Common-MaskPattern.html#method_applyRule1">applyRule1()</a>
  246. <span>
  247. &nbsp;: int </span>
  248. </dt>
  249. <dd></dd>
  250. <dt class="phpdocumentor-table-of-contents__entry -method -private">
  251. <a href="classes/chillerlan-QRCode-Common-MaskPattern.html#method_isWhiteHorizontal">isWhiteHorizontal()</a>
  252. <span>
  253. &nbsp;: bool </span>
  254. </dt>
  255. <dd></dd>
  256. <dt class="phpdocumentor-table-of-contents__entry -method -private">
  257. <a href="classes/chillerlan-QRCode-Common-MaskPattern.html#method_isWhiteVertical">isWhiteVertical()</a>
  258. <span>
  259. &nbsp;: bool </span>
  260. </dt>
  261. <dd></dd>
  262. </dl>
  263. <section class="phpdocumentor-constants">
  264. <h3 class="phpdocumentor-elements__header" id="constants">
  265. Constants
  266. <a href="classes/chillerlan-QRCode-Common-MaskPattern.html#constants" class="headerlink"><i class="fas fa-link"></i></a>
  267. </h3>
  268. <article class="phpdocumentor-element -constant -public ">
  269. <h4 class="phpdocumentor-element__name" id="constant_PATTERN_000">
  270. PATTERN_000
  271. <a href="classes/chillerlan-QRCode-Common-MaskPattern.html#constant_PATTERN_000" class="headerlink"><i class="fas fa-link"></i></a>
  272. </h4>
  273. <aside class="phpdocumentor-element-found-in">
  274. <abbr class="phpdocumentor-element-found-in__file" title="src/Common/MaskPattern.php"><a href="files/src-common-maskpattern.html"><abbr title="src/Common/MaskPattern.php">MaskPattern.php</abbr></a></abbr>
  275. :
  276. <span class="phpdocumentor-element-found-in__line">28</span>
  277. </aside>
  278. <code class="phpdocumentor-signature phpdocumentor-code ">
  279. <span class="phpdocumentor-signature__visibility">public</span>
  280. <span class="phpdocumentor-signature__type">mixed</span>
  281. <span class="phpdocumentor-signature__name">PATTERN_000</span>
  282. = <span class="phpdocumentor-signature__default-value">0b0</span>
  283. </code>
  284. <section class="phpdocumentor-description"></section>
  285. <section class="phpdocumentor-description"></section>
  286. </article>
  287. <article class="phpdocumentor-element -constant -public ">
  288. <h4 class="phpdocumentor-element__name" id="constant_PATTERN_001">
  289. PATTERN_001
  290. <a href="classes/chillerlan-QRCode-Common-MaskPattern.html#constant_PATTERN_001" class="headerlink"><i class="fas fa-link"></i></a>
  291. </h4>
  292. <aside class="phpdocumentor-element-found-in">
  293. <abbr class="phpdocumentor-element-found-in__file" title="src/Common/MaskPattern.php"><a href="files/src-common-maskpattern.html"><abbr title="src/Common/MaskPattern.php">MaskPattern.php</abbr></a></abbr>
  294. :
  295. <span class="phpdocumentor-element-found-in__line">29</span>
  296. </aside>
  297. <code class="phpdocumentor-signature phpdocumentor-code ">
  298. <span class="phpdocumentor-signature__visibility">public</span>
  299. <span class="phpdocumentor-signature__type">mixed</span>
  300. <span class="phpdocumentor-signature__name">PATTERN_001</span>
  301. = <span class="phpdocumentor-signature__default-value">0b1</span>
  302. </code>
  303. <section class="phpdocumentor-description"></section>
  304. <section class="phpdocumentor-description"></section>
  305. </article>
  306. <article class="phpdocumentor-element -constant -public ">
  307. <h4 class="phpdocumentor-element__name" id="constant_PATTERN_010">
  308. PATTERN_010
  309. <a href="classes/chillerlan-QRCode-Common-MaskPattern.html#constant_PATTERN_010" class="headerlink"><i class="fas fa-link"></i></a>
  310. </h4>
  311. <aside class="phpdocumentor-element-found-in">
  312. <abbr class="phpdocumentor-element-found-in__file" title="src/Common/MaskPattern.php"><a href="files/src-common-maskpattern.html"><abbr title="src/Common/MaskPattern.php">MaskPattern.php</abbr></a></abbr>
  313. :
  314. <span class="phpdocumentor-element-found-in__line">30</span>
  315. </aside>
  316. <code class="phpdocumentor-signature phpdocumentor-code ">
  317. <span class="phpdocumentor-signature__visibility">public</span>
  318. <span class="phpdocumentor-signature__type">mixed</span>
  319. <span class="phpdocumentor-signature__name">PATTERN_010</span>
  320. = <span class="phpdocumentor-signature__default-value">0b10</span>
  321. </code>
  322. <section class="phpdocumentor-description"></section>
  323. <section class="phpdocumentor-description"></section>
  324. </article>
  325. <article class="phpdocumentor-element -constant -public ">
  326. <h4 class="phpdocumentor-element__name" id="constant_PATTERN_011">
  327. PATTERN_011
  328. <a href="classes/chillerlan-QRCode-Common-MaskPattern.html#constant_PATTERN_011" class="headerlink"><i class="fas fa-link"></i></a>
  329. </h4>
  330. <aside class="phpdocumentor-element-found-in">
  331. <abbr class="phpdocumentor-element-found-in__file" title="src/Common/MaskPattern.php"><a href="files/src-common-maskpattern.html"><abbr title="src/Common/MaskPattern.php">MaskPattern.php</abbr></a></abbr>
  332. :
  333. <span class="phpdocumentor-element-found-in__line">31</span>
  334. </aside>
  335. <code class="phpdocumentor-signature phpdocumentor-code ">
  336. <span class="phpdocumentor-signature__visibility">public</span>
  337. <span class="phpdocumentor-signature__type">mixed</span>
  338. <span class="phpdocumentor-signature__name">PATTERN_011</span>
  339. = <span class="phpdocumentor-signature__default-value">0b11</span>
  340. </code>
  341. <section class="phpdocumentor-description"></section>
  342. <section class="phpdocumentor-description"></section>
  343. </article>
  344. <article class="phpdocumentor-element -constant -public ">
  345. <h4 class="phpdocumentor-element__name" id="constant_PATTERN_100">
  346. PATTERN_100
  347. <a href="classes/chillerlan-QRCode-Common-MaskPattern.html#constant_PATTERN_100" class="headerlink"><i class="fas fa-link"></i></a>
  348. </h4>
  349. <aside class="phpdocumentor-element-found-in">
  350. <abbr class="phpdocumentor-element-found-in__file" title="src/Common/MaskPattern.php"><a href="files/src-common-maskpattern.html"><abbr title="src/Common/MaskPattern.php">MaskPattern.php</abbr></a></abbr>
  351. :
  352. <span class="phpdocumentor-element-found-in__line">32</span>
  353. </aside>
  354. <code class="phpdocumentor-signature phpdocumentor-code ">
  355. <span class="phpdocumentor-signature__visibility">public</span>
  356. <span class="phpdocumentor-signature__type">mixed</span>
  357. <span class="phpdocumentor-signature__name">PATTERN_100</span>
  358. = <span class="phpdocumentor-signature__default-value">0b100</span>
  359. </code>
  360. <section class="phpdocumentor-description"></section>
  361. <section class="phpdocumentor-description"></section>
  362. </article>
  363. <article class="phpdocumentor-element -constant -public ">
  364. <h4 class="phpdocumentor-element__name" id="constant_PATTERN_101">
  365. PATTERN_101
  366. <a href="classes/chillerlan-QRCode-Common-MaskPattern.html#constant_PATTERN_101" class="headerlink"><i class="fas fa-link"></i></a>
  367. </h4>
  368. <aside class="phpdocumentor-element-found-in">
  369. <abbr class="phpdocumentor-element-found-in__file" title="src/Common/MaskPattern.php"><a href="files/src-common-maskpattern.html"><abbr title="src/Common/MaskPattern.php">MaskPattern.php</abbr></a></abbr>
  370. :
  371. <span class="phpdocumentor-element-found-in__line">33</span>
  372. </aside>
  373. <code class="phpdocumentor-signature phpdocumentor-code ">
  374. <span class="phpdocumentor-signature__visibility">public</span>
  375. <span class="phpdocumentor-signature__type">mixed</span>
  376. <span class="phpdocumentor-signature__name">PATTERN_101</span>
  377. = <span class="phpdocumentor-signature__default-value">0b101</span>
  378. </code>
  379. <section class="phpdocumentor-description"></section>
  380. <section class="phpdocumentor-description"></section>
  381. </article>
  382. <article class="phpdocumentor-element -constant -public ">
  383. <h4 class="phpdocumentor-element__name" id="constant_PATTERN_110">
  384. PATTERN_110
  385. <a href="classes/chillerlan-QRCode-Common-MaskPattern.html#constant_PATTERN_110" class="headerlink"><i class="fas fa-link"></i></a>
  386. </h4>
  387. <aside class="phpdocumentor-element-found-in">
  388. <abbr class="phpdocumentor-element-found-in__file" title="src/Common/MaskPattern.php"><a href="files/src-common-maskpattern.html"><abbr title="src/Common/MaskPattern.php">MaskPattern.php</abbr></a></abbr>
  389. :
  390. <span class="phpdocumentor-element-found-in__line">34</span>
  391. </aside>
  392. <code class="phpdocumentor-signature phpdocumentor-code ">
  393. <span class="phpdocumentor-signature__visibility">public</span>
  394. <span class="phpdocumentor-signature__type">mixed</span>
  395. <span class="phpdocumentor-signature__name">PATTERN_110</span>
  396. = <span class="phpdocumentor-signature__default-value">0b110</span>
  397. </code>
  398. <section class="phpdocumentor-description"></section>
  399. <section class="phpdocumentor-description"></section>
  400. </article>
  401. <article class="phpdocumentor-element -constant -public ">
  402. <h4 class="phpdocumentor-element__name" id="constant_PATTERN_111">
  403. PATTERN_111
  404. <a href="classes/chillerlan-QRCode-Common-MaskPattern.html#constant_PATTERN_111" class="headerlink"><i class="fas fa-link"></i></a>
  405. </h4>
  406. <aside class="phpdocumentor-element-found-in">
  407. <abbr class="phpdocumentor-element-found-in__file" title="src/Common/MaskPattern.php"><a href="files/src-common-maskpattern.html"><abbr title="src/Common/MaskPattern.php">MaskPattern.php</abbr></a></abbr>
  408. :
  409. <span class="phpdocumentor-element-found-in__line">35</span>
  410. </aside>
  411. <code class="phpdocumentor-signature phpdocumentor-code ">
  412. <span class="phpdocumentor-signature__visibility">public</span>
  413. <span class="phpdocumentor-signature__type">mixed</span>
  414. <span class="phpdocumentor-signature__name">PATTERN_111</span>
  415. = <span class="phpdocumentor-signature__default-value">0b111</span>
  416. </code>
  417. <section class="phpdocumentor-description"></section>
  418. <section class="phpdocumentor-description"></section>
  419. </article>
  420. <article class="phpdocumentor-element -constant -public ">
  421. <h4 class="phpdocumentor-element__name" id="constant_PATTERNS">
  422. PATTERNS
  423. <a href="classes/chillerlan-QRCode-Common-MaskPattern.html#constant_PATTERNS" class="headerlink"><i class="fas fa-link"></i></a>
  424. </h4>
  425. <aside class="phpdocumentor-element-found-in">
  426. <abbr class="phpdocumentor-element-found-in__file" title="src/Common/MaskPattern.php"><a href="files/src-common-maskpattern.html"><abbr title="src/Common/MaskPattern.php">MaskPattern.php</abbr></a></abbr>
  427. :
  428. <span class="phpdocumentor-element-found-in__line">40</span>
  429. </aside>
  430. <code class="phpdocumentor-signature phpdocumentor-code ">
  431. <span class="phpdocumentor-signature__visibility">public</span>
  432. <span class="phpdocumentor-signature__type">array&lt;string|int, int&gt;</span>
  433. <span class="phpdocumentor-signature__name">PATTERNS</span>
  434. = <span class="phpdocumentor-signature__default-value">[self::PATTERN_000, self::PATTERN_001, self::PATTERN_010, self::PATTERN_011, self::PATTERN_100, self::PATTERN_101, self::PATTERN_110, self::PATTERN_111]</span>
  435. </code>
  436. </article>
  437. </section>
  438. <section class="phpdocumentor-properties">
  439. <h3 class="phpdocumentor-elements__header" id="properties">
  440. Properties
  441. <a href="classes/chillerlan-QRCode-Common-MaskPattern.html#properties" class="headerlink"><i class="fas fa-link"></i></a>
  442. </h3>
  443. <article
  444. class="
  445. phpdocumentor-element
  446. -property
  447. -private
  448. "
  449. >
  450. <h4 class="phpdocumentor-element__name" id="property_maskPattern">
  451. $maskPattern
  452. <a href="classes/chillerlan-QRCode-Common-MaskPattern.html#property_maskPattern" class="headerlink"><i class="fas fa-link"></i></a>
  453. <span class="phpdocumentor-element__modifiers">
  454. </span>
  455. </h4>
  456. <aside class="phpdocumentor-element-found-in">
  457. <abbr class="phpdocumentor-element-found-in__file" title="src/Common/MaskPattern.php"><a href="files/src-common-maskpattern.html"><abbr title="src/Common/MaskPattern.php">MaskPattern.php</abbr></a></abbr>
  458. :
  459. <span class="phpdocumentor-element-found-in__line">54</span>
  460. </aside>
  461. <p class="phpdocumentor-summary">The current mask pattern value (0-7)</p>
  462. <code class="phpdocumentor-code phpdocumentor-signature ">
  463. <span class="phpdocumentor-signature__visibility">private</span>
  464. <span class="phpdocumentor-signature__type">int</span>
  465. <span class="phpdocumentor-signature__name">$maskPattern</span>
  466. </code>
  467. <section class="phpdocumentor-description"></section>
  468. </article>
  469. </section>
  470. <section class="phpdocumentor-methods">
  471. <h3 class="phpdocumentor-elements__header" id="methods">
  472. Methods
  473. <a href="classes/chillerlan-QRCode-Common-MaskPattern.html#methods" class="headerlink"><i class="fas fa-link"></i></a>
  474. </h3>
  475. <article
  476. class="phpdocumentor-element
  477. -method
  478. -public
  479. "
  480. >
  481. <h4 class="phpdocumentor-element__name" id="method___construct">
  482. __construct()
  483. <a href="classes/chillerlan-QRCode-Common-MaskPattern.html#method___construct" class="headerlink"><i class="fas fa-link"></i></a>
  484. </h4>
  485. <aside class="phpdocumentor-element-found-in">
  486. <abbr class="phpdocumentor-element-found-in__file" title="src/Common/MaskPattern.php"><a href="files/src-common-maskpattern.html"><abbr title="src/Common/MaskPattern.php">MaskPattern.php</abbr></a></abbr>
  487. :
  488. <span class="phpdocumentor-element-found-in__line">61</span>
  489. </aside>
  490. <p class="phpdocumentor-summary">MaskPattern constructor.</p>
  491. <code class="phpdocumentor-code phpdocumentor-signature ">
  492. <span class="phpdocumentor-signature__visibility">public</span>
  493. <span class="phpdocumentor-signature__name">__construct</span><span>(</span><span class="phpdocumentor-signature__argument"><span class="phpdocumentor-signature__argument__return-type">int&nbsp;</span><span class="phpdocumentor-signature__argument__name">$maskPattern</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">mixed</span></code>
  494. <h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
  495. <dl class="phpdocumentor-argument-list">
  496. <dt class="phpdocumentor-argument-list__entry">
  497. <span class="phpdocumentor-signature__argument__name">$maskPattern</span>
  498. : <span class="phpdocumentor-signature__argument__return-type">int</span>
  499. </dt>
  500. <dd class="phpdocumentor-argument-list__definition">
  501. <section class="phpdocumentor-description"></section>
  502. </dd>
  503. </dl>
  504. <h5 class="phpdocumentor-tag-list__heading" id="tags">
  505. Tags
  506. <a href="#tags" class="headerlink"><i class="fas fa-link"></i></a>
  507. </h5>
  508. <dl class="phpdocumentor-tag-list">
  509. <dt class="phpdocumentor-tag-list__entry">
  510. <span class="phpdocumentor-tag__name">throws</span>
  511. </dt>
  512. <dd class="phpdocumentor-tag-list__definition">
  513. <span class="phpdocumentor-tag-link"><a href="classes/chillerlan-QRCode-QRCodeException.html"><abbr title="\chillerlan\QRCode\QRCodeException">QRCodeException</abbr></a></span>
  514. </dd>
  515. </dl>
  516. <h5 class="phpdocumentor-return-value__heading">Return values</h5>
  517. <span class="phpdocumentor-signature__response_type">mixed</span>
  518. &mdash;
  519. </article>
  520. <article
  521. class="phpdocumentor-element
  522. -method
  523. -public
  524. -static "
  525. >
  526. <h4 class="phpdocumentor-element__name" id="method_getBestPattern">
  527. getBestPattern()
  528. <a href="classes/chillerlan-QRCode-Common-MaskPattern.html#method_getBestPattern" class="headerlink"><i class="fas fa-link"></i></a>
  529. </h4>
  530. <aside class="phpdocumentor-element-found-in">
  531. <abbr class="phpdocumentor-element-found-in__file" title="src/Common/MaskPattern.php"><a href="files/src-common-maskpattern.html"><abbr title="src/Common/MaskPattern.php">MaskPattern.php</abbr></a></abbr>
  532. :
  533. <span class="phpdocumentor-element-found-in__line">108</span>
  534. </aside>
  535. <p class="phpdocumentor-summary">Evaluates the matrix of the given data interface and returns a new mask pattern instance for the best result</p>
  536. <code class="phpdocumentor-code phpdocumentor-signature ">
  537. <span class="phpdocumentor-signature__visibility">public</span>
  538. <span class="phpdocumentor-signature__static">static</span> <span class="phpdocumentor-signature__name">getBestPattern</span><span>(</span><span class="phpdocumentor-signature__argument"><span class="phpdocumentor-signature__argument__return-type"><a href="classes/chillerlan-QRCode-Data-QRData.html"><abbr title="\chillerlan\QRCode\Data\QRData">QRData</abbr></a>&nbsp;</span><span class="phpdocumentor-signature__argument__name">$dataInterface</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">self</span></code>
  539. <h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
  540. <dl class="phpdocumentor-argument-list">
  541. <dt class="phpdocumentor-argument-list__entry">
  542. <span class="phpdocumentor-signature__argument__name">$dataInterface</span>
  543. : <span class="phpdocumentor-signature__argument__return-type"><a href="classes/chillerlan-QRCode-Data-QRData.html"><abbr title="\chillerlan\QRCode\Data\QRData">QRData</abbr></a></span>
  544. </dt>
  545. <dd class="phpdocumentor-argument-list__definition">
  546. <section class="phpdocumentor-description"></section>
  547. </dd>
  548. </dl>
  549. <h5 class="phpdocumentor-return-value__heading">Return values</h5>
  550. <span class="phpdocumentor-signature__response_type">self</span>
  551. &mdash;
  552. </article>
  553. <article
  554. class="phpdocumentor-element
  555. -method
  556. -public
  557. "
  558. >
  559. <h4 class="phpdocumentor-element__name" id="method_getMask">
  560. getMask()
  561. <a href="classes/chillerlan-QRCode-Common-MaskPattern.html#method_getMask" class="headerlink"><i class="fas fa-link"></i></a>
  562. </h4>
  563. <aside class="phpdocumentor-element-found-in">
  564. <abbr class="phpdocumentor-element-found-in__file" title="src/Common/MaskPattern.php"><a href="files/src-common-maskpattern.html"><abbr title="src/Common/MaskPattern.php">MaskPattern.php</abbr></a></abbr>
  565. :
  566. <span class="phpdocumentor-element-found-in__line">91</span>
  567. </aside>
  568. <p class="phpdocumentor-summary">Returns a closure that applies the mask for the chosen mask pattern.</p>
  569. <code class="phpdocumentor-code phpdocumentor-signature ">
  570. <span class="phpdocumentor-signature__visibility">public</span>
  571. <span class="phpdocumentor-signature__name">getMask</span><span>(</span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type"><abbr title="\Closure">Closure</abbr></span></code>
  572. <section class="phpdocumentor-description"><p>Encapsulates data masks for the data bits in a QR code, per ISO 18004:2006 6.8. Implementations
  573. of this class can un-mask a raw BitMatrix. For simplicity, they will unmask the entire BitMatrix,
  574. including areas used for finder patterns, timing patterns, etc. These areas should be unused
  575. after the point they are unmasked anyway.</p>
  576. <p>Note that the diagram in section 6.8.1 is misleading since it indicates that i is column position
  577. and j is row position. In fact, as the text says, i is row position and j is column position.</p>
  578. </section>
  579. <h5 class="phpdocumentor-tag-list__heading" id="tags">
  580. Tags
  581. <a href="#tags" class="headerlink"><i class="fas fa-link"></i></a>
  582. </h5>
  583. <dl class="phpdocumentor-tag-list">
  584. <dt class="phpdocumentor-tag-list__entry">
  585. <span class="phpdocumentor-tag__name">see</span>
  586. </dt>
  587. <dd class="phpdocumentor-tag-list__definition">
  588. <span class="phpdocumentor-tag-link"><a href="https://www.thonky.com/qr-code-tutorial/mask-patterns"><abbr title="https://www.thonky.com/qr-code-tutorial/mask-patterns">https://www.thonky.com/qr-code-tutorial/mask-patterns</abbr></a></span>
  589. </dd>
  590. <dt class="phpdocumentor-tag-list__entry">
  591. <span class="phpdocumentor-tag__name">see</span>
  592. </dt>
  593. <dd class="phpdocumentor-tag-list__definition">
  594. <span class="phpdocumentor-tag-link"><a href="https://github.com/zxing/zxing/blob/e9e2bd280bcaeabd59d0f955798384fe6c018a6c/core/src/main/java/com/google/zxing/qrcode/decoder/DataMask.java#L32-L117"><abbr title="https://github.com/zxing/zxing/blob/e9e2bd280bcaeabd59d0f955798384fe6c018a6c/core/src/main/java/com/google/zxing/qrcode/decoder/DataMask.java#L32-L117">https://github.com/zxing/zxing/blob/e9e2bd280bcaeabd59d0f955798384fe6c018a6c/core/src/main/java/com/google/zxing/qrcode/decoder/DataMask.java#L32-L117</abbr></a></span>
  595. </dd>
  596. </dl>
  597. <h5 class="phpdocumentor-return-value__heading">Return values</h5>
  598. <span class="phpdocumentor-signature__response_type"><abbr title="\Closure">Closure</abbr></span>
  599. &mdash;
  600. </article>
  601. <article
  602. class="phpdocumentor-element
  603. -method
  604. -public
  605. "
  606. >
  607. <h4 class="phpdocumentor-element__name" id="method_getPattern">
  608. getPattern()
  609. <a href="classes/chillerlan-QRCode-Common-MaskPattern.html#method_getPattern" class="headerlink"><i class="fas fa-link"></i></a>
  610. </h4>
  611. <aside class="phpdocumentor-element-found-in">
  612. <abbr class="phpdocumentor-element-found-in__file" title="src/Common/MaskPattern.php"><a href="files/src-common-maskpattern.html"><abbr title="src/Common/MaskPattern.php">MaskPattern.php</abbr></a></abbr>
  613. :
  614. <span class="phpdocumentor-element-found-in__line">73</span>
  615. </aside>
  616. <p class="phpdocumentor-summary">Returns the current mask pattern</p>
  617. <code class="phpdocumentor-code phpdocumentor-signature ">
  618. <span class="phpdocumentor-signature__visibility">public</span>
  619. <span class="phpdocumentor-signature__name">getPattern</span><span>(</span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">int</span></code>
  620. <h5 class="phpdocumentor-return-value__heading">Return values</h5>
  621. <span class="phpdocumentor-signature__response_type">int</span>
  622. &mdash;
  623. </article>
  624. <article
  625. class="phpdocumentor-element
  626. -method
  627. -public
  628. -static "
  629. >
  630. <h4 class="phpdocumentor-element__name" id="method_testRule1">
  631. testRule1()
  632. <a href="classes/chillerlan-QRCode-Common-MaskPattern.html#method_testRule1" class="headerlink"><i class="fas fa-link"></i></a>
  633. </h4>
  634. <aside class="phpdocumentor-element-found-in">
  635. <abbr class="phpdocumentor-element-found-in__file" title="src/Common/MaskPattern.php"><a href="files/src-common-maskpattern.html"><abbr title="src/Common/MaskPattern.php">MaskPattern.php</abbr></a></abbr>
  636. :
  637. <span class="phpdocumentor-element-found-in__line">129</span>
  638. </aside>
  639. <p class="phpdocumentor-summary">Apply mask penalty rule 1 and return the penalty. Find repetitive cells with the same color and
  640. give penalty to them. Example: 00000 or 11111.</p>
  641. <code class="phpdocumentor-code phpdocumentor-signature ">
  642. <span class="phpdocumentor-signature__visibility">public</span>
  643. <span class="phpdocumentor-signature__static">static</span> <span class="phpdocumentor-signature__name">testRule1</span><span>(</span><span class="phpdocumentor-signature__argument"><span class="phpdocumentor-signature__argument__return-type">array&lt;string|int, mixed&gt;&nbsp;</span><span class="phpdocumentor-signature__argument__name">$matrix</span></span><span class="phpdocumentor-signature__argument"><span>, </span><span class="phpdocumentor-signature__argument__return-type">int&nbsp;</span><span class="phpdocumentor-signature__argument__name">$height</span></span><span class="phpdocumentor-signature__argument"><span>, </span><span class="phpdocumentor-signature__argument__return-type">int&nbsp;</span><span class="phpdocumentor-signature__argument__name">$width</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">int</span></code>
  644. <h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
  645. <dl class="phpdocumentor-argument-list">
  646. <dt class="phpdocumentor-argument-list__entry">
  647. <span class="phpdocumentor-signature__argument__name">$matrix</span>
  648. : <span class="phpdocumentor-signature__argument__return-type">array&lt;string|int, mixed&gt;</span>
  649. </dt>
  650. <dd class="phpdocumentor-argument-list__definition">
  651. <section class="phpdocumentor-description"></section>
  652. </dd>
  653. <dt class="phpdocumentor-argument-list__entry">
  654. <span class="phpdocumentor-signature__argument__name">$height</span>
  655. : <span class="phpdocumentor-signature__argument__return-type">int</span>
  656. </dt>
  657. <dd class="phpdocumentor-argument-list__definition">
  658. <section class="phpdocumentor-description"></section>
  659. </dd>
  660. <dt class="phpdocumentor-argument-list__entry">
  661. <span class="phpdocumentor-signature__argument__name">$width</span>
  662. : <span class="phpdocumentor-signature__argument__return-type">int</span>
  663. </dt>
  664. <dd class="phpdocumentor-argument-list__definition">
  665. <section class="phpdocumentor-description"></section>
  666. </dd>
  667. </dl>
  668. <h5 class="phpdocumentor-return-value__heading">Return values</h5>
  669. <span class="phpdocumentor-signature__response_type">int</span>
  670. &mdash;
  671. </article>
  672. <article
  673. class="phpdocumentor-element
  674. -method
  675. -public
  676. -static "
  677. >
  678. <h4 class="phpdocumentor-element__name" id="method_testRule2">
  679. testRule2()
  680. <a href="classes/chillerlan-QRCode-Common-MaskPattern.html#method_testRule2" class="headerlink"><i class="fas fa-link"></i></a>
  681. </h4>
  682. <aside class="phpdocumentor-element-found-in">
  683. <abbr class="phpdocumentor-element-found-in__file" title="src/Common/MaskPattern.php"><a href="files/src-common-maskpattern.html"><abbr title="src/Common/MaskPattern.php">MaskPattern.php</abbr></a></abbr>
  684. :
  685. <span class="phpdocumentor-element-found-in__line">174</span>
  686. </aside>
  687. <p class="phpdocumentor-summary">Apply mask penalty rule 2 and return the penalty. Find 2x2 blocks with the same color and give
  688. penalty to them. This is actually equivalent to the spec&#039;s rule, which is to find MxN blocks and give a
  689. penalty proportional to (M-1)x(N-1), because this is the number of 2x2 blocks inside such a block.</p>
  690. <code class="phpdocumentor-code phpdocumentor-signature ">
  691. <span class="phpdocumentor-signature__visibility">public</span>
  692. <span class="phpdocumentor-signature__static">static</span> <span class="phpdocumentor-signature__name">testRule2</span><span>(</span><span class="phpdocumentor-signature__argument"><span class="phpdocumentor-signature__argument__return-type">array&lt;string|int, mixed&gt;&nbsp;</span><span class="phpdocumentor-signature__argument__name">$matrix</span></span><span class="phpdocumentor-signature__argument"><span>, </span><span class="phpdocumentor-signature__argument__return-type">int&nbsp;</span><span class="phpdocumentor-signature__argument__name">$height</span></span><span class="phpdocumentor-signature__argument"><span>, </span><span class="phpdocumentor-signature__argument__return-type">int&nbsp;</span><span class="phpdocumentor-signature__argument__name">$width</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">int</span></code>
  693. <h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
  694. <dl class="phpdocumentor-argument-list">
  695. <dt class="phpdocumentor-argument-list__entry">
  696. <span class="phpdocumentor-signature__argument__name">$matrix</span>
  697. : <span class="phpdocumentor-signature__argument__return-type">array&lt;string|int, mixed&gt;</span>
  698. </dt>
  699. <dd class="phpdocumentor-argument-list__definition">
  700. <section class="phpdocumentor-description"></section>
  701. </dd>
  702. <dt class="phpdocumentor-argument-list__entry">
  703. <span class="phpdocumentor-signature__argument__name">$height</span>
  704. : <span class="phpdocumentor-signature__argument__return-type">int</span>
  705. </dt>
  706. <dd class="phpdocumentor-argument-list__definition">
  707. <section class="phpdocumentor-description"></section>
  708. </dd>
  709. <dt class="phpdocumentor-argument-list__entry">
  710. <span class="phpdocumentor-signature__argument__name">$width</span>
  711. : <span class="phpdocumentor-signature__argument__return-type">int</span>
  712. </dt>
  713. <dd class="phpdocumentor-argument-list__definition">
  714. <section class="phpdocumentor-description"></section>
  715. </dd>
  716. </dl>
  717. <h5 class="phpdocumentor-return-value__heading">Return values</h5>
  718. <span class="phpdocumentor-signature__response_type">int</span>
  719. &mdash;
  720. </article>
  721. <article
  722. class="phpdocumentor-element
  723. -method
  724. -public
  725. -static "
  726. >
  727. <h4 class="phpdocumentor-element__name" id="method_testRule3">
  728. testRule3()
  729. <a href="classes/chillerlan-QRCode-Common-MaskPattern.html#method_testRule3" class="headerlink"><i class="fas fa-link"></i></a>
  730. </h4>
  731. <aside class="phpdocumentor-element-found-in">
  732. <abbr class="phpdocumentor-element-found-in__file" title="src/Common/MaskPattern.php"><a href="files/src-common-maskpattern.html"><abbr title="src/Common/MaskPattern.php">MaskPattern.php</abbr></a></abbr>
  733. :
  734. <span class="phpdocumentor-element-found-in__line">207</span>
  735. </aside>
  736. <p class="phpdocumentor-summary">Apply mask penalty rule 3 and return the penalty. Find consecutive runs of 1:1:3:1:1:4
  737. starting with black, or 4:1:1:3:1:1 starting with white, and give penalty to them. If we
  738. find patterns like 000010111010000, we give penalty once.</p>
  739. <code class="phpdocumentor-code phpdocumentor-signature ">
  740. <span class="phpdocumentor-signature__visibility">public</span>
  741. <span class="phpdocumentor-signature__static">static</span> <span class="phpdocumentor-signature__name">testRule3</span><span>(</span><span class="phpdocumentor-signature__argument"><span class="phpdocumentor-signature__argument__return-type">array&lt;string|int, mixed&gt;&nbsp;</span><span class="phpdocumentor-signature__argument__name">$matrix</span></span><span class="phpdocumentor-signature__argument"><span>, </span><span class="phpdocumentor-signature__argument__return-type">int&nbsp;</span><span class="phpdocumentor-signature__argument__name">$height</span></span><span class="phpdocumentor-signature__argument"><span>, </span><span class="phpdocumentor-signature__argument__return-type">int&nbsp;</span><span class="phpdocumentor-signature__argument__name">$width</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">int</span></code>
  742. <h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
  743. <dl class="phpdocumentor-argument-list">
  744. <dt class="phpdocumentor-argument-list__entry">
  745. <span class="phpdocumentor-signature__argument__name">$matrix</span>
  746. : <span class="phpdocumentor-signature__argument__return-type">array&lt;string|int, mixed&gt;</span>
  747. </dt>
  748. <dd class="phpdocumentor-argument-list__definition">
  749. <section class="phpdocumentor-description"></section>
  750. </dd>
  751. <dt class="phpdocumentor-argument-list__entry">
  752. <span class="phpdocumentor-signature__argument__name">$height</span>
  753. : <span class="phpdocumentor-signature__argument__return-type">int</span>
  754. </dt>
  755. <dd class="phpdocumentor-argument-list__definition">
  756. <section class="phpdocumentor-description"></section>
  757. </dd>
  758. <dt class="phpdocumentor-argument-list__entry">
  759. <span class="phpdocumentor-signature__argument__name">$width</span>
  760. : <span class="phpdocumentor-signature__argument__return-type">int</span>
  761. </dt>
  762. <dd class="phpdocumentor-argument-list__definition">
  763. <section class="phpdocumentor-description"></section>
  764. </dd>
  765. </dl>
  766. <h5 class="phpdocumentor-return-value__heading">Return values</h5>
  767. <span class="phpdocumentor-signature__response_type">int</span>
  768. &mdash;
  769. </article>
  770. <article
  771. class="phpdocumentor-element
  772. -method
  773. -public
  774. -static "
  775. >
  776. <h4 class="phpdocumentor-element__name" id="method_testRule4">
  777. testRule4()
  778. <a href="classes/chillerlan-QRCode-Common-MaskPattern.html#method_testRule4" class="headerlink"><i class="fas fa-link"></i></a>
  779. </h4>
  780. <aside class="phpdocumentor-element-found-in">
  781. <abbr class="phpdocumentor-element-found-in__file" title="src/Common/MaskPattern.php"><a href="files/src-common-maskpattern.html"><abbr title="src/Common/MaskPattern.php">MaskPattern.php</abbr></a></abbr>
  782. :
  783. <span class="phpdocumentor-element-found-in__line">293</span>
  784. </aside>
  785. <p class="phpdocumentor-summary">Apply mask penalty rule 4 and return the penalty. Calculate the ratio of dark cells and give
  786. penalty if the ratio is far from 50%. It gives 10 penalty for 5% distance.</p>
  787. <code class="phpdocumentor-code phpdocumentor-signature ">
  788. <span class="phpdocumentor-signature__visibility">public</span>
  789. <span class="phpdocumentor-signature__static">static</span> <span class="phpdocumentor-signature__name">testRule4</span><span>(</span><span class="phpdocumentor-signature__argument"><span class="phpdocumentor-signature__argument__return-type">array&lt;string|int, mixed&gt;&nbsp;</span><span class="phpdocumentor-signature__argument__name">$matrix</span></span><span class="phpdocumentor-signature__argument"><span>, </span><span class="phpdocumentor-signature__argument__return-type">int&nbsp;</span><span class="phpdocumentor-signature__argument__name">$height</span></span><span class="phpdocumentor-signature__argument"><span>, </span><span class="phpdocumentor-signature__argument__return-type">int&nbsp;</span><span class="phpdocumentor-signature__argument__name">$width</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">int</span></code>
  790. <h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
  791. <dl class="phpdocumentor-argument-list">
  792. <dt class="phpdocumentor-argument-list__entry">
  793. <span class="phpdocumentor-signature__argument__name">$matrix</span>
  794. : <span class="phpdocumentor-signature__argument__return-type">array&lt;string|int, mixed&gt;</span>
  795. </dt>
  796. <dd class="phpdocumentor-argument-list__definition">
  797. <section class="phpdocumentor-description"></section>
  798. </dd>
  799. <dt class="phpdocumentor-argument-list__entry">
  800. <span class="phpdocumentor-signature__argument__name">$height</span>
  801. : <span class="phpdocumentor-signature__argument__return-type">int</span>
  802. </dt>
  803. <dd class="phpdocumentor-argument-list__definition">
  804. <section class="phpdocumentor-description"></section>
  805. </dd>
  806. <dt class="phpdocumentor-argument-list__entry">
  807. <span class="phpdocumentor-signature__argument__name">$width</span>
  808. : <span class="phpdocumentor-signature__argument__return-type">int</span>
  809. </dt>
  810. <dd class="phpdocumentor-argument-list__definition">
  811. <section class="phpdocumentor-description"></section>
  812. </dd>
  813. </dl>
  814. <h5 class="phpdocumentor-return-value__heading">Return values</h5>
  815. <span class="phpdocumentor-signature__response_type">int</span>
  816. &mdash;
  817. </article>
  818. <article
  819. class="phpdocumentor-element
  820. -method
  821. -private
  822. -static "
  823. >
  824. <h4 class="phpdocumentor-element__name" id="method_applyRule1">
  825. applyRule1()
  826. <a href="classes/chillerlan-QRCode-Common-MaskPattern.html#method_applyRule1" class="headerlink"><i class="fas fa-link"></i></a>
  827. </h4>
  828. <aside class="phpdocumentor-element-found-in">
  829. <abbr class="phpdocumentor-element-found-in__file" title="src/Common/MaskPattern.php"><a href="files/src-common-maskpattern.html"><abbr title="src/Common/MaskPattern.php">MaskPattern.php</abbr></a></abbr>
  830. :
  831. <span class="phpdocumentor-element-found-in__line">136</span>
  832. </aside>
  833. <code class="phpdocumentor-code phpdocumentor-signature ">
  834. <span class="phpdocumentor-signature__visibility">private</span>
  835. <span class="phpdocumentor-signature__static">static</span> <span class="phpdocumentor-signature__name">applyRule1</span><span>(</span><span class="phpdocumentor-signature__argument"><span class="phpdocumentor-signature__argument__return-type">array&lt;string|int, mixed&gt;&nbsp;</span><span class="phpdocumentor-signature__argument__name">$matrix</span></span><span class="phpdocumentor-signature__argument"><span>, </span><span class="phpdocumentor-signature__argument__return-type">int&nbsp;</span><span class="phpdocumentor-signature__argument__name">$height</span></span><span class="phpdocumentor-signature__argument"><span>, </span><span class="phpdocumentor-signature__argument__return-type">int&nbsp;</span><span class="phpdocumentor-signature__argument__name">$width</span></span><span class="phpdocumentor-signature__argument"><span>, </span><span class="phpdocumentor-signature__argument__return-type">bool&nbsp;</span><span class="phpdocumentor-signature__argument__name">$isHorizontal</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">int</span></code>
  836. <h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
  837. <dl class="phpdocumentor-argument-list">
  838. <dt class="phpdocumentor-argument-list__entry">
  839. <span class="phpdocumentor-signature__argument__name">$matrix</span>
  840. : <span class="phpdocumentor-signature__argument__return-type">array&lt;string|int, mixed&gt;</span>
  841. </dt>
  842. <dd class="phpdocumentor-argument-list__definition">
  843. <section class="phpdocumentor-description"></section>
  844. </dd>
  845. <dt class="phpdocumentor-argument-list__entry">
  846. <span class="phpdocumentor-signature__argument__name">$height</span>
  847. : <span class="phpdocumentor-signature__argument__return-type">int</span>
  848. </dt>
  849. <dd class="phpdocumentor-argument-list__definition">
  850. <section class="phpdocumentor-description"></section>
  851. </dd>
  852. <dt class="phpdocumentor-argument-list__entry">
  853. <span class="phpdocumentor-signature__argument__name">$width</span>
  854. : <span class="phpdocumentor-signature__argument__return-type">int</span>
  855. </dt>
  856. <dd class="phpdocumentor-argument-list__definition">
  857. <section class="phpdocumentor-description"></section>
  858. </dd>
  859. <dt class="phpdocumentor-argument-list__entry">
  860. <span class="phpdocumentor-signature__argument__name">$isHorizontal</span>
  861. : <span class="phpdocumentor-signature__argument__return-type">bool</span>
  862. </dt>
  863. <dd class="phpdocumentor-argument-list__definition">
  864. <section class="phpdocumentor-description"></section>
  865. </dd>
  866. </dl>
  867. <h5 class="phpdocumentor-return-value__heading">Return values</h5>
  868. <span class="phpdocumentor-signature__response_type">int</span>
  869. &mdash;
  870. </article>
  871. <article
  872. class="phpdocumentor-element
  873. -method
  874. -private
  875. -static "
  876. >
  877. <h4 class="phpdocumentor-element__name" id="method_isWhiteHorizontal">
  878. isWhiteHorizontal()
  879. <a href="classes/chillerlan-QRCode-Common-MaskPattern.html#method_isWhiteHorizontal" class="headerlink"><i class="fas fa-link"></i></a>
  880. </h4>
  881. <aside class="phpdocumentor-element-found-in">
  882. <abbr class="phpdocumentor-element-found-in__file" title="src/Common/MaskPattern.php"><a href="files/src-common-maskpattern.html"><abbr title="src/Common/MaskPattern.php">MaskPattern.php</abbr></a></abbr>
  883. :
  884. <span class="phpdocumentor-element-found-in__line">256</span>
  885. </aside>
  886. <code class="phpdocumentor-code phpdocumentor-signature ">
  887. <span class="phpdocumentor-signature__visibility">private</span>
  888. <span class="phpdocumentor-signature__static">static</span> <span class="phpdocumentor-signature__name">isWhiteHorizontal</span><span>(</span><span class="phpdocumentor-signature__argument"><span class="phpdocumentor-signature__argument__return-type">array&lt;string|int, mixed&gt;&nbsp;</span><span class="phpdocumentor-signature__argument__name">$row</span></span><span class="phpdocumentor-signature__argument"><span>, </span><span class="phpdocumentor-signature__argument__return-type">int&nbsp;</span><span class="phpdocumentor-signature__argument__name">$width</span></span><span class="phpdocumentor-signature__argument"><span>, </span><span class="phpdocumentor-signature__argument__return-type">int&nbsp;</span><span class="phpdocumentor-signature__argument__name">$from</span></span><span class="phpdocumentor-signature__argument"><span>, </span><span class="phpdocumentor-signature__argument__return-type">int&nbsp;</span><span class="phpdocumentor-signature__argument__name">$to</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">bool</span></code>
  889. <h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
  890. <dl class="phpdocumentor-argument-list">
  891. <dt class="phpdocumentor-argument-list__entry">
  892. <span class="phpdocumentor-signature__argument__name">$row</span>
  893. : <span class="phpdocumentor-signature__argument__return-type">array&lt;string|int, mixed&gt;</span>
  894. </dt>
  895. <dd class="phpdocumentor-argument-list__definition">
  896. <section class="phpdocumentor-description"></section>
  897. </dd>
  898. <dt class="phpdocumentor-argument-list__entry">
  899. <span class="phpdocumentor-signature__argument__name">$width</span>
  900. : <span class="phpdocumentor-signature__argument__return-type">int</span>
  901. </dt>
  902. <dd class="phpdocumentor-argument-list__definition">
  903. <section class="phpdocumentor-description"></section>
  904. </dd>
  905. <dt class="phpdocumentor-argument-list__entry">
  906. <span class="phpdocumentor-signature__argument__name">$from</span>
  907. : <span class="phpdocumentor-signature__argument__return-type">int</span>
  908. </dt>
  909. <dd class="phpdocumentor-argument-list__definition">
  910. <section class="phpdocumentor-description"></section>
  911. </dd>
  912. <dt class="phpdocumentor-argument-list__entry">
  913. <span class="phpdocumentor-signature__argument__name">$to</span>
  914. : <span class="phpdocumentor-signature__argument__return-type">int</span>
  915. </dt>
  916. <dd class="phpdocumentor-argument-list__definition">
  917. <section class="phpdocumentor-description"></section>
  918. </dd>
  919. </dl>
  920. <h5 class="phpdocumentor-return-value__heading">Return values</h5>
  921. <span class="phpdocumentor-signature__response_type">bool</span>
  922. &mdash;
  923. </article>
  924. <article
  925. class="phpdocumentor-element
  926. -method
  927. -private
  928. -static "
  929. >
  930. <h4 class="phpdocumentor-element__name" id="method_isWhiteVertical">
  931. isWhiteVertical()
  932. <a href="classes/chillerlan-QRCode-Common-MaskPattern.html#method_isWhiteVertical" class="headerlink"><i class="fas fa-link"></i></a>
  933. </h4>
  934. <aside class="phpdocumentor-element-found-in">
  935. <abbr class="phpdocumentor-element-found-in__file" title="src/Common/MaskPattern.php"><a href="files/src-common-maskpattern.html"><abbr title="src/Common/MaskPattern.php">MaskPattern.php</abbr></a></abbr>
  936. :
  937. <span class="phpdocumentor-element-found-in__line">274</span>
  938. </aside>
  939. <code class="phpdocumentor-code phpdocumentor-signature ">
  940. <span class="phpdocumentor-signature__visibility">private</span>
  941. <span class="phpdocumentor-signature__static">static</span> <span class="phpdocumentor-signature__name">isWhiteVertical</span><span>(</span><span class="phpdocumentor-signature__argument"><span class="phpdocumentor-signature__argument__return-type">array&lt;string|int, mixed&gt;&nbsp;</span><span class="phpdocumentor-signature__argument__name">$matrix</span></span><span class="phpdocumentor-signature__argument"><span>, </span><span class="phpdocumentor-signature__argument__return-type">int&nbsp;</span><span class="phpdocumentor-signature__argument__name">$height</span></span><span class="phpdocumentor-signature__argument"><span>, </span><span class="phpdocumentor-signature__argument__return-type">int&nbsp;</span><span class="phpdocumentor-signature__argument__name">$x</span></span><span class="phpdocumentor-signature__argument"><span>, </span><span class="phpdocumentor-signature__argument__return-type">int&nbsp;</span><span class="phpdocumentor-signature__argument__name">$from</span></span><span class="phpdocumentor-signature__argument"><span>, </span><span class="phpdocumentor-signature__argument__return-type">int&nbsp;</span><span class="phpdocumentor-signature__argument__name">$to</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">bool</span></code>
  942. <h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
  943. <dl class="phpdocumentor-argument-list">
  944. <dt class="phpdocumentor-argument-list__entry">
  945. <span class="phpdocumentor-signature__argument__name">$matrix</span>
  946. : <span class="phpdocumentor-signature__argument__return-type">array&lt;string|int, mixed&gt;</span>
  947. </dt>
  948. <dd class="phpdocumentor-argument-list__definition">
  949. <section class="phpdocumentor-description"></section>
  950. </dd>
  951. <dt class="phpdocumentor-argument-list__entry">
  952. <span class="phpdocumentor-signature__argument__name">$height</span>
  953. : <span class="phpdocumentor-signature__argument__return-type">int</span>
  954. </dt>
  955. <dd class="phpdocumentor-argument-list__definition">
  956. <section class="phpdocumentor-description"></section>
  957. </dd>
  958. <dt class="phpdocumentor-argument-list__entry">
  959. <span class="phpdocumentor-signature__argument__name">$x</span>
  960. : <span class="phpdocumentor-signature__argument__return-type">int</span>
  961. </dt>
  962. <dd class="phpdocumentor-argument-list__definition">
  963. <section class="phpdocumentor-description"></section>
  964. </dd>
  965. <dt class="phpdocumentor-argument-list__entry">
  966. <span class="phpdocumentor-signature__argument__name">$from</span>
  967. : <span class="phpdocumentor-signature__argument__return-type">int</span>
  968. </dt>
  969. <dd class="phpdocumentor-argument-list__definition">
  970. <section class="phpdocumentor-description"></section>
  971. </dd>
  972. <dt class="phpdocumentor-argument-list__entry">
  973. <span class="phpdocumentor-signature__argument__name">$to</span>
  974. : <span class="phpdocumentor-signature__argument__return-type">int</span>
  975. </dt>
  976. <dd class="phpdocumentor-argument-list__definition">
  977. <section class="phpdocumentor-description"></section>
  978. </dd>
  979. </dl>
  980. <h5 class="phpdocumentor-return-value__heading">Return values</h5>
  981. <span class="phpdocumentor-signature__response_type">bool</span>
  982. &mdash;
  983. </article>
  984. </section>
  985. <script type="text/javascript">
  986. function loadExternalCodeSnippets(line) {
  987. Array.prototype.slice.call(document.querySelectorAll('pre[data-src]')).forEach((pre) => {
  988. var src = pre.getAttribute('data-src').replace( /\\/g, '/');
  989. var extension = (src.match(/\.(\w+)$/) || [, ''])[1];
  990. var language = 'php';
  991. var code = document.createElement('code');
  992. code.className = 'language-' + language;
  993. pre.textContent = '';
  994. pre.setAttribute('data-line', line)
  995. code.textContent = 'Loading…';
  996. pre.appendChild(code);
  997. var xhr = new XMLHttpRequest();
  998. xhr.open('GET', src, true);
  999. xhr.onreadystatechange = function () {
  1000. if (xhr.readyState == 4) {
  1001. if (xhr.status < 400 && xhr.responseText) {
  1002. code.textContent = xhr.responseText;
  1003. Prism.highlightElement(code);
  1004. }
  1005. else if (xhr.status >= 400) {
  1006. code.textContent = '✖ Error ' + xhr.status + ' while fetching file: ' + xhr.statusText;
  1007. }
  1008. else {
  1009. code.textContent = '✖ Error: File does not exist, is empty or trying to view from localhost';
  1010. }
  1011. }
  1012. };
  1013. xhr.send(null);
  1014. });
  1015. }
  1016. var modals = document.querySelectorAll("[data-modal]");
  1017. modals.forEach(function (trigger) {
  1018. trigger.addEventListener("click", function (event) {
  1019. //event.preventDefault();
  1020. const modal = document.getElementById(trigger.dataset.modal);
  1021. modal.classList.add("phpdocumentor-modal__open");
  1022. loadExternalCodeSnippets(trigger.dataset.line)
  1023. const exits = modal.querySelectorAll("[data-exit-button]");
  1024. exits.forEach(function (exit) {
  1025. exit.addEventListener("click", function (event) {
  1026. event.preventDefault();
  1027. modal.classList.remove("phpdocumentor-modal__open");
  1028. });
  1029. });
  1030. });
  1031. });
  1032. </script>
  1033. </article>
  1034. <section data-search-results class="phpdocumentor-search-results phpdocumentor-search-results--hidden">
  1035. <section class="phpdocumentor-search-results__dialog">
  1036. <header class="phpdocumentor-search-results__header">
  1037. <h2 class="phpdocumentor-search-results__title">Search results</h2>
  1038. <button class="phpdocumentor-search-results__close"><i class="fas fa-times"></i></button>
  1039. </header>
  1040. <section class="phpdocumentor-search-results__body">
  1041. <ul class="phpdocumentor-search-results__entries"></ul>
  1042. </section>
  1043. </section>
  1044. </section>
  1045. </div>
  1046. </div>
  1047. <a href="classes/chillerlan-QRCode-Common-MaskPattern.html#top" class="phpdocumentor-back-to-top"><i class="fas fa-chevron-circle-up"></i></a>
  1048. </main>
  1049. <script>
  1050. cssVars({});
  1051. </script>
  1052. <script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/prism.min.js"></script>
  1053. <script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/autoloader/prism-autoloader.min.js"></script>
  1054. <script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-numbers/prism-line-numbers.min.js"></script>
  1055. <script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-highlight/prism-line-highlight.min.js"></script>
  1056. </body>
  1057. </html>