Files
php-qrcode/classes/chillerlan-QRCode-Common-MaskPattern.html
T

1594 lines
76 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Documentation</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<base href="../">
<link rel="icon" type="image/png" sizes="32x32" href="images/favicon-32x32.png"/>
<link rel="icon" type="image/png" sizes="16x16" href="images/favicon-16x16.png"/>
<link rel="icon" href="images/favicon.ico"/>
<link rel="apple-touch-icon" href="images/apple-touch-icon.png"/>
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/base.css">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@100;200;300;400;600;700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Source+Code+Pro:wght@400;600;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="css/template.css">
<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" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/themes/prism-okaidia.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-numbers/prism-line-numbers.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-highlight/prism-line-highlight.css">
<script src="https://cdn.jsdelivr.net/npm/fuse.js@3.4.6"></script>
<script src="https://cdn.jsdelivr.net/npm/css-vars-ponyfill@2"></script>
<script src="js/template.js"></script>
<script src="js/search.js"></script>
<script defer src="js/searchIndex.js"></script>
</head>
<body id="top">
<header class="phpdocumentor-header phpdocumentor-section">
<h1 class="phpdocumentor-title"><a href="" class="phpdocumentor-title__link">Documentation</a></h1>
<input class="phpdocumentor-header__menu-button" type="checkbox" id="menu-button" name="menu-button" />
<label class="phpdocumentor-header__menu-icon" for="menu-button">
<i class="fas fa-bars"></i>
</label>
<section data-search-form class="phpdocumentor-search">
<label>
<span class="visually-hidden">Search for</span>
<svg class="phpdocumentor-search__icon" width="21" height="20" viewBox="0 0 21 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="7.5" cy="7.5" r="6.5" stroke="currentColor" stroke-width="2"/>
<line x1="12.4892" y1="12.2727" x2="19.1559" y2="18.9393" stroke="currentColor" stroke-width="3"/>
</svg>
<input type="search" class="phpdocumentor-field phpdocumentor-search__field" placeholder="Loading .." disabled />
</label>
</section>
<nav class="phpdocumentor-topnav">
<ul class="phpdocumentor-topnav__menu">
<li class="phpdocumentor-topnav__menu-item -menu">
<a href="https://php-qrcode.readthedocs.io">
<span>
User Manual
</span>
</a>
</li>
<li class="phpdocumentor-topnav__menu-item -social">
<a href="https://github.com/chillerlan/php-qrcode">
<span>
<i class="fab fa-github"></i>
</span>
</a>
</li>
<li class="phpdocumentor-topnav__menu-item -social">
<a href="https://github.com/chillerlan/php-qrcode/discussions">
<span>
<i class="fas fa-envelope-open-text"></i>
</span>
</a>
</li>
</ul>
</nav>
</header>
<main class="phpdocumentor">
<div class="phpdocumentor-section">
<input class="phpdocumentor-sidebar__menu-button" type="checkbox" id="sidebar-button" name="sidebar-button" />
<label class="phpdocumentor-sidebar__menu-icon" for="sidebar-button">
Menu
</label>
<aside class="phpdocumentor-column -three phpdocumentor-sidebar">
<section class="phpdocumentor-sidebar__category -namespaces">
<h2 class="phpdocumentor-sidebar__category-header">Namespaces</h2>
<h4 class="phpdocumentor-sidebar__root-namespace">
<a href="namespaces/chillerlan.html" class="">chillerlan</a>
</h4>
<ul class="phpdocumentor-list">
<li>
<a href="namespaces/chillerlan-qrcode.html" class="">QRCode</a>
</li>
<li>
<a href="namespaces/chillerlan-qrcodetest.html" class="">QRCodeTest</a>
</li>
</ul>
</section>
<section class="phpdocumentor-sidebar__category -packages">
<h2 class="phpdocumentor-sidebar__category-header">Packages</h2>
<h4 class="phpdocumentor-sidebar__root-namespace">
<a href="packages/Application.html" class="">Application</a>
</h4>
</section>
<section class="phpdocumentor-sidebar__category -reports">
<h2 class="phpdocumentor-sidebar__category-header">Reports</h2>
<h3 class="phpdocumentor-sidebar__root-package"><a href="reports/deprecated.html">Deprecated</a></h3>
<h3 class="phpdocumentor-sidebar__root-package"><a href="reports/errors.html">Errors</a></h3>
<h3 class="phpdocumentor-sidebar__root-package"><a href="reports/markers.html">Markers</a></h3>
</section>
<section class="phpdocumentor-sidebar__category -indices">
<h2 class="phpdocumentor-sidebar__category-header">Indices</h2>
<h3 class="phpdocumentor-sidebar__root-package"><a href="indices/files.html">Files</a></h3>
</section>
</aside>
<div class="phpdocumentor-column -nine phpdocumentor-content">
<section>
<ul class="phpdocumentor-breadcrumbs">
<li class="phpdocumentor-breadcrumb"><a href="namespaces/chillerlan.html">chillerlan</a></li>
<li class="phpdocumentor-breadcrumb"><a href="namespaces/chillerlan-qrcode.html">QRCode</a></li>
<li class="phpdocumentor-breadcrumb"><a href="namespaces/chillerlan-qrcode-common.html">Common</a></li>
</ul>
<article class="phpdocumentor-element -class">
<h2 class="phpdocumentor-content__title">
MaskPattern
<div class="phpdocumentor-element__package">
in package
<ul class="phpdocumentor-breadcrumbs">
<li class="phpdocumentor-breadcrumb"><a href="packages/Application.html">Application</a></li>
</ul>
</div>
</h2>
<div class="phpdocumentor-label-line">
<div class="phpdocumentor-label phpdocumentor-label--success"><span>Final</span><span>Yes</span></div>
</div>
<aside class="phpdocumentor-element-found-in">
<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>
:
<span class="phpdocumentor-element-found-in__line">27</span>
</aside>
<p class="phpdocumentor-summary">ISO/IEC 18004:2000 Section 8.8.1
ISO/IEC 18004:2000 Section 8.8.2 - Evaluation of masking results</p>
<h5 class="phpdocumentor-tag-list__heading" id="tags">
Tags
<a href="classes/chillerlan-QRCode-Common-MaskPattern.html#tags" class="headerlink"><i class="fas fa-link"></i></a>
</h5>
<dl class="phpdocumentor-tag-list">
<dt class="phpdocumentor-tag-list__entry">
<span class="phpdocumentor-tag__name">see</span>
</dt>
<dd class="phpdocumentor-tag-list__definition">
<span class="phpdocumentor-tag-link"><a href="http://www.thonky.com/qr-code-tutorial/data-masking">http://www.thonky.com/qr-code-tutorial/data-masking</a></span>
</dd>
<dd class="phpdocumentor-tag-list__definition">
<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">https://github.com/zxing/zxing/blob/e9e2bd280bcaeabd59d0f955798384fe6c018a6c/core/src/main/java/com/google/zxing/qrcode/encoder/MaskUtil.java</a></span>
</dd>
</dl>
<h3 id="toc">
Table of Contents
<a href="classes/chillerlan-QRCode-Common-MaskPattern.html#toc" class="headerlink"><i class="fas fa-link"></i></a>
</h3>
<h4 id="toc-constants">
Constants
<a href="classes/chillerlan-QRCode-Common-MaskPattern.html#toc-constants" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<dl class="phpdocumentor-table-of-contents">
<dt class="phpdocumentor-table-of-contents__entry -constant -public">
<a class="" href="classes/chillerlan-QRCode-Common-MaskPattern.html#constant_AUTO">AUTO</a>
<span>
&nbsp;: int&nbsp;= -1 </span>
</dt>
<dt class="phpdocumentor-table-of-contents__entry -constant -public">
<a class="" href="classes/chillerlan-QRCode-Common-MaskPattern.html#constant_PATTERN_000">PATTERN_000</a>
<span>
&nbsp;: int&nbsp;= 0b0 </span>
</dt>
<dt class="phpdocumentor-table-of-contents__entry -constant -public">
<a class="" href="classes/chillerlan-QRCode-Common-MaskPattern.html#constant_PATTERN_001">PATTERN_001</a>
<span>
&nbsp;: int&nbsp;= 0b1 </span>
</dt>
<dt class="phpdocumentor-table-of-contents__entry -constant -public">
<a class="" href="classes/chillerlan-QRCode-Common-MaskPattern.html#constant_PATTERN_010">PATTERN_010</a>
<span>
&nbsp;: int&nbsp;= 0b10 </span>
</dt>
<dt class="phpdocumentor-table-of-contents__entry -constant -public">
<a class="" href="classes/chillerlan-QRCode-Common-MaskPattern.html#constant_PATTERN_011">PATTERN_011</a>
<span>
&nbsp;: int&nbsp;= 0b11 </span>
</dt>
<dt class="phpdocumentor-table-of-contents__entry -constant -public">
<a class="" href="classes/chillerlan-QRCode-Common-MaskPattern.html#constant_PATTERN_100">PATTERN_100</a>
<span>
&nbsp;: int&nbsp;= 0b100 </span>
</dt>
<dt class="phpdocumentor-table-of-contents__entry -constant -public">
<a class="" href="classes/chillerlan-QRCode-Common-MaskPattern.html#constant_PATTERN_101">PATTERN_101</a>
<span>
&nbsp;: int&nbsp;= 0b101 </span>
</dt>
<dt class="phpdocumentor-table-of-contents__entry -constant -public">
<a class="" href="classes/chillerlan-QRCode-Common-MaskPattern.html#constant_PATTERN_110">PATTERN_110</a>
<span>
&nbsp;: int&nbsp;= 0b110 </span>
</dt>
<dt class="phpdocumentor-table-of-contents__entry -constant -public">
<a class="" href="classes/chillerlan-QRCode-Common-MaskPattern.html#constant_PATTERN_111">PATTERN_111</a>
<span>
&nbsp;: int&nbsp;= 0b111 </span>
</dt>
<dt class="phpdocumentor-table-of-contents__entry -constant -public">
<a class="" href="classes/chillerlan-QRCode-Common-MaskPattern.html#constant_PATTERNS">PATTERNS</a>
<span>
&nbsp;: array&lt;string|int, mixed&gt;&nbsp;= [self::PATTERN_000, self::PATTERN_001, self::PA... </span>
</dt>
<dt class="phpdocumentor-table-of-contents__entry -constant -private">
<a class="" href="classes/chillerlan-QRCode-Common-MaskPattern.html#constant_PENALTY_N1">PENALTY_N1</a>
<span>
&nbsp;: int&nbsp;= 3 </span>
</dt>
<dt class="phpdocumentor-table-of-contents__entry -constant -private">
<a class="" href="classes/chillerlan-QRCode-Common-MaskPattern.html#constant_PENALTY_N2">PENALTY_N2</a>
<span>
&nbsp;: int&nbsp;= 3 </span>
</dt>
<dt class="phpdocumentor-table-of-contents__entry -constant -private">
<a class="" href="classes/chillerlan-QRCode-Common-MaskPattern.html#constant_PENALTY_N3">PENALTY_N3</a>
<span>
&nbsp;: int&nbsp;= 40 </span>
</dt>
<dt class="phpdocumentor-table-of-contents__entry -constant -private">
<a class="" href="classes/chillerlan-QRCode-Common-MaskPattern.html#constant_PENALTY_N4">PENALTY_N4</a>
<span>
&nbsp;: int&nbsp;= 10 </span>
</dt>
</dl>
<h4 id="toc-properties">
Properties
<a href="classes/chillerlan-QRCode-Common-MaskPattern.html#toc-properties" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<dl class="phpdocumentor-table-of-contents">
<dt class="phpdocumentor-table-of-contents__entry -property -public">
<a class="" href="classes/chillerlan-QRCode-Common-MaskPattern.html#property_currentPattern">$currentPattern</a>
<span>
&nbsp;: int </span>
</dt>
<dd>The current mask pattern value (0-7)</dd>
</dl>
<h4 id="toc-methods">
Methods
<a href="classes/chillerlan-QRCode-Common-MaskPattern.html#toc-methods" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<dl class="phpdocumentor-table-of-contents">
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a class="" href="classes/chillerlan-QRCode-Common-MaskPattern.html#method___construct">__construct()</a>
<span>
&nbsp;: mixed </span>
</dt>
<dd>MaskPattern constructor.</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a class="" href="classes/chillerlan-QRCode-Common-MaskPattern.html#method_getBestPattern">getBestPattern()</a>
<span>
&nbsp;: self </span>
</dt>
<dd>Evaluates the matrix of the given data interface and returns a new mask pattern instance for the best result</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a class="" href="classes/chillerlan-QRCode-Common-MaskPattern.html#method_getMask">getMask()</a>
<span>
&nbsp;: <abbr title="\Closure">Closure</abbr> </span>
</dt>
<dd>Returns a closure that applies the mask for the chosen mask pattern.</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a class="" href="classes/chillerlan-QRCode-Common-MaskPattern.html#method_testRule1">testRule1()</a>
<span>
&nbsp;: int </span>
</dt>
<dd>Apply mask penalty rule 1 and return the penalty. Find repetitive cells with the same color and
give penalty to them. Example: 00000 or 11111.</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a class="" href="classes/chillerlan-QRCode-Common-MaskPattern.html#method_testRule2">testRule2()</a>
<span>
&nbsp;: int </span>
</dt>
<dd>Apply mask penalty rule 2 and return the penalty. Find 2x2 blocks with the same color and give
penalty to them. This is actually equivalent to the spec&#039;s rule, which is to find MxN blocks and give a
penalty proportional to (M-1)x(N-1), because this is the number of 2x2 blocks inside such a block.</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a class="" href="classes/chillerlan-QRCode-Common-MaskPattern.html#method_testRule3">testRule3()</a>
<span>
&nbsp;: int </span>
</dt>
<dd>Apply mask penalty rule 3 and return the penalty. Find consecutive runs of 1:1:3:1:1:4
starting with black, or 4:1:1:3:1:1 starting with white, and give penalty to them. If we
find patterns like 000010111010000, we give penalty once.</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a class="" href="classes/chillerlan-QRCode-Common-MaskPattern.html#method_testRule4">testRule4()</a>
<span>
&nbsp;: int </span>
</dt>
<dd>Apply mask penalty rule 4 and return the penalty. Calculate the ratio of dark cells and give
penalty if the ratio is far from 50%. It gives 10 penalty for 5% distance.</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -private">
<a class="" href="classes/chillerlan-QRCode-Common-MaskPattern.html#method_applyRule1">applyRule1()</a>
<span>
&nbsp;: int </span>
</dt>
<dt class="phpdocumentor-table-of-contents__entry -method -private">
<a class="" href="classes/chillerlan-QRCode-Common-MaskPattern.html#method_isWhiteHorizontal">isWhiteHorizontal()</a>
<span>
&nbsp;: bool </span>
</dt>
<dt class="phpdocumentor-table-of-contents__entry -method -private">
<a class="" href="classes/chillerlan-QRCode-Common-MaskPattern.html#method_isWhiteVertical">isWhiteVertical()</a>
<span>
&nbsp;: bool </span>
</dt>
</dl>
<section class="phpdocumentor-constants">
<h3 class="phpdocumentor-elements__header" id="constants">
Constants
<a href="classes/chillerlan-QRCode-Common-MaskPattern.html#constants" class="headerlink"><i class="fas fa-link"></i></a>
</h3>
<article class="phpdocumentor-element -constant -public ">
<h4 class="phpdocumentor-element__name" id="constant_AUTO">
AUTO
<a href="classes/chillerlan-QRCode-Common-MaskPattern.html#constant_AUTO" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<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>
:
<span class="phpdocumentor-element-found-in__line">32</span>
</aside>
<code class="phpdocumentor-signature phpdocumentor-code ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__type">int</span>
<span class="phpdocumentor-signature__name">AUTO</span>
= <span class="phpdocumentor-signature__default-value">-1</span>
</code>
<h5 class="phpdocumentor-tag-list__heading" id="constant_AUTO_tags">
Tags
<a href="classes/chillerlan-QRCode-Common-MaskPattern.html#constant_AUTO_tags" class="headerlink"><i class="fas fa-link"></i></a>
</h5>
<dl class="phpdocumentor-tag-list">
<dt class="phpdocumentor-tag-list__entry">
<span class="phpdocumentor-tag__name">see</span>
</dt>
<dd class="phpdocumentor-tag-list__definition">
<span class="phpdocumentor-tag-link"><a href="classes/chillerlan-QRCode-QROptionsTrait.html#property_maskPattern"><abbr title="\chillerlan\QRCode\QROptionsTrait::$maskPattern">QROptionsTrait::$maskPattern</abbr></a></span>
</dd>
</dl>
</article>
<article class="phpdocumentor-element -constant -public ">
<h4 class="phpdocumentor-element__name" id="constant_PATTERN_000">
PATTERN_000
<a href="classes/chillerlan-QRCode-Common-MaskPattern.html#constant_PATTERN_000" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<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>
:
<span class="phpdocumentor-element-found-in__line">34</span>
</aside>
<code class="phpdocumentor-signature phpdocumentor-code ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__type">int</span>
<span class="phpdocumentor-signature__name">PATTERN_000</span>
= <span class="phpdocumentor-signature__default-value">0b0</span>
</code>
</article>
<article class="phpdocumentor-element -constant -public ">
<h4 class="phpdocumentor-element__name" id="constant_PATTERN_001">
PATTERN_001
<a href="classes/chillerlan-QRCode-Common-MaskPattern.html#constant_PATTERN_001" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<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>
:
<span class="phpdocumentor-element-found-in__line">35</span>
</aside>
<code class="phpdocumentor-signature phpdocumentor-code ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__type">int</span>
<span class="phpdocumentor-signature__name">PATTERN_001</span>
= <span class="phpdocumentor-signature__default-value">0b1</span>
</code>
</article>
<article class="phpdocumentor-element -constant -public ">
<h4 class="phpdocumentor-element__name" id="constant_PATTERN_010">
PATTERN_010
<a href="classes/chillerlan-QRCode-Common-MaskPattern.html#constant_PATTERN_010" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<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>
:
<span class="phpdocumentor-element-found-in__line">36</span>
</aside>
<code class="phpdocumentor-signature phpdocumentor-code ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__type">int</span>
<span class="phpdocumentor-signature__name">PATTERN_010</span>
= <span class="phpdocumentor-signature__default-value">0b10</span>
</code>
</article>
<article class="phpdocumentor-element -constant -public ">
<h4 class="phpdocumentor-element__name" id="constant_PATTERN_011">
PATTERN_011
<a href="classes/chillerlan-QRCode-Common-MaskPattern.html#constant_PATTERN_011" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<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>
:
<span class="phpdocumentor-element-found-in__line">37</span>
</aside>
<code class="phpdocumentor-signature phpdocumentor-code ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__type">int</span>
<span class="phpdocumentor-signature__name">PATTERN_011</span>
= <span class="phpdocumentor-signature__default-value">0b11</span>
</code>
</article>
<article class="phpdocumentor-element -constant -public ">
<h4 class="phpdocumentor-element__name" id="constant_PATTERN_100">
PATTERN_100
<a href="classes/chillerlan-QRCode-Common-MaskPattern.html#constant_PATTERN_100" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<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>
:
<span class="phpdocumentor-element-found-in__line">38</span>
</aside>
<code class="phpdocumentor-signature phpdocumentor-code ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__type">int</span>
<span class="phpdocumentor-signature__name">PATTERN_100</span>
= <span class="phpdocumentor-signature__default-value">0b100</span>
</code>
</article>
<article class="phpdocumentor-element -constant -public ">
<h4 class="phpdocumentor-element__name" id="constant_PATTERN_101">
PATTERN_101
<a href="classes/chillerlan-QRCode-Common-MaskPattern.html#constant_PATTERN_101" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<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>
:
<span class="phpdocumentor-element-found-in__line">39</span>
</aside>
<code class="phpdocumentor-signature phpdocumentor-code ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__type">int</span>
<span class="phpdocumentor-signature__name">PATTERN_101</span>
= <span class="phpdocumentor-signature__default-value">0b101</span>
</code>
</article>
<article class="phpdocumentor-element -constant -public ">
<h4 class="phpdocumentor-element__name" id="constant_PATTERN_110">
PATTERN_110
<a href="classes/chillerlan-QRCode-Common-MaskPattern.html#constant_PATTERN_110" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<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>
:
<span class="phpdocumentor-element-found-in__line">40</span>
</aside>
<code class="phpdocumentor-signature phpdocumentor-code ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__type">int</span>
<span class="phpdocumentor-signature__name">PATTERN_110</span>
= <span class="phpdocumentor-signature__default-value">0b110</span>
</code>
</article>
<article class="phpdocumentor-element -constant -public ">
<h4 class="phpdocumentor-element__name" id="constant_PATTERN_111">
PATTERN_111
<a href="classes/chillerlan-QRCode-Common-MaskPattern.html#constant_PATTERN_111" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<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>
:
<span class="phpdocumentor-element-found-in__line">41</span>
</aside>
<code class="phpdocumentor-signature phpdocumentor-code ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__type">int</span>
<span class="phpdocumentor-signature__name">PATTERN_111</span>
= <span class="phpdocumentor-signature__default-value">0b111</span>
</code>
</article>
<article class="phpdocumentor-element -constant -public ">
<h4 class="phpdocumentor-element__name" id="constant_PATTERNS">
PATTERNS
<a href="classes/chillerlan-QRCode-Common-MaskPattern.html#constant_PATTERNS" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<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>
:
<span class="phpdocumentor-element-found-in__line">46</span>
</aside>
<code class="phpdocumentor-signature phpdocumentor-code ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__type">array&lt;string|int, mixed&gt;</span>
<span class="phpdocumentor-signature__name">PATTERNS</span>
= <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>
</code>
</article>
<article class="phpdocumentor-element -constant -private ">
<h4 class="phpdocumentor-element__name" id="constant_PENALTY_N1">
PENALTY_N1
<a href="classes/chillerlan-QRCode-Common-MaskPattern.html#constant_PENALTY_N1" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<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>
:
<span class="phpdocumentor-element-found-in__line">62</span>
</aside>
<code class="phpdocumentor-signature phpdocumentor-code ">
<span class="phpdocumentor-signature__visibility">private</span>
<span class="phpdocumentor-signature__type">int</span>
<span class="phpdocumentor-signature__name">PENALTY_N1</span>
= <span class="phpdocumentor-signature__default-value">3</span>
</code>
</article>
<article class="phpdocumentor-element -constant -private ">
<h4 class="phpdocumentor-element__name" id="constant_PENALTY_N2">
PENALTY_N2
<a href="classes/chillerlan-QRCode-Common-MaskPattern.html#constant_PENALTY_N2" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<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>
:
<span class="phpdocumentor-element-found-in__line">63</span>
</aside>
<code class="phpdocumentor-signature phpdocumentor-code ">
<span class="phpdocumentor-signature__visibility">private</span>
<span class="phpdocumentor-signature__type">int</span>
<span class="phpdocumentor-signature__name">PENALTY_N2</span>
= <span class="phpdocumentor-signature__default-value">3</span>
</code>
</article>
<article class="phpdocumentor-element -constant -private ">
<h4 class="phpdocumentor-element__name" id="constant_PENALTY_N3">
PENALTY_N3
<a href="classes/chillerlan-QRCode-Common-MaskPattern.html#constant_PENALTY_N3" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<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>
:
<span class="phpdocumentor-element-found-in__line">64</span>
</aside>
<code class="phpdocumentor-signature phpdocumentor-code ">
<span class="phpdocumentor-signature__visibility">private</span>
<span class="phpdocumentor-signature__type">int</span>
<span class="phpdocumentor-signature__name">PENALTY_N3</span>
= <span class="phpdocumentor-signature__default-value">40</span>
</code>
</article>
<article class="phpdocumentor-element -constant -private ">
<h4 class="phpdocumentor-element__name" id="constant_PENALTY_N4">
PENALTY_N4
<a href="classes/chillerlan-QRCode-Common-MaskPattern.html#constant_PENALTY_N4" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<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>
:
<span class="phpdocumentor-element-found-in__line">65</span>
</aside>
<code class="phpdocumentor-signature phpdocumentor-code ">
<span class="phpdocumentor-signature__visibility">private</span>
<span class="phpdocumentor-signature__type">int</span>
<span class="phpdocumentor-signature__name">PENALTY_N4</span>
= <span class="phpdocumentor-signature__default-value">10</span>
</code>
</article>
</section>
<section class="phpdocumentor-properties">
<h3 class="phpdocumentor-elements__header" id="properties">
Properties
<a href="classes/chillerlan-QRCode-Common-MaskPattern.html#properties" class="headerlink"><i class="fas fa-link"></i></a>
</h3>
<article
class="
phpdocumentor-element
-property
-public
"
>
<h4 class="phpdocumentor-element__name" id="property_currentPattern">
$currentPattern
<a href="classes/chillerlan-QRCode-Common-MaskPattern.html#property_currentPattern" class="headerlink"><i class="fas fa-link"></i></a>
<span class="phpdocumentor-element__modifiers">
</span>
</h4>
<aside class="phpdocumentor-element-found-in">
<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>
:
<span class="phpdocumentor-element-found-in__line">70</span>
</aside>
<p class="phpdocumentor-summary">The current mask pattern value (0-7)</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public private(set)</span>
<span class="phpdocumentor-signature__type">int</span>
<span class="phpdocumentor-signature__name">$currentPattern</span>
</code>
</article>
</section>
<section class="phpdocumentor-methods">
<h3 class="phpdocumentor-elements__header" id="methods">
Methods
<a href="classes/chillerlan-QRCode-Common-MaskPattern.html#methods" class="headerlink"><i class="fas fa-link"></i></a>
</h3>
<article
class="phpdocumentor-element
-method
-public
"
>
<h4 class="phpdocumentor-element__name" id="method___construct">
__construct()
<a href="classes/chillerlan-QRCode-Common-MaskPattern.html#method___construct" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<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>
:
<span class="phpdocumentor-element-found-in__line">77</span>
</aside>
<p class="phpdocumentor-summary">MaskPattern constructor.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__name">__construct</span><span>(</span><span class="phpdocumentor-signature__argument"><span class="phpdocumentor-signature__argument__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>
<div class="phpdocumentor-label-line">
</div>
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-argument-list__argument__name">$maskPattern</span>
: <span class="phpdocumentor-argument-list__argument__type">int</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
</dd>
</dl>
<h5 class="phpdocumentor-tag-list__heading" id="method___construct_tags">
Tags
<a href="classes/chillerlan-QRCode-Common-MaskPattern.html#method___construct_tags" class="headerlink"><i class="fas fa-link"></i></a>
</h5>
<dl class="phpdocumentor-tag-list">
<dt class="phpdocumentor-tag-list__entry">
<span class="phpdocumentor-tag__name">throws</span>
</dt>
<dd class="phpdocumentor-tag-list__definition">
<span class="phpdocumentor-tag-link"><a href="classes/chillerlan-QRCode-QRCodeException.html"><abbr title="\chillerlan\QRCode\QRCodeException">QRCodeException</abbr></a></span>
</dd>
</dl>
</article>
<article
class="phpdocumentor-element
-method
-public
-static "
>
<h4 class="phpdocumentor-element__name" id="method_getBestPattern">
getBestPattern()
<a href="classes/chillerlan-QRCode-Common-MaskPattern.html#method_getBestPattern" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<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>
:
<span class="phpdocumentor-element-found-in__line">112</span>
</aside>
<p class="phpdocumentor-summary">Evaluates the matrix of the given data interface and returns a new mask pattern instance for the best result</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<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__type"><a href="classes/chillerlan-QRCode-Data-QRMatrix.html"><abbr title="\chillerlan\QRCode\Data\QRMatrix">QRMatrix</abbr></a>&nbsp;</span><span class="phpdocumentor-signature__argument__name">$QRMatrix</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">self</span></code>
<div class="phpdocumentor-label-line">
</div>
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-argument-list__argument__name">$QRMatrix</span>
: <span class="phpdocumentor-argument-list__argument__type"><a href="classes/chillerlan-QRCode-Data-QRMatrix.html"><abbr title="\chillerlan\QRCode\Data\QRMatrix">QRMatrix</abbr></a></span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
</dd>
</dl>
<section>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">self</span>
</section>
</article>
<article
class="phpdocumentor-element
-method
-public
"
>
<h4 class="phpdocumentor-element__name" id="method_getMask">
getMask()
<a href="classes/chillerlan-QRCode-Common-MaskPattern.html#method_getMask" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<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>
:
<span class="phpdocumentor-element-found-in__line">95</span>
</aside>
<p class="phpdocumentor-summary">Returns a closure that applies the mask for the chosen mask pattern.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<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>
<div class="phpdocumentor-label-line">
</div>
<section class="phpdocumentor-description"><p>Note that the diagram in section 6.8.1 is misleading since it indicates that $i is column position
and $j is row position. In fact, as the text says, $i is row position and $j is column position.</p>
</section>
<h5 class="phpdocumentor-tag-list__heading" id="method_getMask_tags">
Tags
<a href="classes/chillerlan-QRCode-Common-MaskPattern.html#method_getMask_tags" class="headerlink"><i class="fas fa-link"></i></a>
</h5>
<dl class="phpdocumentor-tag-list">
<dt class="phpdocumentor-tag-list__entry">
<span class="phpdocumentor-tag__name">see</span>
</dt>
<dd class="phpdocumentor-tag-list__definition">
<span class="phpdocumentor-tag-link"><a href="https://www.thonky.com/qr-code-tutorial/mask-patterns">https://www.thonky.com/qr-code-tutorial/mask-patterns</a></span>
</dd>
<dd class="phpdocumentor-tag-list__definition">
<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">https://github.com/zxing/zxing/blob/e9e2bd280bcaeabd59d0f955798384fe6c018a6c/core/src/main/java/com/google/zxing/qrcode/decoder/DataMask.java#L32-L117</a></span>
</dd>
</dl>
<section>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type"><abbr title="\Closure">Closure</abbr></span>
</section>
</article>
<article
class="phpdocumentor-element
-method
-public
-static "
>
<h4 class="phpdocumentor-element__name" id="method_testRule1">
testRule1()
<a href="classes/chillerlan-QRCode-Common-MaskPattern.html#method_testRule1" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<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>
:
<span class="phpdocumentor-element-found-in__line">137</span>
</aside>
<p class="phpdocumentor-summary">Apply mask penalty rule 1 and return the penalty. Find repetitive cells with the same color and
give penalty to them. Example: 00000 or 11111.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<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__type">array&lt;string|int, array&lt;string|int, bool&gt;&gt;&nbsp;</span><span class="phpdocumentor-signature__argument__name">$matrix</span></span><span class="phpdocumentor-signature__argument"><span>, </span><span class="phpdocumentor-signature__argument__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__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>
<div class="phpdocumentor-label-line">
</div>
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-argument-list__argument__name">$matrix</span>
: <span class="phpdocumentor-argument-list__argument__type">array&lt;string|int, array&lt;string|int, bool&gt;&gt;</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
</dd>
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-argument-list__argument__name">$height</span>
: <span class="phpdocumentor-argument-list__argument__type">int</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
</dd>
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-argument-list__argument__name">$width</span>
: <span class="phpdocumentor-argument-list__argument__type">int</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
</dd>
</dl>
<section>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">int</span>
</section>
</article>
<article
class="phpdocumentor-element
-method
-public
-static "
>
<h4 class="phpdocumentor-element__name" id="method_testRule2">
testRule2()
<a href="classes/chillerlan-QRCode-Common-MaskPattern.html#method_testRule2" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<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>
:
<span class="phpdocumentor-element-found-in__line">191</span>
</aside>
<p class="phpdocumentor-summary">Apply mask penalty rule 2 and return the penalty. Find 2x2 blocks with the same color and give
penalty to them. This is actually equivalent to the spec&#039;s rule, which is to find MxN blocks and give a
penalty proportional to (M-1)x(N-1), because this is the number of 2x2 blocks inside such a block.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<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__type">array&lt;string|int, array&lt;string|int, bool&gt;&gt;&nbsp;</span><span class="phpdocumentor-signature__argument__name">$matrix</span></span><span class="phpdocumentor-signature__argument"><span>, </span><span class="phpdocumentor-signature__argument__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__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>
<div class="phpdocumentor-label-line">
</div>
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-argument-list__argument__name">$matrix</span>
: <span class="phpdocumentor-argument-list__argument__type">array&lt;string|int, array&lt;string|int, bool&gt;&gt;</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
</dd>
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-argument-list__argument__name">$height</span>
: <span class="phpdocumentor-argument-list__argument__type">int</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
</dd>
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-argument-list__argument__name">$width</span>
: <span class="phpdocumentor-argument-list__argument__type">int</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
</dd>
</dl>
<section>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">int</span>
</section>
</article>
<article
class="phpdocumentor-element
-method
-public
-static "
>
<h4 class="phpdocumentor-element__name" id="method_testRule3">
testRule3()
<a href="classes/chillerlan-QRCode-Common-MaskPattern.html#method_testRule3" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<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>
:
<span class="phpdocumentor-element-found-in__line">226</span>
</aside>
<p class="phpdocumentor-summary">Apply mask penalty rule 3 and return the penalty. Find consecutive runs of 1:1:3:1:1:4
starting with black, or 4:1:1:3:1:1 starting with white, and give penalty to them. If we
find patterns like 000010111010000, we give penalty once.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<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__type">array&lt;string|int, array&lt;string|int, bool&gt;&gt;&nbsp;</span><span class="phpdocumentor-signature__argument__name">$matrix</span></span><span class="phpdocumentor-signature__argument"><span>, </span><span class="phpdocumentor-signature__argument__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__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>
<div class="phpdocumentor-label-line">
</div>
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-argument-list__argument__name">$matrix</span>
: <span class="phpdocumentor-argument-list__argument__type">array&lt;string|int, array&lt;string|int, bool&gt;&gt;</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
</dd>
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-argument-list__argument__name">$height</span>
: <span class="phpdocumentor-argument-list__argument__type">int</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
</dd>
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-argument-list__argument__name">$width</span>
: <span class="phpdocumentor-argument-list__argument__type">int</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
</dd>
</dl>
<section>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">int</span>
</section>
</article>
<article
class="phpdocumentor-element
-method
-public
-static "
>
<h4 class="phpdocumentor-element__name" id="method_testRule4">
testRule4()
<a href="classes/chillerlan-QRCode-Common-MaskPattern.html#method_testRule4" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<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>
:
<span class="phpdocumentor-element-found-in__line">314</span>
</aside>
<p class="phpdocumentor-summary">Apply mask penalty rule 4 and return the penalty. Calculate the ratio of dark cells and give
penalty if the ratio is far from 50%. It gives 10 penalty for 5% distance.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<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__type">array&lt;string|int, array&lt;string|int, bool&gt;&gt;&nbsp;</span><span class="phpdocumentor-signature__argument__name">$matrix</span></span><span class="phpdocumentor-signature__argument"><span>, </span><span class="phpdocumentor-signature__argument__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__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>
<div class="phpdocumentor-label-line">
</div>
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-argument-list__argument__name">$matrix</span>
: <span class="phpdocumentor-argument-list__argument__type">array&lt;string|int, array&lt;string|int, bool&gt;&gt;</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
</dd>
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-argument-list__argument__name">$height</span>
: <span class="phpdocumentor-argument-list__argument__type">int</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
</dd>
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-argument-list__argument__name">$width</span>
: <span class="phpdocumentor-argument-list__argument__type">int</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
</dd>
</dl>
<section>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">int</span>
</section>
</article>
<article
class="phpdocumentor-element
-method
-private
-static "
>
<h4 class="phpdocumentor-element__name" id="method_applyRule1">
applyRule1()
<a href="classes/chillerlan-QRCode-Common-MaskPattern.html#method_applyRule1" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<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>
:
<span class="phpdocumentor-element-found-in__line">156</span>
</aside>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">private</span>
<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__type">array&lt;string|int, bool&gt;&nbsp;</span><span class="phpdocumentor-signature__argument__name">$rc</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">int</span></code>
<div class="phpdocumentor-label-line">
</div>
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-argument-list__argument__name">$rc</span>
: <span class="phpdocumentor-argument-list__argument__type">array&lt;string|int, bool&gt;</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
</dd>
</dl>
<section>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">int</span>
</section>
</article>
<article
class="phpdocumentor-element
-method
-private
-static "
>
<h4 class="phpdocumentor-element__name" id="method_isWhiteHorizontal">
isWhiteHorizontal()
<a href="classes/chillerlan-QRCode-Common-MaskPattern.html#method_isWhiteHorizontal" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<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>
:
<span class="phpdocumentor-element-found-in__line">275</span>
</aside>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">private</span>
<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__type">array&lt;string|int, bool&gt;&nbsp;</span><span class="phpdocumentor-signature__argument__name">$row</span></span><span class="phpdocumentor-signature__argument"><span>, </span><span class="phpdocumentor-signature__argument__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__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__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>
<div class="phpdocumentor-label-line">
</div>
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-argument-list__argument__name">$row</span>
: <span class="phpdocumentor-argument-list__argument__type">array&lt;string|int, bool&gt;</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
</dd>
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-argument-list__argument__name">$width</span>
: <span class="phpdocumentor-argument-list__argument__type">int</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
</dd>
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-argument-list__argument__name">$from</span>
: <span class="phpdocumentor-argument-list__argument__type">int</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
</dd>
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-argument-list__argument__name">$to</span>
: <span class="phpdocumentor-argument-list__argument__type">int</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
</dd>
</dl>
<section>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">bool</span>
</section>
</article>
<article
class="phpdocumentor-element
-method
-private
-static "
>
<h4 class="phpdocumentor-element__name" id="method_isWhiteVertical">
isWhiteVertical()
<a href="classes/chillerlan-QRCode-Common-MaskPattern.html#method_isWhiteVertical" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<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>
:
<span class="phpdocumentor-element-found-in__line">293</span>
</aside>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">private</span>
<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__type">array&lt;string|int, array&lt;string|int, bool&gt;&gt;&nbsp;</span><span class="phpdocumentor-signature__argument__name">$matrix</span></span><span class="phpdocumentor-signature__argument"><span>, </span><span class="phpdocumentor-signature__argument__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__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__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__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>
<div class="phpdocumentor-label-line">
</div>
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-argument-list__argument__name">$matrix</span>
: <span class="phpdocumentor-argument-list__argument__type">array&lt;string|int, array&lt;string|int, bool&gt;&gt;</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
</dd>
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-argument-list__argument__name">$height</span>
: <span class="phpdocumentor-argument-list__argument__type">int</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
</dd>
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-argument-list__argument__name">$x</span>
: <span class="phpdocumentor-argument-list__argument__type">int</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
</dd>
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-argument-list__argument__name">$from</span>
: <span class="phpdocumentor-argument-list__argument__type">int</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
</dd>
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-argument-list__argument__name">$to</span>
: <span class="phpdocumentor-argument-list__argument__type">int</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
</dd>
</dl>
<section>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">bool</span>
</section>
</article>
</section>
</article>
</section>
<section class="phpdocumentor-on-this-page__sidebar">
<section class="phpdocumentor-on-this-page__content">
<strong class="phpdocumentor-on-this-page__title">On this page</strong>
<ul class="phpdocumentor-list -clean">
<li class="phpdocumentor-on-this-page-section__title">Table Of Contents</li>
<li>
<ul class="phpdocumentor-list -clean">
<li><a href="classes/chillerlan-QRCode-Common-MaskPattern.html#toc-constants">Constants</a></li>
<li><a href="classes/chillerlan-QRCode-Common-MaskPattern.html#toc-properties">Properties</a></li>
<li><a href="classes/chillerlan-QRCode-Common-MaskPattern.html#toc-methods">Methods</a></li>
</ul>
</li>
<li class="phpdocumentor-on-this-page-section__title">Constants</li>
<li>
<ul class="phpdocumentor-list -clean">
<li class=""><a href="classes/chillerlan-QRCode-Common-MaskPattern.html#constant_AUTO">AUTO</a></li>
<li class=""><a href="classes/chillerlan-QRCode-Common-MaskPattern.html#constant_PATTERN_000">PATTERN_000</a></li>
<li class=""><a href="classes/chillerlan-QRCode-Common-MaskPattern.html#constant_PATTERN_001">PATTERN_001</a></li>
<li class=""><a href="classes/chillerlan-QRCode-Common-MaskPattern.html#constant_PATTERN_010">PATTERN_010</a></li>
<li class=""><a href="classes/chillerlan-QRCode-Common-MaskPattern.html#constant_PATTERN_011">PATTERN_011</a></li>
<li class=""><a href="classes/chillerlan-QRCode-Common-MaskPattern.html#constant_PATTERN_100">PATTERN_100</a></li>
<li class=""><a href="classes/chillerlan-QRCode-Common-MaskPattern.html#constant_PATTERN_101">PATTERN_101</a></li>
<li class=""><a href="classes/chillerlan-QRCode-Common-MaskPattern.html#constant_PATTERN_110">PATTERN_110</a></li>
<li class=""><a href="classes/chillerlan-QRCode-Common-MaskPattern.html#constant_PATTERN_111">PATTERN_111</a></li>
<li class=""><a href="classes/chillerlan-QRCode-Common-MaskPattern.html#constant_PATTERNS">PATTERNS</a></li>
<li class=""><a href="classes/chillerlan-QRCode-Common-MaskPattern.html#constant_PENALTY_N1">PENALTY_N1</a></li>
<li class=""><a href="classes/chillerlan-QRCode-Common-MaskPattern.html#constant_PENALTY_N2">PENALTY_N2</a></li>
<li class=""><a href="classes/chillerlan-QRCode-Common-MaskPattern.html#constant_PENALTY_N3">PENALTY_N3</a></li>
<li class=""><a href="classes/chillerlan-QRCode-Common-MaskPattern.html#constant_PENALTY_N4">PENALTY_N4</a></li>
</ul>
</li>
<li class="phpdocumentor-on-this-page-section__title">Properties</li>
<li>
<ul class="phpdocumentor-list -clean">
<li class=""><a href="classes/chillerlan-QRCode-Common-MaskPattern.html#property_currentPattern">$currentPattern</a></li>
</ul>
</li>
<li class="phpdocumentor-on-this-page-section__title">Methods</li>
<li>
<ul class="phpdocumentor-list -clean">
<li class=""><a href="classes/chillerlan-QRCode-Common-MaskPattern.html#method___construct">__construct()</a></li>
<li class=""><a href="classes/chillerlan-QRCode-Common-MaskPattern.html#method_getBestPattern">getBestPattern()</a></li>
<li class=""><a href="classes/chillerlan-QRCode-Common-MaskPattern.html#method_getMask">getMask()</a></li>
<li class=""><a href="classes/chillerlan-QRCode-Common-MaskPattern.html#method_testRule1">testRule1()</a></li>
<li class=""><a href="classes/chillerlan-QRCode-Common-MaskPattern.html#method_testRule2">testRule2()</a></li>
<li class=""><a href="classes/chillerlan-QRCode-Common-MaskPattern.html#method_testRule3">testRule3()</a></li>
<li class=""><a href="classes/chillerlan-QRCode-Common-MaskPattern.html#method_testRule4">testRule4()</a></li>
<li class=""><a href="classes/chillerlan-QRCode-Common-MaskPattern.html#method_applyRule1">applyRule1()</a></li>
<li class=""><a href="classes/chillerlan-QRCode-Common-MaskPattern.html#method_isWhiteHorizontal">isWhiteHorizontal()</a></li>
<li class=""><a href="classes/chillerlan-QRCode-Common-MaskPattern.html#method_isWhiteVertical">isWhiteVertical()</a></li>
</ul>
</li>
</ul>
</section>
</section>
</div>
<section data-search-results class="phpdocumentor-search-results phpdocumentor-search-results--hidden">
<section class="phpdocumentor-search-results__dialog">
<header class="phpdocumentor-search-results__header">
<h2 class="phpdocumentor-search-results__title">Search results</h2>
<button class="phpdocumentor-search-results__close"><i class="fas fa-times"></i></button>
</header>
<section class="phpdocumentor-search-results__body">
<ul class="phpdocumentor-search-results__entries"></ul>
</section>
</section>
</section>
</div>
<a href="classes/chillerlan-QRCode-Common-MaskPattern.html#top" class="phpdocumentor-back-to-top"><i class="fas fa-chevron-circle-up"></i></a>
</main>
<script>
cssVars({});
</script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/prism.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/autoloader/prism-autoloader.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-numbers/prism-line-numbers.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-highlight/prism-line-highlight.min.js"></script>
</body>
</html>