Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
10 / 10 |
|
100.00% |
7 / 7 |
CRAP | |
100.00% |
1 / 1 |
| AbstractDraw | |
100.00% |
10 / 10 |
|
100.00% |
7 / 7 |
7 | |
100.00% |
1 / 1 |
| setOpacity | n/a |
0 / 0 |
n/a |
0 / 0 |
0 | |||||
| getOpacity | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getFillColor | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getStrokeColor | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getStrokeWidth | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setFillColor | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| setStrokeColor | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| setStrokeWidth | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | declare(strict_types=1); |
| 3 | /** |
| 4 | * Pop PHP Framework (https://www.popphp.org/) |
| 5 | * |
| 6 | * @link https://github.com/popphp/popphp-framework |
| 7 | * @author Nick Sagona, III <dev@noladev.com> |
| 8 | * @copyright Copyright (c) 2009-2027 NOLA Interactive, LLC. |
| 9 | * @license https://www.popphp.org/license New BSD License |
| 10 | */ |
| 11 | |
| 12 | /** |
| 13 | * @namespace |
| 14 | */ |
| 15 | namespace Pop\Image\Draw; |
| 16 | |
| 17 | use Pop\Image\AbstractEditObject; |
| 18 | use Pop\Color\Color; |
| 19 | |
| 20 | /** |
| 21 | * Draw abstract class |
| 22 | * |
| 23 | * @category Pop |
| 24 | * @package Pop\Image |
| 25 | * @author Nick Sagona, III <dev@noladev.com> |
| 26 | * @copyright Copyright (c) 2009-2027 NOLA Interactive, LLC. |
| 27 | * @license https://www.popphp.org/license New BSD License |
| 28 | * @version 5.0.0 |
| 29 | */ |
| 30 | abstract class AbstractDraw extends AbstractEditObject implements DrawInterface |
| 31 | { |
| 32 | |
| 33 | /** |
| 34 | * Opacity |
| 35 | * @var int|float|null |
| 36 | */ |
| 37 | protected int|float|null $opacity = null; |
| 38 | |
| 39 | /** |
| 40 | * Fill color |
| 41 | * @var ?Color\ColorInterface |
| 42 | */ |
| 43 | protected ?Color\ColorInterface $fillColor = null; |
| 44 | |
| 45 | /** |
| 46 | * Stroke color |
| 47 | * @var ?Color\ColorInterface |
| 48 | */ |
| 49 | protected ?Color\ColorInterface $strokeColor = null; |
| 50 | |
| 51 | /** |
| 52 | * Stroke width |
| 53 | * @var int |
| 54 | */ |
| 55 | protected int $strokeWidth = 0; |
| 56 | |
| 57 | /** |
| 58 | * Set the opacity |
| 59 | * |
| 60 | * @param int|float $opacity |
| 61 | * @return AbstractDraw |
| 62 | */ |
| 63 | abstract public function setOpacity(int|float $opacity): AbstractDraw; |
| 64 | |
| 65 | /** |
| 66 | * Get the opacity |
| 67 | * |
| 68 | * @return mixed |
| 69 | */ |
| 70 | public function getOpacity(): mixed |
| 71 | { |
| 72 | return $this->opacity; |
| 73 | } |
| 74 | |
| 75 | /** |
| 76 | * Get fill color |
| 77 | * |
| 78 | * @return Color\ColorInterface |
| 79 | */ |
| 80 | public function getFillColor(): Color\ColorInterface |
| 81 | { |
| 82 | return $this->fillColor; |
| 83 | } |
| 84 | |
| 85 | /** |
| 86 | * Get stroke color |
| 87 | * |
| 88 | * @return Color\ColorInterface |
| 89 | */ |
| 90 | public function getStrokeColor(): Color\ColorInterface |
| 91 | { |
| 92 | return $this->strokeColor; |
| 93 | } |
| 94 | |
| 95 | /** |
| 96 | * Get stroke width |
| 97 | * |
| 98 | * @return int |
| 99 | */ |
| 100 | public function getStrokeWidth(): int |
| 101 | { |
| 102 | return $this->strokeWidth; |
| 103 | } |
| 104 | |
| 105 | /** |
| 106 | * Set fill color |
| 107 | * |
| 108 | * @param Color\ColorInterface $color |
| 109 | * @return AbstractDraw |
| 110 | */ |
| 111 | public function setFillColor(Color\ColorInterface $color): AbstractDraw |
| 112 | { |
| 113 | $this->fillColor = $color; |
| 114 | return $this; |
| 115 | } |
| 116 | |
| 117 | /** |
| 118 | * Set stroke color |
| 119 | * |
| 120 | * @param Color\ColorInterface $color |
| 121 | * @return AbstractDraw |
| 122 | */ |
| 123 | public function setStrokeColor(Color\ColorInterface $color): AbstractDraw |
| 124 | { |
| 125 | $this->strokeColor = $color; |
| 126 | return $this; |
| 127 | } |
| 128 | |
| 129 | /** |
| 130 | * Get stroke width |
| 131 | * |
| 132 | * @param int $w |
| 133 | * @return AbstractDraw |
| 134 | */ |
| 135 | public function setStrokeWidth(int $w): AbstractDraw |
| 136 | { |
| 137 | $this->strokeWidth = $w; |
| 138 | return $this; |
| 139 | } |
| 140 | |
| 141 | } |