PDF ohne PWD in V1.4; FDPI hinzugefügt
This commit is contained in:
116
fpdf186/FPDI-master/src/Math/Matrix.php
Normal file
116
fpdf186/FPDI-master/src/Math/Matrix.php
Normal file
@ -0,0 +1,116 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of FPDI
|
||||
*
|
||||
* @package setasign\Fpdi
|
||||
* @copyright Copyright (c) 2023 Setasign GmbH & Co. KG (https://www.setasign.com)
|
||||
* @license http://opensource.org/licenses/mit-license The MIT License
|
||||
*/
|
||||
|
||||
namespace setasign\Fpdi\Math;
|
||||
|
||||
/**
|
||||
* A simple 2D-Matrix class
|
||||
*/
|
||||
class Matrix
|
||||
{
|
||||
/**
|
||||
* @var float
|
||||
*/
|
||||
protected $a;
|
||||
|
||||
/**
|
||||
* @var float
|
||||
*/
|
||||
protected $b;
|
||||
|
||||
/**
|
||||
* @var float
|
||||
*/
|
||||
protected $c;
|
||||
|
||||
/**
|
||||
* @var float
|
||||
*/
|
||||
protected $d;
|
||||
|
||||
/**
|
||||
* @var float
|
||||
*/
|
||||
protected $e;
|
||||
|
||||
/**
|
||||
* @var float
|
||||
*/
|
||||
protected $f;
|
||||
|
||||
/**
|
||||
* @param int|float $a
|
||||
* @param int|float $b
|
||||
* @param int|float $c
|
||||
* @param int|float $d
|
||||
* @param int|float $e
|
||||
* @param int|float $f
|
||||
*/
|
||||
public function __construct($a = 1, $b = 0, $c = 0, $d = 1, $e = 0, $f = 0)
|
||||
{
|
||||
$this->a = (float)$a;
|
||||
$this->b = (float)$b;
|
||||
$this->c = (float)$c;
|
||||
$this->d = (float)$d;
|
||||
$this->e = (float)$e;
|
||||
$this->f = (float)$f;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float[]
|
||||
*/
|
||||
public function getValues()
|
||||
{
|
||||
return [$this->a, $this->b, $this->c, $this->d, $this->e, $this->f];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Matrix $by
|
||||
* @return Matrix
|
||||
*/
|
||||
public function multiply(self $by)
|
||||
{
|
||||
$a =
|
||||
$this->a * $by->a
|
||||
+ $this->b * $by->c
|
||||
//+ 0 * $by->e
|
||||
;
|
||||
|
||||
$b =
|
||||
$this->a * $by->b
|
||||
+ $this->b * $by->d
|
||||
//+ 0 * $by->f
|
||||
;
|
||||
|
||||
$c =
|
||||
$this->c * $by->a
|
||||
+ $this->d * $by->c
|
||||
//+ 0 * $by->e
|
||||
;
|
||||
|
||||
$d =
|
||||
$this->c * $by->b
|
||||
+ $this->d * $by->d
|
||||
//+ 0 * $by->f
|
||||
;
|
||||
|
||||
$e =
|
||||
$this->e * $by->a
|
||||
+ $this->f * $by->c
|
||||
+ /*1 * */$by->e;
|
||||
|
||||
$f =
|
||||
$this->e * $by->b
|
||||
+ $this->f * $by->d
|
||||
+ /*1 * */$by->f;
|
||||
|
||||
return new self($a, $b, $c, $d, $e, $f);
|
||||
}
|
||||
}
|
66
fpdf186/FPDI-master/src/Math/Vector.php
Normal file
66
fpdf186/FPDI-master/src/Math/Vector.php
Normal file
@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of FPDI
|
||||
*
|
||||
* @package setasign\Fpdi
|
||||
* @copyright Copyright (c) 2023 Setasign GmbH & Co. KG (https://www.setasign.com)
|
||||
* @license http://opensource.org/licenses/mit-license The MIT License
|
||||
*/
|
||||
|
||||
namespace setasign\Fpdi\Math;
|
||||
|
||||
/**
|
||||
* A simple 2D-Vector class
|
||||
*/
|
||||
class Vector
|
||||
{
|
||||
/**
|
||||
* @var float
|
||||
*/
|
||||
protected $x;
|
||||
|
||||
/**
|
||||
* @var float
|
||||
*/
|
||||
protected $y;
|
||||
|
||||
/**
|
||||
* @param int|float $x
|
||||
* @param int|float $y
|
||||
*/
|
||||
public function __construct($x = .0, $y = .0)
|
||||
{
|
||||
$this->x = (float)$x;
|
||||
$this->y = (float)$y;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float
|
||||
*/
|
||||
public function getX()
|
||||
{
|
||||
return $this->x;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float
|
||||
*/
|
||||
public function getY()
|
||||
{
|
||||
return $this->y;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Matrix $matrix
|
||||
* @return Vector
|
||||
*/
|
||||
public function multiplyWithMatrix(Matrix $matrix)
|
||||
{
|
||||
list($a, $b, $c, $d, $e, $f) = $matrix->getValues();
|
||||
$x = $a * $this->x + $c * $this->y + $e;
|
||||
$y = $b * $this->x + $d * $this->y + $f;
|
||||
|
||||
return new self($x, $y);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user