wp-2fa
/
includes
/
classes
/
bacon
/
bacon-qr-code
/
src
/
Renderer
/
Image
/
ImageBackEndInterface.php
EpsImageBackEnd.php
1 week ago
ImageBackEndInterface.php
1 week ago
ImagickImageBackEnd.php
1 week ago
SvgImageBackEnd.php
1 week ago
TransformationMatrix.php
1 week ago
index.php
1 week ago
ImageBackEndInterface.php
72 lines
| 1 | <?php |
| 2 | |
| 3 | declare (strict_types=1); |
| 4 | namespace WP2FA_Vendor\BaconQrCode\Renderer\Image; |
| 5 | |
| 6 | use WP2FA_Vendor\BaconQrCode\Exception\RuntimeException; |
| 7 | use WP2FA_Vendor\BaconQrCode\Renderer\Color\ColorInterface; |
| 8 | use WP2FA_Vendor\BaconQrCode\Renderer\Path\Path; |
| 9 | use WP2FA_Vendor\BaconQrCode\Renderer\RendererStyle\Gradient; |
| 10 | /** |
| 11 | * Interface for back ends able to to produce path based images. |
| 12 | */ |
| 13 | interface ImageBackEndInterface |
| 14 | { |
| 15 | /** |
| 16 | * Starts a new image. |
| 17 | * |
| 18 | * If a previous image was already started, previous data get erased. |
| 19 | */ |
| 20 | public function new(int $size, ColorInterface $backgroundColor) : void; |
| 21 | /** |
| 22 | * Transforms all following drawing operation coordinates by scaling them by a given factor. |
| 23 | * |
| 24 | * @throws RuntimeException if no image was started yet. |
| 25 | */ |
| 26 | public function scale(float $size) : void; |
| 27 | /** |
| 28 | * Transforms all following drawing operation coordinates by translating them by a given amount. |
| 29 | * |
| 30 | * @throws RuntimeException if no image was started yet. |
| 31 | */ |
| 32 | public function translate(float $x, float $y) : void; |
| 33 | /** |
| 34 | * Transforms all following drawing operation coordinates by rotating them by a given amount. |
| 35 | * |
| 36 | * @throws RuntimeException if no image was started yet. |
| 37 | */ |
| 38 | public function rotate(int $degrees) : void; |
| 39 | /** |
| 40 | * Pushes the current coordinate transformation onto a stack. |
| 41 | * |
| 42 | * @throws RuntimeException if no image was started yet. |
| 43 | */ |
| 44 | public function push() : void; |
| 45 | /** |
| 46 | * Pops the last coordinate transformation from a stack. |
| 47 | * |
| 48 | * @throws RuntimeException if no image was started yet. |
| 49 | */ |
| 50 | public function pop() : void; |
| 51 | /** |
| 52 | * Draws a path with a given color. |
| 53 | * |
| 54 | * @throws RuntimeException if no image was started yet. |
| 55 | */ |
| 56 | public function drawPathWithColor(Path $path, ColorInterface $color) : void; |
| 57 | /** |
| 58 | * Draws a path with a given gradient which spans the box described by the position and size. |
| 59 | * |
| 60 | * @throws RuntimeException if no image was started yet. |
| 61 | */ |
| 62 | public function drawPathWithGradient(Path $path, Gradient $gradient, float $x, float $y, float $width, float $height) : void; |
| 63 | /** |
| 64 | * Ends the image drawing operation and returns the resulting blob. |
| 65 | * |
| 66 | * This should reset the state of the back end and thus this method should only be callable once per image. |
| 67 | * |
| 68 | * @throws RuntimeException if no image was started yet. |
| 69 | */ |
| 70 | public function done() : string; |
| 71 | } |
| 72 |