PluginProbe
QuickWebP – WebP & AVIF Image Optimizer, Compression & SEO for WordPress / 3.2.1
QuickWebP – WebP & AVIF Image Optimizer, Compression & SEO for WordPress v3.2.1
4.1.2 4.1.1 4.1.0 4.0.1 4.0.0 3.3.1 3.3.0 trunk 1.0.0 2.0.0 2.1.0 3.0.0 3.1.0 3.2.0 3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8
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

72 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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