1 /*
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 % %
4 % %
5 % %
6 % PPPP IIIII X X EEEEE L %
7 % P P I X X E L %
8 % PPPP I X EEE L %
9 % P I X X E L %
10 % P IIIII X X EEEEE LLLLL %
11 % %
12 % W W AAA N N DDDD %
13 % W W A A NN N D D %
14 % W W W AAAAA N N N D D %
15 % WW WW A A N NN D D %
16 % W W A A N N DDDD %
17 % %
18 % %
19 % MagickWand Image Pixel Wand Methods %
20 % %
21 % Software Design %
22 % Cristy %
23 % March 2003 %
24 % %
25 % %
26 % Copyright 1999-2021 ImageMagick Studio LLC, a non-profit organization %
27 % dedicated to making software imaging solutions freely available. %
28 % %
29 % You may not use this file except in compliance with the License. You may %
30 % obtain a copy of the License at %
31 % %
32 % https://imagemagick.org/script/license.php %
33 % %
34 % Unless required by applicable law or agreed to in writing, software %
35 % distributed under the License is distributed on an "AS IS" BASIS, %
36 % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %
37 % See the License for the specific language governing permissions and %
38 % limitations under the License. %
39 % %
40 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
41 %
42 %
43 %
44 */
45
46 /*
47 Include declarations.
48 */
49 #include "MagickWand/studio.h"
50 #include "MagickWand/MagickWand.h"
51 #include "MagickWand/magick-wand-private.h"
52 #include "MagickWand/pixel-wand-private.h"
53 #include "MagickWand/wand.h"
54
55 /*
56 Define declarations.
57 */
58 #define PixelWandId "PixelWand"
59
60 /*
61 Typedef declarations.
62 */
63 struct _PixelWand
64 {
65 size_t
66 id;
67
68 char
69 name[MagickPathExtent];
70
71 ExceptionInfo
72 *exception;
73
74 PixelInfo
75 pixel;
76
77 size_t
78 count;
79
80 MagickBooleanType
81 debug;
82
83 size_t
84 signature;
85 };
86
87 /*
88 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
89 % %
90 % %
91 % %
92 % C l e a r P i x e l W a n d %
93 % %
94 % %
95 % %
96 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
97 %
98 % ClearPixelWand() clears resources associated with the wand.
99 %
100 % The format of the ClearPixelWand method is:
101 %
102 % void ClearPixelWand(PixelWand *wand)
103 %
104 % A description of each parameter follows:
105 %
106 % o wand: the pixel wand.
107 %
108 */
ClearPixelWand(PixelWand * wand)109 WandExport void ClearPixelWand(PixelWand *wand)
110 {
111 assert(wand != (PixelWand *) NULL);
112 assert(wand->signature == MagickWandSignature);
113 if (wand->debug != MagickFalse)
114 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
115 ClearMagickException(wand->exception);
116 wand->pixel.colorspace=sRGBColorspace;
117 wand->debug=IsEventLogging();
118 }
119
120 /*
121 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
122 % %
123 % %
124 % %
125 % C l o n e P i x e l W a n d %
126 % %
127 % %
128 % %
129 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
130 %
131 % ClonePixelWand() makes an exact copy of the specified wand.
132 %
133 % The format of the ClonePixelWand method is:
134 %
135 % PixelWand *ClonePixelWand(const PixelWand *wand)
136 %
137 % A description of each parameter follows:
138 %
139 % o wand: the magick wand.
140 %
141 */
ClonePixelWand(const PixelWand * wand)142 WandExport PixelWand *ClonePixelWand(const PixelWand *wand)
143 {
144 PixelWand
145 *clone_wand;
146
147 assert(wand != (PixelWand *) NULL);
148 assert(wand->signature == MagickWandSignature);
149 if (wand->debug != MagickFalse)
150 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
151 clone_wand=(PixelWand *) AcquireCriticalMemory(sizeof(*clone_wand));
152 (void) memset(clone_wand,0,sizeof(*clone_wand));
153 clone_wand->id=AcquireWandId();
154 (void) FormatLocaleString(clone_wand->name,MagickPathExtent,"%s-%.20g",
155 PixelWandId,(double) clone_wand->id);
156 clone_wand->exception=AcquireExceptionInfo();
157 InheritException(clone_wand->exception,wand->exception);
158 clone_wand->pixel=wand->pixel;
159 clone_wand->count=wand->count;
160 clone_wand->debug=IsEventLogging();
161 if (clone_wand->debug != MagickFalse)
162 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clone_wand->name);
163 clone_wand->signature=MagickWandSignature;
164 return(clone_wand);
165 }
166
167 /*
168 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
169 % %
170 % %
171 % %
172 % C l o n e P i x e l W a n d s %
173 % %
174 % %
175 % %
176 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
177 %
178 % ClonePixelWands() makes an exact copy of the specified wands.
179 %
180 % The format of the ClonePixelWands method is:
181 %
182 % PixelWand **ClonePixelWands(const PixelWand **wands,
183 % const size_t number_wands)
184 %
185 % A description of each parameter follows:
186 %
187 % o wands: the magick wands.
188 %
189 % o number_wands: the number of wands.
190 %
191 */
ClonePixelWands(const PixelWand ** wands,const size_t number_wands)192 WandExport PixelWand **ClonePixelWands(const PixelWand **wands,
193 const size_t number_wands)
194 {
195 ssize_t
196 i;
197
198 PixelWand
199 **clone_wands;
200
201 clone_wands=(PixelWand **) AcquireCriticalMemory((size_t) number_wands*
202 sizeof(*clone_wands));
203 for (i=0; i < (ssize_t) number_wands; i++)
204 clone_wands[i]=ClonePixelWand(wands[i]);
205 return(clone_wands);
206 }
207
208 /*
209 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
210 % %
211 % %
212 % %
213 % D e s t r o y P i x e l W a n d %
214 % %
215 % %
216 % %
217 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
218 %
219 % DestroyPixelWand() deallocates resources associated with a PixelWand.
220 %
221 % The format of the DestroyPixelWand method is:
222 %
223 % PixelWand *DestroyPixelWand(PixelWand *wand)
224 %
225 % A description of each parameter follows:
226 %
227 % o wand: the pixel wand.
228 %
229 */
DestroyPixelWand(PixelWand * wand)230 WandExport PixelWand *DestroyPixelWand(PixelWand *wand)
231 {
232 assert(wand != (PixelWand *) NULL);
233 assert(wand->signature == MagickWandSignature);
234 if (wand->debug != MagickFalse)
235 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
236 wand->exception=DestroyExceptionInfo(wand->exception);
237 wand->signature=(~MagickWandSignature);
238 RelinquishWandId(wand->id);
239 wand=(PixelWand *) RelinquishMagickMemory(wand);
240 return(wand);
241 }
242
243 /*
244 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
245 % %
246 % %
247 % %
248 % D e s t r o y P i x e l W a n d s %
249 % %
250 % %
251 % %
252 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
253 %
254 % DestroyPixelWands() deallocates resources associated with an array of
255 % pixel wands.
256 %
257 % The format of the DestroyPixelWands method is:
258 %
259 % PixelWand **DestroyPixelWands(PixelWand **wand,
260 % const size_t number_wands)
261 %
262 % A description of each parameter follows:
263 %
264 % o wand: the pixel wand.
265 %
266 % o number_wands: the number of wands.
267 %
268 */
DestroyPixelWands(PixelWand ** wand,const size_t number_wands)269 WandExport PixelWand **DestroyPixelWands(PixelWand **wand,
270 const size_t number_wands)
271 {
272 ssize_t
273 i;
274
275 assert(wand != (PixelWand **) NULL);
276 assert(*wand != (PixelWand *) NULL);
277 assert((*wand)->signature == MagickWandSignature);
278 if ((*wand)->debug != MagickFalse)
279 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",(*wand)->name);
280 for (i=(ssize_t) number_wands-1; i >= 0; i--)
281 wand[i]=DestroyPixelWand(wand[i]);
282 wand=(PixelWand **) RelinquishMagickMemory(wand);
283 return(wand);
284 }
285
286 /*
287 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
288 % %
289 % %
290 % %
291 % I s P i x e l W a n d S i m i l a r %
292 % %
293 % %
294 % %
295 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
296 %
297 % IsPixelWandSimilar() returns MagickTrue if the distance between two
298 % colors is less than the specified distance.
299 %
300 % The format of the IsPixelWandSimilar method is:
301 %
302 % MagickBooleanType IsPixelWandSimilar(PixelWand *p,PixelWand *q,
303 % const double fuzz)
304 %
305 % A description of each parameter follows:
306 %
307 % o p: the pixel wand.
308 %
309 % o q: the pixel wand.
310 %
311 % o fuzz: any two colors that are less than or equal to this distance
312 % squared are consider similar.
313 %
314 */
IsPixelWandSimilar(PixelWand * p,PixelWand * q,const double fuzz)315 WandExport MagickBooleanType IsPixelWandSimilar(PixelWand *p,PixelWand *q,
316 const double fuzz)
317 {
318 assert(p != (PixelWand *) NULL);
319 assert(p->signature == MagickWandSignature);
320 if (p->debug != MagickFalse)
321 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",p->name);
322 assert(q != (PixelWand *) NULL);
323 assert(q->signature == MagickWandSignature);
324 if (q->debug != MagickFalse)
325 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",q->name);
326 p->pixel.fuzz=fuzz;
327 q->pixel.fuzz=fuzz;
328 return(IsFuzzyEquivalencePixelInfo(&p->pixel,&q->pixel));
329 }
330
331 /*
332 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
333 % %
334 % %
335 % %
336 % I s P i x e l W a n d %
337 % %
338 % %
339 % %
340 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
341 %
342 % IsPixelWand() returns MagickTrue if the wand is verified as a pixel wand.
343 %
344 % The format of the IsPixelWand method is:
345 %
346 % MagickBooleanType IsPixelWand(const PixelWand *wand)
347 %
348 % A description of each parameter follows:
349 %
350 % o wand: the magick wand.
351 %
352 */
IsPixelWand(const PixelWand * wand)353 WandExport MagickBooleanType IsPixelWand(const PixelWand *wand)
354 {
355 if (wand == (const PixelWand *) NULL)
356 return(MagickFalse);
357 if (wand->signature != MagickWandSignature)
358 return(MagickFalse);
359 if (LocaleNCompare(wand->name,PixelWandId,strlen(PixelWandId)) != 0)
360 return(MagickFalse);
361 return(MagickTrue);
362 }
363
364 /*
365 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
366 % %
367 % %
368 % %
369 % N e w P i x e l W a n d %
370 % %
371 % %
372 % %
373 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
374 %
375 % NewPixelWand() returns a new pixel wand.
376 %
377 % The format of the NewPixelWand method is:
378 %
379 % PixelWand *NewPixelWand(void)
380 %
381 */
NewPixelWand(void)382 WandExport PixelWand *NewPixelWand(void)
383 {
384 const char
385 *quantum;
386
387 PixelWand
388 *wand;
389
390 size_t
391 depth;
392
393 depth=MAGICKCORE_QUANTUM_DEPTH;
394 quantum=GetMagickQuantumDepth(&depth);
395 if (depth != MAGICKCORE_QUANTUM_DEPTH)
396 ThrowWandFatalException(WandError,"QuantumDepthMismatch",quantum);
397 wand=(PixelWand *) AcquireCriticalMemory(sizeof(*wand));
398 (void) memset(wand,0,sizeof(*wand));
399 wand->id=AcquireWandId();
400 (void) FormatLocaleString(wand->name,MagickPathExtent,"%s-%.20g",PixelWandId,
401 (double) wand->id);
402 wand->exception=AcquireExceptionInfo();
403 GetPixelInfo((Image *) NULL,&wand->pixel);
404 wand->debug=IsEventLogging();
405 if (wand->debug != MagickFalse)
406 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
407 wand->signature=MagickWandSignature;
408 return(wand);
409 }
410
411 /*
412 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
413 % %
414 % %
415 % %
416 % N e w P i x e l W a n d s %
417 % %
418 % %
419 % %
420 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
421 %
422 % NewPixelWands() returns an array of pixel wands.
423 %
424 % The format of the NewPixelWands method is:
425 %
426 % PixelWand **NewPixelWands(const size_t number_wands)
427 %
428 % A description of each parameter follows:
429 %
430 % o number_wands: the number of wands.
431 %
432 */
NewPixelWands(const size_t number_wands)433 WandExport PixelWand **NewPixelWands(const size_t number_wands)
434 {
435 ssize_t
436 i;
437
438 PixelWand
439 **wands;
440
441 wands=(PixelWand **) AcquireCriticalMemory((size_t) number_wands*
442 sizeof(*wands));
443 for (i=0; i < (ssize_t) number_wands; i++)
444 wands[i]=NewPixelWand();
445 return(wands);
446 }
447
448 /*
449 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
450 % %
451 % %
452 % %
453 % P i x e l C l e a r E x c e p t i o n %
454 % %
455 % %
456 % %
457 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
458 %
459 % PixelClearException() clear any exceptions associated with the iterator.
460 %
461 % The format of the PixelClearException method is:
462 %
463 % MagickBooleanType PixelClearException(PixelWand *wand)
464 %
465 % A description of each parameter follows:
466 %
467 % o wand: the pixel wand.
468 %
469 */
PixelClearException(PixelWand * wand)470 WandExport MagickBooleanType PixelClearException(PixelWand *wand)
471 {
472 assert(wand != (PixelWand *) NULL);
473 assert(wand->signature == MagickWandSignature);
474 if (wand->debug != MagickFalse)
475 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
476 ClearMagickException(wand->exception);
477 return(MagickTrue);
478 }
479
480 /*
481 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
482 % %
483 % %
484 % %
485 % P i x e l G e t A l p h a %
486 % %
487 % %
488 % %
489 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
490 %
491 % PixelGetAlpha() returns the normalized alpha value of the pixel wand.
492 %
493 % The format of the PixelGetAlpha method is:
494 %
495 % double PixelGetAlpha(const PixelWand *wand)
496 %
497 % A description of each parameter follows:
498 %
499 % o wand: the pixel wand.
500 %
501 */
PixelGetAlpha(const PixelWand * wand)502 WandExport double PixelGetAlpha(const PixelWand *wand)
503 {
504 assert(wand != (const PixelWand *) NULL);
505 assert(wand->signature == MagickWandSignature);
506 if (wand->debug != MagickFalse)
507 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
508 return((double) QuantumScale*wand->pixel.alpha);
509 }
510
511 /*
512 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
513 % %
514 % %
515 % %
516 % P i x e l G e t A l p h a Q u a n t u m %
517 % %
518 % %
519 % %
520 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
521 %
522 % PixelGetAlphaQuantum() returns the alpha value of the pixel wand.
523 %
524 % The format of the PixelGetAlphaQuantum method is:
525 %
526 % Quantum PixelGetAlphaQuantum(const PixelWand *wand)
527 %
528 % A description of each parameter follows:
529 %
530 % o wand: the pixel wand.
531 %
532 */
PixelGetAlphaQuantum(const PixelWand * wand)533 WandExport Quantum PixelGetAlphaQuantum(const PixelWand *wand)
534 {
535 assert(wand != (const PixelWand *) NULL);
536 assert(wand->signature == MagickWandSignature);
537 if (wand->debug != MagickFalse)
538 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
539 return(ClampToQuantum(wand->pixel.alpha));
540 }
541
542 /*
543 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
544 % %
545 % %
546 % %
547 % P i x e l G e t B l a c k %
548 % %
549 % %
550 % %
551 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
552 %
553 % PixelGetBlack() returns the normalized black color of the pixel wand.
554 %
555 % The format of the PixelGetBlack method is:
556 %
557 % double PixelGetBlack(const PixelWand *wand)
558 %
559 % A description of each parameter follows:
560 %
561 % o wand: the pixel wand.
562 %
563 */
PixelGetBlack(const PixelWand * wand)564 WandExport double PixelGetBlack(const PixelWand *wand)
565 {
566 assert(wand != (const PixelWand *) NULL);
567 assert(wand->signature == MagickWandSignature);
568 if (wand->debug != MagickFalse)
569 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
570 return((double) QuantumScale*wand->pixel.black);
571 }
572
573 /*
574 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
575 % %
576 % %
577 % %
578 % P i x e l G e t B l a c k Q u a n t u m %
579 % %
580 % %
581 % %
582 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
583 %
584 % PixelGetBlackQuantum() returns the black color of the pixel wand.
585 %
586 % The format of the PixelGetBlackQuantum method is:
587 %
588 % Quantum PixelGetBlackQuantum(const PixelWand *wand)
589 %
590 % A description of each parameter follows:
591 %
592 % o wand: the pixel wand.
593 %
594 */
PixelGetBlackQuantum(const PixelWand * wand)595 WandExport Quantum PixelGetBlackQuantum(const PixelWand *wand)
596 {
597 assert(wand != (const PixelWand *) NULL);
598 assert(wand->signature == MagickWandSignature);
599 if (wand->debug != MagickFalse)
600 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
601 return(ClampToQuantum(wand->pixel.black));
602 }
603
604 /*
605 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
606 % %
607 % %
608 % %
609 % P i x e l G e t B l u e %
610 % %
611 % %
612 % %
613 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
614 %
615 % PixelGetBlue() returns the normalized blue color of the pixel wand.
616 %
617 % The format of the PixelGetBlue method is:
618 %
619 % double PixelGetBlue(const PixelWand *wand)
620 %
621 % A description of each parameter follows:
622 %
623 % o wand: the pixel wand.
624 %
625 */
PixelGetBlue(const PixelWand * wand)626 WandExport double PixelGetBlue(const PixelWand *wand)
627 {
628 assert(wand != (const PixelWand *) NULL);
629 assert(wand->signature == MagickWandSignature);
630 if (wand->debug != MagickFalse)
631 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
632 return((double) QuantumScale*wand->pixel.blue);
633 }
634
635 /*
636 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
637 % %
638 % %
639 % %
640 % P i x e l G e t B l u e Q u a n t u m %
641 % %
642 % %
643 % %
644 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
645 %
646 % PixelGetBlueQuantum() returns the blue color of the pixel wand.
647 %
648 % The format of the PixelGetBlueQuantum method is:
649 %
650 % Quantum PixelGetBlueQuantum(const PixelWand *wand)
651 %
652 % A description of each parameter follows:
653 %
654 % o wand: the pixel wand.
655 %
656 */
PixelGetBlueQuantum(const PixelWand * wand)657 WandExport Quantum PixelGetBlueQuantum(const PixelWand *wand)
658 {
659 assert(wand != (const PixelWand *) NULL);
660 assert(wand->signature == MagickWandSignature);
661 if (wand->debug != MagickFalse)
662 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
663 return(ClampToQuantum(wand->pixel.blue));
664 }
665
666 /*
667 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
668 % %
669 % %
670 % %
671 % P i x e l G e t C o l o r A s S t r i n g %
672 % %
673 % %
674 % %
675 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
676 %
677 % PixelGetColorAsString() returnsd the color of the pixel wand as a string.
678 %
679 % The format of the PixelGetColorAsString method is:
680 %
681 % char *PixelGetColorAsString(PixelWand *wand)
682 %
683 % A description of each parameter follows:
684 %
685 % o wand: the pixel wand.
686 %
687 */
PixelGetColorAsString(const PixelWand * wand)688 WandExport char *PixelGetColorAsString(const PixelWand *wand)
689 {
690 char
691 *color;
692
693 PixelInfo
694 pixel;
695
696 assert(wand != (const PixelWand *) NULL);
697 assert(wand->signature == MagickWandSignature);
698 if (wand->debug != MagickFalse)
699 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
700 pixel=wand->pixel;
701 color=AcquireString((const char *) NULL);
702 GetColorTuple(&pixel,MagickFalse,color);
703 return(color);
704 }
705
706 /*
707 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
708 % %
709 % %
710 % %
711 % P i x e l G e t C o l o r A s N o r m a l i z e d S t r i n g %
712 % %
713 % %
714 % %
715 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
716 %
717 % PixelGetColorAsNormalizedString() returns the normalized color of the pixel
718 % wand as a string.
719 %
720 % The format of the PixelGetColorAsNormalizedString method is:
721 %
722 % char *PixelGetColorAsNormalizedString(PixelWand *wand)
723 %
724 % A description of each parameter follows:
725 %
726 % o wand: the pixel wand.
727 %
728 */
PixelGetColorAsNormalizedString(const PixelWand * wand)729 WandExport char *PixelGetColorAsNormalizedString(const PixelWand *wand)
730 {
731 char
732 color[2*MagickPathExtent];
733
734 assert(wand != (const PixelWand *) NULL);
735 assert(wand->signature == MagickWandSignature);
736 if (wand->debug != MagickFalse)
737 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
738 (void) FormatLocaleString(color,MagickPathExtent,"%g,%g,%g",(double)
739 (QuantumScale*wand->pixel.red),(double) (QuantumScale*wand->pixel.green),
740 (double) (QuantumScale*wand->pixel.blue));
741 if (wand->pixel.colorspace == CMYKColorspace)
742 (void) FormatLocaleString(color+strlen(color),MagickPathExtent,",%g",
743 (double) (QuantumScale*wand->pixel.black));
744 if (wand->pixel.alpha_trait != UndefinedPixelTrait)
745 (void) FormatLocaleString(color+strlen(color),MagickPathExtent,",%g",
746 (double) (QuantumScale*wand->pixel.alpha));
747 return(ConstantString(color));
748 }
749
750 /*
751 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
752 % %
753 % %
754 % %
755 % P i x e l G e t C o l o r C o u n t %
756 % %
757 % %
758 % %
759 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
760 %
761 % PixelGetColorCount() returns the color count associated with this color.
762 %
763 % The format of the PixelGetColorCount method is:
764 %
765 % size_t PixelGetColorCount(const PixelWand *wand)
766 %
767 % A description of each parameter follows:
768 %
769 % o wand: the pixel wand.
770 %
771 */
PixelGetColorCount(const PixelWand * wand)772 WandExport size_t PixelGetColorCount(const PixelWand *wand)
773 {
774 assert(wand != (const PixelWand *) NULL);
775 assert(wand->signature == MagickWandSignature);
776 if (wand->debug != MagickFalse)
777 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
778 return(wand->count);
779 }
780
781 /*
782 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
783 % %
784 % %
785 % %
786 % P i x e l G e t C y a n %
787 % %
788 % %
789 % %
790 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
791 %
792 % PixelGetCyan() returns the normalized cyan color of the pixel wand.
793 %
794 % The format of the PixelGetCyan method is:
795 %
796 % double PixelGetCyan(const PixelWand *wand)
797 %
798 % A description of each parameter follows:
799 %
800 % o wand: the pixel wand.
801 %
802 */
PixelGetCyan(const PixelWand * wand)803 WandExport double PixelGetCyan(const PixelWand *wand)
804 {
805 assert(wand != (const PixelWand *) NULL);
806 assert(wand->signature == MagickWandSignature);
807 if (wand->debug != MagickFalse)
808 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
809 return((double) QuantumScale*wand->pixel.red);
810 }
811
812 /*
813 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
814 % %
815 % %
816 % %
817 % P i x e l G e t C y a n Q u a n t u m %
818 % %
819 % %
820 % %
821 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
822 %
823 % PixelGetCyanQuantum() returns the cyan color of the pixel wand.
824 %
825 % The format of the PixelGetCyanQuantum method is:
826 %
827 % Quantum PixelGetCyanQuantum(const PixelWand *wand)
828 %
829 % A description of each parameter follows:
830 %
831 % o wand: the pixel wand.
832 %
833 */
PixelGetCyanQuantum(const PixelWand * wand)834 WandExport Quantum PixelGetCyanQuantum(const PixelWand *wand)
835 {
836 assert(wand != (const PixelWand *) NULL);
837 assert(wand->signature == MagickWandSignature);
838 if (wand->debug != MagickFalse)
839 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
840 return(ClampToQuantum(wand->pixel.red));
841 }
842
843 /*
844 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
845 % %
846 % %
847 % %
848 % P i x e l G e t E x c e p t i o n %
849 % %
850 % %
851 % %
852 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
853 %
854 % PixelGetException() returns the severity, reason, and description of any
855 % error that occurs when using other methods in this API.
856 %
857 % The format of the PixelGetException method is:
858 %
859 % char *PixelGetException(const PixelWand *wand,ExceptionType *severity)
860 %
861 % A description of each parameter follows:
862 %
863 % o wand: the pixel wand.
864 %
865 % o severity: the severity of the error is returned here.
866 %
867 */
PixelGetException(const PixelWand * wand,ExceptionType * severity)868 WandExport char *PixelGetException(const PixelWand *wand,
869 ExceptionType *severity)
870 {
871 char
872 *description;
873
874 assert(wand != (const PixelWand *) NULL);
875 assert(wand->signature == MagickWandSignature);
876 if (wand->debug != MagickFalse)
877 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
878 assert(severity != (ExceptionType *) NULL);
879 *severity=wand->exception->severity;
880 description=(char *) AcquireQuantumMemory(2UL*MagickPathExtent,
881 sizeof(*description));
882 if (description == (char *) NULL)
883 ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
884 wand->name);
885 *description='\0';
886 if (wand->exception->reason != (char *) NULL)
887 (void) CopyMagickString(description,GetLocaleExceptionMessage(
888 wand->exception->severity,wand->exception->reason),MagickPathExtent);
889 if (wand->exception->description != (char *) NULL)
890 {
891 (void) ConcatenateMagickString(description," (",MagickPathExtent);
892 (void) ConcatenateMagickString(description,GetLocaleExceptionMessage(
893 wand->exception->severity,wand->exception->description),
894 MagickPathExtent);
895 (void) ConcatenateMagickString(description,")",MagickPathExtent);
896 }
897 return(description);
898 }
899
900 /*
901 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
902 % %
903 % %
904 % %
905 % P i x e l G e t E x c e p t i o n T y p e %
906 % %
907 % %
908 % %
909 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
910 %
911 % PixelGetExceptionType() the exception type associated with the wand. If
912 % no exception has occurred, UndefinedExceptionType is returned.
913 %
914 % The format of the PixelGetExceptionType method is:
915 %
916 % ExceptionType PixelGetExceptionType(const PixelWand *wand)
917 %
918 % A description of each parameter follows:
919 %
920 % o wand: the magick wand.
921 %
922 */
PixelGetExceptionType(const PixelWand * wand)923 WandExport ExceptionType PixelGetExceptionType(const PixelWand *wand)
924 {
925 assert(wand != (const PixelWand *) NULL);
926 assert(wand->signature == MagickWandSignature);
927 if (wand->debug != MagickFalse)
928 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
929 return(wand->exception->severity);
930 }
931
932 /*
933 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
934 % %
935 % %
936 % %
937 % P i x e l G e t F u z z %
938 % %
939 % %
940 % %
941 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
942 %
943 % PixelGetFuzz() returns the normalized fuzz value of the pixel wand.
944 %
945 % The format of the PixelGetFuzz method is:
946 %
947 % double PixelGetFuzz(const PixelWand *wand)
948 %
949 % A description of each parameter follows:
950 %
951 % o wand: the pixel wand.
952 %
953 */
PixelGetFuzz(const PixelWand * wand)954 WandExport double PixelGetFuzz(const PixelWand *wand)
955 {
956 assert(wand != (const PixelWand *) NULL);
957 assert(wand->signature == MagickWandSignature);
958 if (wand->debug != MagickFalse)
959 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
960 return((double) wand->pixel.fuzz);
961 }
962
963 /*
964 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
965 % %
966 % %
967 % %
968 % P i x e l G e t G r e e n %
969 % %
970 % %
971 % %
972 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
973 %
974 % PixelGetGreen() returns the normalized green color of the pixel wand.
975 %
976 % The format of the PixelGetGreen method is:
977 %
978 % double PixelGetGreen(const PixelWand *wand)
979 %
980 % A description of each parameter follows:
981 %
982 % o wand: the pixel wand.
983 %
984 */
PixelGetGreen(const PixelWand * wand)985 WandExport double PixelGetGreen(const PixelWand *wand)
986 {
987 assert(wand != (const PixelWand *) NULL);
988 assert(wand->signature == MagickWandSignature);
989 if (wand->debug != MagickFalse)
990 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
991 return((double) QuantumScale*wand->pixel.green);
992 }
993
994 /*
995 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
996 % %
997 % %
998 % %
999 % P i x e l G e t G r e e n Q u a n t u m %
1000 % %
1001 % %
1002 % %
1003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1004 %
1005 % PixelGetGreenQuantum() returns the green color of the pixel wand.
1006 %
1007 % The format of the PixelGetGreenQuantum method is:
1008 %
1009 % Quantum PixelGetGreenQuantum(const PixelWand *wand)
1010 %
1011 % A description of each parameter follows:
1012 %
1013 % o wand: the pixel wand.
1014 %
1015 */
PixelGetGreenQuantum(const PixelWand * wand)1016 WandExport Quantum PixelGetGreenQuantum(const PixelWand *wand)
1017 {
1018 assert(wand != (const PixelWand *) NULL);
1019 assert(wand->signature == MagickWandSignature);
1020 if (wand->debug != MagickFalse)
1021 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1022 return(ClampToQuantum(wand->pixel.green));
1023 }
1024
1025 /*
1026 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1027 % %
1028 % %
1029 % %
1030 % P i x e l G e t H S L %
1031 % %
1032 % %
1033 % %
1034 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1035 %
1036 % PixelGetHSL() returns the normalized HSL color of the pixel wand.
1037 %
1038 % The format of the PixelGetHSL method is:
1039 %
1040 % void PixelGetHSL(const PixelWand *wand,double *hue,double *saturation,
1041 % double *lightness)
1042 %
1043 % A description of each parameter follows:
1044 %
1045 % o wand: the pixel wand.
1046 %
1047 % o hue,saturation,lightness: Return the pixel hue, saturation, and
1048 % brightness.
1049 %
1050 */
PixelGetHSL(const PixelWand * wand,double * hue,double * saturation,double * lightness)1051 WandExport void PixelGetHSL(const PixelWand *wand,double *hue,
1052 double *saturation,double *lightness)
1053 {
1054 assert(wand != (const PixelWand *) NULL);
1055 assert(wand->signature == MagickWandSignature);
1056 if (wand->debug != MagickFalse)
1057 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1058 ConvertRGBToHSL((double) ClampToQuantum(wand->pixel.red),(double)
1059 ClampToQuantum(wand->pixel.green),(double) ClampToQuantum(wand->pixel.blue),
1060 hue,saturation,lightness);
1061 }
1062
1063 /*
1064 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1065 % %
1066 % %
1067 % %
1068 % P i x e l G e t I n d e x %
1069 % %
1070 % %
1071 % %
1072 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1073 %
1074 % PixelGetIndex() returns the colormap index from the pixel wand.
1075 %
1076 % The format of the PixelGetIndex method is:
1077 %
1078 % Quantum PixelGetIndex(const PixelWand *wand)
1079 %
1080 % A description of each parameter follows:
1081 %
1082 % o wand: the pixel wand.
1083 %
1084 */
PixelGetIndex(const PixelWand * wand)1085 WandExport Quantum PixelGetIndex(const PixelWand *wand)
1086 {
1087 assert(wand != (const PixelWand *) NULL);
1088 assert(wand->signature == MagickWandSignature);
1089 if (wand->debug != MagickFalse)
1090 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1091 return((Quantum) wand->pixel.index);
1092 }
1093
1094 /*
1095 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1096 % %
1097 % %
1098 % %
1099 % P i x e l G e t M a g e n t a %
1100 % %
1101 % %
1102 % %
1103 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1104 %
1105 % PixelGetMagenta() returns the normalized magenta color of the pixel wand.
1106 %
1107 % The format of the PixelGetMagenta method is:
1108 %
1109 % double PixelGetMagenta(const PixelWand *wand)
1110 %
1111 % A description of each parameter follows:
1112 %
1113 % o wand: the pixel wand.
1114 %
1115 */
PixelGetMagenta(const PixelWand * wand)1116 WandExport double PixelGetMagenta(const PixelWand *wand)
1117 {
1118 assert(wand != (const PixelWand *) NULL);
1119 assert(wand->signature == MagickWandSignature);
1120 if (wand->debug != MagickFalse)
1121 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1122 return((double) QuantumScale*wand->pixel.green);
1123 }
1124
1125 /*
1126 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1127 % %
1128 % %
1129 % %
1130 % P i x e l G e t M a g e n t a Q u a n t u m %
1131 % %
1132 % %
1133 % %
1134 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1135 %
1136 % PixelGetMagentaQuantum() returns the magenta color of the pixel wand.
1137 %
1138 % The format of the PixelGetMagentaQuantum method is:
1139 %
1140 % Quantum PixelGetMagentaQuantum(const PixelWand *wand)
1141 %
1142 % A description of each parameter follows:
1143 %
1144 % o wand: the pixel wand.
1145 %
1146 */
PixelGetMagentaQuantum(const PixelWand * wand)1147 WandExport Quantum PixelGetMagentaQuantum(const PixelWand *wand)
1148 {
1149 assert(wand != (const PixelWand *) NULL);
1150 assert(wand->signature == MagickWandSignature);
1151 if (wand->debug != MagickFalse)
1152 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1153 return(ClampToQuantum(wand->pixel.green));
1154 }
1155
1156 /*
1157 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1158 % %
1159 % %
1160 % %
1161 % P i x e l G e t M a g i c k C o l o r %
1162 % %
1163 % %
1164 % %
1165 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1166 %
1167 % PixelGetMagickColor() gets the magick color of the pixel wand.
1168 %
1169 % The format of the PixelGetMagickColor method is:
1170 %
1171 % void PixelGetMagickColor(PixelWand *wand,PixelInfo *color)
1172 %
1173 % A description of each parameter follows:
1174 %
1175 % o wand: the pixel wand.
1176 %
1177 % o color: The pixel wand color is returned here.
1178 %
1179 */
PixelGetMagickColor(const PixelWand * wand,PixelInfo * color)1180 WandExport void PixelGetMagickColor(const PixelWand *wand,
1181 PixelInfo *color)
1182 {
1183 assert(wand != (const PixelWand *) NULL);
1184 assert(wand->signature == MagickWandSignature);
1185 if (wand->debug != MagickFalse)
1186 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1187 assert(color != (PixelInfo *) NULL);
1188 *color=wand->pixel;
1189 }
1190
1191 /*
1192 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1193 % %
1194 % %
1195 % %
1196 % P i x e l G e t P i x e l %
1197 % %
1198 % %
1199 % %
1200 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1201 %
1202 % PixelGetPixel() returns the pixel wand pixel.
1203 %
1204 % The format of the PixelGetPixel method is:
1205 %
1206 % PixelInfo PixelGetPixel(const PixelWand *wand)
1207 %
1208 % A description of each parameter follows:
1209 %
1210 % o wand: the pixel wand.
1211 %
1212 */
PixelGetPixel(const PixelWand * wand)1213 WandExport PixelInfo PixelGetPixel(const PixelWand *wand)
1214 {
1215 assert(wand != (const PixelWand *) NULL);
1216 assert(wand->signature == MagickWandSignature);
1217 if (wand->debug != MagickFalse)
1218 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1219 return(wand->pixel);
1220 }
1221
1222 /*
1223 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1224 % %
1225 % %
1226 % %
1227 % P i x e l G e t Q u a n t u m P a c k e t %
1228 % %
1229 % %
1230 % %
1231 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1232 %
1233 % PixelGetQuantumPacket() gets the packet of the pixel wand as a PixelInfo.
1234 %
1235 % The format of the PixelGetQuantumPacket method is:
1236 %
1237 % void PixelGetQuantumPacket(PixelWand *wand,PixelInfo *packet)
1238 %
1239 % A description of each parameter follows:
1240 %
1241 % o wand: the pixel wand.
1242 %
1243 % o packet: The pixel wand packet is returned here.
1244 %
1245 */
PixelGetQuantumPacket(const PixelWand * wand,PixelInfo * packet)1246 WandExport void PixelGetQuantumPacket(const PixelWand *wand,PixelInfo *packet)
1247 {
1248 assert(wand != (const PixelWand *) NULL);
1249 assert(wand->signature == MagickWandSignature);
1250 if (wand->debug != MagickFalse)
1251 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1252 assert(packet != (PixelInfo *) NULL);
1253 packet->storage_class=wand->pixel.storage_class;
1254 packet->colorspace=wand->pixel.colorspace;
1255 packet->depth=wand->pixel.depth;
1256 packet->fuzz=wand->pixel.fuzz;
1257 packet->count=wand->pixel.count;
1258 packet->index=wand->pixel.index;
1259 packet->alpha=(double) ClampToQuantum(wand->pixel.alpha);
1260 packet->alpha_trait=wand->pixel.alpha_trait;
1261 if (wand->pixel.colorspace == CMYKColorspace)
1262 {
1263 packet->red=(double) ClampToQuantum(QuantumRange-(wand->pixel.red*
1264 (QuantumRange-wand->pixel.black)+wand->pixel.black));
1265 packet->green=(double) ClampToQuantum(QuantumRange-(wand->pixel.green*
1266 (QuantumRange-wand->pixel.black)+wand->pixel.black));
1267 packet->blue=(double) ClampToQuantum(QuantumRange-(wand->pixel.blue*
1268 (QuantumRange-wand->pixel.black)+wand->pixel.black));
1269 packet->black=(double) ClampToQuantum(wand->pixel.black);
1270 return;
1271 }
1272 packet->red=(double) ClampToQuantum(wand->pixel.red);
1273 packet->green=(double) ClampToQuantum(wand->pixel.green);
1274 packet->blue=(double) ClampToQuantum(wand->pixel.blue);
1275 }
1276
1277 /*
1278 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1279 % %
1280 % %
1281 % %
1282 % P i x e l G e t Q u a n t u m P i x e l %
1283 % %
1284 % %
1285 % %
1286 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1287 %
1288 % PixelGetQuantumPixel() gets the pixel of the pixel wand as a PixelInfo.
1289 %
1290 % The format of the PixelGetQuantumPixel method is:
1291 %
1292 % void PixelGetQuantumPixel(const Image *image,const PixelWand *wand,
1293 % Quantum *pixel)
1294 %
1295 % A description of each parameter follows:
1296 %
1297 % o wand: the pixel wand.
1298 %
1299 % o pixel: The pixel wand pixel is returned here.
1300 %
1301 */
PixelGetQuantumPixel(const Image * image,const PixelWand * wand,Quantum * pixel)1302 WandExport void PixelGetQuantumPixel(const Image *image,const PixelWand *wand,
1303 Quantum *pixel)
1304 {
1305 assert(wand != (const PixelWand *) NULL);
1306 assert(wand->signature == MagickWandSignature);
1307 if (wand->debug != MagickFalse)
1308 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1309 assert(pixel != (Quantum *) NULL);
1310 SetPixelAlpha(image,ClampToQuantum(wand->pixel.alpha),pixel);
1311 if (wand->pixel.colorspace == CMYKColorspace)
1312 {
1313 SetPixelRed(image,ClampToQuantum(QuantumRange-
1314 (wand->pixel.red*(QuantumRange-wand->pixel.black)+wand->pixel.black)),
1315 pixel);
1316 SetPixelGreen(image,ClampToQuantum(QuantumRange-
1317 (wand->pixel.green*(QuantumRange-wand->pixel.black)+wand->pixel.black)),
1318 pixel);
1319 SetPixelBlue(image,ClampToQuantum(QuantumRange-
1320 (wand->pixel.blue*(QuantumRange-wand->pixel.black)+wand->pixel.black)),
1321 pixel);
1322 SetPixelBlack(image,ClampToQuantum(wand->pixel.black),pixel);
1323 return;
1324 }
1325 SetPixelRed(image,ClampToQuantum(wand->pixel.red),pixel);
1326 SetPixelGreen(image,ClampToQuantum(wand->pixel.green),pixel);
1327 SetPixelBlue(image,ClampToQuantum(wand->pixel.blue),pixel);
1328 }
1329
1330 /*
1331 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1332 % %
1333 % %
1334 % %
1335 % P i x e l G e t R e d %
1336 % %
1337 % %
1338 % %
1339 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1340 %
1341 % PixelGetRed() returns the normalized red color of the pixel wand.
1342 %
1343 % The format of the PixelGetRed method is:
1344 %
1345 % double PixelGetRed(const PixelWand *wand)
1346 %
1347 % A description of each parameter follows:
1348 %
1349 % o wand: the pixel wand.
1350 %
1351 */
PixelGetRed(const PixelWand * wand)1352 WandExport double PixelGetRed(const PixelWand *wand)
1353 {
1354 assert(wand != (const PixelWand *) NULL);
1355 assert(wand->signature == MagickWandSignature);
1356 if (wand->debug != MagickFalse)
1357 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1358 return((double) QuantumScale*wand->pixel.red);
1359 }
1360
1361 /*
1362 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1363 % %
1364 % %
1365 % %
1366 % P i x e l G e t R e d Q u a n t u m %
1367 % %
1368 % %
1369 % %
1370 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1371 %
1372 % PixelGetRedQuantum() returns the red color of the pixel wand.
1373 %
1374 % The format of the PixelGetRedQuantum method is:
1375 %
1376 % Quantum PixelGetRedQuantum(const PixelWand *wand)
1377 %
1378 % A description of each parameter follows:
1379 %
1380 % o wand: the pixel wand.
1381 %
1382 */
PixelGetRedQuantum(const PixelWand * wand)1383 WandExport Quantum PixelGetRedQuantum(const PixelWand *wand)
1384 {
1385 assert(wand != (const PixelWand *) NULL);
1386 assert(wand->signature == MagickWandSignature);
1387 if (wand->debug != MagickFalse)
1388 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1389 return(ClampToQuantum(wand->pixel.red));
1390 }
1391
1392 /*
1393 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1394 % %
1395 % %
1396 % %
1397 % P i x e l G e t Y e l l o w %
1398 % %
1399 % %
1400 % %
1401 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1402 %
1403 % PixelGetYellow() returns the normalized yellow color of the pixel wand.
1404 %
1405 % The format of the PixelGetYellow method is:
1406 %
1407 % double PixelGetYellow(const PixelWand *wand)
1408 %
1409 % A description of each parameter follows:
1410 %
1411 % o wand: the pixel wand.
1412 %
1413 */
PixelGetYellow(const PixelWand * wand)1414 WandExport double PixelGetYellow(const PixelWand *wand)
1415 {
1416 assert(wand != (const PixelWand *) NULL);
1417 assert(wand->signature == MagickWandSignature);
1418 if (wand->debug != MagickFalse)
1419 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1420 return((double) QuantumScale*wand->pixel.blue);
1421 }
1422
1423 /*
1424 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1425 % %
1426 % %
1427 % %
1428 % P i x e l G e t Y e l l o w Q u a n t u m %
1429 % %
1430 % %
1431 % %
1432 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1433 %
1434 % PixelGetYellowQuantum() returns the yellow color of the pixel wand.
1435 %
1436 % The format of the PixelGetYellowQuantum method is:
1437 %
1438 % Quantum PixelGetYellowQuantum(const PixelWand *wand)
1439 %
1440 % A description of each parameter follows:
1441 %
1442 % o wand: the pixel wand.
1443 %
1444 */
PixelGetYellowQuantum(const PixelWand * wand)1445 WandExport Quantum PixelGetYellowQuantum(const PixelWand *wand)
1446 {
1447 assert(wand != (const PixelWand *) NULL);
1448 assert(wand->signature == MagickWandSignature);
1449 if (wand->debug != MagickFalse)
1450 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1451 return(ClampToQuantum(wand->pixel.blue));
1452 }
1453
1454 /*
1455 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1456 % %
1457 % %
1458 % %
1459 % P i x e l S e t A l p h a %
1460 % %
1461 % %
1462 % %
1463 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1464 %
1465 % PixelSetAlpha() sets the normalized alpha value of the pixel wand.
1466 %
1467 % The format of the PixelSetAlpha method is:
1468 %
1469 % void PixelSetAlpha(PixelWand *wand,const double alpha)
1470 %
1471 % A description of each parameter follows:
1472 %
1473 % o wand: the pixel wand.
1474 %
1475 % o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
1476 % transparent.
1477 %
1478 */
PixelSetAlpha(PixelWand * wand,const double alpha)1479 WandExport void PixelSetAlpha(PixelWand *wand,const double alpha)
1480 {
1481 assert(wand != (const PixelWand *) NULL);
1482 assert(wand->signature == MagickWandSignature);
1483 if (wand->debug != MagickFalse)
1484 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1485 wand->pixel.alpha=(double) ClampToQuantum(QuantumRange*alpha);
1486 }
1487
1488 /*
1489 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1490 % %
1491 % %
1492 % %
1493 % P i x e l S e t A l p h a Q u a n t u m %
1494 % %
1495 % %
1496 % %
1497 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1498 %
1499 % PixelSetAlphaQuantum() sets the alpha value of the pixel wand.
1500 %
1501 % The format of the PixelSetAlphaQuantum method is:
1502 %
1503 % void PixelSetAlphaQuantum(PixelWand *wand,const Quantum alpha)
1504 %
1505 % A description of each parameter follows:
1506 %
1507 % o wand: the pixel wand.
1508 %
1509 % o alpha: the alpha value.
1510 %
1511 */
PixelSetAlphaQuantum(PixelWand * wand,const Quantum alpha)1512 WandExport void PixelSetAlphaQuantum(PixelWand *wand,const Quantum alpha)
1513 {
1514 assert(wand != (const PixelWand *) NULL);
1515 assert(wand->signature == MagickWandSignature);
1516 if (wand->debug != MagickFalse)
1517 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1518 wand->pixel.alpha=(double) alpha;
1519 }
1520
1521 /*
1522 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1523 % %
1524 % %
1525 % %
1526 % P i x e l S e t B l a c k %
1527 % %
1528 % %
1529 % %
1530 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1531 %
1532 % PixelSetBlack() sets the normalized black color of the pixel wand.
1533 %
1534 % The format of the PixelSetBlack method is:
1535 %
1536 % void PixelSetBlack(PixelWand *wand,const double black)
1537 %
1538 % A description of each parameter follows:
1539 %
1540 % o wand: the pixel wand.
1541 %
1542 % o black: the black color.
1543 %
1544 */
PixelSetBlack(PixelWand * wand,const double black)1545 WandExport void PixelSetBlack(PixelWand *wand,const double black)
1546 {
1547 assert(wand != (const PixelWand *) NULL);
1548 assert(wand->signature == MagickWandSignature);
1549 if (wand->debug != MagickFalse)
1550 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1551 wand->pixel.black=(double) ClampToQuantum(QuantumRange*black);
1552 }
1553
1554 /*
1555 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1556 % %
1557 % %
1558 % %
1559 % P i x e l S e t B l a c k Q u a n t u m %
1560 % %
1561 % %
1562 % %
1563 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1564 %
1565 % PixelSetBlackQuantum() sets the black color of the pixel wand.
1566 %
1567 % The format of the PixelSetBlackQuantum method is:
1568 %
1569 % void PixelSetBlackQuantum(PixelWand *wand,const Quantum black)
1570 %
1571 % A description of each parameter follows:
1572 %
1573 % o wand: the pixel wand.
1574 %
1575 % o black: the black color.
1576 %
1577 */
PixelSetBlackQuantum(PixelWand * wand,const Quantum black)1578 WandExport void PixelSetBlackQuantum(PixelWand *wand,const Quantum black)
1579 {
1580 assert(wand != (const PixelWand *) NULL);
1581 assert(wand->signature == MagickWandSignature);
1582 if (wand->debug != MagickFalse)
1583 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1584 wand->pixel.black=(double) black;
1585 }
1586
1587 /*
1588 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1589 % %
1590 % %
1591 % %
1592 % P i x e l S e t B l u e %
1593 % %
1594 % %
1595 % %
1596 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1597 %
1598 % PixelSetBlue() sets the normalized blue color of the pixel wand.
1599 %
1600 % The format of the PixelSetBlue method is:
1601 %
1602 % void PixelSetBlue(PixelWand *wand,const double blue)
1603 %
1604 % A description of each parameter follows:
1605 %
1606 % o wand: the pixel wand.
1607 %
1608 % o blue: the blue color.
1609 %
1610 */
PixelSetBlue(PixelWand * wand,const double blue)1611 WandExport void PixelSetBlue(PixelWand *wand,const double blue)
1612 {
1613 assert(wand != (const PixelWand *) NULL);
1614 assert(wand->signature == MagickWandSignature);
1615 if (wand->debug != MagickFalse)
1616 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1617 wand->pixel.blue=(double) ClampToQuantum(QuantumRange*blue);
1618 }
1619
1620 /*
1621 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1622 % %
1623 % %
1624 % %
1625 % P i x e l S e t B l u e Q u a n t u m %
1626 % %
1627 % %
1628 % %
1629 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1630 %
1631 % PixelSetBlueQuantum() sets the blue color of the pixel wand.
1632 %
1633 % The format of the PixelSetBlueQuantum method is:
1634 %
1635 % void PixelSetBlueQuantum(PixelWand *wand,const Quantum blue)
1636 %
1637 % A description of each parameter follows:
1638 %
1639 % o wand: the pixel wand.
1640 %
1641 % o blue: the blue color.
1642 %
1643 */
PixelSetBlueQuantum(PixelWand * wand,const Quantum blue)1644 WandExport void PixelSetBlueQuantum(PixelWand *wand,const Quantum blue)
1645 {
1646 assert(wand != (const PixelWand *) NULL);
1647 assert(wand->signature == MagickWandSignature);
1648 if (wand->debug != MagickFalse)
1649 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1650 wand->pixel.blue=(double) blue;
1651 }
1652
1653 /*
1654 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1655 % %
1656 % %
1657 % %
1658 % P i x e l S e t C o l o r %
1659 % %
1660 % %
1661 % %
1662 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1663 %
1664 % PixelSetColor() sets the color of the pixel wand with a string (e.g.
1665 % "blue", "#0000ff", "rgb(0,0,255)", "cmyk(100,100,100,10)", etc.).
1666 %
1667 % The format of the PixelSetColor method is:
1668 %
1669 % MagickBooleanType PixelSetColor(PixelWand *wand,const char *color)
1670 %
1671 % A description of each parameter follows:
1672 %
1673 % o wand: the pixel wand.
1674 %
1675 % o color: the pixel wand color.
1676 %
1677 */
PixelSetColor(PixelWand * wand,const char * color)1678 WandExport MagickBooleanType PixelSetColor(PixelWand *wand,const char *color)
1679 {
1680 MagickBooleanType
1681 status;
1682
1683 PixelInfo
1684 pixel;
1685
1686 assert(wand != (const PixelWand *) NULL);
1687 assert(wand->signature == MagickWandSignature);
1688 if (wand->debug != MagickFalse)
1689 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1690 status=QueryColorCompliance(color,AllCompliance,&pixel,wand->exception);
1691 if (status != MagickFalse)
1692 wand->pixel=pixel;
1693 return(status);
1694 }
1695
1696 /*
1697 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1698 % %
1699 % %
1700 % %
1701 % P i x e l S e t C o l o r C o u n t %
1702 % %
1703 % %
1704 % %
1705 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1706 %
1707 % PixelSetColorCount() sets the color count of the pixel wand.
1708 %
1709 % The format of the PixelSetColorCount method is:
1710 %
1711 % void PixelSetColorCount(PixelWand *wand,const size_t count)
1712 %
1713 % A description of each parameter follows:
1714 %
1715 % o wand: the pixel wand.
1716 %
1717 % o count: the number of this particular color.
1718 %
1719 */
PixelSetColorCount(PixelWand * wand,const size_t count)1720 WandExport void PixelSetColorCount(PixelWand *wand,const size_t count)
1721 {
1722 assert(wand != (const PixelWand *) NULL);
1723 assert(wand->signature == MagickWandSignature);
1724 if (wand->debug != MagickFalse)
1725 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1726 wand->count=count;
1727 }
1728
1729 /*
1730 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1731 % %
1732 % %
1733 % %
1734 % P i x e l S e t C o l o r F r o m W a n d %
1735 % %
1736 % %
1737 % %
1738 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1739 %
1740 % PixelSetColorFromWand() sets the color of the pixel wand.
1741 %
1742 % The format of the PixelSetColorFromWand method is:
1743 %
1744 % void PixelSetColorFromWand(PixelWand *wand,const PixelWand *color)
1745 %
1746 % A description of each parameter follows:
1747 %
1748 % o wand: the pixel wand.
1749 %
1750 % o color: set the pixel wand color here.
1751 %
1752 */
PixelSetColorFromWand(PixelWand * wand,const PixelWand * color)1753 WandExport void PixelSetColorFromWand(PixelWand *wand,const PixelWand *color)
1754 {
1755 assert(wand != (const PixelWand *) NULL);
1756 assert(wand->signature == MagickWandSignature);
1757 if (wand->debug != MagickFalse)
1758 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1759 assert(color != (const PixelWand *) NULL);
1760 wand->pixel=color->pixel;
1761 }
1762
1763 /*
1764 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1765 % %
1766 % %
1767 % %
1768 % P i x e l S e t C y a n %
1769 % %
1770 % %
1771 % %
1772 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1773 %
1774 % PixelSetCyan() sets the normalized cyan color of the pixel wand.
1775 %
1776 % The format of the PixelSetCyan method is:
1777 %
1778 % void PixelSetCyan(PixelWand *wand,const double cyan)
1779 %
1780 % A description of each parameter follows:
1781 %
1782 % o wand: the pixel wand.
1783 %
1784 % o cyan: the cyan color.
1785 %
1786 */
PixelSetCyan(PixelWand * wand,const double cyan)1787 WandExport void PixelSetCyan(PixelWand *wand,const double cyan)
1788 {
1789 assert(wand != (const PixelWand *) NULL);
1790 assert(wand->signature == MagickWandSignature);
1791 if (wand->debug != MagickFalse)
1792 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1793 wand->pixel.red=(double) ClampToQuantum(QuantumRange*cyan);
1794 }
1795
1796 /*
1797 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1798 % %
1799 % %
1800 % %
1801 % P i x e l S e t C y a n Q u a n t u m %
1802 % %
1803 % %
1804 % %
1805 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1806 %
1807 % PixelSetCyanQuantum() sets the cyan color of the pixel wand.
1808 %
1809 % The format of the PixelSetCyanQuantum method is:
1810 %
1811 % void PixelSetCyanQuantum(PixelWand *wand,const Quantum cyan)
1812 %
1813 % A description of each parameter follows:
1814 %
1815 % o wand: the pixel wand.
1816 %
1817 % o cyan: the cyan color.
1818 %
1819 */
PixelSetCyanQuantum(PixelWand * wand,const Quantum cyan)1820 WandExport void PixelSetCyanQuantum(PixelWand *wand,const Quantum cyan)
1821 {
1822 assert(wand != (const PixelWand *) NULL);
1823 assert(wand->signature == MagickWandSignature);
1824 if (wand->debug != MagickFalse)
1825 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1826 wand->pixel.red=(double) cyan;
1827 }
1828
1829 /*
1830 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1831 % %
1832 % %
1833 % %
1834 % P i x e l S e t F u z z %
1835 % %
1836 % %
1837 % %
1838 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1839 %
1840 % PixelSetFuzz() sets the fuzz value of the pixel wand.
1841 %
1842 % The format of the PixelSetFuzz method is:
1843 %
1844 % void PixelSetFuzz(PixelWand *wand,const double fuzz)
1845 %
1846 % A description of each parameter follows:
1847 %
1848 % o wand: the pixel wand.
1849 %
1850 % o fuzz: the fuzz value.
1851 %
1852 */
PixelSetFuzz(PixelWand * wand,const double fuzz)1853 WandExport void PixelSetFuzz(PixelWand *wand,const double fuzz)
1854 {
1855 assert(wand != (const PixelWand *) NULL);
1856 assert(wand->signature == MagickWandSignature);
1857 if (wand->debug != MagickFalse)
1858 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1859 wand->pixel.fuzz=(double) fuzz;
1860 }
1861
1862 /*
1863 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1864 % %
1865 % %
1866 % %
1867 % P i x e l S e t G r e e n %
1868 % %
1869 % %
1870 % %
1871 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1872 %
1873 % PixelSetGreen() sets the normalized green color of the pixel wand.
1874 %
1875 % The format of the PixelSetGreen method is:
1876 %
1877 % void PixelSetGreen(PixelWand *wand,const double green)
1878 %
1879 % A description of each parameter follows:
1880 %
1881 % o wand: the pixel wand.
1882 %
1883 % o green: the green color.
1884 %
1885 */
PixelSetGreen(PixelWand * wand,const double green)1886 WandExport void PixelSetGreen(PixelWand *wand,const double green)
1887 {
1888 assert(wand != (const PixelWand *) NULL);
1889 assert(wand->signature == MagickWandSignature);
1890 if (wand->debug != MagickFalse)
1891 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1892 wand->pixel.green=(double) ClampToQuantum(QuantumRange*green);
1893 }
1894
1895 /*
1896 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1897 % %
1898 % %
1899 % %
1900 % P i x e l S e t G r e e n Q u a n t u m %
1901 % %
1902 % %
1903 % %
1904 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1905 %
1906 % PixelSetGreenQuantum() sets the green color of the pixel wand.
1907 %
1908 % The format of the PixelSetGreenQuantum method is:
1909 %
1910 % void PixelSetGreenQuantum(PixelWand *wand,const Quantum green)
1911 %
1912 % A description of each parameter follows:
1913 %
1914 % o wand: the pixel wand.
1915 %
1916 % o green: the green color.
1917 %
1918 */
PixelSetGreenQuantum(PixelWand * wand,const Quantum green)1919 WandExport void PixelSetGreenQuantum(PixelWand *wand,const Quantum green)
1920 {
1921 assert(wand != (const PixelWand *) NULL);
1922 assert(wand->signature == MagickWandSignature);
1923 if (wand->debug != MagickFalse)
1924 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1925 wand->pixel.green=(double) green;
1926 }
1927
1928 /*
1929 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1930 % %
1931 % %
1932 % %
1933 % P i x e l S e t H S L %
1934 % %
1935 % %
1936 % %
1937 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1938 %
1939 % PixelSetHSL() sets the normalized HSL color of the pixel wand.
1940 %
1941 % The format of the PixelSetHSL method is:
1942 %
1943 % void PixelSetHSL(PixelWand *wand,const double hue,
1944 % const double saturation,const double lightness)
1945 %
1946 % A description of each parameter follows:
1947 %
1948 % o wand: the pixel wand.
1949 %
1950 % o hue,saturation,lightness: Return the pixel hue, saturation, and
1951 % brightness.
1952 %
1953 */
PixelSetHSL(PixelWand * wand,const double hue,const double saturation,const double lightness)1954 WandExport void PixelSetHSL(PixelWand *wand,const double hue,
1955 const double saturation,const double lightness)
1956 {
1957 double
1958 blue,
1959 green,
1960 red;
1961
1962 assert(wand != (const PixelWand *) NULL);
1963 assert(wand->signature == MagickWandSignature);
1964 if (wand->debug != MagickFalse)
1965 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1966 ConvertHSLToRGB(hue,saturation,lightness,&red,&green,&blue);
1967 wand->pixel.red=(double) red;
1968 wand->pixel.green=(double) green;
1969 wand->pixel.blue=(double) blue;
1970 }
1971
1972 /*
1973 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1974 % %
1975 % %
1976 % %
1977 % P i x e l S e t I n d e x %
1978 % %
1979 % %
1980 % %
1981 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1982 %
1983 % PixelSetIndex() sets the colormap index of the pixel wand.
1984 %
1985 % The format of the PixelSetIndex method is:
1986 %
1987 % void PixelSetIndex(PixelWand *wand,const Quantum index)
1988 %
1989 % A description of each parameter follows:
1990 %
1991 % o wand: the pixel wand.
1992 %
1993 % o index: the colormap index.
1994 %
1995 */
PixelSetIndex(PixelWand * wand,const Quantum index)1996 WandExport void PixelSetIndex(PixelWand *wand,const Quantum index)
1997 {
1998 assert(wand != (const PixelWand *) NULL);
1999 assert(wand->signature == MagickWandSignature);
2000 if (wand->debug != MagickFalse)
2001 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2002 wand->pixel.index=(double) index;
2003 }
2004
2005 /*
2006 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2007 % %
2008 % %
2009 % %
2010 % P i x e l S e t M a g e n t a %
2011 % %
2012 % %
2013 % %
2014 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2015 %
2016 % PixelSetMagenta() sets the normalized magenta color of the pixel wand.
2017 %
2018 % The format of the PixelSetMagenta method is:
2019 %
2020 % void PixelSetMagenta(PixelWand *wand,const double magenta)
2021 %
2022 % A description of each parameter follows:
2023 %
2024 % o wand: the pixel wand.
2025 %
2026 % o magenta: the magenta color.
2027 %
2028 */
PixelSetMagenta(PixelWand * wand,const double magenta)2029 WandExport void PixelSetMagenta(PixelWand *wand,const double magenta)
2030 {
2031 assert(wand != (const PixelWand *) NULL);
2032 assert(wand->signature == MagickWandSignature);
2033 if (wand->debug != MagickFalse)
2034 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2035 wand->pixel.green=(double) ClampToQuantum(QuantumRange*magenta);
2036 }
2037
2038 /*
2039 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2040 % %
2041 % %
2042 % %
2043 % P i x e l S e t M a g e n t a Q u a n t u m %
2044 % %
2045 % %
2046 % %
2047 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2048 %
2049 % PixelSetMagentaQuantum() sets the magenta color of the pixel wand.
2050 %
2051 % The format of the PixelSetMagentaQuantum method is:
2052 %
2053 % void PixelSetMagentaQuantum(PixelWand *wand,
2054 % const Quantum magenta)
2055 %
2056 % A description of each parameter follows:
2057 %
2058 % o wand: the pixel wand.
2059 %
2060 % o magenta: the green magenta.
2061 %
2062 */
PixelSetMagentaQuantum(PixelWand * wand,const Quantum magenta)2063 WandExport void PixelSetMagentaQuantum(PixelWand *wand,const Quantum magenta)
2064 {
2065 assert(wand != (const PixelWand *) NULL);
2066 assert(wand->signature == MagickWandSignature);
2067 if (wand->debug != MagickFalse)
2068 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2069 wand->pixel.green=(double) magenta;
2070 }
2071
2072 /*
2073 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2074 % %
2075 % %
2076 % %
2077 % P i x e l S e t P i x e l C o l o r %
2078 % %
2079 % %
2080 % %
2081 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2082 %
2083 % PixelSetPixelColor() sets the color of the pixel wand.
2084 %
2085 % The format of the PixelSetPixelColor method is:
2086 %
2087 % void PixelSetPixelColor(PixelWand *wand,const PixelInfo *color)
2088 %
2089 % A description of each parameter follows:
2090 %
2091 % o wand: the pixel wand.
2092 %
2093 % o color: the pixel wand color.
2094 %
2095 */
PixelSetPixelColor(PixelWand * wand,const PixelInfo * color)2096 WandExport void PixelSetPixelColor(PixelWand *wand,const PixelInfo *color)
2097 {
2098 assert(wand != (const PixelWand *) NULL);
2099 assert(wand->signature == MagickWandSignature);
2100 if (wand->debug != MagickFalse)
2101 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2102 assert(color != (const PixelInfo *) NULL);
2103 wand->pixel=(*color);
2104 }
2105
2106 /*
2107 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2108 % %
2109 % %
2110 % %
2111 % P i x e l S e t Q u a n t u m P i x e l %
2112 % %
2113 % %
2114 % %
2115 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2116 %
2117 % PixelSetQuantumPixel() sets the pixel of the pixel wand.
2118 %
2119 % The format of the PixelSetQuantumPixel method is:
2120 %
2121 % void PixelSetQuantumPixel(const Image *image,const Quantum *pixel,
2122 % PixelWand *wand)
2123 %
2124 % A description of each parameter follows:
2125 %
2126 % o wand: the pixel wand.
2127 %
2128 % o pixel: the pixel wand pixel.
2129 %
2130 */
PixelSetQuantumPixel(const Image * image,const Quantum * pixel,PixelWand * wand)2131 WandExport void PixelSetQuantumPixel(const Image *image,const Quantum *pixel,
2132 PixelWand *wand)
2133 {
2134 assert(wand != (const PixelWand *) NULL);
2135 assert(wand->signature == MagickWandSignature);
2136 if (wand->debug != MagickFalse)
2137 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2138 assert(pixel != (Quantum *) NULL);
2139 wand->pixel.red=(double) GetPixelRed(image,pixel);
2140 wand->pixel.green=(double) GetPixelGreen(image,pixel);
2141 wand->pixel.blue=(double) GetPixelBlue(image,pixel);
2142 wand->pixel.black=(double) GetPixelBlack(image,pixel);
2143 wand->pixel.alpha=(double) GetPixelAlpha(image,pixel);
2144 wand->pixel.alpha_trait=GetPixelAlpha(image,pixel) != OpaqueAlpha ?
2145 BlendPixelTrait : UndefinedPixelTrait;
2146 }
2147
2148 /*
2149 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2150 % %
2151 % %
2152 % %
2153 % P i x e l S e t R e d %
2154 % %
2155 % %
2156 % %
2157 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2158 %
2159 % PixelSetRed() sets the normalized red color of the pixel wand.
2160 %
2161 % The format of the PixelSetRed method is:
2162 %
2163 % void PixelSetRed(PixelWand *wand,const double red)
2164 %
2165 % A description of each parameter follows:
2166 %
2167 % o wand: the pixel wand.
2168 %
2169 % o red: the red color.
2170 %
2171 */
PixelSetRed(PixelWand * wand,const double red)2172 WandExport void PixelSetRed(PixelWand *wand,const double red)
2173 {
2174 assert(wand != (const PixelWand *) NULL);
2175 assert(wand->signature == MagickWandSignature);
2176 if (wand->debug != MagickFalse)
2177 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2178 wand->pixel.red=(double) ClampToQuantum(QuantumRange*red);
2179 }
2180
2181 /*
2182 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2183 % %
2184 % %
2185 % %
2186 % P i x e l S e t R e d Q u a n t u m %
2187 % %
2188 % %
2189 % %
2190 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2191 %
2192 % PixelSetRedQuantum() sets the red color of the pixel wand.
2193 %
2194 % The format of the PixelSetRedQuantum method is:
2195 %
2196 % void PixelSetRedQuantum(PixelWand *wand,const Quantum red)
2197 %
2198 % A description of each parameter follows:
2199 %
2200 % o wand: the pixel wand.
2201 %
2202 % o red: the red color.
2203 %
2204 */
PixelSetRedQuantum(PixelWand * wand,const Quantum red)2205 WandExport void PixelSetRedQuantum(PixelWand *wand,const Quantum red)
2206 {
2207 assert(wand != (const PixelWand *) NULL);
2208 assert(wand->signature == MagickWandSignature);
2209 if (wand->debug != MagickFalse)
2210 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2211 wand->pixel.red=(double) red;
2212 }
2213
2214 /*
2215 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2216 % %
2217 % %
2218 % %
2219 % P i x e l S e t Y e l l o w %
2220 % %
2221 % %
2222 % %
2223 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2224 %
2225 % PixelSetYellow() sets the normalized yellow color of the pixel wand.
2226 %
2227 % The format of the PixelSetYellow method is:
2228 %
2229 % void PixelSetYellow(PixelWand *wand,const double yellow)
2230 %
2231 % A description of each parameter follows:
2232 %
2233 % o wand: the pixel wand.
2234 %
2235 % o yellow: the yellow color.
2236 %
2237 */
PixelSetYellow(PixelWand * wand,const double yellow)2238 WandExport void PixelSetYellow(PixelWand *wand,const double yellow)
2239 {
2240 assert(wand != (const PixelWand *) NULL);
2241 assert(wand->signature == MagickWandSignature);
2242 if (wand->debug != MagickFalse)
2243 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2244 wand->pixel.blue=(double) ClampToQuantum(QuantumRange*yellow);
2245 }
2246
2247 /*
2248 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2249 % %
2250 % %
2251 % %
2252 % P i x e l S e t Y e l l o w Q u a n t u m %
2253 % %
2254 % %
2255 % %
2256 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2257 %
2258 % PixelSetYellowQuantum() sets the yellow color of the pixel wand.
2259 %
2260 % The format of the PixelSetYellowQuantum method is:
2261 %
2262 % void PixelSetYellowQuantum(PixelWand *wand,const Quantum yellow)
2263 %
2264 % A description of each parameter follows:
2265 %
2266 % o wand: the pixel wand.
2267 %
2268 % o yellow: the yellow color.
2269 %
2270 */
PixelSetYellowQuantum(PixelWand * wand,const Quantum yellow)2271 WandExport void PixelSetYellowQuantum(PixelWand *wand,const Quantum yellow)
2272 {
2273 assert(wand != (const PixelWand *) NULL);
2274 assert(wand->signature == MagickWandSignature);
2275 if (wand->debug != MagickFalse)
2276 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2277 wand->pixel.blue=(double) yellow;
2278 }
2279