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