2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6 % QQQ U U AAA N N TTTTT U U M M %
7 % Q Q U U A A NN N T U U MM MM %
8 % Q Q U U AAAAA N N N T U U M M M %
9 % Q QQ U U A A N NN T U U M M %
10 % QQQQ UUU A A N N T UUU M M %
12 % MagicCore Methods to Acquire / Destroy Quantum Pixels %
19 % Copyright 1999-2008 ImageMagick Studio LLC, a non-profit organization %
20 % dedicated to making software imaging solutions freely available. %
22 % You may not use this file except in compliance with the License. You may %
23 % obtain a copy of the License at %
25 % http://www.imagemagick.org/script/license.php %
27 % Unless required by applicable law or agreed to in writing, software %
28 % distributed under the License is distributed on an "AS IS" BASIS, %
29 % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %
30 % See the License for the specific language governing permissions and %
31 % limitations under the License. %
33 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
41 #include "MagickCore/studio.h"
42 #include "MagickCore/attribute.h"
43 #include "MagickCore/blob.h"
44 #include "MagickCore/blob-private.h"
45 #include "MagickCore/color-private.h"
46 #include "MagickCore/exception.h"
47 #include "MagickCore/exception-private.h"
48 #include "MagickCore/cache.h"
49 #include "MagickCore/constitute.h"
50 #include "MagickCore/delegate.h"
51 #include "MagickCore/geometry.h"
52 #include "MagickCore/list.h"
53 #include "MagickCore/magick.h"
54 #include "MagickCore/memory_.h"
55 #include "MagickCore/monitor.h"
56 #include "MagickCore/option.h"
57 #include "MagickCore/pixel.h"
58 #include "MagickCore/pixel-accessor.h"
59 #include "MagickCore/property.h"
60 #include "MagickCore/quantum.h"
61 #include "MagickCore/quantum-private.h"
62 #include "MagickCore/resource_.h"
63 #include "MagickCore/semaphore.h"
64 #include "MagickCore/statistic.h"
65 #include "MagickCore/stream.h"
66 #include "MagickCore/string_.h"
67 #include "MagickCore/string-private.h"
68 #include "MagickCore/thread-private.h"
69 #include "MagickCore/utility.h"
74 #define QuantumSignature 0xab
80 DestroyQuantumPixels(QuantumInfo *);
83 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
87 % A c q u i r e Q u a n t u m I n f o %
91 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
93 % AcquireQuantumInfo() allocates the QuantumInfo structure.
95 % The format of the AcquireQuantumInfo method is:
97 % QuantumInfo *AcquireQuantumInfo(const ImageInfo *image_info,Image *image)
99 % A description of each parameter follows:
101 % o image_info: the image info.
103 % o image: the image.
107 static inline size_t MagickMax(const size_t x,
115 MagickExport QuantumInfo *AcquireQuantumInfo(const ImageInfo *image_info,
124 quantum_info=(QuantumInfo *) AcquireMagickMemory(sizeof(*quantum_info));
125 if (quantum_info == (QuantumInfo *) NULL)
126 ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
127 quantum_info->signature=MagickSignature;
128 GetQuantumInfo(image_info,quantum_info);
129 if (image == (const Image *) NULL)
130 return(quantum_info);
131 status=SetQuantumDepth(image,quantum_info,image->depth);
132 if (status == MagickFalse)
133 quantum_info=DestroyQuantumInfo(quantum_info);
134 return(quantum_info);
138 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
142 + A c q u i r e Q u a n t u m P i x e l s %
146 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
148 % AcquireQuantumPixels() allocates the unsigned char structure.
150 % The format of the AcquireQuantumPixels method is:
152 % MagickBooleanType AcquireQuantumPixels(QuantumInfo *quantum_info,
153 % const size_t extent)
155 % A description of each parameter follows:
157 % o quantum_info: the quantum info.
159 % o extent: the quantum info.
162 static MagickBooleanType AcquireQuantumPixels(QuantumInfo *quantum_info,
168 assert(quantum_info != (QuantumInfo *) NULL);
169 assert(quantum_info->signature == MagickSignature);
170 quantum_info->number_threads=GetOpenMPMaximumThreads();
171 quantum_info->pixels=(unsigned char **) AcquireQuantumMemory(
172 quantum_info->number_threads,sizeof(*quantum_info->pixels));
173 if (quantum_info->pixels == (unsigned char **) NULL)
175 quantum_info->extent=extent;
176 (void) ResetMagickMemory(quantum_info->pixels,0,
177 quantum_info->number_threads*sizeof(*quantum_info->pixels));
178 for (i=0; i < (ssize_t) quantum_info->number_threads; i++)
180 quantum_info->pixels[i]=(unsigned char *) AcquireQuantumMemory(extent+1,
181 sizeof(**quantum_info->pixels));
182 if (quantum_info->pixels[i] == (unsigned char *) NULL)
184 (void) ResetMagickMemory(quantum_info->pixels[i],0,(extent+1)*
185 sizeof(**quantum_info->pixels));
186 quantum_info->pixels[i][extent]=QuantumSignature;
192 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
196 % D e s t r o y Q u a n t u m I n f o %
200 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
202 % DestroyQuantumInfo() deallocates memory associated with the QuantumInfo
205 % The format of the DestroyQuantumInfo method is:
207 % QuantumInfo *DestroyQuantumInfo(QuantumInfo *quantum_info)
209 % A description of each parameter follows:
211 % o quantum_info: the quantum info.
214 MagickExport QuantumInfo *DestroyQuantumInfo(QuantumInfo *quantum_info)
216 assert(quantum_info != (QuantumInfo *) NULL);
217 assert(quantum_info->signature == MagickSignature);
218 if (quantum_info->pixels != (unsigned char **) NULL)
219 DestroyQuantumPixels(quantum_info);
220 if (quantum_info->semaphore != (SemaphoreInfo *) NULL)
221 DestroySemaphoreInfo(&quantum_info->semaphore);
222 quantum_info->signature=(~MagickSignature);
223 quantum_info=(QuantumInfo *) RelinquishMagickMemory(quantum_info);
224 return(quantum_info);
228 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
232 + D e s t r o y Q u a n t u m P i x e l s %
236 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
238 % DestroyQuantumPixels() destroys the quantum pixels.
240 % The format of the DestroyQuantumPixels() method is:
242 % void DestroyQuantumPixels(QuantumInfo *quantum_info)
244 % A description of each parameter follows:
246 % o quantum_info: the quantum info.
249 static void DestroyQuantumPixels(QuantumInfo *quantum_info)
257 assert(quantum_info != (QuantumInfo *) NULL);
258 assert(quantum_info->signature == MagickSignature);
259 assert(quantum_info->pixels != (unsigned char **) NULL);
260 extent=(ssize_t) quantum_info->extent;
261 for (i=0; i < (ssize_t) quantum_info->number_threads; i++)
262 if (quantum_info->pixels[i] != (unsigned char *) NULL)
265 Did we overrun our quantum buffer?
267 assert(quantum_info->pixels[i][extent] == QuantumSignature);
268 quantum_info->pixels[i]=(unsigned char *) RelinquishMagickMemory(
269 quantum_info->pixels[i]);
271 quantum_info->pixels=(unsigned char **) RelinquishMagickMemory(
272 quantum_info->pixels);
276 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
280 % G e t Q u a n t u m E x t e n t %
284 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
286 % GetQuantumExtent() returns the quantum pixel buffer extent.
288 % The format of the GetQuantumExtent method is:
290 % size_t GetQuantumExtent(Image *image,const QuantumInfo *quantum_info,
291 % const QuantumType quantum_type)
293 % A description of each parameter follows:
295 % o image: the image.
297 % o quantum_info: the quantum info.
299 % o quantum_type: Declare which pixel components to transfer (red, green,
300 % blue, opacity, RGB, or RGBA).
303 MagickExport size_t GetQuantumExtent(const Image *image,
304 const QuantumInfo *quantum_info,const QuantumType quantum_type)
309 assert(quantum_info != (QuantumInfo *) NULL);
310 assert(quantum_info->signature == MagickSignature);
312 switch (quantum_type)
314 case GrayAlphaQuantum: packet_size=2; break;
315 case IndexAlphaQuantum: packet_size=2; break;
316 case RGBQuantum: packet_size=3; break;
317 case BGRQuantum: packet_size=3; break;
318 case RGBAQuantum: packet_size=4; break;
319 case RGBOQuantum: packet_size=4; break;
320 case BGRAQuantum: packet_size=4; break;
321 case CMYKQuantum: packet_size=4; break;
322 case CMYKAQuantum: packet_size=5; break;
325 if (quantum_info->pack == MagickFalse)
326 return((size_t) (packet_size*image->columns*((quantum_info->depth+7)/8)));
327 return((size_t) ((packet_size*image->columns*quantum_info->depth+7)/8));
331 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
335 % G e t Q u a n t u m F o r m a t %
339 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
341 % GetQuantumFormat() returns the quantum format of the image.
343 % The format of the GetQuantumFormat method is:
345 % QuantumFormatType GetQuantumFormat(const QuantumInfo *quantum_info)
347 % A description of each parameter follows:
349 % o quantum_info: the quantum info.
352 MagickExport QuantumFormatType GetQuantumFormat(const QuantumInfo *quantum_info)
354 assert(quantum_info != (QuantumInfo *) NULL);
355 assert(quantum_info->signature == MagickSignature);
356 return(quantum_info->format);
360 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
364 % G e t Q u a n t u m I n f o %
368 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
370 % GetQuantumInfo() initializes the QuantumInfo structure to default values.
372 % The format of the GetQuantumInfo method is:
374 % GetQuantumInfo(const ImageInfo *image_info,QuantumInfo *quantum_info)
376 % A description of each parameter follows:
378 % o image_info: the image info.
380 % o quantum_info: the quantum info.
383 MagickExport void GetQuantumInfo(const ImageInfo *image_info,
384 QuantumInfo *quantum_info)
389 assert(quantum_info != (QuantumInfo *) NULL);
390 (void) ResetMagickMemory(quantum_info,0,sizeof(*quantum_info));
391 quantum_info->quantum=8;
392 quantum_info->maximum=1.0;
393 quantum_info->scale=QuantumRange;
394 quantum_info->pack=MagickTrue;
395 quantum_info->semaphore=AllocateSemaphoreInfo();
396 quantum_info->signature=MagickSignature;
397 if (image_info == (const ImageInfo *) NULL)
399 option=GetImageOption(image_info,"quantum:format");
400 if (option != (char *) NULL)
401 quantum_info->format=(QuantumFormatType) ParseCommandOption(
402 MagickQuantumFormatOptions,MagickFalse,option);
403 option=GetImageOption(image_info,"quantum:minimum");
404 if (option != (char *) NULL)
405 quantum_info->minimum=StringToDouble(option,(char **) NULL);
406 option=GetImageOption(image_info,"quantum:maximum");
407 if (option != (char *) NULL)
408 quantum_info->maximum=StringToDouble(option,(char **) NULL);
409 if ((quantum_info->minimum == 0.0) && (quantum_info->maximum == 0.0))
410 quantum_info->scale=0.0;
412 if (quantum_info->minimum == quantum_info->maximum)
414 quantum_info->scale=(MagickRealType) QuantumRange/quantum_info->minimum;
415 quantum_info->minimum=0.0;
418 quantum_info->scale=(MagickRealType) QuantumRange/(quantum_info->maximum-
419 quantum_info->minimum);
420 option=GetImageOption(image_info,"quantum:scale");
421 if (option != (char *) NULL)
422 quantum_info->scale=StringToDouble(option,(char **) NULL);
423 option=GetImageOption(image_info,"quantum:polarity");
424 if (option != (char *) NULL)
425 quantum_info->min_is_white=LocaleCompare(option,"min-is-white") == 0 ?
426 MagickTrue : MagickFalse;
430 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
434 % G e t Q u a n t u m P i x e l s %
438 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
440 % GetQuantumPixels() returns the quantum pixels.
442 % The format of the GetQuantumPixels method is:
444 % unsigned char *QuantumPixels GetQuantumPixels(
445 % const QuantumInfo *quantum_info)
447 % A description of each parameter follows:
449 % o image: the image.
452 MagickExport unsigned char *GetQuantumPixels(const QuantumInfo *quantum_info)
455 id = GetOpenMPThreadId();
457 assert(quantum_info != (QuantumInfo *) NULL);
458 assert(quantum_info->signature == MagickSignature);
459 return(quantum_info->pixels[id]);
463 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
467 % G e t Q u a n t u m T y p e %
471 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
473 % GetQuantumType() returns the quantum type of the image.
475 % The format of the GetQuantumType method is:
477 % QuantumType GetQuantumType(Image *image,ExceptionInfo *exception)
479 % A description of each parameter follows:
481 % o image: the image.
484 MagickExport QuantumType GetQuantumType(Image *image,ExceptionInfo *exception)
489 assert(image != (Image *) NULL);
490 assert(image->signature == MagickSignature);
491 if (image->debug != MagickFalse)
492 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
493 quantum_type=RGBQuantum;
494 if (image->matte != MagickFalse)
495 quantum_type=RGBAQuantum;
496 if (image->colorspace == CMYKColorspace)
498 quantum_type=CMYKQuantum;
499 if (image->matte != MagickFalse)
500 quantum_type=CMYKAQuantum;
502 if (IsImageGray(image,exception) != MagickFalse)
504 quantum_type=GrayQuantum;
505 if (image->matte != MagickFalse)
506 quantum_type=GrayAlphaQuantum;
509 if (image->storage_class == PseudoClass)
511 quantum_type=IndexQuantum;
512 if (image->matte != MagickFalse)
513 quantum_type=IndexAlphaQuantum;
515 return(quantum_type);
519 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
523 % S e t Q u a n t u m F o r m a t %
527 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
529 % SetQuantumAlphaType() sets the quantum format.
531 % The format of the SetQuantumAlphaType method is:
533 % void SetQuantumAlphaType(QuantumInfo *quantum_info,
534 % const QuantumAlphaType type)
536 % A description of each parameter follows:
538 % o quantum_info: the quantum info.
540 % o type: the alpha type (e.g. associate).
543 MagickExport void SetQuantumAlphaType(QuantumInfo *quantum_info,
544 const QuantumAlphaType type)
546 assert(quantum_info != (QuantumInfo *) NULL);
547 assert(quantum_info->signature == MagickSignature);
548 quantum_info->alpha_type=type;
552 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
556 % S e t Q u a n t u m D e p t h %
560 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
562 % SetQuantumDepth() sets the quantum depth.
564 % The format of the SetQuantumDepth method is:
566 % MagickBooleanType SetQuantumDepth(const Image *image,
567 % QuantumInfo *quantum_info,const size_t depth)
569 % A description of each parameter follows:
571 % o image: the image.
573 % o quantum_info: the quantum info.
575 % o depth: the quantum depth.
578 MagickExport MagickBooleanType SetQuantumDepth(const Image *image,
579 QuantumInfo *quantum_info,const size_t depth)
585 Allocate the quantum pixel buffer.
587 assert(image != (Image *) NULL);
588 assert(image->signature == MagickSignature);
589 if (image->debug != MagickFalse)
590 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
591 assert(quantum_info != (QuantumInfo *) NULL);
592 assert(quantum_info->signature == MagickSignature);
593 quantum_info->depth=depth;
594 if (quantum_info->format == FloatingPointQuantumFormat)
596 if (quantum_info->depth > 32)
597 quantum_info->depth=64;
599 if (quantum_info->depth > 16)
600 quantum_info->depth=32;
602 quantum_info->depth=16;
604 if (quantum_info->pixels != (unsigned char **) NULL)
605 DestroyQuantumPixels(quantum_info);
606 status=AcquireQuantumPixels(quantum_info,(6+quantum_info->pad)*image->columns*
607 ((quantum_info->depth+7)/8)); /* allow for CMYKA + RLE byte + pad */
612 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
616 % S e t Q u a n t u m F o r m a t %
620 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
622 % SetQuantumFormat() sets the quantum format.
624 % The format of the SetQuantumFormat method is:
626 % MagickBooleanType SetQuantumFormat(const Image *image,
627 % QuantumInfo *quantum_info,const QuantumFormatType format)
629 % A description of each parameter follows:
631 % o image: the image.
633 % o quantum_info: the quantum info.
635 % o format: the quantum format.
638 MagickExport MagickBooleanType SetQuantumFormat(const Image *image,
639 QuantumInfo *quantum_info,const QuantumFormatType format)
641 assert(image != (Image *) NULL);
642 assert(image->signature == MagickSignature);
643 if (image->debug != MagickFalse)
644 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
645 assert(quantum_info != (QuantumInfo *) NULL);
646 assert(quantum_info->signature == MagickSignature);
647 quantum_info->format=format;
648 return(SetQuantumDepth(image,quantum_info,quantum_info->depth));
652 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
656 % S e t Q u a n t u m I m a g e T y p e %
660 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
662 % SetQuantumImageType() sets the image type based on the quantum type.
664 % The format of the SetQuantumImageType method is:
666 % void ImageType SetQuantumImageType(Image *image,
667 % const QuantumType quantum_type)
669 % A description of each parameter follows:
671 % o image: the image.
673 % o quantum_type: Declare which pixel components to transfer (red, green,
674 % blue, opacity, RGB, or RGBA).
677 MagickExport void SetQuantumImageType(Image *image,
678 const QuantumType quantum_type)
680 assert(image != (Image *) NULL);
681 assert(image->signature == MagickSignature);
682 if (image->debug != MagickFalse)
683 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
684 switch (quantum_type)
687 case IndexAlphaQuantum:
689 image->type=PaletteType;
693 case GrayAlphaQuantum:
695 image->type=GrayscaleType;
696 if (image->depth == 1)
697 image->type=BilevelType;
707 image->type=ColorSeparationType;
712 image->type=TrueColorType;
719 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
723 % S e t Q u a n t u m P a c k %
727 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
729 % SetQuantumPack() sets the quantum pack flag.
731 % The format of the SetQuantumPack method is:
733 % void SetQuantumPack(QuantumInfo *quantum_info,
734 % const MagickBooleanType pack)
736 % A description of each parameter follows:
738 % o quantum_info: the quantum info.
740 % o pack: the pack flag.
743 MagickExport void SetQuantumPack(QuantumInfo *quantum_info,
744 const MagickBooleanType pack)
746 assert(quantum_info != (QuantumInfo *) NULL);
747 assert(quantum_info->signature == MagickSignature);
748 quantum_info->pack=pack;
753 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
757 % S e t Q u a n t u m P a d %
761 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
763 % SetQuantumPad() sets the quantum pad.
765 % The format of the SetQuantumPad method is:
767 % MagickBooleanType SetQuantumPad(const Image *image,
768 % QuantumInfo *quantum_info,const size_t pad)
770 % A description of each parameter follows:
772 % o image: the image.
774 % o quantum_info: the quantum info.
776 % o pad: the quantum pad.
779 MagickExport MagickBooleanType SetQuantumPad(const Image *image,
780 QuantumInfo *quantum_info,const size_t pad)
782 assert(image != (Image *) NULL);
783 assert(image->signature == MagickSignature);
784 if (image->debug != MagickFalse)
785 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
786 assert(quantum_info != (QuantumInfo *) NULL);
787 assert(quantum_info->signature == MagickSignature);
788 quantum_info->pad=pad;
789 return(SetQuantumDepth(image,quantum_info,quantum_info->depth));
793 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
797 % S e t Q u a n t u m M i n I s W h i t e %
801 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
803 % SetQuantumMinIsWhite() sets the quantum min-is-white flag.
805 % The format of the SetQuantumMinIsWhite method is:
807 % void SetQuantumMinIsWhite(QuantumInfo *quantum_info,
808 % const MagickBooleanType min_is_white)
810 % A description of each parameter follows:
812 % o quantum_info: the quantum info.
814 % o min_is_white: the min-is-white flag.
817 MagickExport void SetQuantumMinIsWhite(QuantumInfo *quantum_info,
818 const MagickBooleanType min_is_white)
820 assert(quantum_info != (QuantumInfo *) NULL);
821 assert(quantum_info->signature == MagickSignature);
822 quantum_info->min_is_white=min_is_white;
826 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
830 % S e t Q u a n t u m Q u a n t u m %
834 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
836 % SetQuantumQuantum() sets the quantum quantum.
838 % The format of the SetQuantumQuantum method is:
840 % void SetQuantumQuantum(QuantumInfo *quantum_info,
841 % const size_t quantum)
843 % A description of each parameter follows:
845 % o quantum_info: the quantum info.
847 % o quantum: the quantum quantum.
850 MagickExport void SetQuantumQuantum(QuantumInfo *quantum_info,
851 const size_t quantum)
853 assert(quantum_info != (QuantumInfo *) NULL);
854 assert(quantum_info->signature == MagickSignature);
855 quantum_info->quantum=quantum;
859 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
863 % S e t Q u a n t u m S c a l e %
867 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
869 % SetQuantumScale() sets the quantum scale.
871 % The format of the SetQuantumScale method is:
873 % void SetQuantumScale(QuantumInfo *quantum_info,const double scale)
875 % A description of each parameter follows:
877 % o quantum_info: the quantum info.
879 % o scale: the quantum scale.
882 MagickExport void SetQuantumScale(QuantumInfo *quantum_info,const double scale)
884 assert(quantum_info != (QuantumInfo *) NULL);
885 assert(quantum_info->signature == MagickSignature);
886 quantum_info->scale=scale;