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