MCPcopy Create free account
hub / github.com/codemistic/Web-Development / putAlignmentPattern

Method putAlignmentPattern

text-to-qr/lib/phpqrcode/qrspec.php:299–334  ·  view source on GitHub ↗

----------------------------------------------------------------------

($version, &$frame, $width)

Source from the content-addressed store, hash-verified

297
298 //----------------------------------------------------------------------
299 public static function putAlignmentPattern($version, &$frame, $width)
300 {
301 if($version < 2)
302 return;
303
304 $d = self::$alignmentPattern[$version][1] - self::$alignmentPattern[$version][0];
305 if($d < 0) {
306 $w = 2;
307 } else {
308 $w = (int)(($width - self::$alignmentPattern[$version][0]) / $d + 2);
309 }
310
311 if($w * $w - 3 == 1) {
312 $x = self::$alignmentPattern[$version][0];
313 $y = self::$alignmentPattern[$version][0];
314 self::putAlignmentMarker($frame, $x, $y);
315 return;
316 }
317
318 $cx = self::$alignmentPattern[$version][0];
319 for($x=1; $x<$w - 1; $x++) {
320 self::putAlignmentMarker($frame, 6, $cx);
321 self::putAlignmentMarker($frame, $cx, 6);
322 $cx += $d;
323 }
324
325 $cy = self::$alignmentPattern[$version][0];
326 for($y=0; $y<$w-1; $y++) {
327 $cx = self::$alignmentPattern[$version][0];
328 for($x=0; $x<$w-1; $x++) {
329 self::putAlignmentMarker($frame, $cx, $cy);
330 $cx += $d;
331 }
332 $cy += $d;
333 }
334 }
335
336 // Version information pattern -----------------------------------------
337

Callers 1

createFrameMethod · 0.95

Calls 1

putAlignmentMarkerMethod · 0.95

Tested by

no test coverage detected