PluginProbe ʕ •ᴥ•ʔ
WP 2FA – Two-factor authentication for WordPress / 2.9.1
WP 2FA – Two-factor authentication for WordPress v2.9.1
4.0.0 1.7.1 2.0.0 2.0.1 2.1.0 2.2.0 2.2.1 2.3.0 2.4.0 2.4.1 2.4.2 2.5.0 2.6.0 2.6.1 2.6.2 2.6.3 2.6.4 2.7.0 2.8.0 2.9.0 2.9.1 2.9.2 2.9.3 3.0.0 3.0.1 3.1.0 3.1.1 3.1.1.2 trunk 1.2.0 1.3.0 1.4.0 1.4.1 1.4.2 1.5.0 1.5.1 1.5.2 1.6.0 1.6.1 1.6.2 1.7.0
wp-2fa / includes / classes / bacon / bacon-qr-code / src / Renderer / Image / TransformationMatrix.php
wp-2fa / includes / classes / bacon / bacon-qr-code / src / Renderer / Image Last commit date
EpsImageBackEnd.php 11 months ago ImageBackEndInterface.php 11 months ago ImagickImageBackEnd.php 11 months ago SvgImageBackEnd.php 11 months ago TransformationMatrix.php 11 months ago
TransformationMatrix.php
56 lines
1 <?php
2
3 declare (strict_types=1);
4 namespace WP2FA_Vendor\BaconQrCode\Renderer\Image;
5
6 final class TransformationMatrix
7 {
8 /**
9 * @var float[]
10 */
11 private $values;
12 public function __construct()
13 {
14 $this->values = [1, 0, 0, 1, 0, 0];
15 }
16 public function multiply(self $other) : self
17 {
18 $matrix = new self();
19 $matrix->values[0] = $this->values[0] * $other->values[0] + $this->values[2] * $other->values[1];
20 $matrix->values[1] = $this->values[1] * $other->values[0] + $this->values[3] * $other->values[1];
21 $matrix->values[2] = $this->values[0] * $other->values[2] + $this->values[2] * $other->values[3];
22 $matrix->values[3] = $this->values[1] * $other->values[2] + $this->values[3] * $other->values[3];
23 $matrix->values[4] = $this->values[0] * $other->values[4] + $this->values[2] * $other->values[5] + $this->values[4];
24 $matrix->values[5] = $this->values[1] * $other->values[4] + $this->values[3] * $other->values[5] + $this->values[5];
25 return $matrix;
26 }
27 public static function scale(float $size) : self
28 {
29 $matrix = new self();
30 $matrix->values = [$size, 0, 0, $size, 0, 0];
31 return $matrix;
32 }
33 public static function translate(float $x, float $y) : self
34 {
35 $matrix = new self();
36 $matrix->values = [1, 0, 0, 1, $x, $y];
37 return $matrix;
38 }
39 public static function rotate(int $degrees) : self
40 {
41 $matrix = new self();
42 $rad = \deg2rad($degrees);
43 $matrix->values = [\cos($rad), \sin($rad), -\sin($rad), \cos($rad), 0, 0];
44 return $matrix;
45 }
46 /**
47 * Applies this matrix onto a point and returns the resulting viewport point.
48 *
49 * @return float[]
50 */
51 public function apply(float $x, float $y) : array
52 {
53 return [$x * $this->values[0] + $y * $this->values[2] + $this->values[4], $x * $this->values[1] + $y * $this->values[3] + $this->values[5]];
54 }
55 }
56