blob: 78f2408ea948239080adbdbaee042a45242c52a8 [file] [log] [blame]
cristy3ed852e2009-09-05 21:47:34 +00001/*
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 %
cristyde984cd2013-12-01 14:49:27 +000022% Cristy %
cristy3ed852e2009-09-05 21:47:34 +000023% March 2003 %
24% %
25% %
Cristy7ce65e72015-12-12 18:03:16 -050026% Copyright 1999-2016 ImageMagick Studio LLC, a non-profit organization %
cristy3ed852e2009-09-05 21:47:34 +000027% dedicated to making software imaging solutions freely available. %
28% %
29% You may not use this file except in compliance with the License. You may %
30% obtain a copy of the License at %
31% %
32% http://www.imagemagick.org/script/license.php %
33% %
34% Unless required by applicable law or agreed to in writing, software %
35% distributed under the License is distributed on an "AS IS" BASIS, %
36% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %
37% See the License for the specific language governing permissions and %
38% limitations under the License. %
39% %
40%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
41%
42%
43%
44*/
45
46/*
47 Include declarations.
48*/
cristy4c08aed2011-07-01 19:47:50 +000049#include "MagickWand/studio.h"
50#include "MagickWand/MagickWand.h"
51#include "MagickWand/magick-wand-private.h"
52#include "MagickWand/pixel-wand-private.h"
53#include "MagickWand/wand.h"
cristy3ed852e2009-09-05 21:47:34 +000054
55/*
56 Define declarations.
57*/
58#define PixelWandId "PixelWand"
59
60/*
61 Typedef declarations.
62*/
63struct _PixelWand
64{
cristybb503372010-05-27 20:51:26 +000065 size_t
cristy3ed852e2009-09-05 21:47:34 +000066 id;
67
68 char
cristy151b66d2015-04-15 10:50:31 +000069 name[MagickPathExtent];
cristy3ed852e2009-09-05 21:47:34 +000070
71 ExceptionInfo
72 *exception;
73
cristy4c08aed2011-07-01 19:47:50 +000074 PixelInfo
cristy3ed852e2009-09-05 21:47:34 +000075 pixel;
76
cristybb503372010-05-27 20:51:26 +000077 size_t
cristy3ed852e2009-09-05 21:47:34 +000078 count;
79
80 MagickBooleanType
81 debug;
82
cristybb503372010-05-27 20:51:26 +000083 size_t
cristy3ed852e2009-09-05 21:47:34 +000084 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);
cristye1c94d92015-06-28 12:16:33 +0000112 assert(wand->signature == MagickWandSignature);
cristy3ed852e2009-09-05 21:47:34 +0000113 if (wand->debug != MagickFalse)
114 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
115 ClearMagickException(wand->exception);
cristy7020ae62012-04-18 12:58:34 +0000116 wand->pixel.colorspace=sRGBColorspace;
cristy3ed852e2009-09-05 21:47:34 +0000117 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{
144 PixelWand
145 *clone_wand;
146
147 assert(wand != (PixelWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +0000148 assert(wand->signature == MagickWandSignature);
cristy3ed852e2009-09-05 21:47:34 +0000149 if (wand->debug != MagickFalse)
150 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
cristy73bd4a52010-10-05 11:24:23 +0000151 clone_wand=(PixelWand *) AcquireMagickMemory(sizeof(*clone_wand));
cristy3ed852e2009-09-05 21:47:34 +0000152 if (clone_wand == (PixelWand *) NULL)
153 ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
154 wand->name);
155 (void) ResetMagickMemory(clone_wand,0,sizeof(*clone_wand));
156 clone_wand->id=AcquireWandId();
cristy151b66d2015-04-15 10:50:31 +0000157 (void) FormatLocaleString(clone_wand->name,MagickPathExtent,"%s-%.20g",
cristye8c25f92010-06-03 00:53:06 +0000158 PixelWandId,(double) clone_wand->id);
cristy3ed852e2009-09-05 21:47:34 +0000159 clone_wand->exception=AcquireExceptionInfo();
160 InheritException(clone_wand->exception,wand->exception);
161 clone_wand->pixel=wand->pixel;
162 clone_wand->count=wand->count;
163 clone_wand->debug=IsEventLogging();
164 if (clone_wand->debug != MagickFalse)
165 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clone_wand->name);
cristye1c94d92015-06-28 12:16:33 +0000166 clone_wand->signature=MagickWandSignature;
cristy3ed852e2009-09-05 21:47:34 +0000167 return(clone_wand);
168}
169
170/*
171%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
172% %
173% %
174% %
175% C l o n e P i x e l W a n d s %
176% %
177% %
178% %
179%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
180%
181% ClonePixelWands() makes an exact copy of the specified wands.
182%
183% The format of the ClonePixelWands method is:
184%
185% PixelWand **ClonePixelWands(const PixelWand **wands,
cristybb503372010-05-27 20:51:26 +0000186% const size_t number_wands)
cristy3ed852e2009-09-05 21:47:34 +0000187%
188% A description of each parameter follows:
189%
190% o wands: the magick wands.
191%
192% o number_wands: the number of wands.
193%
194*/
195WandExport PixelWand **ClonePixelWands(const PixelWand **wands,
cristybb503372010-05-27 20:51:26 +0000196 const size_t number_wands)
cristy3ed852e2009-09-05 21:47:34 +0000197{
cristybb503372010-05-27 20:51:26 +0000198 register ssize_t
cristy3ed852e2009-09-05 21:47:34 +0000199 i;
200
201 PixelWand
202 **clone_wands;
203
204 clone_wands=(PixelWand **) AcquireQuantumMemory((size_t) number_wands,
205 sizeof(*clone_wands));
206 if (clone_wands == (PixelWand **) NULL)
207 ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
208 GetExceptionMessage(errno));
cristybb503372010-05-27 20:51:26 +0000209 for (i=0; i < (ssize_t) number_wands; i++)
cristy3ed852e2009-09-05 21:47:34 +0000210 clone_wands[i]=ClonePixelWand(wands[i]);
211 return(clone_wands);
212}
213
214/*
215%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
216% %
217% %
218% %
219% D e s t r o y P i x e l W a n d %
220% %
221% %
222% %
223%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
224%
225% DestroyPixelWand() deallocates resources associated with a PixelWand.
226%
227% The format of the DestroyPixelWand method is:
228%
229% PixelWand *DestroyPixelWand(PixelWand *wand)
230%
231% A description of each parameter follows:
232%
233% o wand: the pixel wand.
234%
235*/
236WandExport PixelWand *DestroyPixelWand(PixelWand *wand)
237{
238 assert(wand != (PixelWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +0000239 assert(wand->signature == MagickWandSignature);
cristy3ed852e2009-09-05 21:47:34 +0000240 if (wand->debug != MagickFalse)
241 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
242 wand->exception=DestroyExceptionInfo(wand->exception);
cristye1c94d92015-06-28 12:16:33 +0000243 wand->signature=(~MagickWandSignature);
cristy3ed852e2009-09-05 21:47:34 +0000244 RelinquishWandId(wand->id);
245 wand=(PixelWand *) RelinquishMagickMemory(wand);
246 return(wand);
247}
248
249/*
250%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
251% %
252% %
253% %
254% D e s t r o y P i x e l W a n d s %
255% %
256% %
257% %
258%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
259%
260% DestroyPixelWands() deallocates resources associated with an array of
261% pixel wands.
262%
263% The format of the DestroyPixelWands method is:
264%
265% PixelWand **DestroyPixelWands(PixelWand **wand,
cristybb503372010-05-27 20:51:26 +0000266% const size_t number_wands)
cristy3ed852e2009-09-05 21:47:34 +0000267%
268% A description of each parameter follows:
269%
270% o wand: the pixel wand.
271%
272% o number_wands: the number of wands.
273%
274*/
275WandExport PixelWand **DestroyPixelWands(PixelWand **wand,
cristybb503372010-05-27 20:51:26 +0000276 const size_t number_wands)
cristy3ed852e2009-09-05 21:47:34 +0000277{
cristybb503372010-05-27 20:51:26 +0000278 register ssize_t
cristy3ed852e2009-09-05 21:47:34 +0000279 i;
280
281 assert(wand != (PixelWand **) NULL);
282 assert(*wand != (PixelWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +0000283 assert((*wand)->signature == MagickWandSignature);
cristy3ed852e2009-09-05 21:47:34 +0000284 if ((*wand)->debug != MagickFalse)
285 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",(*wand)->name);
cristybb503372010-05-27 20:51:26 +0000286 for (i=(ssize_t) number_wands-1; i >= 0; i--)
cristy3ed852e2009-09-05 21:47:34 +0000287 wand[i]=DestroyPixelWand(wand[i]);
288 wand=(PixelWand **) RelinquishMagickMemory(wand);
289 return(wand);
290}
291
292/*
293%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
294% %
295% %
296% %
297% I s P i x e l W a n d S i m i l a r %
298% %
299% %
300% %
301%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
302%
303% IsPixelWandSimilar() returns MagickTrue if the distance between two
304% colors is less than the specified distance.
305%
306% The format of the IsPixelWandSimilar method is:
307%
308% MagickBooleanType IsPixelWandSimilar(PixelWand *p,PixelWand *q,
309% const double fuzz)
310%
311% A description of each parameter follows:
312%
313% o p: the pixel wand.
314%
315% o q: the pixel wand.
316%
317% o fuzz: any two colors that are less than or equal to this distance
318% squared are consider similar.
319%
320*/
321WandExport MagickBooleanType IsPixelWandSimilar(PixelWand *p,PixelWand *q,
322 const double fuzz)
323{
324 assert(p != (PixelWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +0000325 assert(p->signature == MagickWandSignature);
cristy3ed852e2009-09-05 21:47:34 +0000326 if (p->debug != MagickFalse)
327 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",p->name);
328 assert(q != (PixelWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +0000329 assert(q->signature == MagickWandSignature);
cristy3ed852e2009-09-05 21:47:34 +0000330 if (q->debug != MagickFalse)
331 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",q->name);
332 p->pixel.fuzz=fuzz;
333 q->pixel.fuzz=fuzz;
cristy4c08aed2011-07-01 19:47:50 +0000334 return(IsFuzzyEquivalencePixelInfo(&p->pixel,&q->pixel));
cristy3ed852e2009-09-05 21:47:34 +0000335}
336
337/*
338%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
339% %
340% %
341% %
342% I s P i x e l W a n d %
343% %
344% %
345% %
346%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
347%
348% IsPixelWand() returns MagickTrue if the wand is verified as a pixel wand.
349%
350% The format of the IsPixelWand method is:
351%
352% MagickBooleanType IsPixelWand(const PixelWand *wand)
353%
354% A description of each parameter follows:
355%
356% o wand: the magick wand.
357%
358*/
359WandExport MagickBooleanType IsPixelWand(const PixelWand *wand)
360{
361 if (wand == (const PixelWand *) NULL)
362 return(MagickFalse);
cristye1c94d92015-06-28 12:16:33 +0000363 if (wand->signature != MagickWandSignature)
cristy3ed852e2009-09-05 21:47:34 +0000364 return(MagickFalse);
365 if (LocaleNCompare(wand->name,PixelWandId,strlen(PixelWandId)) != 0)
366 return(MagickFalse);
367 return(MagickTrue);
368}
369
370/*
371%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
372% %
373% %
374% %
375% N e w P i x e l W a n d %
376% %
377% %
378% %
379%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
380%
381% NewPixelWand() returns a new pixel wand.
382%
383% The format of the NewPixelWand method is:
384%
385% PixelWand *NewPixelWand(void)
386%
387*/
388WandExport PixelWand *NewPixelWand(void)
389{
390 const char
391 *quantum;
392
393 PixelWand
394 *wand;
395
cristybb503372010-05-27 20:51:26 +0000396 size_t
cristy3ed852e2009-09-05 21:47:34 +0000397 depth;
398
399 depth=MAGICKCORE_QUANTUM_DEPTH;
400 quantum=GetMagickQuantumDepth(&depth);
401 if (depth != MAGICKCORE_QUANTUM_DEPTH)
402 ThrowWandFatalException(WandError,"QuantumDepthMismatch",quantum);
cristy73bd4a52010-10-05 11:24:23 +0000403 wand=(PixelWand *) AcquireMagickMemory(sizeof(*wand));
cristy3ed852e2009-09-05 21:47:34 +0000404 if (wand == (PixelWand *) NULL)
405 ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
406 GetExceptionMessage(errno));
407 (void) ResetMagickMemory(wand,0,sizeof(*wand));
408 wand->id=AcquireWandId();
cristy151b66d2015-04-15 10:50:31 +0000409 (void) FormatLocaleString(wand->name,MagickPathExtent,"%s-%.20g",PixelWandId,
cristye8c25f92010-06-03 00:53:06 +0000410 (double) wand->id);
cristy3ed852e2009-09-05 21:47:34 +0000411 wand->exception=AcquireExceptionInfo();
cristy4c08aed2011-07-01 19:47:50 +0000412 GetPixelInfo((Image *) NULL,&wand->pixel);
cristy3ed852e2009-09-05 21:47:34 +0000413 wand->debug=IsEventLogging();
414 if (wand->debug != MagickFalse)
415 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
cristye1c94d92015-06-28 12:16:33 +0000416 wand->signature=MagickWandSignature;
cristy3ed852e2009-09-05 21:47:34 +0000417 return(wand);
418}
419
420/*
421%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
422% %
423% %
424% %
425% N e w P i x e l W a n d s %
426% %
427% %
428% %
429%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
430%
431% NewPixelWands() returns an array of pixel wands.
432%
433% The format of the NewPixelWands method is:
434%
cristybb503372010-05-27 20:51:26 +0000435% PixelWand **NewPixelWands(const size_t number_wands)
cristy3ed852e2009-09-05 21:47:34 +0000436%
437% A description of each parameter follows:
438%
439% o number_wands: the number of wands.
440%
441*/
cristybb503372010-05-27 20:51:26 +0000442WandExport PixelWand **NewPixelWands(const size_t number_wands)
cristy3ed852e2009-09-05 21:47:34 +0000443{
cristybb503372010-05-27 20:51:26 +0000444 register ssize_t
cristy3ed852e2009-09-05 21:47:34 +0000445 i;
446
447 PixelWand
448 **wands;
449
450 wands=(PixelWand **) AcquireQuantumMemory((size_t) number_wands,
451 sizeof(*wands));
452 if (wands == (PixelWand **) NULL)
453 ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
454 GetExceptionMessage(errno));
cristybb503372010-05-27 20:51:26 +0000455 for (i=0; i < (ssize_t) number_wands; i++)
cristy3ed852e2009-09-05 21:47:34 +0000456 wands[i]=NewPixelWand();
457 return(wands);
458}
459
460/*
461%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
462% %
463% %
464% %
465% P i x e l C l e a r E x c e p t i o n %
466% %
467% %
468% %
469%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
470%
471% PixelClearException() clear any exceptions associated with the iterator.
472%
473% The format of the PixelClearException method is:
474%
475% MagickBooleanType PixelClearException(PixelWand *wand)
476%
477% A description of each parameter follows:
478%
479% o wand: the pixel wand.
480%
481*/
482WandExport MagickBooleanType PixelClearException(PixelWand *wand)
483{
484 assert(wand != (PixelWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +0000485 assert(wand->signature == MagickWandSignature);
cristy3ed852e2009-09-05 21:47:34 +0000486 if (wand->debug != MagickFalse)
487 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
488 ClearMagickException(wand->exception);
489 return(MagickTrue);
490}
491
492/*
493%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
494% %
495% %
496% %
497% P i x e l G e t A l p h a %
498% %
499% %
500% %
501%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
502%
cristy13fdc362014-07-01 14:15:18 +0000503% PixelGetAlpha() returns the normalized alpha value of the pixel wand.
cristy3ed852e2009-09-05 21:47:34 +0000504%
505% The format of the PixelGetAlpha method is:
506%
507% double PixelGetAlpha(const PixelWand *wand)
508%
509% A description of each parameter follows:
510%
511% o wand: the pixel wand.
512%
513*/
514WandExport double PixelGetAlpha(const PixelWand *wand)
515{
516 assert(wand != (const PixelWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +0000517 assert(wand->signature == MagickWandSignature);
cristy3ed852e2009-09-05 21:47:34 +0000518 if (wand->debug != MagickFalse)
519 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
cristy4c08aed2011-07-01 19:47:50 +0000520 return((double) QuantumScale*wand->pixel.alpha);
cristy3ed852e2009-09-05 21:47:34 +0000521}
522
523/*
524%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
525% %
526% %
527% %
528% P i x e l G e t A l p h a Q u a n t u m %
529% %
530% %
531% %
532%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
533%
534% PixelGetAlphaQuantum() returns the alpha value of the pixel wand.
535%
536% The format of the PixelGetAlphaQuantum method is:
537%
538% Quantum PixelGetAlphaQuantum(const PixelWand *wand)
539%
540% A description of each parameter follows:
541%
542% o wand: the pixel wand.
543%
544*/
545WandExport Quantum PixelGetAlphaQuantum(const PixelWand *wand)
546{
547 assert(wand != (const PixelWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +0000548 assert(wand->signature == MagickWandSignature);
cristy3ed852e2009-09-05 21:47:34 +0000549 if (wand->debug != MagickFalse)
550 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
cristy4c08aed2011-07-01 19:47:50 +0000551 return(ClampToQuantum(wand->pixel.alpha));
cristy3ed852e2009-09-05 21:47:34 +0000552}
553
554/*
555%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
556% %
557% %
558% %
559% P i x e l G e t B l a c k %
560% %
561% %
562% %
563%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
564%
565% PixelGetBlack() returns the normalized black color of the pixel wand.
566%
567% The format of the PixelGetBlack method is:
568%
569% double PixelGetBlack(const PixelWand *wand)
570%
571% A description of each parameter follows:
572%
573% o wand: the pixel wand.
574%
575*/
576WandExport double PixelGetBlack(const PixelWand *wand)
577{
578 assert(wand != (const PixelWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +0000579 assert(wand->signature == MagickWandSignature);
cristy3ed852e2009-09-05 21:47:34 +0000580 if (wand->debug != MagickFalse)
581 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
cristy4c08aed2011-07-01 19:47:50 +0000582 return((double) QuantumScale*wand->pixel.black);
cristy3ed852e2009-09-05 21:47:34 +0000583}
584
585/*
586%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
587% %
588% %
589% %
590% P i x e l G e t B l a c k Q u a n t u m %
591% %
592% %
593% %
594%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
595%
596% PixelGetBlackQuantum() returns the black color of the pixel wand.
597%
598% The format of the PixelGetBlackQuantum method is:
599%
600% Quantum PixelGetBlackQuantum(const PixelWand *wand)
601%
602% A description of each parameter follows:
603%
604% o wand: the pixel wand.
605%
606*/
607WandExport Quantum PixelGetBlackQuantum(const PixelWand *wand)
608{
609 assert(wand != (const PixelWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +0000610 assert(wand->signature == MagickWandSignature);
cristy3ed852e2009-09-05 21:47:34 +0000611 if (wand->debug != MagickFalse)
612 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
cristy4c08aed2011-07-01 19:47:50 +0000613 return(ClampToQuantum(wand->pixel.black));
cristy3ed852e2009-09-05 21:47:34 +0000614}
615
616/*
617%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
618% %
619% %
620% %
621% P i x e l G e t B l u e %
622% %
623% %
624% %
625%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
626%
627% PixelGetBlue() returns the normalized blue color of the pixel wand.
628%
629% The format of the PixelGetBlue method is:
630%
631% double PixelGetBlue(const PixelWand *wand)
632%
633% A description of each parameter follows:
634%
635% o wand: the pixel wand.
636%
637*/
638WandExport double PixelGetBlue(const PixelWand *wand)
639{
640 assert(wand != (const PixelWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +0000641 assert(wand->signature == MagickWandSignature);
cristy3ed852e2009-09-05 21:47:34 +0000642 if (wand->debug != MagickFalse)
643 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
644 return((double) QuantumScale*wand->pixel.blue);
645}
646
647/*
648%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
649% %
650% %
651% %
652% P i x e l G e t B l u e Q u a n t u m %
653% %
654% %
655% %
656%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
657%
658% PixelGetBlueQuantum() returns the blue color of the pixel wand.
659%
660% The format of the PixelGetBlueQuantum method is:
661%
662% Quantum PixelGetBlueQuantum(const PixelWand *wand)
663%
664% A description of each parameter follows:
665%
666% o wand: the pixel wand.
667%
668*/
669WandExport Quantum PixelGetBlueQuantum(const PixelWand *wand)
670{
671 assert(wand != (const PixelWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +0000672 assert(wand->signature == MagickWandSignature);
cristy3ed852e2009-09-05 21:47:34 +0000673 if (wand->debug != MagickFalse)
674 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
cristyce70c172010-01-07 17:15:30 +0000675 return(ClampToQuantum(wand->pixel.blue));
cristy3ed852e2009-09-05 21:47:34 +0000676}
677
678/*
679%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
680% %
681% %
682% %
683% P i x e l G e t C o l o r A s S t r i n g %
684% %
685% %
686% %
687%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
688%
689% PixelGetColorAsString() returnsd the color of the pixel wand as a string.
690%
691% The format of the PixelGetColorAsString method is:
692%
693% char *PixelGetColorAsString(PixelWand *wand)
694%
695% A description of each parameter follows:
696%
697% o wand: the pixel wand.
698%
699*/
700WandExport char *PixelGetColorAsString(const PixelWand *wand)
701{
702 char
703 *color;
704
cristy4c08aed2011-07-01 19:47:50 +0000705 PixelInfo
cristy3ed852e2009-09-05 21:47:34 +0000706 pixel;
707
708 assert(wand != (const PixelWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +0000709 assert(wand->signature == MagickWandSignature);
cristy3ed852e2009-09-05 21:47:34 +0000710 if (wand->debug != MagickFalse)
711 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
712 pixel=wand->pixel;
713 color=AcquireString((const char *) NULL);
714 GetColorTuple(&pixel,MagickFalse,color);
715 return(color);
716}
717
718/*
719%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
720% %
721% %
722% %
723% P i x e l G e t C o l o r A s N o r m a l i z e d S t r i n g %
724% %
725% %
726% %
727%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
728%
729% PixelGetColorAsNormalizedString() returns the normalized color of the pixel
730% wand as a string.
731%
732% The format of the PixelGetColorAsNormalizedString method is:
733%
734% char *PixelGetColorAsNormalizedString(PixelWand *wand)
735%
736% A description of each parameter follows:
737%
738% o wand: the pixel wand.
739%
740*/
741WandExport char *PixelGetColorAsNormalizedString(const PixelWand *wand)
742{
743 char
cristy151b66d2015-04-15 10:50:31 +0000744 color[2*MagickPathExtent];
cristy3ed852e2009-09-05 21:47:34 +0000745
746 assert(wand != (const PixelWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +0000747 assert(wand->signature == MagickWandSignature);
cristy3ed852e2009-09-05 21:47:34 +0000748 if (wand->debug != MagickFalse)
749 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
cristy151b66d2015-04-15 10:50:31 +0000750 (void) FormatLocaleString(color,MagickPathExtent,"%g,%g,%g",
cristy3ed852e2009-09-05 21:47:34 +0000751 (double) (QuantumScale*wand->pixel.red),
752 (double) (QuantumScale*wand->pixel.green),
753 (double) (QuantumScale*wand->pixel.blue));
754 if (wand->pixel.colorspace == CMYKColorspace)
cristy151b66d2015-04-15 10:50:31 +0000755 (void) FormatLocaleString(color+strlen(color),MagickPathExtent,",%g",
cristy4c08aed2011-07-01 19:47:50 +0000756 (double) (QuantumScale*wand->pixel.black));
cristy7d6d3d82014-11-09 17:00:16 +0000757 if (wand->pixel.alpha_trait != UndefinedPixelTrait)
cristy151b66d2015-04-15 10:50:31 +0000758 (void) FormatLocaleString(color+strlen(color),MagickPathExtent,",%g",
cristy4c08aed2011-07-01 19:47:50 +0000759 (double) (QuantumScale*wand->pixel.alpha));
cristy3ed852e2009-09-05 21:47:34 +0000760 return(ConstantString(color));
761}
762
763/*
764%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
765% %
766% %
767% %
768% P i x e l G e t C o l o r C o u n t %
769% %
770% %
771% %
772%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
773%
774% PixelGetColorCount() returns the color count associated with this color.
775%
776% The format of the PixelGetColorCount method is:
777%
cristybb503372010-05-27 20:51:26 +0000778% size_t PixelGetColorCount(const PixelWand *wand)
cristy3ed852e2009-09-05 21:47:34 +0000779%
780% A description of each parameter follows:
781%
782% o wand: the pixel wand.
783%
784*/
cristybb503372010-05-27 20:51:26 +0000785WandExport size_t PixelGetColorCount(const PixelWand *wand)
cristy3ed852e2009-09-05 21:47:34 +0000786{
787 assert(wand != (const PixelWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +0000788 assert(wand->signature == MagickWandSignature);
cristy3ed852e2009-09-05 21:47:34 +0000789 if (wand->debug != MagickFalse)
790 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
791 return(wand->count);
792}
793
794/*
795%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
796% %
797% %
798% %
799% P i x e l G e t C y a n %
800% %
801% %
802% %
803%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
804%
805% PixelGetCyan() returns the normalized cyan color of the pixel wand.
806%
807% The format of the PixelGetCyan method is:
808%
809% double PixelGetCyan(const PixelWand *wand)
810%
811% A description of each parameter follows:
812%
813% o wand: the pixel wand.
814%
815*/
816WandExport double PixelGetCyan(const PixelWand *wand)
817{
818 assert(wand != (const PixelWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +0000819 assert(wand->signature == MagickWandSignature);
cristy3ed852e2009-09-05 21:47:34 +0000820 if (wand->debug != MagickFalse)
821 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
822 return((double) QuantumScale*wand->pixel.red);
823}
824
825/*
826%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
827% %
828% %
829% %
830% P i x e l G e t C y a n Q u a n t u m %
831% %
832% %
833% %
834%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
835%
836% PixelGetCyanQuantum() returns the cyan color of the pixel wand.
837%
838% The format of the PixelGetCyanQuantum method is:
839%
840% Quantum PixelGetCyanQuantum(const PixelWand *wand)
841%
842% A description of each parameter follows:
843%
844% o wand: the pixel wand.
845%
846*/
847WandExport Quantum PixelGetCyanQuantum(const PixelWand *wand)
848{
849 assert(wand != (const PixelWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +0000850 assert(wand->signature == MagickWandSignature);
cristy3ed852e2009-09-05 21:47:34 +0000851 if (wand->debug != MagickFalse)
852 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
cristyce70c172010-01-07 17:15:30 +0000853 return(ClampToQuantum(wand->pixel.red));
cristy3ed852e2009-09-05 21:47:34 +0000854}
855
856/*
857%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
858% %
859% %
860% %
861% P i x e l G e t E x c e p t i o n %
862% %
863% %
864% %
865%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
866%
867% PixelGetException() returns the severity, reason, and description of any
868% error that occurs when using other methods in this API.
869%
870% The format of the PixelGetException method is:
871%
872% char *PixelGetException(const PixelWand *wand,ExceptionType *severity)
873%
874% A description of each parameter follows:
875%
876% o wand: the pixel wand.
877%
878% o severity: the severity of the error is returned here.
879%
880*/
881WandExport char *PixelGetException(const PixelWand *wand,
882 ExceptionType *severity)
883{
884 char
885 *description;
886
887 assert(wand != (const PixelWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +0000888 assert(wand->signature == MagickWandSignature);
cristy3ed852e2009-09-05 21:47:34 +0000889 if (wand->debug != MagickFalse)
890 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
891 assert(severity != (ExceptionType *) NULL);
892 *severity=wand->exception->severity;
cristy151b66d2015-04-15 10:50:31 +0000893 description=(char *) AcquireQuantumMemory(2UL*MagickPathExtent,
cristy3ed852e2009-09-05 21:47:34 +0000894 sizeof(*description));
895 if (description == (char *) NULL)
896 ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
897 wand->name);
898 *description='\0';
899 if (wand->exception->reason != (char *) NULL)
900 (void) CopyMagickString(description,GetLocaleExceptionMessage(
cristy151b66d2015-04-15 10:50:31 +0000901 wand->exception->severity,wand->exception->reason),MagickPathExtent);
cristy3ed852e2009-09-05 21:47:34 +0000902 if (wand->exception->description != (char *) NULL)
903 {
cristy151b66d2015-04-15 10:50:31 +0000904 (void) ConcatenateMagickString(description," (",MagickPathExtent);
cristy3ed852e2009-09-05 21:47:34 +0000905 (void) ConcatenateMagickString(description,GetLocaleExceptionMessage(
cristy151b66d2015-04-15 10:50:31 +0000906 wand->exception->severity,wand->exception->description),MagickPathExtent);
907 (void) ConcatenateMagickString(description,")",MagickPathExtent);
cristy3ed852e2009-09-05 21:47:34 +0000908 }
909 return(description);
910}
911
912/*
913%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
914% %
915% %
916% %
917% P i x e l G e t E x c e p t i o n T y p e %
918% %
919% %
920% %
921%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
922%
923% PixelGetExceptionType() the exception type associated with the wand. If
924% no exception has occurred, UndefinedExceptionType is returned.
925%
926% The format of the PixelGetExceptionType method is:
927%
928% ExceptionType PixelGetExceptionType(const PixelWand *wand)
929%
930% A description of each parameter follows:
931%
932% o wand: the magick wand.
933%
934*/
935WandExport ExceptionType PixelGetExceptionType(const PixelWand *wand)
936{
937 assert(wand != (const PixelWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +0000938 assert(wand->signature == MagickWandSignature);
cristy3ed852e2009-09-05 21:47:34 +0000939 if (wand->debug != MagickFalse)
940 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
941 return(wand->exception->severity);
942}
943
944/*
945%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
946% %
947% %
948% %
949% P i x e l G e t F u z z %
950% %
951% %
952% %
953%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
954%
955% PixelGetFuzz() returns the normalized fuzz value of the pixel wand.
956%
957% The format of the PixelGetFuzz method is:
958%
959% double PixelGetFuzz(const PixelWand *wand)
960%
961% A description of each parameter follows:
962%
963% o wand: the pixel wand.
964%
965*/
966WandExport double PixelGetFuzz(const PixelWand *wand)
967{
968 assert(wand != (const PixelWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +0000969 assert(wand->signature == MagickWandSignature);
cristy3ed852e2009-09-05 21:47:34 +0000970 if (wand->debug != MagickFalse)
971 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
972 return((double) wand->pixel.fuzz);
973}
974
975/*
976%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
977% %
978% %
979% %
980% P i x e l G e t G r e e n %
981% %
982% %
983% %
984%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
985%
986% PixelGetGreen() returns the normalized green color of the pixel wand.
987%
988% The format of the PixelGetGreen method is:
989%
990% double PixelGetGreen(const PixelWand *wand)
991%
992% A description of each parameter follows:
993%
994% o wand: the pixel wand.
995%
996*/
997WandExport double PixelGetGreen(const PixelWand *wand)
998{
999 assert(wand != (const PixelWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00001000 assert(wand->signature == MagickWandSignature);
cristy3ed852e2009-09-05 21:47:34 +00001001 if (wand->debug != MagickFalse)
1002 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1003 return((double) QuantumScale*wand->pixel.green);
1004}
1005
1006/*
1007%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1008% %
1009% %
1010% %
1011% P i x e l G e t G r e e n Q u a n t u m %
1012% %
1013% %
1014% %
1015%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1016%
1017% PixelGetGreenQuantum() returns the green color of the pixel wand.
1018%
1019% The format of the PixelGetGreenQuantum method is:
1020%
1021% Quantum PixelGetGreenQuantum(const PixelWand *wand)
1022%
1023% A description of each parameter follows:
1024%
1025% o wand: the pixel wand.
1026%
1027*/
1028WandExport Quantum PixelGetGreenQuantum(const PixelWand *wand)
1029{
1030 assert(wand != (const PixelWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00001031 assert(wand->signature == MagickWandSignature);
cristy3ed852e2009-09-05 21:47:34 +00001032 if (wand->debug != MagickFalse)
1033 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
cristyce70c172010-01-07 17:15:30 +00001034 return(ClampToQuantum(wand->pixel.green));
cristy3ed852e2009-09-05 21:47:34 +00001035}
1036
1037/*
1038%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1039% %
1040% %
1041% %
1042% P i x e l G e t H S L %
1043% %
1044% %
1045% %
1046%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1047%
1048% PixelGetHSL() returns the normalized HSL color of the pixel wand.
1049%
1050% The format of the PixelGetHSL method is:
1051%
1052% void PixelGetHSL(const PixelWand *wand,double *hue,double *saturation,
1053% double *lightness)
1054%
1055% A description of each parameter follows:
1056%
1057% o wand: the pixel wand.
1058%
1059% o hue,saturation,lightness: Return the pixel hue, saturation, and
1060% brightness.
1061%
1062*/
1063WandExport void PixelGetHSL(const PixelWand *wand,double *hue,
1064 double *saturation,double *lightness)
1065{
1066 assert(wand != (const PixelWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00001067 assert(wand->signature == MagickWandSignature);
cristy3ed852e2009-09-05 21:47:34 +00001068 if (wand->debug != MagickFalse)
1069 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
cristy0a39a5c2012-06-27 12:51:45 +00001070 ConvertRGBToHSL((double) ClampToQuantum(wand->pixel.red),(double)
cristye42f6582012-02-11 17:59:50 +00001071 ClampToQuantum(wand->pixel.green),(double) ClampToQuantum(wand->pixel.blue),
1072 hue,saturation,lightness);
cristy3ed852e2009-09-05 21:47:34 +00001073}
1074
1075/*
1076%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1077% %
1078% %
1079% %
1080% P i x e l G e t I n d e x %
1081% %
1082% %
1083% %
1084%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1085%
1086% PixelGetIndex() returns the colormap index from the pixel wand.
1087%
1088% The format of the PixelGetIndex method is:
1089%
cristy4c08aed2011-07-01 19:47:50 +00001090% Quantum PixelGetIndex(const PixelWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00001091%
1092% A description of each parameter follows:
1093%
1094% o wand: the pixel wand.
1095%
1096*/
cristy4c08aed2011-07-01 19:47:50 +00001097WandExport Quantum PixelGetIndex(const PixelWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00001098{
1099 assert(wand != (const PixelWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00001100 assert(wand->signature == MagickWandSignature);
cristy3ed852e2009-09-05 21:47:34 +00001101 if (wand->debug != MagickFalse)
1102 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
cristy4c08aed2011-07-01 19:47:50 +00001103 return((Quantum) wand->pixel.black);
cristy3ed852e2009-09-05 21:47:34 +00001104}
1105
1106/*
1107%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1108% %
1109% %
1110% %
1111% P i x e l G e t M a g e n t a %
1112% %
1113% %
1114% %
1115%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1116%
1117% PixelGetMagenta() returns the normalized magenta color of the pixel wand.
1118%
1119% The format of the PixelGetMagenta method is:
1120%
1121% double PixelGetMagenta(const PixelWand *wand)
1122%
1123% A description of each parameter follows:
1124%
1125% o wand: the pixel wand.
1126%
1127*/
1128WandExport double PixelGetMagenta(const PixelWand *wand)
1129{
1130 assert(wand != (const PixelWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00001131 assert(wand->signature == MagickWandSignature);
cristy3ed852e2009-09-05 21:47:34 +00001132 if (wand->debug != MagickFalse)
1133 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1134 return((double) QuantumScale*wand->pixel.green);
1135}
1136
1137/*
1138%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1139% %
1140% %
1141% %
1142% P i x e l G e t M a g e n t a Q u a n t u m %
1143% %
1144% %
1145% %
1146%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1147%
1148% PixelGetMagentaQuantum() returns the magenta color of the pixel wand.
1149%
1150% The format of the PixelGetMagentaQuantum method is:
1151%
1152% Quantum PixelGetMagentaQuantum(const PixelWand *wand)
1153%
1154% A description of each parameter follows:
1155%
1156% o wand: the pixel wand.
1157%
1158*/
1159WandExport Quantum PixelGetMagentaQuantum(const PixelWand *wand)
1160{
1161 assert(wand != (const PixelWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00001162 assert(wand->signature == MagickWandSignature);
cristy3ed852e2009-09-05 21:47:34 +00001163 if (wand->debug != MagickFalse)
1164 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
cristyce70c172010-01-07 17:15:30 +00001165 return(ClampToQuantum(wand->pixel.green));
cristy3ed852e2009-09-05 21:47:34 +00001166}
1167
1168/*
1169%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1170% %
1171% %
1172% %
cristy9e1d53f2010-12-16 13:44:43 +00001173% P i x e l G e t M a g i c k C o l o r %
cristy3ed852e2009-09-05 21:47:34 +00001174% %
1175% %
1176% %
1177%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1178%
1179% PixelGetMagickColor() gets the magick color of the pixel wand.
1180%
1181% The format of the PixelGetMagickColor method is:
1182%
cristy4c08aed2011-07-01 19:47:50 +00001183% void PixelGetMagickColor(PixelWand *wand,PixelInfo *color)
cristy3ed852e2009-09-05 21:47:34 +00001184%
1185% A description of each parameter follows:
1186%
1187% o wand: the pixel wand.
1188%
1189% o color: The pixel wand color is returned here.
1190%
1191*/
1192WandExport void PixelGetMagickColor(const PixelWand *wand,
cristy4c08aed2011-07-01 19:47:50 +00001193 PixelInfo *color)
cristy3ed852e2009-09-05 21:47:34 +00001194{
1195 assert(wand != (const PixelWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00001196 assert(wand->signature == MagickWandSignature);
cristy3ed852e2009-09-05 21:47:34 +00001197 if (wand->debug != MagickFalse)
1198 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
cristy4c08aed2011-07-01 19:47:50 +00001199 assert(color != (PixelInfo *) NULL);
cristy3ed852e2009-09-05 21:47:34 +00001200 *color=wand->pixel;
1201}
1202
1203/*
1204%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1205% %
1206% %
1207% %
cristy28474bf2011-09-11 23:32:52 +00001208% P i x e l G e t P i x e l %
1209% %
1210% %
1211% %
1212%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1213%
1214% PixelGetPixel() returns the pixel wand pixel.
1215%
1216% The format of the PixelGetPixel method is:
1217%
1218% PixelInfo PixelGetPixel(const PixelWand *wand)
1219%
1220% A description of each parameter follows:
1221%
1222% o wand: the pixel wand.
1223%
1224*/
1225WandExport PixelInfo PixelGetPixel(const PixelWand *wand)
1226{
1227 assert(wand != (const PixelWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00001228 assert(wand->signature == MagickWandSignature);
cristy28474bf2011-09-11 23:32:52 +00001229 if (wand->debug != MagickFalse)
1230 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1231 return(wand->pixel);
1232}
1233
1234/*
1235%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1236% %
1237% %
1238% %
cristy4c08aed2011-07-01 19:47:50 +00001239% P i x e l G e t Q u a n t u m P a c k e t %
cristy3ed852e2009-09-05 21:47:34 +00001240% %
1241% %
1242% %
1243%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1244%
cristy101ab702011-10-13 13:06:32 +00001245% PixelGetQuantumPacket() gets the packet of the pixel wand as a PixelInfo.
cristy3ed852e2009-09-05 21:47:34 +00001246%
cristy4c08aed2011-07-01 19:47:50 +00001247% The format of the PixelGetQuantumPacket method is:
cristy3ed852e2009-09-05 21:47:34 +00001248%
cristy101ab702011-10-13 13:06:32 +00001249% void PixelGetQuantumPacket(PixelWand *wand,PixelInfo *packet)
cristy3ed852e2009-09-05 21:47:34 +00001250%
1251% A description of each parameter follows:
1252%
1253% o wand: the pixel wand.
1254%
cristy4c08aed2011-07-01 19:47:50 +00001255% o packet: The pixel wand packet is returned here.
cristy3ed852e2009-09-05 21:47:34 +00001256%
1257*/
cristy101ab702011-10-13 13:06:32 +00001258WandExport void PixelGetQuantumPacket(const PixelWand *wand,PixelInfo *packet)
cristy3ed852e2009-09-05 21:47:34 +00001259{
1260 assert(wand != (const PixelWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00001261 assert(wand->signature == MagickWandSignature);
cristy3ed852e2009-09-05 21:47:34 +00001262 if (wand->debug != MagickFalse)
1263 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
cristy101ab702011-10-13 13:06:32 +00001264 assert(packet != (PixelInfo *) NULL);
cristy7bd30142015-06-20 13:40:47 +00001265 packet->storage_class=wand->pixel.storage_class;
1266 packet->colorspace=wand->pixel.colorspace;
cristy72437802015-03-23 00:42:27 +00001267 packet->depth=wand->pixel.depth;
cristy9c450d82014-05-27 00:29:31 +00001268 packet->fuzz=wand->pixel.fuzz;
cristye7770e32015-06-21 19:51:15 +00001269 packet->count=wand->pixel.count;
1270 packet->index=wand->pixel.index;
cristye42f6582012-02-11 17:59:50 +00001271 packet->alpha=(double) ClampToQuantum(wand->pixel.alpha);
cristyf2a82ee2014-05-26 17:49:54 +00001272 packet->alpha_trait=wand->pixel.alpha_trait;
cristy3ed852e2009-09-05 21:47:34 +00001273 if (wand->pixel.colorspace == CMYKColorspace)
1274 {
cristy8cd03c32012-07-07 18:57:59 +00001275 packet->red=(double) ClampToQuantum(QuantumRange-
cristy4c08aed2011-07-01 19:47:50 +00001276 (wand->pixel.red*(QuantumRange-wand->pixel.black)+
1277 wand->pixel.black));
cristy8cd03c32012-07-07 18:57:59 +00001278 packet->green=(double) ClampToQuantum(QuantumRange-
cristy4c08aed2011-07-01 19:47:50 +00001279 (wand->pixel.green*(QuantumRange-wand->pixel.black)+
1280 wand->pixel.black));
cristy8cd03c32012-07-07 18:57:59 +00001281 packet->blue=(double) ClampToQuantum(QuantumRange-
cristy4c08aed2011-07-01 19:47:50 +00001282 (wand->pixel.blue*(QuantumRange-wand->pixel.black)+
1283 wand->pixel.black));
cristye42f6582012-02-11 17:59:50 +00001284 packet->black=(double) ClampToQuantum(wand->pixel.black);
cristy3ed852e2009-09-05 21:47:34 +00001285 return;
1286 }
cristye42f6582012-02-11 17:59:50 +00001287 packet->red=(double) ClampToQuantum(wand->pixel.red);
1288 packet->green=(double) ClampToQuantum(wand->pixel.green);
1289 packet->blue=(double) ClampToQuantum(wand->pixel.blue);
cristy4c08aed2011-07-01 19:47:50 +00001290}
1291
1292/*
1293%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1294% %
1295% %
1296% %
1297% P i x e l G e t Q u a n t u m P i x e l %
1298% %
1299% %
1300% %
1301%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1302%
cristy101ab702011-10-13 13:06:32 +00001303% PixelGetQuantumPixel() gets the pixel of the pixel wand as a PixelInfo.
cristy4c08aed2011-07-01 19:47:50 +00001304%
1305% The format of the PixelGetQuantumPixel method is:
1306%
1307% void PixelGetQuantumPixel(const Image *image,const PixelWand *wand,
1308% Quantum *pixel)
1309%
1310% A description of each parameter follows:
1311%
1312% o wand: the pixel wand.
1313%
1314% o pixel: The pixel wand pixel is returned here.
1315%
1316*/
1317WandExport void PixelGetQuantumPixel(const Image *image,const PixelWand *wand,
1318 Quantum *pixel)
1319{
1320 assert(wand != (const PixelWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00001321 assert(wand->signature == MagickWandSignature);
cristy4c08aed2011-07-01 19:47:50 +00001322 if (wand->debug != MagickFalse)
1323 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1324 assert(pixel != (Quantum *) NULL);
1325 SetPixelAlpha(image,ClampToQuantum(wand->pixel.alpha),pixel);
1326 if (wand->pixel.colorspace == CMYKColorspace)
1327 {
cristy8cd03c32012-07-07 18:57:59 +00001328 SetPixelRed(image,ClampToQuantum(QuantumRange-
cristy4c08aed2011-07-01 19:47:50 +00001329 (wand->pixel.red*(QuantumRange-wand->pixel.black)+wand->pixel.black)),
1330 pixel);
cristy8cd03c32012-07-07 18:57:59 +00001331 SetPixelGreen(image,ClampToQuantum(QuantumRange-
cristy4c08aed2011-07-01 19:47:50 +00001332 (wand->pixel.green*(QuantumRange-wand->pixel.black)+wand->pixel.black)),
1333 pixel);
cristy8cd03c32012-07-07 18:57:59 +00001334 SetPixelBlue(image,ClampToQuantum(QuantumRange-
cristy4c08aed2011-07-01 19:47:50 +00001335 (wand->pixel.blue*(QuantumRange-wand->pixel.black)+wand->pixel.black)),
1336 pixel);
1337 SetPixelBlack(image,ClampToQuantum(wand->pixel.black),pixel);
1338 return;
1339 }
1340 SetPixelRed(image,ClampToQuantum(wand->pixel.red),pixel);
1341 SetPixelGreen(image,ClampToQuantum(wand->pixel.green),pixel);
1342 SetPixelBlue(image,ClampToQuantum(wand->pixel.blue),pixel);
cristy3ed852e2009-09-05 21:47:34 +00001343}
1344
1345/*
1346%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1347% %
1348% %
1349% %
1350% P i x e l G e t R e d %
1351% %
1352% %
1353% %
1354%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1355%
1356% PixelGetRed() returns the normalized red color of the pixel wand.
1357%
1358% The format of the PixelGetRed method is:
1359%
1360% double PixelGetRed(const PixelWand *wand)
1361%
1362% A description of each parameter follows:
1363%
1364% o wand: the pixel wand.
1365%
1366*/
1367WandExport double PixelGetRed(const PixelWand *wand)
1368{
1369 assert(wand != (const PixelWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00001370 assert(wand->signature == MagickWandSignature);
cristy3ed852e2009-09-05 21:47:34 +00001371 if (wand->debug != MagickFalse)
1372 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1373 return((double) QuantumScale*wand->pixel.red);
1374}
1375
1376/*
1377%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1378% %
1379% %
1380% %
1381% P i x e l G e t R e d Q u a n t u m %
1382% %
1383% %
1384% %
1385%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1386%
1387% PixelGetRedQuantum() returns the red color of the pixel wand.
1388%
1389% The format of the PixelGetRedQuantum method is:
1390%
1391% Quantum PixelGetRedQuantum(const PixelWand *wand)
1392%
1393% A description of each parameter follows:
1394%
1395% o wand: the pixel wand.
1396%
1397*/
1398WandExport Quantum PixelGetRedQuantum(const PixelWand *wand)
1399{
1400 assert(wand != (const PixelWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00001401 assert(wand->signature == MagickWandSignature);
cristy3ed852e2009-09-05 21:47:34 +00001402 if (wand->debug != MagickFalse)
1403 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
cristyce70c172010-01-07 17:15:30 +00001404 return(ClampToQuantum(wand->pixel.red));
cristy3ed852e2009-09-05 21:47:34 +00001405}
1406
1407/*
1408%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1409% %
1410% %
1411% %
1412% P i x e l G e t Y e l l o w %
1413% %
1414% %
1415% %
1416%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1417%
1418% PixelGetYellow() returns the normalized yellow color of the pixel wand.
1419%
1420% The format of the PixelGetYellow method is:
1421%
1422% double PixelGetYellow(const PixelWand *wand)
1423%
1424% A description of each parameter follows:
1425%
1426% o wand: the pixel wand.
1427%
1428*/
1429WandExport double PixelGetYellow(const PixelWand *wand)
1430{
1431 assert(wand != (const PixelWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00001432 assert(wand->signature == MagickWandSignature);
cristy3ed852e2009-09-05 21:47:34 +00001433 if (wand->debug != MagickFalse)
1434 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1435 return((double) QuantumScale*wand->pixel.blue);
1436}
1437
1438/*
1439%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1440% %
1441% %
1442% %
1443% P i x e l G e t Y e l l o w Q u a n t u m %
1444% %
1445% %
1446% %
1447%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1448%
1449% PixelGetYellowQuantum() returns the yellow color of the pixel wand.
1450%
1451% The format of the PixelGetYellowQuantum method is:
1452%
1453% Quantum PixelGetYellowQuantum(const PixelWand *wand)
1454%
1455% A description of each parameter follows:
1456%
1457% o wand: the pixel wand.
1458%
1459*/
1460WandExport Quantum PixelGetYellowQuantum(const PixelWand *wand)
1461{
1462 assert(wand != (const PixelWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00001463 assert(wand->signature == MagickWandSignature);
cristy3ed852e2009-09-05 21:47:34 +00001464 if (wand->debug != MagickFalse)
1465 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
cristyce70c172010-01-07 17:15:30 +00001466 return(ClampToQuantum(wand->pixel.blue));
cristy3ed852e2009-09-05 21:47:34 +00001467}
1468
1469/*
1470%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1471% %
1472% %
1473% %
1474% P i x e l S e t A l p h a %
1475% %
1476% %
1477% %
1478%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1479%
cristy13fdc362014-07-01 14:15:18 +00001480% PixelSetAlpha() sets the normalized alpha value of the pixel wand.
cristy3ed852e2009-09-05 21:47:34 +00001481%
1482% The format of the PixelSetAlpha method is:
1483%
1484% void PixelSetAlpha(PixelWand *wand,const double alpha)
1485%
1486% A description of each parameter follows:
1487%
1488% o wand: the pixel wand.
1489%
1490% o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
1491% transparent.
1492%
1493*/
1494WandExport void PixelSetAlpha(PixelWand *wand,const double alpha)
1495{
1496 assert(wand != (const PixelWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00001497 assert(wand->signature == MagickWandSignature);
cristy3ed852e2009-09-05 21:47:34 +00001498 if (wand->debug != MagickFalse)
1499 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
cristye42f6582012-02-11 17:59:50 +00001500 wand->pixel.alpha=(double) ClampToQuantum(QuantumRange*alpha);
cristy3ed852e2009-09-05 21:47:34 +00001501}
1502
1503/*
1504%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1505% %
1506% %
1507% %
1508% P i x e l S e t A l p h a Q u a n t u m %
1509% %
1510% %
1511% %
1512%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1513%
cristy13fdc362014-07-01 14:15:18 +00001514% PixelSetAlphaQuantum() sets the alpha value of the pixel wand.
cristy3ed852e2009-09-05 21:47:34 +00001515%
1516% The format of the PixelSetAlphaQuantum method is:
1517%
cristy13fdc362014-07-01 14:15:18 +00001518% void PixelSetAlphaQuantum(PixelWand *wand,const Quantum alpha)
cristy3ed852e2009-09-05 21:47:34 +00001519%
1520% A description of each parameter follows:
1521%
1522% o wand: the pixel wand.
1523%
cristy13fdc362014-07-01 14:15:18 +00001524% o alpha: the alpha value.
cristy3ed852e2009-09-05 21:47:34 +00001525%
1526*/
cristyb6a294d2011-10-03 00:55:17 +00001527WandExport void PixelSetAlphaQuantum(PixelWand *wand,const Quantum alpha)
cristy3ed852e2009-09-05 21:47:34 +00001528{
1529 assert(wand != (const PixelWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00001530 assert(wand->signature == MagickWandSignature);
cristy3ed852e2009-09-05 21:47:34 +00001531 if (wand->debug != MagickFalse)
1532 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
cristya19f1d72012-08-07 18:24:38 +00001533 wand->pixel.alpha=(double) alpha;
cristy3ed852e2009-09-05 21:47:34 +00001534}
1535
1536/*
1537%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1538% %
1539% %
1540% %
1541% P i x e l S e t B l a c k %
1542% %
1543% %
1544% %
1545%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1546%
1547% PixelSetBlack() sets the normalized black color of the pixel wand.
1548%
1549% The format of the PixelSetBlack method is:
1550%
1551% void PixelSetBlack(PixelWand *wand,const double black)
1552%
1553% A description of each parameter follows:
1554%
1555% o wand: the pixel wand.
1556%
1557% o black: the black color.
1558%
1559*/
1560WandExport void PixelSetBlack(PixelWand *wand,const double black)
1561{
1562 assert(wand != (const PixelWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00001563 assert(wand->signature == MagickWandSignature);
cristy3ed852e2009-09-05 21:47:34 +00001564 if (wand->debug != MagickFalse)
1565 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
cristya19f1d72012-08-07 18:24:38 +00001566 wand->pixel.black=(double) ClampToQuantum(QuantumRange*black);
cristy3ed852e2009-09-05 21:47:34 +00001567}
1568
1569/*
1570%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1571% %
1572% %
1573% %
1574% P i x e l S e t B l a c k Q u a n t u m %
1575% %
1576% %
1577% %
1578%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1579%
1580% PixelSetBlackQuantum() sets the black color of the pixel wand.
1581%
1582% The format of the PixelSetBlackQuantum method is:
1583%
1584% void PixelSetBlackQuantum(PixelWand *wand,const Quantum black)
1585%
1586% A description of each parameter follows:
1587%
1588% o wand: the pixel wand.
1589%
1590% o black: the black color.
1591%
1592*/
1593WandExport void PixelSetBlackQuantum(PixelWand *wand,const Quantum black)
1594{
1595 assert(wand != (const PixelWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00001596 assert(wand->signature == MagickWandSignature);
cristy3ed852e2009-09-05 21:47:34 +00001597 if (wand->debug != MagickFalse)
1598 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
cristya19f1d72012-08-07 18:24:38 +00001599 wand->pixel.black=(double) black;
cristy3ed852e2009-09-05 21:47:34 +00001600}
1601
1602/*
1603%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1604% %
1605% %
1606% %
1607% P i x e l S e t B l u e %
1608% %
1609% %
1610% %
1611%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1612%
1613% PixelSetBlue() sets the normalized blue color of the pixel wand.
1614%
1615% The format of the PixelSetBlue method is:
1616%
1617% void PixelSetBlue(PixelWand *wand,const double blue)
1618%
1619% A description of each parameter follows:
1620%
1621% o wand: the pixel wand.
1622%
1623% o blue: the blue color.
1624%
1625*/
1626WandExport void PixelSetBlue(PixelWand *wand,const double blue)
1627{
1628 assert(wand != (const PixelWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00001629 assert(wand->signature == MagickWandSignature);
cristy3ed852e2009-09-05 21:47:34 +00001630 if (wand->debug != MagickFalse)
1631 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
cristya19f1d72012-08-07 18:24:38 +00001632 wand->pixel.blue=(double) ClampToQuantum(QuantumRange*blue);
cristy3ed852e2009-09-05 21:47:34 +00001633}
1634
1635/*
1636%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1637% %
1638% %
1639% %
1640% P i x e l S e t B l u e Q u a n t u m %
1641% %
1642% %
1643% %
1644%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1645%
1646% PixelSetBlueQuantum() sets the blue color of the pixel wand.
1647%
1648% The format of the PixelSetBlueQuantum method is:
1649%
1650% void PixelSetBlueQuantum(PixelWand *wand,const Quantum blue)
1651%
1652% A description of each parameter follows:
1653%
1654% o wand: the pixel wand.
1655%
1656% o blue: the blue color.
1657%
1658*/
1659WandExport void PixelSetBlueQuantum(PixelWand *wand,const Quantum blue)
1660{
1661 assert(wand != (const PixelWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00001662 assert(wand->signature == MagickWandSignature);
cristy3ed852e2009-09-05 21:47:34 +00001663 if (wand->debug != MagickFalse)
1664 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
cristya19f1d72012-08-07 18:24:38 +00001665 wand->pixel.blue=(double) blue;
cristy3ed852e2009-09-05 21:47:34 +00001666}
1667
1668/*
1669%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1670% %
1671% %
1672% %
1673% P i x e l S e t C o l o r %
1674% %
1675% %
1676% %
1677%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1678%
1679% PixelSetColor() sets the color of the pixel wand with a string (e.g.
1680% "blue", "#0000ff", "rgb(0,0,255)", "cmyk(100,100,100,10)", etc.).
1681%
1682% The format of the PixelSetColor method is:
1683%
1684% MagickBooleanType PixelSetColor(PixelWand *wand,const char *color)
1685%
1686% A description of each parameter follows:
1687%
1688% o wand: the pixel wand.
1689%
1690% o color: the pixel wand color.
1691%
1692*/
1693WandExport MagickBooleanType PixelSetColor(PixelWand *wand,const char *color)
1694{
1695 MagickBooleanType
1696 status;
1697
cristy4c08aed2011-07-01 19:47:50 +00001698 PixelInfo
cristy3ed852e2009-09-05 21:47:34 +00001699 pixel;
1700
1701 assert(wand != (const PixelWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00001702 assert(wand->signature == MagickWandSignature);
cristy3ed852e2009-09-05 21:47:34 +00001703 if (wand->debug != MagickFalse)
1704 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
cristy269c9412011-10-13 23:41:15 +00001705 status=QueryColorCompliance(color,AllCompliance,&pixel,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00001706 if (status != MagickFalse)
1707 wand->pixel=pixel;
cristy220c4d52013-11-27 19:31:32 +00001708 return(status);
cristy3ed852e2009-09-05 21:47:34 +00001709}
1710
1711/*
1712%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1713% %
1714% %
1715% %
1716% P i x e l S e t C o l o r C o u n t %
1717% %
1718% %
1719% %
1720%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1721%
1722% PixelSetColorCount() sets the color count of the pixel wand.
1723%
1724% The format of the PixelSetColorCount method is:
1725%
cristybb503372010-05-27 20:51:26 +00001726% void PixelSetColorCount(PixelWand *wand,const size_t count)
cristy3ed852e2009-09-05 21:47:34 +00001727%
1728% A description of each parameter follows:
1729%
1730% o wand: the pixel wand.
1731%
1732% o count: the number of this particular color.
1733%
1734*/
cristybb503372010-05-27 20:51:26 +00001735WandExport void PixelSetColorCount(PixelWand *wand,const size_t count)
cristy3ed852e2009-09-05 21:47:34 +00001736{
1737 assert(wand != (const PixelWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00001738 assert(wand->signature == MagickWandSignature);
cristy3ed852e2009-09-05 21:47:34 +00001739 if (wand->debug != MagickFalse)
1740 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1741 wand->count=count;
1742}
1743
1744/*
1745%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1746% %
1747% %
1748% %
1749% P i x e l S e t C o l o r F r o m W a n d %
1750% %
1751% %
1752% %
1753%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1754%
1755% PixelSetColorFromWand() sets the color of the pixel wand.
1756%
1757% The format of the PixelSetColorFromWand method is:
1758%
cristy0da2c572012-04-26 00:25:37 +00001759% void PixelSetColorFromWand(PixelWand *wand,const PixelWand *color)
cristy3ed852e2009-09-05 21:47:34 +00001760%
1761% A description of each parameter follows:
1762%
1763% o wand: the pixel wand.
1764%
1765% o color: set the pixel wand color here.
1766%
1767*/
1768WandExport void PixelSetColorFromWand(PixelWand *wand,const PixelWand *color)
1769{
1770 assert(wand != (const PixelWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00001771 assert(wand->signature == MagickWandSignature);
cristy3ed852e2009-09-05 21:47:34 +00001772 if (wand->debug != MagickFalse)
1773 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1774 assert(color != (const PixelWand *) NULL);
1775 wand->pixel=color->pixel;
1776}
1777
1778/*
1779%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1780% %
1781% %
1782% %
1783% P i x e l S e t C y a n %
1784% %
1785% %
1786% %
1787%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1788%
1789% PixelSetCyan() sets the normalized cyan color of the pixel wand.
1790%
1791% The format of the PixelSetCyan method is:
1792%
1793% void PixelSetCyan(PixelWand *wand,const double cyan)
1794%
1795% A description of each parameter follows:
1796%
1797% o wand: the pixel wand.
1798%
1799% o cyan: the cyan color.
1800%
1801*/
1802WandExport void PixelSetCyan(PixelWand *wand,const double cyan)
1803{
1804 assert(wand != (const PixelWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00001805 assert(wand->signature == MagickWandSignature);
cristy3ed852e2009-09-05 21:47:34 +00001806 if (wand->debug != MagickFalse)
1807 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
cristya19f1d72012-08-07 18:24:38 +00001808 wand->pixel.red=(double) ClampToQuantum(QuantumRange*cyan);
cristy3ed852e2009-09-05 21:47:34 +00001809}
1810
1811/*
1812%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1813% %
1814% %
1815% %
1816% P i x e l S e t C y a n Q u a n t u m %
1817% %
1818% %
1819% %
1820%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1821%
1822% PixelSetCyanQuantum() sets the cyan color of the pixel wand.
1823%
1824% The format of the PixelSetCyanQuantum method is:
1825%
1826% void PixelSetCyanQuantum(PixelWand *wand,const Quantum cyan)
1827%
1828% A description of each parameter follows:
1829%
1830% o wand: the pixel wand.
1831%
1832% o cyan: the cyan color.
1833%
1834*/
1835WandExport void PixelSetCyanQuantum(PixelWand *wand,const Quantum cyan)
1836{
1837 assert(wand != (const PixelWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00001838 assert(wand->signature == MagickWandSignature);
cristy3ed852e2009-09-05 21:47:34 +00001839 if (wand->debug != MagickFalse)
1840 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
cristya19f1d72012-08-07 18:24:38 +00001841 wand->pixel.red=(double) cyan;
cristy3ed852e2009-09-05 21:47:34 +00001842}
1843
1844/*
1845%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1846% %
1847% %
1848% %
1849% P i x e l S e t F u z z %
1850% %
1851% %
1852% %
1853%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1854%
1855% PixelSetFuzz() sets the fuzz value of the pixel wand.
1856%
1857% The format of the PixelSetFuzz method is:
1858%
1859% void PixelSetFuzz(PixelWand *wand,const double fuzz)
1860%
1861% A description of each parameter follows:
1862%
1863% o wand: the pixel wand.
1864%
1865% o fuzz: the fuzz value.
1866%
1867*/
1868WandExport void PixelSetFuzz(PixelWand *wand,const double fuzz)
1869{
1870 assert(wand != (const PixelWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00001871 assert(wand->signature == MagickWandSignature);
cristy3ed852e2009-09-05 21:47:34 +00001872 if (wand->debug != MagickFalse)
1873 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
cristya19f1d72012-08-07 18:24:38 +00001874 wand->pixel.fuzz=(double) fuzz;
cristy3ed852e2009-09-05 21:47:34 +00001875}
1876
1877/*
1878%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1879% %
1880% %
1881% %
1882% P i x e l S e t G r e e n %
1883% %
1884% %
1885% %
1886%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1887%
1888% PixelSetGreen() sets the normalized green color of the pixel wand.
1889%
1890% The format of the PixelSetGreen method is:
1891%
1892% void PixelSetGreen(PixelWand *wand,const double green)
1893%
1894% A description of each parameter follows:
1895%
1896% o wand: the pixel wand.
1897%
1898% o green: the green color.
1899%
1900*/
1901WandExport void PixelSetGreen(PixelWand *wand,const double green)
1902{
1903 assert(wand != (const PixelWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00001904 assert(wand->signature == MagickWandSignature);
cristy3ed852e2009-09-05 21:47:34 +00001905 if (wand->debug != MagickFalse)
1906 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
cristya19f1d72012-08-07 18:24:38 +00001907 wand->pixel.green=(double) ClampToQuantum(QuantumRange*green);
cristy3ed852e2009-09-05 21:47:34 +00001908}
1909
1910/*
1911%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1912% %
1913% %
1914% %
1915% P i x e l S e t G r e e n Q u a n t u m %
1916% %
1917% %
1918% %
1919%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1920%
1921% PixelSetGreenQuantum() sets the green color of the pixel wand.
1922%
1923% The format of the PixelSetGreenQuantum method is:
1924%
1925% void PixelSetGreenQuantum(PixelWand *wand,const Quantum green)
1926%
1927% A description of each parameter follows:
1928%
1929% o wand: the pixel wand.
1930%
1931% o green: the green color.
1932%
1933*/
1934WandExport void PixelSetGreenQuantum(PixelWand *wand,const Quantum green)
1935{
1936 assert(wand != (const PixelWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00001937 assert(wand->signature == MagickWandSignature);
cristy3ed852e2009-09-05 21:47:34 +00001938 if (wand->debug != MagickFalse)
1939 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
cristya19f1d72012-08-07 18:24:38 +00001940 wand->pixel.green=(double) green;
cristy3ed852e2009-09-05 21:47:34 +00001941}
1942
1943/*
1944%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1945% %
1946% %
1947% %
1948% P i x e l S e t H S L %
1949% %
1950% %
1951% %
1952%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1953%
1954% PixelSetHSL() sets the normalized HSL color of the pixel wand.
1955%
1956% The format of the PixelSetHSL method is:
1957%
1958% void PixelSetHSL(PixelWand *wand,const double hue,
1959% const double saturation,const double lightness)
1960%
1961% A description of each parameter follows:
1962%
1963% o wand: the pixel wand.
1964%
1965% o hue,saturation,lightness: Return the pixel hue, saturation, and
1966% brightness.
1967%
1968*/
1969WandExport void PixelSetHSL(PixelWand *wand,const double hue,
1970 const double saturation,const double lightness)
1971{
cristy3094b7f2011-10-01 23:18:02 +00001972 double
cristy3ed852e2009-09-05 21:47:34 +00001973 blue,
1974 green,
1975 red;
1976
1977 assert(wand != (const PixelWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00001978 assert(wand->signature == MagickWandSignature);
cristy3ed852e2009-09-05 21:47:34 +00001979 if (wand->debug != MagickFalse)
1980 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
cristy0a39a5c2012-06-27 12:51:45 +00001981 ConvertHSLToRGB(hue,saturation,lightness,&red,&green,&blue);
cristya19f1d72012-08-07 18:24:38 +00001982 wand->pixel.red=(double) red;
1983 wand->pixel.green=(double) green;
1984 wand->pixel.blue=(double) blue;
cristy3ed852e2009-09-05 21:47:34 +00001985}
1986
1987/*
1988%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1989% %
1990% %
1991% %
1992% P i x e l S e t I n d e x %
1993% %
1994% %
1995% %
1996%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1997%
1998% PixelSetIndex() sets the colormap index of the pixel wand.
1999%
2000% The format of the PixelSetIndex method is:
2001%
cristy4c08aed2011-07-01 19:47:50 +00002002% void PixelSetIndex(PixelWand *wand,const Quantum index)
cristy3ed852e2009-09-05 21:47:34 +00002003%
2004% A description of each parameter follows:
2005%
2006% o wand: the pixel wand.
2007%
2008% o index: the colormap index.
2009%
2010*/
cristy4c08aed2011-07-01 19:47:50 +00002011WandExport void PixelSetIndex(PixelWand *wand,const Quantum index)
cristy3ed852e2009-09-05 21:47:34 +00002012{
2013 assert(wand != (const PixelWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00002014 assert(wand->signature == MagickWandSignature);
cristy3ed852e2009-09-05 21:47:34 +00002015 if (wand->debug != MagickFalse)
2016 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
cristya19f1d72012-08-07 18:24:38 +00002017 wand->pixel.index=(double) index;
cristy3ed852e2009-09-05 21:47:34 +00002018}
2019
2020/*
2021%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2022% %
2023% %
2024% %
2025% P i x e l S e t M a g e n t a %
2026% %
2027% %
2028% %
2029%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2030%
2031% PixelSetMagenta() sets the normalized magenta color of the pixel wand.
2032%
2033% The format of the PixelSetMagenta method is:
2034%
2035% void PixelSetMagenta(PixelWand *wand,const double magenta)
2036%
2037% A description of each parameter follows:
2038%
2039% o wand: the pixel wand.
2040%
2041% o magenta: the magenta color.
2042%
2043*/
2044WandExport void PixelSetMagenta(PixelWand *wand,const double magenta)
2045{
2046 assert(wand != (const PixelWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00002047 assert(wand->signature == MagickWandSignature);
cristy3ed852e2009-09-05 21:47:34 +00002048 if (wand->debug != MagickFalse)
2049 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
cristya19f1d72012-08-07 18:24:38 +00002050 wand->pixel.green=(double) ClampToQuantum(QuantumRange*magenta);
cristy3ed852e2009-09-05 21:47:34 +00002051}
2052
2053/*
2054%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2055% %
2056% %
2057% %
2058% P i x e l S e t M a g e n t a Q u a n t u m %
2059% %
2060% %
2061% %
2062%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2063%
2064% PixelSetMagentaQuantum() sets the magenta color of the pixel wand.
2065%
2066% The format of the PixelSetMagentaQuantum method is:
2067%
2068% void PixelSetMagentaQuantum(PixelWand *wand,
2069% const Quantum magenta)
2070%
2071% A description of each parameter follows:
2072%
2073% o wand: the pixel wand.
2074%
2075% o magenta: the green magenta.
2076%
2077*/
2078WandExport void PixelSetMagentaQuantum(PixelWand *wand,const Quantum magenta)
2079{
2080 assert(wand != (const PixelWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00002081 assert(wand->signature == MagickWandSignature);
cristy3ed852e2009-09-05 21:47:34 +00002082 if (wand->debug != MagickFalse)
2083 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
cristya19f1d72012-08-07 18:24:38 +00002084 wand->pixel.green=(double) magenta;
cristy3ed852e2009-09-05 21:47:34 +00002085}
2086
2087/*
2088%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2089% %
2090% %
2091% %
cristyf82c4a02011-12-15 02:43:44 +00002092% P i x e l S e t P i x e l C o l o r %
cristy3ed852e2009-09-05 21:47:34 +00002093% %
2094% %
2095% %
2096%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2097%
cristyf82c4a02011-12-15 02:43:44 +00002098% PixelSetPixelColor() sets the color of the pixel wand.
cristy3ed852e2009-09-05 21:47:34 +00002099%
cristyf82c4a02011-12-15 02:43:44 +00002100% The format of the PixelSetPixelColor method is:
cristy3ed852e2009-09-05 21:47:34 +00002101%
cristy76fa3142012-04-26 11:30:17 +00002102% void PixelSetPixelColor(PixelWand *wand,const PixelInfo *color)
cristy3ed852e2009-09-05 21:47:34 +00002103%
2104% A description of each parameter follows:
2105%
2106% o wand: the pixel wand.
2107%
2108% o color: the pixel wand color.
2109%
2110*/
cristyf82c4a02011-12-15 02:43:44 +00002111WandExport void PixelSetPixelColor(PixelWand *wand,const PixelInfo *color)
cristy3ed852e2009-09-05 21:47:34 +00002112{
2113 assert(wand != (const PixelWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00002114 assert(wand->signature == MagickWandSignature);
cristy3ed852e2009-09-05 21:47:34 +00002115 if (wand->debug != MagickFalse)
2116 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
cristy4c08aed2011-07-01 19:47:50 +00002117 assert(color != (const PixelInfo *) NULL);
cristy3ed852e2009-09-05 21:47:34 +00002118 wand->pixel=(*color);
2119}
2120
2121/*
2122%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2123% %
2124% %
2125% %
cristy4c08aed2011-07-01 19:47:50 +00002126% P i x e l S e t Q u a n t u m P i x e l %
2127% %
2128% %
2129% %
2130%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2131%
2132% PixelSetQuantumPixel() sets the pixel of the pixel wand.
2133%
2134% The format of the PixelSetQuantumPixel method is:
2135%
cristy6d7e3ba2012-04-26 01:24:40 +00002136% void PixelSetQuantumPixel(const Image *image,const Quantum *pixel,
cristy4c08aed2011-07-01 19:47:50 +00002137% PixelWand *wand)
2138%
2139% A description of each parameter follows:
2140%
2141% o wand: the pixel wand.
2142%
2143% o pixel: the pixel wand pixel.
2144%
2145*/
2146WandExport void PixelSetQuantumPixel(const Image *image,const Quantum *pixel,
2147 PixelWand *wand)
2148{
2149 assert(wand != (const PixelWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00002150 assert(wand->signature == MagickWandSignature);
cristy4c08aed2011-07-01 19:47:50 +00002151 if (wand->debug != MagickFalse)
2152 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2153 assert(pixel != (Quantum *) NULL);
cristya19f1d72012-08-07 18:24:38 +00002154 wand->pixel.red=(double) GetPixelRed(image,pixel);
2155 wand->pixel.green=(double) GetPixelGreen(image,pixel);
2156 wand->pixel.blue=(double) GetPixelBlue(image,pixel);
2157 wand->pixel.black=(double) GetPixelBlack(image,pixel);
2158 wand->pixel.alpha=(double) GetPixelAlpha(image,pixel);
cristyb0a657e2012-08-29 00:45:37 +00002159 wand->pixel.alpha_trait=GetPixelAlpha(image,pixel) != OpaqueAlpha ?
2160 BlendPixelTrait : UndefinedPixelTrait;
cristy3ed852e2009-09-05 21:47:34 +00002161}
2162
2163/*
2164%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2165% %
2166% %
2167% %
2168% P i x e l S e t R e d %
2169% %
2170% %
2171% %
2172%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2173%
2174% PixelSetRed() sets the normalized red color of the pixel wand.
2175%
2176% The format of the PixelSetRed method is:
2177%
2178% void PixelSetRed(PixelWand *wand,const double red)
2179%
2180% A description of each parameter follows:
2181%
2182% o wand: the pixel wand.
2183%
2184% o red: the red color.
2185%
2186*/
2187WandExport void PixelSetRed(PixelWand *wand,const double red)
2188{
2189 assert(wand != (const PixelWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00002190 assert(wand->signature == MagickWandSignature);
cristy3ed852e2009-09-05 21:47:34 +00002191 if (wand->debug != MagickFalse)
2192 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
cristya19f1d72012-08-07 18:24:38 +00002193 wand->pixel.red=(double) ClampToQuantum(QuantumRange*red);
cristy3ed852e2009-09-05 21:47:34 +00002194}
2195
2196/*
2197%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2198% %
2199% %
2200% %
2201% P i x e l S e t R e d Q u a n t u m %
2202% %
2203% %
2204% %
2205%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2206%
2207% PixelSetRedQuantum() sets the red color of the pixel wand.
2208%
2209% The format of the PixelSetRedQuantum method is:
2210%
2211% void PixelSetRedQuantum(PixelWand *wand,const Quantum red)
2212%
2213% A description of each parameter follows:
2214%
2215% o wand: the pixel wand.
2216%
2217% o red: the red color.
2218%
2219*/
2220WandExport void PixelSetRedQuantum(PixelWand *wand,const Quantum red)
2221{
2222 assert(wand != (const PixelWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00002223 assert(wand->signature == MagickWandSignature);
cristy3ed852e2009-09-05 21:47:34 +00002224 if (wand->debug != MagickFalse)
2225 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
cristya19f1d72012-08-07 18:24:38 +00002226 wand->pixel.red=(double) red;
cristy3ed852e2009-09-05 21:47:34 +00002227}
2228
2229/*
2230%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2231% %
2232% %
2233% %
2234% P i x e l S e t Y e l l o w %
2235% %
2236% %
2237% %
2238%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2239%
2240% PixelSetYellow() sets the normalized yellow color of the pixel wand.
2241%
2242% The format of the PixelSetYellow method is:
2243%
2244% void PixelSetYellow(PixelWand *wand,const double yellow)
2245%
2246% A description of each parameter follows:
2247%
2248% o wand: the pixel wand.
2249%
2250% o yellow: the yellow color.
2251%
2252*/
2253WandExport void PixelSetYellow(PixelWand *wand,const double yellow)
2254{
2255 assert(wand != (const PixelWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00002256 assert(wand->signature == MagickWandSignature);
cristy3ed852e2009-09-05 21:47:34 +00002257 if (wand->debug != MagickFalse)
2258 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
cristya19f1d72012-08-07 18:24:38 +00002259 wand->pixel.blue=(double) ClampToQuantum(QuantumRange*yellow);
cristy3ed852e2009-09-05 21:47:34 +00002260}
2261
2262/*
2263%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2264% %
2265% %
2266% %
2267% P i x e l S e t Y e l l o w Q u a n t u m %
2268% %
2269% %
2270% %
2271%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2272%
2273% PixelSetYellowQuantum() sets the yellow color of the pixel wand.
2274%
2275% The format of the PixelSetYellowQuantum method is:
2276%
2277% void PixelSetYellowQuantum(PixelWand *wand,const Quantum yellow)
2278%
2279% A description of each parameter follows:
2280%
2281% o wand: the pixel wand.
2282%
2283% o yellow: the yellow color.
2284%
2285*/
2286WandExport void PixelSetYellowQuantum(PixelWand *wand,const Quantum yellow)
2287{
2288 assert(wand != (const PixelWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00002289 assert(wand->signature == MagickWandSignature);
cristy3ed852e2009-09-05 21:47:34 +00002290 if (wand->debug != MagickFalse)
2291 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
cristya19f1d72012-08-07 18:24:38 +00002292 wand->pixel.blue=(double) yellow;
cristy3ed852e2009-09-05 21:47:34 +00002293}