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