1 | <?php |
||
10 | class ImagickDominantColorExtractor implements DominantColorExtractorInterface |
||
11 | { |
||
12 | /** |
||
13 | * Default width for image sampling |
||
14 | * |
||
15 | * @var int |
||
16 | * |
||
17 | * @see http://php.net/manual/en/imagick.resizeimage.php |
||
18 | */ |
||
19 | const DEFAULT_SAMPLE_WIDTH = 256; |
||
20 | |||
21 | /** |
||
22 | * Default height for image sampling |
||
23 | * |
||
24 | * @var int |
||
25 | * |
||
26 | * @see http://php.net/manual/en/imagick.resizeimage.php |
||
27 | */ |
||
28 | const DEFAULT_SAMPLE_HEIGHT = 256; |
||
29 | |||
30 | /** |
||
31 | * Default blur ratio for image sampling |
||
32 | * |
||
33 | * @var int |
||
34 | * |
||
35 | * @see http://php.net/manual/en/imagick.resizeimage.php |
||
36 | */ |
||
37 | const DEFAULT_SAMPLE_BLUR_RATIO = 1; |
||
38 | |||
39 | /** |
||
40 | * @var RGBColorExtractor |
||
41 | */ |
||
42 | private $extractor; |
||
43 | |||
44 | /** |
||
45 | * @var Imagick |
||
46 | */ |
||
47 | private $imagick; |
||
48 | |||
49 | /** |
||
50 | * @var int |
||
51 | */ |
||
52 | private $sampleWidth; |
||
53 | |||
54 | /** |
||
55 | * @var int |
||
56 | */ |
||
57 | private $sampleHeight; |
||
58 | |||
59 | /** |
||
60 | * @var int |
||
61 | */ |
||
62 | private $sampleBlurRatio; |
||
63 | |||
64 | /** |
||
65 | * ImagickDominantColorExtractor constructor. |
||
66 | * |
||
67 | * @param RGBColorExtractor $extractor |
||
68 | * @param Imagick $imagick Imagick instance |
||
69 | * @param int $sampleWidth Image sample width |
||
70 | * @param int $sampleHeight Image sample height |
||
71 | * @param int $sampleBlurRatio Image blur ratio |
||
72 | */ |
||
73 | 4 | public function __construct( |
|
87 | |||
88 | /** |
||
89 | * {@inheritdoc} |
||
90 | */ |
||
91 | 2 | public function extract($content) |
|
106 | } |
||
107 |