xref: /imagick/shim_im6_to_im7.c (revision 4094bcc1)
1 
2 /*
3    +----------------------------------------------------------------------+
4    | Imagick                                                              |
5    +----------------------------------------------------------------------+
6    | This source file is subject to version 3.01 of the PHP license,      |
7    | that is bundled with this package in the file LICENSE, and is        |
8    | available through the world-wide-web at the following url:           |
9    | http://www.php.net/license/3_01.txt                                  |
10    | If you did not receive a copy of the PHP license and are unable to   |
11    | obtain it through the world-wide-web, please send a note to          |
12    | license@php.net so we can mail you a copy immediately.               |
13    +----------------------------------------------------------------------+
14 */
15 
16 #include "php_imagick.h"
17 #include "php_imagick_defs.h"
18 #include "php_imagick_macros.h"
19 #include "php_imagick_helpers.h"
20 #include "php_imagick_file.h"
21 
22 //derprecated
23 
24 //MagickReduceNoiseImage
25 //MagickMedianFilterImage
26 //MagickRecolorImage
27 
28 //Mising
29 //MagickSetImageBias
30 //MagickSetImageClipMask
31 
32 
33 #if MagickLibVersion >= 0x700
34 
35 
36 // Functions that have been replaced by channel aware versions
MagickAdaptiveBlurImageChannel(MagickWand * wand,const ChannelType channel,const double radius,const double sigma)37 MagickBooleanType MagickAdaptiveBlurImageChannel(MagickWand *wand,const ChannelType channel,const double radius, const double sigma) {
38 	MagickBooleanType status;
39 	ChannelType previous_channel_mask;
40 
41 	if (channel != UndefinedChannel) {
42 		previous_channel_mask = MagickSetImageChannelMask(wand, channel);
43 	}
44 
45 	status = MagickAdaptiveBlurImage(wand, radius, sigma);
46 
47 	if (channel != UndefinedChannel) {
48 		(void) MagickSetImageChannelMask(wand, previous_channel_mask);
49 	}
50 
51 	return status;
52 }
53 
MagickAdaptiveSharpenImageChannel(MagickWand * wand,const ChannelType channel,const double radius,const double sigma)54 MagickBooleanType MagickAdaptiveSharpenImageChannel(MagickWand *wand, const ChannelType channel, const double radius, const double sigma) {
55 	MagickBooleanType status;
56 	ChannelType previous_channel_mask;
57 
58 	if (channel != UndefinedChannel) {
59 		previous_channel_mask = MagickSetImageChannelMask(wand, channel);
60 	}
61 
62 	status = MagickAdaptiveSharpenImage(wand, radius, sigma);
63 
64 	if (channel != UndefinedChannel) {
65 		(void) MagickSetImageChannelMask(wand, previous_channel_mask);
66 	}
67 
68 	return status;
69 }
70 
MagickAddNoiseImageChannel(MagickWand * wand,const ChannelType channel,const NoiseType noise_type)71 MagickBooleanType MagickAddNoiseImageChannel(MagickWand *wand,const ChannelType channel,const NoiseType noise_type) {
72 	MagickBooleanType status;
73 	ChannelType previous_channel_mask;
74 
75 	if (channel != UndefinedChannel) {
76 		previous_channel_mask = MagickSetImageChannelMask(wand, channel);
77 	}
78 
79 	//TODO - what is the value meant to be?
80 	status = MagickAddNoiseImage(wand, noise_type, 1.0);
81 
82 	if (channel != UndefinedChannel) {
83 		(void) MagickSetImageChannelMask(wand, previous_channel_mask);
84 	}
85 
86 	return status;
87 }
88 
MagickAutoGammaImageChannel(MagickWand * wand,const ChannelType channel)89 MagickBooleanType MagickAutoGammaImageChannel(MagickWand *wand, const ChannelType channel) {
90   	MagickBooleanType status;
91 	ChannelType previous_channel_mask;
92 
93 	if (channel != UndefinedChannel) {
94 		previous_channel_mask = MagickSetImageChannelMask(wand, channel);
95 	}
96 
97 	status = MagickAutoGammaImage(wand);
98 
99 	if (channel != UndefinedChannel) {
100 		(void) MagickSetImageChannelMask(wand, previous_channel_mask);
101 	}
102 
103 	return status;
104 }
105 
MagickAutoLevelImageChannel(MagickWand * wand,const ChannelType channel)106 MagickBooleanType MagickAutoLevelImageChannel(MagickWand *wand,
107   const ChannelType channel) {
108 	MagickBooleanType status;
109 	ChannelType previous_channel_mask;
110 
111 	if (channel != UndefinedChannel) {
112 		previous_channel_mask = MagickSetImageChannelMask(wand, channel);
113 	}
114 
115 	status = MagickAutoLevelImage(wand);
116 
117 	if (channel != UndefinedChannel) {
118 		(void) MagickSetImageChannelMask(wand, previous_channel_mask);
119 	}
120 
121 	return status;
122 }
123 
MagickBlurImageChannel(MagickWand * wand,const ChannelType channel,const double radius,const double sigma)124 MagickBooleanType MagickBlurImageChannel(MagickWand *wand,
125   const ChannelType channel,const double radius,const double sigma) {
126 	MagickBooleanType status;
127 	ChannelType previous_channel_mask;
128 
129 	if (channel != UndefinedChannel) {
130 		previous_channel_mask = MagickSetImageChannelMask(wand, channel);
131 	}
132 
133 	status = MagickBlurImage(wand, radius,sigma);
134 
135 	if (channel != UndefinedChannel) {
136 		(void) MagickSetImageChannelMask(wand, previous_channel_mask);
137 	}
138 
139 	return status;
140 }
141 
MagickBrightnessContrastImageChannel(MagickWand * wand,const ChannelType channel,const double brightness,const double contrast)142 MagickBooleanType MagickBrightnessContrastImageChannel(MagickWand *wand,const ChannelType channel,const double brightness, const double contrast) {
143 	MagickBooleanType status;
144 	ChannelType previous_channel_mask;
145 
146 	if (channel != UndefinedChannel) {
147 		previous_channel_mask = MagickSetImageChannelMask(wand, channel);
148 	}
149 
150 	status = MagickBrightnessContrastImage(wand, brightness, contrast);
151 
152 	if (channel != UndefinedChannel) {
153 		(void) MagickSetImageChannelMask(wand, previous_channel_mask);
154 	}
155 
156 	return status;
157 }
158 
MagickClampImageChannel(MagickWand * wand,const ChannelType channel)159 MagickBooleanType MagickClampImageChannel(MagickWand *wand, const ChannelType channel) {
160 	MagickBooleanType status;
161 	ChannelType previous_channel_mask;
162 
163 	if (channel != UndefinedChannel) {
164 		previous_channel_mask = MagickSetImageChannelMask(wand, channel);
165 	}
166 
167 	status = MagickClampImage(wand);
168 
169 	if (channel != UndefinedChannel) {
170 		(void) MagickSetImageChannelMask(wand, previous_channel_mask);
171 	}
172 
173 	return status;
174 
175 }
176 
MagickClutImageChannel(MagickWand * wand,const ChannelType channel,const MagickWand * clut_wand)177 MagickBooleanType MagickClutImageChannel(MagickWand *wand, const ChannelType channel, const MagickWand *clut_wand) {
178 	MagickBooleanType status;
179 	ChannelType previous_channel_mask;
180 
181 	if (channel != UndefinedChannel) {
182 		previous_channel_mask = MagickSetImageChannelMask(wand, channel);
183 	}
184 	//TODO - need to take parameter
185 	status = MagickClutImage(wand, clut_wand, AverageInterpolatePixel);
186 
187 	if (channel != UndefinedChannel) {
188 		(void) MagickSetImageChannelMask(wand, previous_channel_mask);
189 	}
190 
191 	return status;
192 }
193 
MagickCompositeImageChannel(MagickWand * wand,const ChannelType channel,const MagickWand * source_wand,const CompositeOperator compose,const ssize_t x,const ssize_t y)194 MagickBooleanType MagickCompositeImageChannel(MagickWand *wand,
195   const ChannelType channel,const MagickWand *source_wand,
196   const CompositeOperator compose,const ssize_t x,const ssize_t y) {
197 	MagickBooleanType status;
198 	ChannelType previous_channel_mask;
199 
200 	long clip_to_self = 1;
201 
202 	if (channel != UndefinedChannel) {
203 		previous_channel_mask = MagickSetImageChannelMask(wand, channel);
204 	}
205 
206 	status = MagickCompositeImage(wand, source_wand, compose, clip_to_self, x,y);
207 
208 	if (channel != UndefinedChannel) {
209 		(void) MagickSetImageChannelMask(wand, previous_channel_mask);
210 	}
211 
212 	return status;
213 }
214 
215 
MagickCompareImageChannels(MagickWand * wand,const MagickWand * reference,const ChannelType channel,const MetricType metric,double * distortion)216 MagickWand *MagickCompareImageChannels(MagickWand *wand, const MagickWand *reference, const ChannelType channel, const MetricType metric, double *distortion) {
217 
218 	MagickWand *tmp_wand;
219 	ChannelType previous_channel_mask;
220 
221 	if (channel != UndefinedChannel) {
222 		previous_channel_mask = MagickSetImageChannelMask(wand, channel);
223 	}
224 
225 	tmp_wand = MagickCompareImages(wand, reference, metric, distortion);
226 
227 	if (channel != UndefinedChannel) {
228 		(void) MagickSetImageChannelMask(wand, previous_channel_mask);
229 	}
230 	return tmp_wand;
231 }
232 
233 
MagickContrastStretchImageChannel(MagickWand * wand,const ChannelType channel,const double black_point,const double white_point)234 MagickBooleanType MagickContrastStretchImageChannel(MagickWand *wand,
235   const ChannelType channel,const double black_point,
236   const double white_point) {
237 	MagickBooleanType status;
238 	ChannelType previous_channel_mask;
239 
240 	if (channel != UndefinedChannel) {
241 		previous_channel_mask = MagickSetImageChannelMask(wand, channel);
242 	}
243 
244 	status = MagickContrastStretchImage(wand, black_point, white_point);
245 
246 	if (channel != UndefinedChannel) {
247 		(void) MagickSetImageChannelMask(wand, previous_channel_mask);
248 	}
249 
250 	return status;
251 }
252 
MagickConvolveImageChannel(MagickWand * wand,const ChannelType channel,const KernelInfo * kernel)253 MagickBooleanType MagickConvolveImageChannel(MagickWand *wand,
254   const ChannelType channel, const KernelInfo *kernel){
255 
256 	MagickBooleanType status;
257 	ChannelType previous_channel_mask;
258 
259 	if (channel != UndefinedChannel) {
260 		previous_channel_mask = MagickSetImageChannelMask(wand, channel);
261 	}
262 
263 	status = MagickConvolveImage(wand, kernel);
264 
265 	if (channel != UndefinedChannel) {
266 		(void) MagickSetImageChannelMask(wand, previous_channel_mask);
267 	}
268 
269 	return status;
270 }
271 
272 
MagickEqualizeImageChannel(MagickWand * wand,const ChannelType channel)273 MagickBooleanType MagickEqualizeImageChannel(MagickWand *wand,
274   const ChannelType channel) {
275 	MagickBooleanType status;
276 	ChannelType previous_channel_mask;
277 
278 	if (channel != UndefinedChannel) {
279 		previous_channel_mask = MagickSetImageChannelMask(wand, channel);
280 	}
281 
282 	status = MagickEqualizeImage(wand);
283 
284 	if (channel != UndefinedChannel) {
285 		(void) MagickSetImageChannelMask(wand, previous_channel_mask);
286 	}
287 
288 	return status;
289 }
290 
291 
MagickEvaluateImageChannel(MagickWand * wand,const ChannelType channel,const MagickEvaluateOperator op,const double value)292 MagickBooleanType MagickEvaluateImageChannel(MagickWand *wand,
293   const ChannelType channel,const MagickEvaluateOperator op,const double value) {
294 	MagickBooleanType status;
295 	ChannelType previous_channel_mask;
296 
297 	if (channel != UndefinedChannel) {
298 		previous_channel_mask = MagickSetImageChannelMask(wand, channel);
299 	}
300 
301 	status = MagickEvaluateImage(wand,op,value);
302 
303 	if (channel != UndefinedChannel) {
304 		(void) MagickSetImageChannelMask(wand, previous_channel_mask);
305 	}
306 
307 	return status;
308 }
309 
310 //MagickBooleanType MagickFilterImageChannel(MagickWand *wand,
311 //  const ChannelType channel,const KernelInfo *kernel) {
312 //	MagickBooleanType status;
313 //	ChannelType previous_channel_mask;
314 //
315 //	if (channel != UndefinedChannel) {
316 //		previous_channel_mask = MagickSetImageChannelMask(wand, channel);
317 //	}
318 //
319 //	status = MagickFilterImage(wand, kernel);
320 //
321 //	if (channel != UndefinedChannel) {
322 //		(void) MagickSetImageChannelMask(wand, previous_channel_mask);
323 //	}
324 //
325 //	return status;
326 //}
327 
MagickFloodfillPaintImageChannel(MagickWand * wand,const ChannelType channel,const PixelWand * fill,const double fuzz,const PixelWand * bordercolor,const ssize_t x,const ssize_t y,const MagickBooleanType invert)328 MagickBooleanType MagickFloodfillPaintImageChannel(MagickWand *wand,
329   const ChannelType channel,const PixelWand *fill,const double fuzz,
330   const PixelWand *bordercolor,const ssize_t x,const ssize_t y,
331   const MagickBooleanType invert) {
332 
333 	MagickBooleanType status;
334 	ChannelType previous_channel_mask;
335 
336 	if (channel != UndefinedChannel) {
337 		previous_channel_mask = MagickSetImageChannelMask(wand, channel);
338 	}
339 
340 	status = MagickFloodfillPaintImage(wand, fill, fuzz, bordercolor, x, y, invert);
341 
342 	if (channel != UndefinedChannel) {
343 		(void) MagickSetImageChannelMask(wand, previous_channel_mask);
344 	}
345 
346 	return status;
347 }
348 
MagickFunctionImageChannel(MagickWand * wand,const ChannelType channel,const MagickFunction function,const size_t number_arguments,const double * arguments)349 MagickBooleanType MagickFunctionImageChannel(MagickWand *wand,
350   const ChannelType channel,const MagickFunction function,
351   const size_t number_arguments,const double *arguments) {
352 	MagickBooleanType status;
353 	ChannelType previous_channel_mask;
354 
355 	if (channel != UndefinedChannel) {
356 		previous_channel_mask = MagickSetImageChannelMask(wand, channel);
357 	}
358 
359 	status = MagickFunctionImage(wand,function,number_arguments,arguments);
360 
361 	if (channel != UndefinedChannel) {
362 		(void) MagickSetImageChannelMask(wand, previous_channel_mask);
363 	}
364 
365 	return status;
366 }
367 
368 
MagickFxImageChannel(MagickWand * wand,const ChannelType channel,const char * expression)369 MagickWand *MagickFxImageChannel(MagickWand *wand, const ChannelType channel,const char *expression) {
370 
371 	MagickWand *result_wand;
372 	ChannelType previous_channel_mask;
373 
374 	if (channel != UndefinedChannel) {
375 		previous_channel_mask = MagickSetImageChannelMask(wand, channel);
376 	}
377 
378 	result_wand = MagickFxImage(wand, expression);
379 
380 	if (channel != UndefinedChannel) {
381 		(void) MagickSetImageChannelMask(wand, previous_channel_mask);
382 	}
383 
384 	return result_wand;
385 }
386 
387 
MagickGammaImageChannel(MagickWand * wand,const ChannelType channel,const double gamma)388 MagickBooleanType MagickGammaImageChannel(MagickWand *wand,
389   const ChannelType channel,const double gamma) {
390 	MagickBooleanType status;
391 	ChannelType previous_channel_mask;
392 
393 	if (channel != UndefinedChannel) {
394 		previous_channel_mask = MagickSetImageChannelMask(wand, channel);
395 	}
396 
397 	status = MagickGammaImage(wand,gamma);
398 
399 	if (channel != UndefinedChannel) {
400 		(void) MagickSetImageChannelMask(wand, previous_channel_mask);
401 	}
402 
403 	return status;
404 }
405 
MagickGaussianBlurImageChannel(MagickWand * wand,const ChannelType channel,const double radius,const double sigma)406 MagickBooleanType MagickGaussianBlurImageChannel(MagickWand *wand,
407   const ChannelType channel,const double radius,const double sigma) {
408 	MagickBooleanType status;
409 	ChannelType previous_channel_mask;
410 
411 	if (channel != UndefinedChannel) {
412 		previous_channel_mask = MagickSetImageChannelMask(wand, channel);
413 	}
414 
415 	status = MagickGaussianBlurImage(wand,radius,sigma);
416 
417 	if (channel != UndefinedChannel) {
418 		(void) MagickSetImageChannelMask(wand, previous_channel_mask);
419 	}
420 
421 	return status;
422 }
423 
MagickGetImageChannelDepth(MagickWand * wand,const ChannelType channel)424 size_t MagickGetImageChannelDepth(MagickWand *wand, const ChannelType channel) {
425 	size_t depth;
426 	ChannelType previous_channel_mask;
427 
428 	if (channel != UndefinedChannel) {
429 		previous_channel_mask = MagickSetImageChannelMask(wand, channel);
430 	}
431 
432 	depth = MagickGetImageDepth(wand);
433 
434 	if (channel != UndefinedChannel) {
435 		(void) MagickSetImageChannelMask(wand, previous_channel_mask);
436 	}
437 
438 	return depth;
439 }
440 
MagickGetImageChannelMean(MagickWand * wand,const ChannelType channel,double * mean,double * standard_deviation)441 MagickBooleanType MagickGetImageChannelMean(MagickWand *wand, const ChannelType channel,double *mean,
442   double *standard_deviation) {
443   	MagickBooleanType status;
444 	ChannelType previous_channel_mask;
445 
446 	if (channel != UndefinedChannel) {
447 		previous_channel_mask = MagickSetImageChannelMask(wand, channel);
448 	}
449 
450 	status = MagickGetImageMean(wand, mean, standard_deviation);
451 
452 	if (channel != UndefinedChannel) {
453 		(void) MagickSetImageChannelMask(wand, previous_channel_mask);
454 	}
455 
456 	return status;
457 }
458 
459 
MagickSetImageChannelDepth(MagickWand * wand,const ChannelType channel,const size_t depth)460 MagickBooleanType MagickSetImageChannelDepth(MagickWand *wand, const ChannelType channel,
461   const size_t depth) {
462 	MagickBooleanType status;
463 	ChannelType previous_channel_mask;
464 
465 	if (channel != UndefinedChannel) {
466 		previous_channel_mask = MagickSetImageChannelMask(wand, channel);
467 	}
468 
469 	status = MagickSetImageDepth(wand, depth);
470 
471 	if (channel != UndefinedChannel) {
472 		(void) MagickSetImageChannelMask(wand, previous_channel_mask);
473 	}
474 
475 	return status;
476 }
477 
MagickGetImageChannelDistortion(MagickWand * wand,const MagickWand * reference,const ChannelType channel,const MetricType metric,double * distortion)478 MagickBooleanType MagickGetImageChannelDistortion(MagickWand *wand,
479   const MagickWand *reference,const ChannelType channel,const MetricType metric,
480   double *distortion) {
481   	MagickBooleanType status;
482 	ChannelType previous_channel_mask;
483 
484 	if (channel != UndefinedChannel) {
485 		previous_channel_mask = MagickSetImageChannelMask(wand, channel);
486 	}
487 
488 	status = MagickGetImageDistortion(wand, reference, metric, distortion);
489 
490 	if (channel != UndefinedChannel) {
491 		(void) MagickSetImageChannelMask(wand, previous_channel_mask);
492 	}
493 
494 	return status;
495 }
496 
MagickGetImageChannelKurtosis(MagickWand * wand,const ChannelType channel,double * kurtosis,double * skewness)497 MagickBooleanType MagickGetImageChannelKurtosis(MagickWand *wand,const ChannelType channel,
498   double *kurtosis,double *skewness) {
499   	MagickBooleanType status;
500 	ChannelType previous_channel_mask;
501 
502 	if (channel != UndefinedChannel) {
503 		previous_channel_mask = MagickSetImageChannelMask(wand, channel);
504 	}
505 
506 	status = MagickGetImageKurtosis(wand,kurtosis,skewness);
507 
508 	if (channel != UndefinedChannel) {
509 		(void) MagickSetImageChannelMask(wand, previous_channel_mask);
510 	}
511 
512 	return status;
513 }
514 
MagickGetImageChannelRange(MagickWand * wand,const ChannelType channel,double * minima,double * maxima)515 MagickBooleanType MagickGetImageChannelRange(MagickWand *wand,const ChannelType channel,double *minima,
516   double *maxima) {
517   	MagickBooleanType status;
518 	ChannelType previous_channel_mask;
519 
520 	if (channel != UndefinedChannel) {
521 		previous_channel_mask = MagickSetImageChannelMask(wand, channel);
522 	}
523 
524 	status = MagickGetImageRange(wand, minima, maxima);
525 
526 	if (channel != UndefinedChannel) {
527 		(void) MagickSetImageChannelMask(wand, previous_channel_mask);
528 	}
529 
530 	return status;
531 }
532 
MagickOrderedPosterizeImageChannel(MagickWand * wand,const ChannelType channel,const char * threshold_map)533 MagickBooleanType MagickOrderedPosterizeImageChannel(MagickWand *wand,const ChannelType channel,
534   const char *threshold_map) {
535 	MagickBooleanType status;
536 	ChannelType previous_channel_mask;
537 
538 	if (channel != UndefinedChannel) {
539 		previous_channel_mask = MagickSetImageChannelMask(wand, channel);
540 	}
541 
542 	status = MagickOrderedDitherImage(wand, threshold_map);
543 
544 	if (channel != UndefinedChannel) {
545 		(void) MagickSetImageChannelMask(wand, previous_channel_mask);
546 	}
547 
548 	return status;
549 }
550 
MagickGetImageChannelStatistics(MagickWand * wand)551 ChannelStatistics *MagickGetImageChannelStatistics(MagickWand *wand) {
552 	return MagickGetImageStatistics(wand);
553 }
554 
MagickHaldClutImageChannel(MagickWand * wand,const ChannelType channel,const MagickWand * hald_wand)555 MagickBooleanType MagickHaldClutImageChannel(MagickWand *wand, const ChannelType channel,const MagickWand *hald_wand) {
556 	MagickBooleanType status;
557 	ChannelType previous_channel_mask;
558 
559 	if (channel != UndefinedChannel) {
560 		previous_channel_mask = MagickSetImageChannelMask(wand, channel);
561 	}
562 
563 	status = MagickHaldClutImage(wand, hald_wand);
564 
565 	if (channel != UndefinedChannel) {
566 		(void) MagickSetImageChannelMask(wand, previous_channel_mask);
567 	}
568 
569 	return status;
570 }
571 
MagickLevelImageChannel(MagickWand * wand,const ChannelType channel,const double black_point,const double gamma,const double white_point)572 MagickBooleanType MagickLevelImageChannel(MagickWand *wand,
573   const ChannelType channel,const double black_point,const double gamma,
574   const double white_point) {
575 	MagickBooleanType status;
576 	ChannelType previous_channel_mask;
577 
578 	if (channel != UndefinedChannel) {
579 		previous_channel_mask = MagickSetImageChannelMask(wand, channel);
580 	}
581 
582 	status = MagickLevelImage(wand,black_point,gamma, white_point);
583 
584 	if (channel != UndefinedChannel) {
585 		(void) MagickSetImageChannelMask(wand, previous_channel_mask);
586 	}
587 
588 	return status;
589 }
590 
MagickMorphologyImageChannel(MagickWand * wand,ChannelType channel,MorphologyMethod method,const ssize_t iterations,KernelInfo * kernel)591 MagickBooleanType MagickMorphologyImageChannel(MagickWand *wand,
592   ChannelType channel,MorphologyMethod method,const ssize_t iterations,
593   KernelInfo *kernel) {
594 	MagickBooleanType status;
595 	ChannelType previous_channel_mask;
596 
597 	if (channel != UndefinedChannel) {
598 		previous_channel_mask = MagickSetImageChannelMask(wand, channel);
599 	}
600 
601 	status = MagickMorphologyImage(wand, method, iterations, kernel);
602 
603 	if (channel != UndefinedChannel) {
604 		(void) MagickSetImageChannelMask(wand, previous_channel_mask);
605 	}
606 
607 	return status;
608 }
609 
MagickMotionBlurImageChannel(MagickWand * wand,const ChannelType channel,const double radius,const double sigma,const double angle)610 MagickBooleanType MagickMotionBlurImageChannel(MagickWand *wand,
611   const ChannelType channel,const double radius,const double sigma,
612   const double angle) {
613 	MagickBooleanType status;
614 	ChannelType previous_channel_mask;
615 
616 	if (channel != UndefinedChannel) {
617 		previous_channel_mask = MagickSetImageChannelMask(wand, channel);
618 	}
619 
620 	status = MagickMotionBlurImage(wand, radius, sigma,angle);
621 
622 	if (channel != UndefinedChannel) {
623 		(void) MagickSetImageChannelMask(wand, previous_channel_mask);
624 	}
625 
626 	return status;
627 }
628 
629 
MagickNegateImageChannel(MagickWand * wand,const ChannelType channel,const MagickBooleanType gray)630 MagickBooleanType MagickNegateImageChannel(MagickWand *wand,const ChannelType channel,const MagickBooleanType gray) {
631 
632 	MagickBooleanType status;
633 	ChannelType previous_channel_mask;
634 
635 	if (channel != UndefinedChannel) {
636 		previous_channel_mask = MagickSetImageChannelMask(wand, channel);
637 	}
638 
639 	status = MagickNegateImage(wand, gray);
640 
641 	if (channel != UndefinedChannel) {
642 		(void) MagickSetImageChannelMask(wand, previous_channel_mask);
643 	}
644 
645 	return status;
646 }
647 
MagickNormalizeImageChannel(MagickWand * wand,const ChannelType channel)648 MagickBooleanType MagickNormalizeImageChannel(MagickWand *wand,
649   const ChannelType channel) {
650 	MagickBooleanType status;
651 	ChannelType previous_channel_mask;
652 
653 	if (channel != UndefinedChannel) {
654 		previous_channel_mask = MagickSetImageChannelMask(wand, channel);
655 	}
656 
657 	status = MagickNormalizeImage(wand);
658 
659 	if (channel != UndefinedChannel) {
660 		(void) MagickSetImageChannelMask(wand, previous_channel_mask);
661 	}
662 
663 	return status;
664 }
665 
MagickOpaquePaintImageChannel(MagickWand * wand,const ChannelType channel,const PixelWand * target,const PixelWand * fill,const double fuzz,const MagickBooleanType invert)666 MagickBooleanType MagickOpaquePaintImageChannel(MagickWand *wand,
667   const ChannelType channel,const PixelWand *target,
668   const PixelWand *fill,const double fuzz,const MagickBooleanType invert) {
669 	MagickBooleanType status;
670 	ChannelType previous_channel_mask;
671 
672 	if (channel != UndefinedChannel) {
673 		previous_channel_mask = MagickSetImageChannelMask(wand, channel);
674 	}
675 
676 	status = MagickOpaquePaintImage(wand, target, fill, fuzz, invert);
677 
678 	if (channel != UndefinedChannel) {
679 		(void) MagickSetImageChannelMask(wand, previous_channel_mask);
680 	}
681 
682 	return status;
683 }
684 
685 
MagickRandomThresholdImageChannel(MagickWand * wand,const ChannelType channel,const double low,const double high)686 MagickBooleanType MagickRandomThresholdImageChannel(MagickWand *wand,
687   const ChannelType channel,const double low,const double high) {
688 	MagickBooleanType status;
689 	ChannelType previous_channel_mask;
690 
691 	if (channel != UndefinedChannel) {
692 		previous_channel_mask = MagickSetImageChannelMask(wand, channel);
693 	}
694 
695 	status = MagickRandomThresholdImage(wand, low, high);
696 
697 	if (channel != UndefinedChannel) {
698 		(void) MagickSetImageChannelMask(wand, previous_channel_mask);
699 	}
700 
701 	return status;
702 }
703 
MagickRotationalBlurImageChannel(MagickWand * wand,const ChannelType channel,const double angle)704 MagickBooleanType MagickRotationalBlurImageChannel(MagickWand *wand,
705   const ChannelType channel,const double angle) {
706 	MagickBooleanType status;
707 	ChannelType previous_channel_mask;
708 
709 	if (channel != UndefinedChannel) {
710 		previous_channel_mask = MagickSetImageChannelMask(wand, channel);
711 	}
712 
713 	status = MagickRotationalBlurImage(wand, angle);
714 
715 	if (channel != UndefinedChannel) {
716 		(void) MagickSetImageChannelMask(wand, previous_channel_mask);
717 	}
718 
719 	return status;
720 }
721 
MagickSelectiveBlurImageChannel(MagickWand * wand,const ChannelType channel,const double radius,const double sigma,const double threshold)722 MagickBooleanType MagickSelectiveBlurImageChannel(MagickWand *wand,
723   const ChannelType channel,const double radius,const double sigma,
724   const double threshold) {
725 	MagickBooleanType status;
726 	ChannelType previous_channel_mask;
727 
728 	if (channel != UndefinedChannel) {
729 		previous_channel_mask = MagickSetImageChannelMask(wand, channel);
730 	}
731 
732 	status = MagickSelectiveBlurImage(wand, radius, sigma, threshold);
733 
734 	if (channel != UndefinedChannel) {
735 		(void) MagickSetImageChannelMask(wand, previous_channel_mask);
736 	}
737 
738 	return status;
739 }
740 
MagickSeparateImageChannel(MagickWand * wand,const ChannelType channel)741 MagickBooleanType MagickSeparateImageChannel(MagickWand *wand,const ChannelType channel) {
742 	return MagickSeparateImage(wand, channel);
743 }
744 
MagickSharpenImageChannel(MagickWand * wand,const ChannelType channel,const double radius,const double sigma)745 MagickBooleanType MagickSharpenImageChannel(MagickWand *wand,
746   const ChannelType channel,const double radius,const double sigma) {
747 	MagickBooleanType status;
748 	ChannelType previous_channel_mask;
749 
750 	if (channel != UndefinedChannel) {
751 		previous_channel_mask = MagickSetImageChannelMask(wand, channel);
752 	}
753 
754 	status = MagickSharpenImage(wand, radius, sigma);
755 
756 	if (channel != UndefinedChannel) {
757 		(void) MagickSetImageChannelMask(wand, previous_channel_mask);
758 	}
759 
760 	return status;
761 }
762 
MagickSigmoidalContrastImageChannel(MagickWand * wand,const ChannelType channel,const MagickBooleanType sharpen,const double alpha,const double beta)763 MagickBooleanType MagickSigmoidalContrastImageChannel(
764   MagickWand *wand,const ChannelType channel,const MagickBooleanType sharpen,
765   const double alpha,const double beta) {
766 	MagickBooleanType status;
767 	ChannelType previous_channel_mask;
768 
769 	if (channel != UndefinedChannel) {
770 		previous_channel_mask = MagickSetImageChannelMask(wand, channel);
771 	}
772 
773 	status = MagickSigmoidalContrastImage(wand, sharpen, alpha, beta);
774 
775 	if (channel != UndefinedChannel) {
776 		(void) MagickSetImageChannelMask(wand, previous_channel_mask);
777 	}
778 
779 	return status;
780 }
781 
MagickSolarizeImageChannel(MagickWand * wand,const ChannelType channel,const double threshold)782 MagickBooleanType MagickSolarizeImageChannel(MagickWand *wand, const ChannelType channel,const double threshold) {
783 	MagickBooleanType status;
784 	ChannelType previous_channel_mask;
785 
786 	if (channel != UndefinedChannel) {
787 		previous_channel_mask = MagickSetImageChannelMask(wand, channel);
788 	}
789 
790 	status = MagickSolarizeImage(wand, threshold);
791 
792 	if (channel != UndefinedChannel) {
793 		(void) MagickSetImageChannelMask(wand, previous_channel_mask);
794 	}
795 
796 	return status;
797 }
798 
799 
800 
MagickSparseColorImageChannel(MagickWand * wand,const ChannelType channel,const SparseColorMethod method,const size_t number_arguments,const double * arguments)801 MagickBooleanType MagickSparseColorImageChannel(MagickWand *wand, const ChannelType channel,const SparseColorMethod method, const size_t number_arguments,const double *arguments) {
802 	MagickBooleanType status;
803 	ChannelType previous_channel_mask;
804 
805 	if (channel != UndefinedChannel) {
806 		previous_channel_mask = MagickSetImageChannelMask(wand, channel);
807 	}
808 
809 	status = MagickSparseColorImage(wand, method, number_arguments, arguments);
810 
811    	if (channel != UndefinedChannel) {
812 		(void) MagickSetImageChannelMask(wand, previous_channel_mask);
813 	}
814 
815 	return status;
816 }
817 
818 
819 
MagickStatisticImageChannel(MagickWand * wand,const ChannelType channel,const StatisticType type,const size_t width,const size_t height)820 MagickBooleanType MagickStatisticImageChannel(MagickWand *wand,
821   const ChannelType channel,const StatisticType type,const size_t width,
822   const size_t height) {
823 	MagickBooleanType status;
824 	ChannelType previous_channel_mask;
825 
826 	if (channel != UndefinedChannel) {
827 		previous_channel_mask = MagickSetImageChannelMask(wand, channel);
828 	}
829 
830 	status = MagickStatisticImage(wand, type, width, height);
831 
832 	if (channel != UndefinedChannel) {
833 		(void) MagickSetImageChannelMask(wand, previous_channel_mask);
834 	}
835 
836 	return status;
837 }
838 
839 //MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
840 //  const ChannelType channel,const double threshold) {
841 //	MagickBooleanType status;
842 //	ChannelType previous_channel_mask;
843 //
844 //	if (channel != UndefinedChannel) {
845 //		previous_channel_mask = MagickSetImageChannelMask(wand, channel);
846 //	}
847 //
848 //	status = MagickThresholdImage(wand, threshold);
849 //
850 //	if (channel != UndefinedChannel) {
851 //		(void) MagickSetImageChannelMask(wand, previous_channel_mask);
852 //	}
853 //
854 //	return status;
855 //}
856 
857 
MagickUnsharpMaskImageChannel(MagickWand * wand,const ChannelType channel,const double radius,const double sigma,const double amount,const double threshold)858 MagickBooleanType MagickUnsharpMaskImageChannel(MagickWand *wand,
859   const ChannelType channel,const double radius,const double sigma,
860   const double amount,const double threshold) {
861 	MagickBooleanType status;
862 	ChannelType previous_channel_mask;
863 
864 	if (channel != UndefinedChannel) {
865 		previous_channel_mask = MagickSetImageChannelMask(wand, channel);
866 	}
867 
868 	status = MagickUnsharpMaskImage(wand, radius, sigma, amount, threshold);
869 
870 	if (channel != UndefinedChannel) {
871 		(void) MagickSetImageChannelMask(wand, previous_channel_mask);
872 	}
873 
874 	return status;
875 }
876 
877 
878 
879 
880 #endif