1 | <?php |
||
17 | trait MonochromeImageCompressionTrait |
||
18 | { |
||
19 | /** |
||
20 | * Available monochrome image downsample type values |
||
21 | * |
||
22 | * @var string[] |
||
23 | */ |
||
24 | protected static $monoImageDownsampleTypeValues = [ |
||
25 | DistillerParametersInterface::IMAGE_DOWNSAMPLE_TYPE_AVERAGE, |
||
26 | DistillerParametersInterface::IMAGE_DOWNSAMPLE_TYPE_BICUBIC, |
||
27 | DistillerParametersInterface::IMAGE_DOWNSAMPLE_TYPE_SUBSAMPLE, |
||
28 | DistillerParametersInterface::IMAGE_DOWNSAMPLE_TYPE_NONE, |
||
29 | ]; |
||
30 | |||
31 | /** |
||
32 | * Available monochrome image filter values |
||
33 | * |
||
34 | * @var string[] |
||
35 | */ |
||
36 | protected static $monoImageFilterValues = [ |
||
37 | DistillerParametersInterface::IMAGE_FILTER_CCITT_FAX_ENCODE, |
||
38 | DistillerParametersInterface::IMAGE_FILTER_FLATE_ENCODE, |
||
39 | DistillerParametersInterface::IMAGE_FILTER_RUN_LENGTH_ENCODE |
||
40 | ]; |
||
41 | |||
42 | /** |
||
43 | * Get argument value |
||
44 | * |
||
45 | * @param string $name |
||
46 | * |
||
47 | * @return string |
||
48 | */ |
||
49 | abstract protected function getArgumentValue($name); |
||
50 | |||
51 | /** |
||
52 | * Set argument |
||
53 | * |
||
54 | * @param string $argument |
||
55 | * |
||
56 | * @return $this |
||
57 | */ |
||
58 | abstract protected function setArgument($argument); |
||
59 | |||
60 | /** |
||
61 | * Whether to anti alias monochrome images |
||
62 | * |
||
63 | * @return bool |
||
64 | */ |
||
65 | public function isAntiAliasMonoImages() |
||
74 | |||
75 | /** |
||
76 | * Set anti alias monochrome images flag |
||
77 | * |
||
78 | * @param bool $antiAliasMonoImages |
||
79 | * |
||
80 | * @return $this |
||
81 | */ |
||
82 | public function setAntiAliasMonoImages($antiAliasMonoImages) |
||
88 | |||
89 | /** |
||
90 | * Whether to downsample monochrome images |
||
91 | * |
||
92 | * @return bool |
||
93 | */ |
||
94 | public function isDownsampleMonoImages() |
||
103 | |||
104 | /** |
||
105 | * Set downsample monochrome images flag |
||
106 | * |
||
107 | * @param bool $downsampleMonoImages |
||
108 | * |
||
109 | * @return $this |
||
110 | */ |
||
111 | public function setDownsampleMonoImages($downsampleMonoImages) |
||
117 | |||
118 | /** |
||
119 | * Whether to encode monochrome images |
||
120 | * |
||
121 | * @return bool |
||
122 | */ |
||
123 | public function isEncodeMonoImages() |
||
132 | |||
133 | /** |
||
134 | * Set encode monochrome images flag |
||
135 | * |
||
136 | * @param bool $encodeMonoImages |
||
137 | * |
||
138 | * @return $this |
||
139 | */ |
||
140 | public function setEncodeMonoImages($encodeMonoImages) |
||
146 | |||
147 | /** |
||
148 | * Get monochrome image depth |
||
149 | * |
||
150 | * @return int |
||
151 | */ |
||
152 | public function getMonoImageDepth() |
||
161 | |||
162 | /** |
||
163 | * Set monochrome image depth |
||
164 | * |
||
165 | * @param int $monoImageDepth |
||
166 | * |
||
167 | * @return $this |
||
168 | */ |
||
169 | public function setMonoImageDepth($monoImageDepth) |
||
175 | |||
176 | /** |
||
177 | * Get monochrome image downsample threshold |
||
178 | * |
||
179 | * @return float |
||
180 | */ |
||
181 | public function getMonoImageDownsampleThreshold() |
||
190 | |||
191 | /** |
||
192 | * Set monochrome image downsample threshold |
||
193 | * |
||
194 | * @param float $monoImageDownsampleThreshold |
||
195 | * |
||
196 | * @return $this |
||
197 | */ |
||
198 | public function setMonoImageDownsampleThreshold($monoImageDownsampleThreshold) |
||
204 | |||
205 | /** |
||
206 | * Get monochrome image downsample type |
||
207 | * |
||
208 | * @return string |
||
209 | */ |
||
210 | public function getMonoImageDownsampleType() |
||
219 | |||
220 | /** |
||
221 | * Set monochrome image downsample type |
||
222 | * |
||
223 | * @param string $monoImageDownsampleType |
||
224 | * |
||
225 | * @throws \InvalidArgumentException |
||
226 | * |
||
227 | * @return $this |
||
228 | */ |
||
229 | public function setMonoImageDownsampleType($monoImageDownsampleType) |
||
239 | |||
240 | /** |
||
241 | * Get monochrome image filter |
||
242 | * |
||
243 | * @return string |
||
244 | */ |
||
245 | public function getMonoImageFilter() |
||
254 | |||
255 | /** |
||
256 | * Set monochrome image filter |
||
257 | * |
||
258 | * @param string $monoImageFilter |
||
259 | * |
||
260 | * @throws \InvalidArgumentException |
||
261 | * |
||
262 | * @return $this |
||
263 | */ |
||
264 | public function setMonoImageFilter($monoImageFilter) |
||
274 | |||
275 | /** |
||
276 | * Get monochrome image resolution |
||
277 | * |
||
278 | * @return int |
||
279 | */ |
||
280 | public function getMonoImageResolution() |
||
289 | |||
290 | /** |
||
291 | * Set monochrome image resolution |
||
292 | * |
||
293 | * @param int $monoImageResolution |
||
294 | * |
||
295 | * @return $this |
||
296 | */ |
||
297 | public function setMonoImageResolution($monoImageResolution) |
||
303 | } |
||
304 |