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