quickwebp
/
includes
/
vendor
/
intervention
/
image
/
src
/
Intervention
/
Image
/
AbstractShape.php
AbstractShape.php in QuickWebP – WebP & AVIF Image Optimizer, Compression & SEO for WordPress 3.2.1, at includes/vendor/intervention/image/src/Intervention/Image/AbstractShape.php
| 1 | <?php |
| 2 | |
| 3 | namespace Intervention\Image; |
| 4 | |
| 5 | abstract class AbstractShape |
| 6 | { |
| 7 | /** |
| 8 | * Background color of shape |
| 9 | * |
| 10 | * @var string |
| 11 | */ |
| 12 | public $background; |
| 13 | |
| 14 | /** |
| 15 | * Border color of current shape |
| 16 | * |
| 17 | * @var string |
| 18 | */ |
| 19 | public $border_color; |
| 20 | |
| 21 | /** |
| 22 | * Border width of shape |
| 23 | * |
| 24 | * @var int |
| 25 | */ |
| 26 | public $border_width = 0; |
| 27 | |
| 28 | /** |
| 29 | * Draws shape to given image on given position |
| 30 | * |
| 31 | * @param Image $image |
| 32 | * @param int $posx |
| 33 | * @param int $posy |
| 34 | * @return boolean |
| 35 | */ |
| 36 | abstract public function applyToImage(Image $image, $posx = 0, $posy = 0); |
| 37 | |
| 38 | /** |
| 39 | * Set text to be written |
| 40 | * |
| 41 | * @param string $text |
| 42 | * @return void |
| 43 | */ |
| 44 | public function background($color) |
| 45 | { |
| 46 | $this->background = $color; |
| 47 | } |
| 48 | |
| 49 | /** |
| 50 | * Set border width and color of current shape |
| 51 | * |
| 52 | * @param int $width |
| 53 | * @param string $color |
| 54 | * @return void |
| 55 | */ |
| 56 | public function border($width, $color = null) |
| 57 | { |
| 58 | $this->border_width = is_numeric($width) ? intval($width) : 0; |
| 59 | $this->border_color = is_null($color) ? '#000000' : $color; |
| 60 | } |
| 61 | |
| 62 | /** |
| 63 | * Determines if current shape has border |
| 64 | * |
| 65 | * @return boolean |
| 66 | */ |
| 67 | public function hasBorder() |
| 68 | { |
| 69 | return ($this->border_width >= 1); |
| 70 | } |
| 71 | } |
| 72 |