chillerlan-QRCode-Common-MaskPattern.html 68 KB

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