MagickWand 6.9.6
Loading...
Searching...
No Matches
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 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*/
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*/
109WandExport 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*/
142WandExport PixelWand *ClonePixelWand(const PixelWand *wand)
143{
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*/
192WandExport PixelWand **ClonePixelWands(const PixelWand **wands,
193 const size_t number_wands)
194{
195 ssize_t
196 i;
197
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*/
230WandExport 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*/
269WandExport 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*/
315WandExport 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*/
353WandExport 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*/
382WandExport PixelWand *NewPixelWand(void)
383{
384 const char
385 *quantum;
386
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*/
433WandExport PixelWand **NewPixelWands(const size_t number_wands)
434{
435 ssize_t
436 i;
437
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*/
470WandExport 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*/
502WandExport 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(QuantumScale*((double) QuantumRange-(double) 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*/
533WandExport 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*/
564WandExport 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*/
595WandExport 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*/
626WandExport 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*/
657WandExport 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() returns 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*/
688WandExport 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*/
729WandExport 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*/
773WandExport 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*/
804WandExport 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*/
835WandExport 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*/
869WandExport 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*/
923WandExport 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*/
954WandExport 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*/
985WandExport 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*/
1016WandExport 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*/
1051WandExport 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*/
1085WandExport 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*/
1116WandExport 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*/
1147WandExport 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*/
1180WandExport 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*/
1213WandExport 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*/
1244WandExport 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*/
1277WandExport 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((double) QuantumRange-
1288 (wand->pixel.red*((double) QuantumRange-wand->pixel.index)+
1289 wand->pixel.index));
1290 color->green=ClampToQuantum((double) QuantumRange-
1291 (wand->pixel.green*((double) QuantumRange-wand->pixel.index)+
1292 wand->pixel.index));
1293 color->blue=ClampToQuantum((double) QuantumRange-
1294 (wand->pixel.blue*((double) QuantumRange-wand->pixel.index)+
1295 wand->pixel.index));
1296 return;
1297 }
1298 color->red=ClampToQuantum(wand->pixel.red);
1299 color->green=ClampToQuantum(wand->pixel.green);
1300 color->blue=ClampToQuantum(wand->pixel.blue);
1301}
1302
1303/*
1304%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1305% %
1306% %
1307% %
1308% P i x e l G e t R e d %
1309% %
1310% %
1311% %
1312%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1313%
1314% PixelGetRed() returns the normalized red color of the pixel wand.
1315%
1316% The format of the PixelGetRed method is:
1317%
1318% double PixelGetRed(const PixelWand *wand)
1319%
1320% A description of each parameter follows:
1321%
1322% o wand: the pixel wand.
1323%
1324*/
1325WandExport double PixelGetRed(const PixelWand *wand)
1326{
1327 assert(wand != (const PixelWand *) NULL);
1328 assert(wand->signature == WandSignature);
1329 if (wand->debug != MagickFalse)
1330 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1331 return((double) QuantumScale*wand->pixel.red);
1332}
1333
1334/*
1335%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1336% %
1337% %
1338% %
1339% P i x e l G e t R e d Q u a n t u m %
1340% %
1341% %
1342% %
1343%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1344%
1345% PixelGetRedQuantum() returns the red color of the pixel wand.
1346%
1347% The format of the PixelGetRedQuantum method is:
1348%
1349% Quantum PixelGetRedQuantum(const PixelWand *wand)
1350%
1351% A description of each parameter follows:
1352%
1353% o wand: the pixel wand.
1354%
1355*/
1356WandExport Quantum PixelGetRedQuantum(const PixelWand *wand)
1357{
1358 assert(wand != (const PixelWand *) NULL);
1359 assert(wand->signature == WandSignature);
1360 if (wand->debug != MagickFalse)
1361 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1362 return(ClampToQuantum(wand->pixel.red));
1363}
1364
1365/*
1366%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1367% %
1368% %
1369% %
1370% P i x e l G e t Y e l l o w %
1371% %
1372% %
1373% %
1374%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1375%
1376% PixelGetYellow() returns the normalized yellow color of the pixel wand.
1377%
1378% The format of the PixelGetYellow method is:
1379%
1380% double PixelGetYellow(const PixelWand *wand)
1381%
1382% A description of each parameter follows:
1383%
1384% o wand: the pixel wand.
1385%
1386*/
1387WandExport double PixelGetYellow(const PixelWand *wand)
1388{
1389 assert(wand != (const PixelWand *) NULL);
1390 assert(wand->signature == WandSignature);
1391 if (wand->debug != MagickFalse)
1392 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1393 return((double) QuantumScale*wand->pixel.blue);
1394}
1395
1396/*
1397%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1398% %
1399% %
1400% %
1401% P i x e l G e t Y e l l o w Q u a n t u m %
1402% %
1403% %
1404% %
1405%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1406%
1407% PixelGetYellowQuantum() returns the yellow color of the pixel wand.
1408%
1409% The format of the PixelGetYellowQuantum method is:
1410%
1411% Quantum PixelGetYellowQuantum(const PixelWand *wand)
1412%
1413% A description of each parameter follows:
1414%
1415% o wand: the pixel wand.
1416%
1417*/
1418WandExport Quantum PixelGetYellowQuantum(const PixelWand *wand)
1419{
1420 assert(wand != (const PixelWand *) NULL);
1421 assert(wand->signature == WandSignature);
1422 if (wand->debug != MagickFalse)
1423 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1424 return(ClampToQuantum(wand->pixel.blue));
1425}
1426
1427/*
1428%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1429% %
1430% %
1431% %
1432% P i x e l S e t A l p h a %
1433% %
1434% %
1435% %
1436%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1437%
1438% PixelSetAlpha() sets the normalized alpha value of the pixel wand.
1439%
1440% The format of the PixelSetAlpha method is:
1441%
1442% void PixelSetAlpha(PixelWand *wand,const double alpha)
1443%
1444% A description of each parameter follows:
1445%
1446% o wand: the pixel wand.
1447%
1448% o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
1449% transparent.
1450%
1451*/
1452WandExport void PixelSetAlpha(PixelWand *wand,const double alpha)
1453{
1454 assert(wand != (const PixelWand *) NULL);
1455 assert(wand->signature == WandSignature);
1456 if (wand->debug != MagickFalse)
1457 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1458 wand->pixel.opacity=(MagickRealType) (QuantumRange-
1459 ClampToQuantum((MagickRealType) QuantumRange*alpha));
1460}
1461
1462/*
1463%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1464% %
1465% %
1466% %
1467% P i x e l S e t A l p h a Q u a n t u m %
1468% %
1469% %
1470% %
1471%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1472%
1473% PixelSetAlphaQuantum() sets the alpha value of the pixel wand.
1474%
1475% The format of the PixelSetAlphaQuantum method is:
1476%
1477% void PixelSetAlphaQuantum(PixelWand *wand,
1478% const Quantum opacity)
1479%
1480% A description of each parameter follows:
1481%
1482% o wand: the pixel wand.
1483%
1484% o opacity: the opacity value.
1485%
1486*/
1487WandExport void PixelSetAlphaQuantum(PixelWand *wand,const Quantum opacity)
1488{
1489 assert(wand != (const PixelWand *) NULL);
1490 assert(wand->signature == WandSignature);
1491 if (wand->debug != MagickFalse)
1492 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1493 wand->pixel.opacity=(MagickRealType) (QuantumRange-opacity);
1494}
1495
1496/*
1497%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1498% %
1499% %
1500% %
1501% P i x e l S e t B l a c k %
1502% %
1503% %
1504% %
1505%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1506%
1507% PixelSetBlack() sets the normalized black color of the pixel wand.
1508%
1509% The format of the PixelSetBlack method is:
1510%
1511% void PixelSetBlack(PixelWand *wand,const double black)
1512%
1513% A description of each parameter follows:
1514%
1515% o wand: the pixel wand.
1516%
1517% o black: the black color.
1518%
1519*/
1520WandExport void PixelSetBlack(PixelWand *wand,const double black)
1521{
1522 assert(wand != (const PixelWand *) NULL);
1523 assert(wand->signature == WandSignature);
1524 if (wand->debug != MagickFalse)
1525 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1526 wand->pixel.index=(MagickRealType) ClampToQuantum((MagickRealType)
1527 QuantumRange*black);
1528}
1529
1530/*
1531%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1532% %
1533% %
1534% %
1535% P i x e l S e t B l a c k Q u a n t u m %
1536% %
1537% %
1538% %
1539%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1540%
1541% PixelSetBlackQuantum() sets the black color of the pixel wand.
1542%
1543% The format of the PixelSetBlackQuantum method is:
1544%
1545% void PixelSetBlackQuantum(PixelWand *wand,const Quantum black)
1546%
1547% A description of each parameter follows:
1548%
1549% o wand: the pixel wand.
1550%
1551% o black: the black color.
1552%
1553*/
1554WandExport void PixelSetBlackQuantum(PixelWand *wand,const Quantum black)
1555{
1556 assert(wand != (const PixelWand *) NULL);
1557 assert(wand->signature == WandSignature);
1558 if (wand->debug != MagickFalse)
1559 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1560 wand->pixel.index=(MagickRealType) black;
1561}
1562
1563/*
1564%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1565% %
1566% %
1567% %
1568% P i x e l S e t B l u e %
1569% %
1570% %
1571% %
1572%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1573%
1574% PixelSetBlue() sets the normalized blue color of the pixel wand.
1575%
1576% The format of the PixelSetBlue method is:
1577%
1578% void PixelSetBlue(PixelWand *wand,const double blue)
1579%
1580% A description of each parameter follows:
1581%
1582% o wand: the pixel wand.
1583%
1584% o blue: the blue color.
1585%
1586*/
1587WandExport void PixelSetBlue(PixelWand *wand,const double blue)
1588{
1589 assert(wand != (const PixelWand *) NULL);
1590 assert(wand->signature == WandSignature);
1591 if (wand->debug != MagickFalse)
1592 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1593 wand->pixel.blue=(MagickRealType) ClampToQuantum((MagickRealType)
1594 QuantumRange*blue);
1595}
1596
1597/*
1598%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1599% %
1600% %
1601% %
1602% P i x e l S e t B l u e Q u a n t u m %
1603% %
1604% %
1605% %
1606%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1607%
1608% PixelSetBlueQuantum() sets the blue color of the pixel wand.
1609%
1610% The format of the PixelSetBlueQuantum method is:
1611%
1612% void PixelSetBlueQuantum(PixelWand *wand,const Quantum blue)
1613%
1614% A description of each parameter follows:
1615%
1616% o wand: the pixel wand.
1617%
1618% o blue: the blue color.
1619%
1620*/
1621WandExport void PixelSetBlueQuantum(PixelWand *wand,const Quantum blue)
1622{
1623 assert(wand != (const PixelWand *) NULL);
1624 assert(wand->signature == WandSignature);
1625 if (wand->debug != MagickFalse)
1626 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1627 wand->pixel.blue=(MagickRealType) blue;
1628}
1629
1630/*
1631%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1632% %
1633% %
1634% %
1635% P i x e l S e t C o l o r %
1636% %
1637% %
1638% %
1639%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1640%
1641% PixelSetColor() sets the color of the pixel wand with a string (e.g.
1642% "blue", "#0000ff", "rgb(0,0,255)", "cmyk(100,100,100,10)", etc.).
1643%
1644% The format of the PixelSetColor method is:
1645%
1646% MagickBooleanType PixelSetColor(PixelWand *wand,const char *color)
1647%
1648% A description of each parameter follows:
1649%
1650% o wand: the pixel wand.
1651%
1652% o color: the pixel wand color.
1653%
1654*/
1655WandExport MagickBooleanType PixelSetColor(PixelWand *wand,const char *color)
1656{
1657 MagickBooleanType
1658 status;
1659
1660 MagickPixelPacket
1661 pixel;
1662
1663 assert(wand != (const PixelWand *) NULL);
1664 assert(wand->signature == WandSignature);
1665 if (wand->debug != MagickFalse)
1666 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1667 status=QueryMagickColor(color,&pixel,wand->exception);
1668 if (status != MagickFalse)
1669 wand->pixel=pixel;
1670 return(status);
1671}
1672
1673/*
1674%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1675% %
1676% %
1677% %
1678% P i x e l S e t C o l o r C o u n t %
1679% %
1680% %
1681% %
1682%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1683%
1684% PixelSetColorCount() sets the color count of the pixel wand.
1685%
1686% The format of the PixelSetColorCount method is:
1687%
1688% void PixelSetColorCount(PixelWand *wand,const size_t count)
1689%
1690% A description of each parameter follows:
1691%
1692% o wand: the pixel wand.
1693%
1694% o count: the number of this particular color.
1695%
1696*/
1697WandExport void PixelSetColorCount(PixelWand *wand,const size_t count)
1698{
1699 assert(wand != (const PixelWand *) NULL);
1700 assert(wand->signature == WandSignature);
1701 if (wand->debug != MagickFalse)
1702 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1703 wand->count=count;
1704}
1705
1706/*
1707%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1708% %
1709% %
1710% %
1711% P i x e l S e t C o l o r F r o m W a n d %
1712% %
1713% %
1714% %
1715%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1716%
1717% PixelSetColorFromWand() sets the color of the pixel wand.
1718%
1719% The format of the PixelSetColorFromWand method is:
1720%
1721% void PixelSetColorFromWand(PixelWand *wand,const PixelWand *color)
1722%
1723% A description of each parameter follows:
1724%
1725% o wand: the pixel wand.
1726%
1727% o color: set the pixel wand color here.
1728%
1729*/
1730WandExport void PixelSetColorFromWand(PixelWand *wand,const PixelWand *color)
1731{
1732 assert(wand != (const PixelWand *) NULL);
1733 assert(wand->signature == WandSignature);
1734 if (wand->debug != MagickFalse)
1735 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1736 assert(color != (const PixelWand *) NULL);
1737 wand->pixel=color->pixel;
1738}
1739
1740/*
1741%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1742% %
1743% %
1744% %
1745% P i x e l S e t C y a n %
1746% %
1747% %
1748% %
1749%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1750%
1751% PixelSetCyan() sets the normalized cyan color of the pixel wand.
1752%
1753% The format of the PixelSetCyan method is:
1754%
1755% void PixelSetCyan(PixelWand *wand,const double cyan)
1756%
1757% A description of each parameter follows:
1758%
1759% o wand: the pixel wand.
1760%
1761% o cyan: the cyan color.
1762%
1763*/
1764WandExport void PixelSetCyan(PixelWand *wand,const double cyan)
1765{
1766 assert(wand != (const PixelWand *) NULL);
1767 assert(wand->signature == WandSignature);
1768 if (wand->debug != MagickFalse)
1769 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1770 wand->pixel.red=(MagickRealType) ClampToQuantum((MagickRealType)
1771 QuantumRange*cyan);
1772}
1773
1774/*
1775%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1776% %
1777% %
1778% %
1779% P i x e l S e t C y a n Q u a n t u m %
1780% %
1781% %
1782% %
1783%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1784%
1785% PixelSetCyanQuantum() sets the cyan color of the pixel wand.
1786%
1787% The format of the PixelSetCyanQuantum method is:
1788%
1789% void PixelSetCyanQuantum(PixelWand *wand,const Quantum cyan)
1790%
1791% A description of each parameter follows:
1792%
1793% o wand: the pixel wand.
1794%
1795% o cyan: the cyan color.
1796%
1797*/
1798WandExport void PixelSetCyanQuantum(PixelWand *wand,const Quantum cyan)
1799{
1800 assert(wand != (const PixelWand *) NULL);
1801 assert(wand->signature == WandSignature);
1802 if (wand->debug != MagickFalse)
1803 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1804 wand->pixel.red=(MagickRealType) cyan;
1805}
1806
1807/*
1808%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1809% %
1810% %
1811% %
1812% P i x e l S e t F u z z %
1813% %
1814% %
1815% %
1816%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1817%
1818% PixelSetFuzz() sets the fuzz value of the pixel wand.
1819%
1820% The format of the PixelSetFuzz method is:
1821%
1822% void PixelSetFuzz(PixelWand *wand,const double fuzz)
1823%
1824% A description of each parameter follows:
1825%
1826% o wand: the pixel wand.
1827%
1828% o fuzz: the fuzz value.
1829%
1830*/
1831WandExport void PixelSetFuzz(PixelWand *wand,const double fuzz)
1832{
1833 assert(wand != (const PixelWand *) NULL);
1834 assert(wand->signature == WandSignature);
1835 if (wand->debug != MagickFalse)
1836 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1837 wand->pixel.fuzz=(MagickRealType) fuzz;
1838}
1839
1840/*
1841%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1842% %
1843% %
1844% %
1845% P i x e l S e t G r e e n %
1846% %
1847% %
1848% %
1849%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1850%
1851% PixelSetGreen() sets the normalized green color of the pixel wand.
1852%
1853% The format of the PixelSetGreen method is:
1854%
1855% void PixelSetGreen(PixelWand *wand,const double green)
1856%
1857% A description of each parameter follows:
1858%
1859% o wand: the pixel wand.
1860%
1861% o green: the green color.
1862%
1863*/
1864WandExport void PixelSetGreen(PixelWand *wand,const double green)
1865{
1866 assert(wand != (const PixelWand *) NULL);
1867 assert(wand->signature == WandSignature);
1868 if (wand->debug != MagickFalse)
1869 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1870 wand->pixel.green=(MagickRealType) ClampToQuantum((MagickRealType)
1871 QuantumRange*green);
1872}
1873
1874/*
1875%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1876% %
1877% %
1878% %
1879% P i x e l S e t G r e e n Q u a n t u m %
1880% %
1881% %
1882% %
1883%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1884%
1885% PixelSetGreenQuantum() sets the green color of the pixel wand.
1886%
1887% The format of the PixelSetGreenQuantum method is:
1888%
1889% void PixelSetGreenQuantum(PixelWand *wand,const Quantum green)
1890%
1891% A description of each parameter follows:
1892%
1893% o wand: the pixel wand.
1894%
1895% o green: the green color.
1896%
1897*/
1898WandExport void PixelSetGreenQuantum(PixelWand *wand,const Quantum green)
1899{
1900 assert(wand != (const PixelWand *) NULL);
1901 assert(wand->signature == WandSignature);
1902 if (wand->debug != MagickFalse)
1903 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1904 wand->pixel.green=(MagickRealType) green;
1905}
1906
1907/*
1908%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1909% %
1910% %
1911% %
1912% P i x e l S e t H S L %
1913% %
1914% %
1915% %
1916%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1917%
1918% PixelSetHSL() sets the normalized HSL color of the pixel wand.
1919%
1920% The format of the PixelSetHSL method is:
1921%
1922% void PixelSetHSL(PixelWand *wand,const double hue,
1923% const double saturation,const double lightness)
1924%
1925% A description of each parameter follows:
1926%
1927% o wand: the pixel wand.
1928%
1929% o hue,saturation,lightness: Return the pixel hue, saturation, and
1930% brightness.
1931%
1932*/
1933WandExport void PixelSetHSL(PixelWand *wand,const double hue,
1934 const double saturation,const double lightness)
1935{
1936 Quantum
1937 blue,
1938 green,
1939 red;
1940
1941 assert(wand != (const PixelWand *) NULL);
1942 assert(wand->signature == WandSignature);
1943 if (wand->debug != MagickFalse)
1944 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1945 ConvertHSLToRGB(hue,saturation,lightness,&red,&green,&blue);
1946 wand->pixel.red=(MagickRealType) red;
1947 wand->pixel.green=(MagickRealType) green;
1948 wand->pixel.blue=(MagickRealType) blue;
1949}
1950
1951/*
1952%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1953% %
1954% %
1955% %
1956% P i x e l S e t I n d e x %
1957% %
1958% %
1959% %
1960%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1961%
1962% PixelSetIndex() sets the colormap index of the pixel wand.
1963%
1964% The format of the PixelSetIndex method is:
1965%
1966% void PixelSetIndex(PixelWand *wand,const IndexPacket index)
1967%
1968% A description of each parameter follows:
1969%
1970% o wand: the pixel wand.
1971%
1972% o index: the colormap index.
1973%
1974*/
1975WandExport void PixelSetIndex(PixelWand *wand,const IndexPacket index)
1976{
1977 assert(wand != (const PixelWand *) NULL);
1978 assert(wand->signature == WandSignature);
1979 if (wand->debug != MagickFalse)
1980 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1981 wand->pixel.index=(MagickRealType) index;
1982}
1983
1984/*
1985%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1986% %
1987% %
1988% %
1989% P i x e l S e t M a g e n t a %
1990% %
1991% %
1992% %
1993%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1994%
1995% PixelSetMagenta() sets the normalized magenta color of the pixel wand.
1996%
1997% The format of the PixelSetMagenta method is:
1998%
1999% void PixelSetMagenta(PixelWand *wand,const double magenta)
2000%
2001% A description of each parameter follows:
2002%
2003% o wand: the pixel wand.
2004%
2005% o magenta: the magenta color.
2006%
2007*/
2008WandExport void PixelSetMagenta(PixelWand *wand,const double magenta)
2009{
2010 assert(wand != (const PixelWand *) NULL);
2011 assert(wand->signature == WandSignature);
2012 if (wand->debug != MagickFalse)
2013 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2014 wand->pixel.green=(MagickRealType) ClampToQuantum((MagickRealType)
2015 QuantumRange*magenta);
2016}
2017
2018/*
2019%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2020% %
2021% %
2022% %
2023% P i x e l S e t M a g e n t a Q u a n t u m %
2024% %
2025% %
2026% %
2027%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2028%
2029% PixelSetMagentaQuantum() sets the magenta color of the pixel wand.
2030%
2031% The format of the PixelSetMagentaQuantum method is:
2032%
2033% void PixelSetMagentaQuantum(PixelWand *wand,
2034% const Quantum magenta)
2035%
2036% A description of each parameter follows:
2037%
2038% o wand: the pixel wand.
2039%
2040% o magenta: the green magenta.
2041%
2042*/
2043WandExport void PixelSetMagentaQuantum(PixelWand *wand,const Quantum magenta)
2044{
2045 assert(wand != (const PixelWand *) NULL);
2046 assert(wand->signature == WandSignature);
2047 if (wand->debug != MagickFalse)
2048 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2049 wand->pixel.green=(MagickRealType) magenta;
2050}
2051
2052/*
2053%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2054% %
2055% %
2056% %
2057% P i x e l S e t M a g i c k C o l o r %
2058% %
2059% %
2060% %
2061%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2062%
2063% PixelSetMagickColor() sets the color of the pixel wand.
2064%
2065% The format of the PixelSetMagickColor method is:
2066%
2067% void PixelSetMagickColor(PixelWand *wand,const MagickPixelPacket *color)
2068%
2069% A description of each parameter follows:
2070%
2071% o wand: the pixel wand.
2072%
2073% o color: the pixel wand color.
2074%
2075*/
2076WandExport void PixelSetMagickColor(PixelWand *wand,
2077 const MagickPixelPacket *color)
2078{
2079 assert(wand != (const PixelWand *) NULL);
2080 assert(wand->signature == WandSignature);
2081 if (wand->debug != MagickFalse)
2082 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2083 assert(color != (const MagickPixelPacket *) NULL);
2084 wand->pixel=(*color);
2085}
2086
2087/*
2088%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2089% %
2090% %
2091% %
2092% P i x e l S e t O p a c i t y %
2093% %
2094% %
2095% %
2096%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2097%
2098% PixelSetOpacity() sets the normalized opacity value of the pixel wand.
2099%
2100% The format of the PixelSetOpacity method is:
2101%
2102% void PixelSetOpacity(PixelWand *wand,const double opacity)
2103%
2104% A description of each parameter follows:
2105%
2106% o wand: the pixel wand.
2107%
2108% o opacity: the opacity value.
2109%
2110*/
2111WandExport void PixelSetOpacity(PixelWand *wand,const double opacity)
2112{
2113 assert(wand != (const PixelWand *) NULL);
2114 assert(wand->signature == WandSignature);
2115 if (wand->debug != MagickFalse)
2116 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2117 wand->pixel.matte=MagickTrue;
2118 wand->pixel.opacity=(MagickRealType) ClampToQuantum((MagickRealType)
2119 QuantumRange*opacity);
2120}
2121
2122/*
2123%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2124% %
2125% %
2126% %
2127% P i x e l S e t O p a c i t y Q u a n t u m %
2128% %
2129% %
2130% %
2131%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2132%
2133% PixelSetOpacityQuantum() sets the opacity value of the pixel wand.
2134%
2135% The format of the PixelSetOpacityQuantum method is:
2136%
2137% void PixelSetOpacityQuantum(PixelWand *wand,
2138% const Quantum opacity)
2139%
2140% A description of each parameter follows:
2141%
2142% o wand: the pixel wand.
2143%
2144% o opacity: the opacity value.
2145%
2146*/
2147WandExport void PixelSetOpacityQuantum(PixelWand *wand,const Quantum opacity)
2148{
2149 assert(wand != (const PixelWand *) NULL);
2150 assert(wand->signature == WandSignature);
2151 if (wand->debug != MagickFalse)
2152 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2153 wand->pixel.opacity=(MagickRealType) opacity;
2154}
2155
2156/*
2157%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2158% %
2159% %
2160% %
2161% P i x e l S e t Q u a n t u m C o l o r %
2162% %
2163% %
2164% %
2165%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2166%
2167% PixelSetQuantumColor() sets the color of the pixel wand.
2168%
2169% The format of the PixelSetQuantumColor method is:
2170%
2171% void PixelSetQuantumColor(PixelWand *wand,const PixelPacket *color)
2172%
2173% A description of each parameter follows:
2174%
2175% o wand: the pixel wand.
2176%
2177% o color: the pixel wand color.
2178%
2179*/
2180WandExport void PixelSetQuantumColor(PixelWand *wand,const PixelPacket *color)
2181{
2182 assert(wand != (const PixelWand *) NULL);
2183 assert(wand->signature == WandSignature);
2184 if (wand->debug != MagickFalse)
2185 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2186 assert(color != (PixelPacket *) NULL);
2187 wand->pixel.red=(MagickRealType) color->red;
2188 wand->pixel.green=(MagickRealType) color->green;
2189 wand->pixel.blue=(MagickRealType) color->blue;
2190 wand->pixel.opacity=(MagickRealType) color->opacity;
2191 wand->pixel.matte=color->opacity != OpaqueOpacity ? MagickTrue : MagickFalse;
2192}
2193
2194/*
2195%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2196% %
2197% %
2198% %
2199% P i x e l S e t R e d %
2200% %
2201% %
2202% %
2203%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2204%
2205% PixelSetRed() sets the normalized red color of the pixel wand.
2206%
2207% The format of the PixelSetRed method is:
2208%
2209% void PixelSetRed(PixelWand *wand,const double red)
2210%
2211% A description of each parameter follows:
2212%
2213% o wand: the pixel wand.
2214%
2215% o red: the red color.
2216%
2217*/
2218WandExport void PixelSetRed(PixelWand *wand,const double red)
2219{
2220 assert(wand != (const PixelWand *) NULL);
2221 assert(wand->signature == WandSignature);
2222 if (wand->debug != MagickFalse)
2223 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2224 wand->pixel.red=(MagickRealType) ClampToQuantum((MagickRealType)
2225 QuantumRange*red);
2226}
2227
2228/*
2229%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2230% %
2231% %
2232% %
2233% P i x e l S e t R e d Q u a n t u m %
2234% %
2235% %
2236% %
2237%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2238%
2239% PixelSetRedQuantum() sets the red color of the pixel wand.
2240%
2241% The format of the PixelSetRedQuantum method is:
2242%
2243% void PixelSetRedQuantum(PixelWand *wand,const Quantum red)
2244%
2245% A description of each parameter follows:
2246%
2247% o wand: the pixel wand.
2248%
2249% o red: the red color.
2250%
2251*/
2252WandExport void PixelSetRedQuantum(PixelWand *wand,const Quantum red)
2253{
2254 assert(wand != (const PixelWand *) NULL);
2255 assert(wand->signature == WandSignature);
2256 if (wand->debug != MagickFalse)
2257 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2258 wand->pixel.red=(MagickRealType) red;
2259}
2260
2261/*
2262%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2263% %
2264% %
2265% %
2266% P i x e l S e t Y e l l o w %
2267% %
2268% %
2269% %
2270%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2271%
2272% PixelSetYellow() sets the normalized yellow color of the pixel wand.
2273%
2274% The format of the PixelSetYellow method is:
2275%
2276% void PixelSetYellow(PixelWand *wand,const double yellow)
2277%
2278% A description of each parameter follows:
2279%
2280% o wand: the pixel wand.
2281%
2282% o yellow: the yellow color.
2283%
2284*/
2285WandExport void PixelSetYellow(PixelWand *wand,const double yellow)
2286{
2287 assert(wand != (const PixelWand *) NULL);
2288 assert(wand->signature == WandSignature);
2289 if (wand->debug != MagickFalse)
2290 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2291 wand->pixel.blue=(MagickRealType) ClampToQuantum((MagickRealType)
2292 QuantumRange*yellow);
2293}
2294
2295/*
2296%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2297% %
2298% %
2299% %
2300% P i x e l S e t Y e l l o w Q u a n t u m %
2301% %
2302% %
2303% %
2304%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2305%
2306% PixelSetYellowQuantum() sets the yellow color of the pixel wand.
2307%
2308% The format of the PixelSetYellowQuantum method is:
2309%
2310% void PixelSetYellowQuantum(PixelWand *wand,const Quantum yellow)
2311%
2312% A description of each parameter follows:
2313%
2314% o wand: the pixel wand.
2315%
2316% o yellow: the yellow color.
2317%
2318*/
2319WandExport void PixelSetYellowQuantum(PixelWand *wand,const Quantum yellow)
2320{
2321 assert(wand != (const PixelWand *) NULL);
2322 assert(wand->signature == WandSignature);
2323 if (wand->debug != MagickFalse)
2324 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2325 wand->pixel.blue=(MagickRealType) yellow;
2326}