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 % EEEEE X X PPPP OOO RRRR TTTTT %
13 % E X X P P O O R R T %
14 % EEE X PPPP O O RRRR T %
16 % EEEEE X X P OOO R R T %
18 % MagickCore Methods to Export Quantum Pixels %
25 % Copyright 1999-2015 ImageMagick Studio LLC, a non-profit organization %
26 % dedicated to making software imaging solutions freely available. %
28 % You may not use this file except in compliance with the License. You may %
29 % obtain a copy of the License at %
31 % http://www.imagemagick.org/script/license.php %
33 % Unless required by applicable law or agreed to in writing, software %
34 % distributed under the License is distributed on an "AS IS" BASIS, %
35 % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %
36 % See the License for the specific language governing permissions and %
37 % limitations under the License. %
39 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
47 #include "MagickCore/studio.h"
48 #include "MagickCore/property.h"
49 #include "MagickCore/blob.h"
50 #include "MagickCore/blob-private.h"
51 #include "MagickCore/color-private.h"
52 #include "MagickCore/exception.h"
53 #include "MagickCore/exception-private.h"
54 #include "MagickCore/cache.h"
55 #include "MagickCore/constitute.h"
56 #include "MagickCore/delegate.h"
57 #include "MagickCore/geometry.h"
58 #include "MagickCore/list.h"
59 #include "MagickCore/magick.h"
60 #include "MagickCore/memory_.h"
61 #include "MagickCore/monitor.h"
62 #include "MagickCore/option.h"
63 #include "MagickCore/pixel.h"
64 #include "MagickCore/pixel-accessor.h"
65 #include "MagickCore/quantum.h"
66 #include "MagickCore/quantum-private.h"
67 #include "MagickCore/resource_.h"
68 #include "MagickCore/semaphore.h"
69 #include "MagickCore/statistic.h"
70 #include "MagickCore/stream.h"
71 #include "MagickCore/string_.h"
72 #include "MagickCore/utility.h"
75 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
79 + E x p o r t Q u a n t u m P i x e l s %
83 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
85 % ExportQuantumPixels() transfers one or more pixel components from the image
86 % pixel cache to a user supplied buffer. The pixels are returned in network
87 % byte order. MagickTrue is returned if the pixels are successfully
88 % transferred, otherwise MagickFalse.
90 % The format of the ExportQuantumPixels method is:
92 % size_t ExportQuantumPixels(const Image *image,CacheView *image_view,
93 % QuantumInfo *quantum_info,const QuantumType quantum_type,
94 % unsigned char *magick_restrict pixels,ExceptionInfo *exception)
96 % A description of each parameter follows:
100 % o image_view: the image cache view.
102 % o quantum_info: the quantum info.
104 % o quantum_type: Declare which pixel components to transfer (RGB, RGBA,
107 % o pixels: The components are transferred to this buffer.
109 % o exception: return any errors or warnings in this structure.
113 static inline unsigned char *PopDoublePixel(QuantumInfo *quantum_info,
114 const double pixel,unsigned char *magick_restrict pixels)
122 (void) ResetMagickMemory(quantum,0,sizeof(quantum));
123 p=(double *) quantum;
124 *p=(double) (pixel*quantum_info->state.inverse_scale+quantum_info->minimum);
125 if (quantum_info->endian == LSBEndian)
127 *pixels++=quantum[0];
128 *pixels++=quantum[1];
129 *pixels++=quantum[2];
130 *pixels++=quantum[3];
131 *pixels++=quantum[4];
132 *pixels++=quantum[5];
133 *pixels++=quantum[6];
134 *pixels++=quantum[7];
137 *pixels++=quantum[7];
138 *pixels++=quantum[6];
139 *pixels++=quantum[5];
140 *pixels++=quantum[4];
141 *pixels++=quantum[3];
142 *pixels++=quantum[2];
143 *pixels++=quantum[1];
144 *pixels++=quantum[0];
148 static inline unsigned char *PopFloatPixel(QuantumInfo *quantum_info,
149 const float pixel,unsigned char *magick_restrict pixels)
157 (void) ResetMagickMemory(quantum,0,sizeof(quantum));
159 *p=(float) ((double) pixel*quantum_info->state.inverse_scale+
160 quantum_info->minimum);
161 if (quantum_info->endian == LSBEndian)
163 *pixels++=quantum[0];
164 *pixels++=quantum[1];
165 *pixels++=quantum[2];
166 *pixels++=quantum[3];
169 *pixels++=quantum[3];
170 *pixels++=quantum[2];
171 *pixels++=quantum[1];
172 *pixels++=quantum[0];
176 static inline unsigned char *PopQuantumPixel(QuantumInfo *quantum_info,
177 const QuantumAny pixel,unsigned char *magick_restrict pixels)
185 if (quantum_info->state.bits == 0UL)
186 quantum_info->state.bits=8U;
187 for (i=(ssize_t) quantum_info->depth; i > 0L; )
189 quantum_bits=(size_t) i;
190 if (quantum_bits > quantum_info->state.bits)
191 quantum_bits=quantum_info->state.bits;
192 i-=(ssize_t) quantum_bits;
195 if (quantum_info->state.bits == 8UL)
197 quantum_info->state.bits-=quantum_bits;
198 *pixels|=(((pixel >> i) &~ ((~0UL) << quantum_bits)) <<
199 quantum_info->state.bits);
200 if (quantum_info->state.bits == 0UL)
203 quantum_info->state.bits=8UL;
209 static inline unsigned char *PopQuantumLongPixel(QuantumInfo *quantum_info,
210 const size_t pixel,unsigned char *magick_restrict pixels)
218 if (quantum_info->state.bits == 0U)
219 quantum_info->state.bits=32UL;
220 for (i=(ssize_t) quantum_info->depth; i > 0; )
222 quantum_bits=(size_t) i;
223 if (quantum_bits > quantum_info->state.bits)
224 quantum_bits=quantum_info->state.bits;
225 quantum_info->state.pixel|=(((pixel >> (quantum_info->depth-i)) &
226 quantum_info->state.mask[quantum_bits]) << (32U-
227 quantum_info->state.bits));
228 i-=(ssize_t) quantum_bits;
229 quantum_info->state.bits-=quantum_bits;
230 if (quantum_info->state.bits == 0U)
232 pixels=PopLongPixel(quantum_info->endian,quantum_info->state.pixel,
234 quantum_info->state.pixel=0U;
235 quantum_info->state.bits=32U;
241 static void ExportAlphaQuantum(const Image *image,QuantumInfo *quantum_info,
242 const MagickSizeType number_pixels,const Quantum *magick_restrict p,
243 unsigned char *magick_restrict q,ExceptionInfo *exception)
251 assert(exception != (ExceptionInfo *) NULL);
252 assert(exception->signature == MagickCoreSignature);
253 switch (quantum_info->depth)
257 register unsigned char
260 for (x=0; x < (ssize_t) number_pixels; x++)
262 pixel=ScaleQuantumToChar(GetPixelAlpha(image,p));
263 q=PopCharPixel(pixel,q);
264 p+=GetPixelChannels(image);
265 q+=quantum_info->pad;
271 register unsigned short
274 if (quantum_info->format == FloatingPointQuantumFormat)
276 for (x=0; x < (ssize_t) number_pixels; x++)
278 pixel=SinglePrecisionToHalf(QuantumScale*GetPixelAlpha(image,p));
279 q=PopShortPixel(quantum_info->endian,pixel,q);
280 p+=GetPixelChannels(image);
281 q+=quantum_info->pad;
285 for (x=0; x < (ssize_t) number_pixels; x++)
287 pixel=ScaleQuantumToShort(GetPixelAlpha(image,p));
288 q=PopShortPixel(quantum_info->endian,pixel,q);
289 p+=GetPixelChannels(image);
290 q+=quantum_info->pad;
296 register unsigned int
299 if (quantum_info->format == FloatingPointQuantumFormat)
301 for (x=0; x < (ssize_t) number_pixels; x++)
303 q=PopFloatPixel(quantum_info,(float) GetPixelAlpha(image,p),q);
304 p+=GetPixelChannels(image);
305 q+=quantum_info->pad;
309 for (x=0; x < (ssize_t) number_pixels; x++)
311 pixel=ScaleQuantumToLong(GetPixelAlpha(image,p));
312 q=PopLongPixel(quantum_info->endian,pixel,q);
313 p+=GetPixelChannels(image);
314 q+=quantum_info->pad;
320 if (quantum_info->format == FloatingPointQuantumFormat)
322 for (x=0; x < (ssize_t) number_pixels; x++)
324 q=PopDoublePixel(quantum_info,(double) GetPixelAlpha(image,p),q);
325 p+=GetPixelChannels(image);
326 q+=quantum_info->pad;
333 range=GetQuantumRange(quantum_info->depth);
334 for (x=0; x < (ssize_t) number_pixels; x++)
336 q=PopQuantumPixel(quantum_info,ScaleQuantumToAny(GetPixelAlpha(image,p),
338 p+=GetPixelChannels(image);
339 q+=quantum_info->pad;
346 static void ExportBGRQuantum(const Image *image,QuantumInfo *quantum_info,
347 const MagickSizeType number_pixels,const Quantum *magick_restrict p,
348 unsigned char *magick_restrict q,ExceptionInfo *exception)
359 assert(exception != (ExceptionInfo *) NULL);
360 assert(exception->signature == MagickCoreSignature);
361 switch (quantum_info->depth)
365 for (x=0; x < (ssize_t) number_pixels; x++)
367 q=PopCharPixel(ScaleQuantumToChar(GetPixelBlue(image,p)),q);
368 q=PopCharPixel(ScaleQuantumToChar(GetPixelGreen(image,p)),q);
369 q=PopCharPixel(ScaleQuantumToChar(GetPixelRed(image,p)),q);
370 p+=GetPixelChannels(image);
371 q+=quantum_info->pad;
377 register unsigned int
380 range=GetQuantumRange(quantum_info->depth);
381 if (quantum_info->pack == MagickFalse)
383 for (x=0; x < (ssize_t) number_pixels; x++)
385 pixel=(unsigned int) (
386 ScaleQuantumToAny(GetPixelRed(image,p),range) << 22 |
387 ScaleQuantumToAny(GetPixelGreen(image,p),range) << 12 |
388 ScaleQuantumToAny(GetPixelBlue(image,p),range) << 2);
389 q=PopLongPixel(quantum_info->endian,pixel,q);
390 p+=GetPixelChannels(image);
391 q+=quantum_info->pad;
395 if (quantum_info->quantum == 32UL)
397 for (x=0; x < (ssize_t) number_pixels; x++)
399 pixel=(unsigned int) ScaleQuantumToAny(GetPixelRed(image,p),range);
400 q=PopQuantumLongPixel(quantum_info,pixel,q);
401 pixel=(unsigned int) ScaleQuantumToAny(GetPixelGreen(image,p),
403 q=PopQuantumLongPixel(quantum_info,pixel,q);
404 pixel=(unsigned int) ScaleQuantumToAny(GetPixelBlue(image,p),range);
405 q=PopQuantumLongPixel(quantum_info,pixel,q);
406 p+=GetPixelChannels(image);
407 q+=quantum_info->pad;
411 for (x=0; x < (ssize_t) number_pixels; x++)
413 pixel=(unsigned int) ScaleQuantumToAny(GetPixelRed(image,p),range);
414 q=PopQuantumPixel(quantum_info,pixel,q);
415 pixel=(unsigned int) ScaleQuantumToAny(GetPixelGreen(image,p),range);
416 q=PopQuantumPixel(quantum_info,pixel,q);
417 pixel=(unsigned int) ScaleQuantumToAny(GetPixelBlue(image,p),range);
418 q=PopQuantumPixel(quantum_info,pixel,q);
419 p+=GetPixelChannels(image);
420 q+=quantum_info->pad;
426 register unsigned int
429 range=GetQuantumRange(quantum_info->depth);
430 if (quantum_info->pack == MagickFalse)
432 for (x=0; x < (ssize_t) (3*number_pixels-1); x+=2)
439 pixel=(unsigned int) ScaleQuantumToAny(GetPixelRed(image,p),
445 pixel=(unsigned int) ScaleQuantumToAny(GetPixelGreen(image,p),
451 pixel=(unsigned int) ScaleQuantumToAny(GetPixelBlue(image,p),
453 p+=GetPixelChannels(image);
457 q=PopShortPixel(quantum_info->endian,(unsigned short) (pixel << 4),
464 pixel=(unsigned int) ScaleQuantumToAny(GetPixelRed(image,p),
470 pixel=(unsigned int) ScaleQuantumToAny(GetPixelGreen(image,p),
476 pixel=(unsigned int) ScaleQuantumToAny(GetPixelBlue(image,p),
478 p+=GetPixelChannels(image);
482 q=PopShortPixel(quantum_info->endian,(unsigned short) (pixel << 4),
484 q+=quantum_info->pad;
486 for (bit=0; bit < (ssize_t) (3*number_pixels % 2); bit++)
493 pixel=(unsigned int) ScaleQuantumToAny(GetPixelRed(image,p),
499 pixel=(unsigned int) ScaleQuantumToAny(GetPixelGreen(image,p),
505 pixel=(unsigned int) ScaleQuantumToAny(GetPixelBlue(image,p),
507 p+=GetPixelChannels(image);
511 q=PopShortPixel(quantum_info->endian,(unsigned short) (pixel << 4),
513 q+=quantum_info->pad;
516 p+=GetPixelChannels(image);
519 if (quantum_info->quantum == 32UL)
521 for (x=0; x < (ssize_t) number_pixels; x++)
523 pixel=(unsigned int) ScaleQuantumToAny(GetPixelRed(image,p),range);
524 q=PopQuantumLongPixel(quantum_info,pixel,q);
525 pixel=(unsigned int) ScaleQuantumToAny(GetPixelGreen(image,p),
527 q=PopQuantumLongPixel(quantum_info,pixel,q);
528 pixel=(unsigned int) ScaleQuantumToAny(GetPixelBlue(image,p),range);
529 q=PopQuantumLongPixel(quantum_info,pixel,q);
530 p+=GetPixelChannels(image);
531 q+=quantum_info->pad;
535 for (x=0; x < (ssize_t) number_pixels; x++)
537 pixel=(unsigned int) ScaleQuantumToAny(GetPixelRed(image,p),range);
538 q=PopQuantumPixel(quantum_info,pixel,q);
539 pixel=(unsigned int) ScaleQuantumToAny(GetPixelGreen(image,p),range);
540 q=PopQuantumPixel(quantum_info,pixel,q);
541 pixel=(unsigned int) ScaleQuantumToAny(GetPixelBlue(image,p),range);
542 q=PopQuantumPixel(quantum_info,pixel,q);
543 p+=GetPixelChannels(image);
544 q+=quantum_info->pad;
550 register unsigned short
553 if (quantum_info->format == FloatingPointQuantumFormat)
555 for (x=0; x < (ssize_t) number_pixels; x++)
557 pixel=SinglePrecisionToHalf(QuantumScale*GetPixelBlue(image,p));
558 q=PopShortPixel(quantum_info->endian,pixel,q);
559 pixel=SinglePrecisionToHalf(QuantumScale*GetPixelGreen(image,p));
560 q=PopShortPixel(quantum_info->endian,pixel,q);
561 pixel=SinglePrecisionToHalf(QuantumScale*GetPixelRed(image,p));
562 q=PopShortPixel(quantum_info->endian,pixel,q);
563 p+=GetPixelChannels(image);
564 q+=quantum_info->pad;
568 for (x=0; x < (ssize_t) number_pixels; x++)
570 pixel=ScaleQuantumToShort(GetPixelBlue(image,p));
571 q=PopShortPixel(quantum_info->endian,pixel,q);
572 pixel=ScaleQuantumToShort(GetPixelGreen(image,p));
573 q=PopShortPixel(quantum_info->endian,pixel,q);
574 pixel=ScaleQuantumToShort(GetPixelRed(image,p));
575 q=PopShortPixel(quantum_info->endian,pixel,q);
576 p+=GetPixelChannels(image);
577 q+=quantum_info->pad;
583 register unsigned int
586 if (quantum_info->format == FloatingPointQuantumFormat)
588 for (x=0; x < (ssize_t) number_pixels; x++)
590 q=PopFloatPixel(quantum_info,(float) GetPixelRed(image,p),q);
591 q=PopFloatPixel(quantum_info,(float) GetPixelGreen(image,p),q);
592 q=PopFloatPixel(quantum_info,(float) GetPixelBlue(image,p),q);
593 p+=GetPixelChannels(image);
594 q+=quantum_info->pad;
598 for (x=0; x < (ssize_t) number_pixels; x++)
600 pixel=ScaleQuantumToLong(GetPixelBlue(image,p));
601 q=PopLongPixel(quantum_info->endian,pixel,q);
602 pixel=ScaleQuantumToLong(GetPixelGreen(image,p));
603 q=PopLongPixel(quantum_info->endian,pixel,q);
604 pixel=ScaleQuantumToLong(GetPixelRed(image,p));
605 q=PopLongPixel(quantum_info->endian,pixel,q);
606 p+=GetPixelChannels(image);
607 q+=quantum_info->pad;
613 if (quantum_info->format == FloatingPointQuantumFormat)
615 for (x=0; x < (ssize_t) number_pixels; x++)
617 q=PopDoublePixel(quantum_info,(double) GetPixelRed(image,p),q);
618 q=PopDoublePixel(quantum_info,(double) GetPixelGreen(image,p),q);
619 q=PopDoublePixel(quantum_info,(double) GetPixelBlue(image,p),q);
620 p+=GetPixelChannels(image);
621 q+=quantum_info->pad;
628 range=GetQuantumRange(quantum_info->depth);
629 for (x=0; x < (ssize_t) number_pixels; x++)
631 q=PopQuantumPixel(quantum_info,ScaleQuantumToAny(GetPixelRed(image,p),
633 q=PopQuantumPixel(quantum_info,ScaleQuantumToAny(GetPixelGreen(image,p),
635 q=PopQuantumPixel(quantum_info,ScaleQuantumToAny(GetPixelBlue(image,p),
637 p+=GetPixelChannels(image);
638 q+=quantum_info->pad;
645 static void ExportBGRAQuantum(const Image *image,QuantumInfo *quantum_info,
646 const MagickSizeType number_pixels,const Quantum *magick_restrict p,
647 unsigned char *magick_restrict q,ExceptionInfo *exception)
655 assert(exception != (ExceptionInfo *) NULL);
656 assert(exception->signature == MagickCoreSignature);
657 switch (quantum_info->depth)
661 register unsigned char
664 for (x=0; x < (ssize_t) number_pixels; x++)
666 pixel=ScaleQuantumToChar(GetPixelBlue(image,p));
667 q=PopCharPixel(pixel,q);
668 pixel=ScaleQuantumToChar(GetPixelGreen(image,p));
669 q=PopCharPixel(pixel,q);
670 pixel=ScaleQuantumToChar(GetPixelRed(image,p));
671 q=PopCharPixel(pixel,q);
672 pixel=ScaleQuantumToChar(GetPixelAlpha(image,p));
673 q=PopCharPixel(pixel,q);
674 p+=GetPixelChannels(image);
675 q+=quantum_info->pad;
681 register unsigned int
684 range=GetQuantumRange(quantum_info->depth);
685 if (quantum_info->pack == MagickFalse)
699 for (x=0; x < (ssize_t) number_pixels; x++)
701 for (i=0; i < 4; i++)
705 case 0: quantum=GetPixelRed(image,p); break;
706 case 1: quantum=GetPixelGreen(image,p); break;
707 case 2: quantum=GetPixelBlue(image,p); break;
708 case 3: quantum=GetPixelAlpha(image,p); break;
714 pixel|=(size_t) (ScaleQuantumToAny((Quantum) quantum,
720 pixel|=(size_t) (ScaleQuantumToAny((Quantum) quantum,
726 pixel|=(size_t) (ScaleQuantumToAny((Quantum) quantum,
728 q=PopLongPixel(quantum_info->endian,pixel,q);
735 p+=GetPixelChannels(image);
736 q+=quantum_info->pad;
740 if (quantum_info->quantum == 32UL)
742 for (x=0; x < (ssize_t) number_pixels; x++)
744 pixel=(unsigned int) ScaleQuantumToAny(GetPixelRed(image,p),range);
745 q=PopQuantumLongPixel(quantum_info,pixel,q);
746 pixel=(unsigned int) ScaleQuantumToAny(GetPixelGreen(image,p),
748 q=PopQuantumLongPixel(quantum_info,pixel,q);
749 pixel=(unsigned int) ScaleQuantumToAny(GetPixelBlue(image,p),range);
750 q=PopQuantumLongPixel(quantum_info,pixel,q);
751 pixel=(unsigned int) ScaleQuantumToAny(GetPixelAlpha(image,p),
753 q=PopQuantumLongPixel(quantum_info,pixel,q);
754 p+=GetPixelChannels(image);
755 q+=quantum_info->pad;
759 for (x=0; x < (ssize_t) number_pixels; x++)
761 pixel=(unsigned int) ScaleQuantumToAny(GetPixelRed(image,p),range);
762 q=PopQuantumPixel(quantum_info,pixel,q);
763 pixel=(unsigned int) ScaleQuantumToAny(GetPixelGreen(image,p),range);
764 q=PopQuantumPixel(quantum_info,pixel,q);
765 pixel=(unsigned int) ScaleQuantumToAny(GetPixelBlue(image,p),range);
766 q=PopQuantumPixel(quantum_info,pixel,q);
767 pixel=(unsigned int) ScaleQuantumToAny(GetPixelAlpha(image,p),range);
768 q=PopQuantumPixel(quantum_info,pixel,q);
769 p+=GetPixelChannels(image);
770 q+=quantum_info->pad;
776 register unsigned short
779 if (quantum_info->format == FloatingPointQuantumFormat)
781 for (x=0; x < (ssize_t) number_pixels; x++)
783 pixel=SinglePrecisionToHalf(QuantumScale*GetPixelBlue(image,p));
784 q=PopShortPixel(quantum_info->endian,pixel,q);
785 pixel=SinglePrecisionToHalf(QuantumScale*GetPixelGreen(image,p));
786 q=PopShortPixel(quantum_info->endian,pixel,q);
787 pixel=SinglePrecisionToHalf(QuantumScale*GetPixelRed(image,p));
788 q=PopShortPixel(quantum_info->endian,pixel,q);
789 pixel=SinglePrecisionToHalf(QuantumScale*GetPixelAlpha(image,p));
790 q=PopShortPixel(quantum_info->endian,pixel,q);
791 p+=GetPixelChannels(image);
792 q+=quantum_info->pad;
796 for (x=0; x < (ssize_t) number_pixels; x++)
798 pixel=ScaleQuantumToShort(GetPixelBlue(image,p));
799 q=PopShortPixel(quantum_info->endian,pixel,q);
800 pixel=ScaleQuantumToShort(GetPixelGreen(image,p));
801 q=PopShortPixel(quantum_info->endian,pixel,q);
802 pixel=ScaleQuantumToShort(GetPixelRed(image,p));
803 q=PopShortPixel(quantum_info->endian,pixel,q);
804 pixel=ScaleQuantumToShort(GetPixelAlpha(image,p));
805 q=PopShortPixel(quantum_info->endian,pixel,q);
806 p+=GetPixelChannels(image);
807 q+=quantum_info->pad;
813 register unsigned int
816 if (quantum_info->format == FloatingPointQuantumFormat)
818 for (x=0; x < (ssize_t) number_pixels; x++)
823 q=PopFloatPixel(quantum_info,(float) GetPixelRed(image,p),q);
824 q=PopFloatPixel(quantum_info,(float) GetPixelGreen(image,p),q);
825 q=PopFloatPixel(quantum_info,(float) GetPixelBlue(image,p),q);
826 pixel=(float) GetPixelAlpha(image,p);
827 q=PopFloatPixel(quantum_info,pixel,q);
828 p+=GetPixelChannels(image);
829 q+=quantum_info->pad;
833 for (x=0; x < (ssize_t) number_pixels; x++)
835 pixel=ScaleQuantumToLong(GetPixelBlue(image,p));
836 q=PopLongPixel(quantum_info->endian,pixel,q);
837 pixel=ScaleQuantumToLong(GetPixelGreen(image,p));
838 q=PopLongPixel(quantum_info->endian,pixel,q);
839 pixel=ScaleQuantumToLong(GetPixelRed(image,p));
840 q=PopLongPixel(quantum_info->endian,pixel,q);
841 pixel=ScaleQuantumToLong(GetPixelAlpha(image,p));
842 q=PopLongPixel(quantum_info->endian,pixel,q);
843 p+=GetPixelChannels(image);
844 q+=quantum_info->pad;
850 if (quantum_info->format == FloatingPointQuantumFormat)
855 for (x=0; x < (ssize_t) number_pixels; x++)
857 q=PopDoublePixel(quantum_info,(double) GetPixelRed(image,p),q);
858 q=PopDoublePixel(quantum_info,(double) GetPixelGreen(image,p),q);
859 q=PopDoublePixel(quantum_info,(double) GetPixelBlue(image,p),q);
860 pixel=(double) GetPixelAlpha(image,p);
861 q=PopDoublePixel(quantum_info,pixel,q);
862 p+=GetPixelChannels(image);
863 q+=quantum_info->pad;
870 range=GetQuantumRange(quantum_info->depth);
871 for (x=0; x < (ssize_t) number_pixels; x++)
873 q=PopQuantumPixel(quantum_info,ScaleQuantumToAny(GetPixelBlue(image,p),
875 q=PopQuantumPixel(quantum_info,ScaleQuantumToAny(GetPixelGreen(image,p),
877 q=PopQuantumPixel(quantum_info,ScaleQuantumToAny(GetPixelRed(image,p),
879 q=PopQuantumPixel(quantum_info,ScaleQuantumToAny(GetPixelAlpha(image,p),
881 p+=GetPixelChannels(image);
882 q+=quantum_info->pad;
889 static void ExportBGROQuantum(const Image *image,QuantumInfo *quantum_info,
890 const MagickSizeType number_pixels,const Quantum *magick_restrict p,
891 unsigned char *magick_restrict q,ExceptionInfo *exception)
899 assert(exception != (ExceptionInfo *) NULL);
900 assert(exception->signature == MagickCoreSignature);
901 switch (quantum_info->depth)
905 register unsigned char
908 for (x=0; x < (ssize_t) number_pixels; x++)
910 pixel=ScaleQuantumToChar(GetPixelBlue(image,p));
911 q=PopCharPixel(pixel,q);
912 pixel=ScaleQuantumToChar(GetPixelGreen(image,p));
913 q=PopCharPixel(pixel,q);
914 pixel=ScaleQuantumToChar(GetPixelRed(image,p));
915 q=PopCharPixel(pixel,q);
916 pixel=ScaleQuantumToChar(GetPixelOpacity(image,p));
917 q=PopCharPixel(pixel,q);
918 p+=GetPixelChannels(image);
919 q+=quantum_info->pad;
925 register unsigned int
928 range=GetQuantumRange(quantum_info->depth);
929 if (quantum_info->pack == MagickFalse)
943 for (x=0; x < (ssize_t) number_pixels; x++)
945 for (i=0; i < 4; i++)
949 case 0: quantum=GetPixelRed(image,p); break;
950 case 1: quantum=GetPixelGreen(image,p); break;
951 case 2: quantum=GetPixelBlue(image,p); break;
952 case 3: quantum=GetPixelOpacity(image,p); break;
958 pixel|=(size_t) (ScaleQuantumToAny((Quantum) quantum,
964 pixel|=(size_t) (ScaleQuantumToAny((Quantum) quantum,
970 pixel|=(size_t) (ScaleQuantumToAny((Quantum) quantum,
972 q=PopLongPixel(quantum_info->endian,pixel,q);
979 p+=GetPixelChannels(image);
980 q+=quantum_info->pad;
984 if (quantum_info->quantum == 32UL)
986 for (x=0; x < (ssize_t) number_pixels; x++)
988 pixel=(unsigned int) ScaleQuantumToAny(GetPixelRed(image,p),range);
989 q=PopQuantumLongPixel(quantum_info,pixel,q);
990 pixel=(unsigned int) ScaleQuantumToAny(GetPixelGreen(image,p),
992 q=PopQuantumLongPixel(quantum_info,pixel,q);
993 pixel=(unsigned int) ScaleQuantumToAny(GetPixelBlue(image,p),range);
994 q=PopQuantumLongPixel(quantum_info,pixel,q);
995 pixel=(unsigned int) ScaleQuantumToAny(GetPixelOpacity(image,p),
997 q=PopQuantumLongPixel(quantum_info,pixel,q);
998 p+=GetPixelChannels(image);
999 q+=quantum_info->pad;
1003 for (x=0; x < (ssize_t) number_pixels; x++)
1005 pixel=(unsigned int) ScaleQuantumToAny(GetPixelRed(image,p),range);
1006 q=PopQuantumPixel(quantum_info,pixel,q);
1007 pixel=(unsigned int) ScaleQuantumToAny(GetPixelGreen(image,p),range);
1008 q=PopQuantumPixel(quantum_info,pixel,q);
1009 pixel=(unsigned int) ScaleQuantumToAny(GetPixelBlue(image,p),range);
1010 q=PopQuantumPixel(quantum_info,pixel,q);
1011 pixel=(unsigned int) ScaleQuantumToAny(GetPixelOpacity(image,p),range);
1012 q=PopQuantumPixel(quantum_info,pixel,q);
1013 p+=GetPixelChannels(image);
1014 q+=quantum_info->pad;
1020 register unsigned short
1023 if (quantum_info->format == FloatingPointQuantumFormat)
1025 for (x=0; x < (ssize_t) number_pixels; x++)
1027 pixel=SinglePrecisionToHalf(QuantumScale*GetPixelBlue(image,p));
1028 q=PopShortPixel(quantum_info->endian,pixel,q);
1029 pixel=SinglePrecisionToHalf(QuantumScale*GetPixelGreen(image,p));
1030 q=PopShortPixel(quantum_info->endian,pixel,q);
1031 pixel=SinglePrecisionToHalf(QuantumScale*GetPixelRed(image,p));
1032 q=PopShortPixel(quantum_info->endian,pixel,q);
1033 pixel=SinglePrecisionToHalf(QuantumScale*GetPixelOpacity(image,p));
1034 q=PopShortPixel(quantum_info->endian,pixel,q);
1035 p+=GetPixelChannels(image);
1036 q+=quantum_info->pad;
1040 for (x=0; x < (ssize_t) number_pixels; x++)
1042 pixel=ScaleQuantumToShort(GetPixelBlue(image,p));
1043 q=PopShortPixel(quantum_info->endian,pixel,q);
1044 pixel=ScaleQuantumToShort(GetPixelGreen(image,p));
1045 q=PopShortPixel(quantum_info->endian,pixel,q);
1046 pixel=ScaleQuantumToShort(GetPixelRed(image,p));
1047 q=PopShortPixel(quantum_info->endian,pixel,q);
1048 pixel=ScaleQuantumToShort(GetPixelOpacity(image,p));
1049 q=PopShortPixel(quantum_info->endian,pixel,q);
1050 p+=GetPixelChannels(image);
1051 q+=quantum_info->pad;
1057 register unsigned int
1060 if (quantum_info->format == FloatingPointQuantumFormat)
1062 for (x=0; x < (ssize_t) number_pixels; x++)
1067 q=PopFloatPixel(quantum_info,(float) GetPixelRed(image,p),q);
1068 q=PopFloatPixel(quantum_info,(float) GetPixelGreen(image,p),q);
1069 q=PopFloatPixel(quantum_info,(float) GetPixelBlue(image,p),q);
1070 pixel=(float) GetPixelOpacity(image,p);
1071 q=PopFloatPixel(quantum_info,pixel,q);
1072 p+=GetPixelChannels(image);
1073 q+=quantum_info->pad;
1077 for (x=0; x < (ssize_t) number_pixels; x++)
1079 pixel=ScaleQuantumToLong(GetPixelBlue(image,p));
1080 q=PopLongPixel(quantum_info->endian,pixel,q);
1081 pixel=ScaleQuantumToLong(GetPixelGreen(image,p));
1082 q=PopLongPixel(quantum_info->endian,pixel,q);
1083 pixel=ScaleQuantumToLong(GetPixelRed(image,p));
1084 q=PopLongPixel(quantum_info->endian,pixel,q);
1085 pixel=ScaleQuantumToLong(GetPixelOpacity(image,p));
1086 q=PopLongPixel(quantum_info->endian,pixel,q);
1087 p+=GetPixelChannels(image);
1088 q+=quantum_info->pad;
1094 if (quantum_info->format == FloatingPointQuantumFormat)
1099 for (x=0; x < (ssize_t) number_pixels; x++)
1101 q=PopDoublePixel(quantum_info,(double) GetPixelRed(image,p),q);
1102 q=PopDoublePixel(quantum_info,(double) GetPixelGreen(image,p),q);
1103 q=PopDoublePixel(quantum_info,(double) GetPixelBlue(image,p),q);
1104 pixel=(double) GetPixelOpacity(image,p);
1105 q=PopDoublePixel(quantum_info,pixel,q);
1106 p+=GetPixelChannels(image);
1107 q+=quantum_info->pad;
1114 range=GetQuantumRange(quantum_info->depth);
1115 for (x=0; x < (ssize_t) number_pixels; x++)
1117 q=PopQuantumPixel(quantum_info,ScaleQuantumToAny(GetPixelBlue(image,p),
1119 q=PopQuantumPixel(quantum_info,ScaleQuantumToAny(GetPixelGreen(image,p),
1121 q=PopQuantumPixel(quantum_info,ScaleQuantumToAny(GetPixelRed(image,p),
1123 q=PopQuantumPixel(quantum_info,ScaleQuantumToAny(GetPixelOpacity(image,p),
1125 p+=GetPixelChannels(image);
1126 q+=quantum_info->pad;
1133 static void ExportBlackQuantum(const Image *image,QuantumInfo *quantum_info,
1134 const MagickSizeType number_pixels,const Quantum *magick_restrict p,
1135 unsigned char *magick_restrict q,ExceptionInfo *exception)
1143 if (image->colorspace != CMYKColorspace)
1145 (void) ThrowMagickException(exception,GetMagickModule(),ImageError,
1146 "ColorSeparatedImageRequired","`%s'",image->filename);
1149 switch (quantum_info->depth)
1153 register unsigned char
1156 for (x=0; x < (ssize_t) number_pixels; x++)
1158 pixel=ScaleQuantumToChar(GetPixelBlack(image,p));
1159 q=PopCharPixel(pixel,q);
1160 p+=GetPixelChannels(image);
1161 q+=quantum_info->pad;
1167 register unsigned short
1170 if (quantum_info->format == FloatingPointQuantumFormat)
1172 for (x=0; x < (ssize_t) number_pixels; x++)
1174 pixel=SinglePrecisionToHalf(QuantumScale*GetPixelBlack(image,p));
1175 q=PopShortPixel(quantum_info->endian,pixel,q);
1176 p+=GetPixelChannels(image);
1177 q+=quantum_info->pad;
1181 for (x=0; x < (ssize_t) number_pixels; x++)
1183 pixel=ScaleQuantumToShort(GetPixelBlack(image,p));
1184 q=PopShortPixel(quantum_info->endian,pixel,q);
1185 p+=GetPixelChannels(image);
1186 q+=quantum_info->pad;
1192 register unsigned int
1195 if (quantum_info->format == FloatingPointQuantumFormat)
1197 for (x=0; x < (ssize_t) number_pixels; x++)
1199 q=PopFloatPixel(quantum_info,(float) GetPixelBlack(image,p),q);
1200 p+=GetPixelChannels(image);
1201 q+=quantum_info->pad;
1205 for (x=0; x < (ssize_t) number_pixels; x++)
1207 pixel=ScaleQuantumToLong(GetPixelBlack(image,p));
1208 q=PopLongPixel(quantum_info->endian,pixel,q);
1209 p+=GetPixelChannels(image);
1210 q+=quantum_info->pad;
1216 if (quantum_info->format == FloatingPointQuantumFormat)
1218 for (x=0; x < (ssize_t) number_pixels; x++)
1220 q=PopDoublePixel(quantum_info,(double) GetPixelBlack(image,p),q);
1221 p+=GetPixelChannels(image);
1222 q+=quantum_info->pad;
1229 range=GetQuantumRange(quantum_info->depth);
1230 for (x=0; x < (ssize_t) number_pixels; x++)
1232 q=PopQuantumPixel(quantum_info,ScaleQuantumToAny(GetPixelBlack(image,p),
1234 p+=GetPixelChannels(image);
1235 q+=quantum_info->pad;
1242 static void ExportBlueQuantum(const Image *image,QuantumInfo *quantum_info,
1243 const MagickSizeType number_pixels,const Quantum *magick_restrict p,
1244 unsigned char *magick_restrict q,ExceptionInfo *exception)
1252 assert(exception != (ExceptionInfo *) NULL);
1253 assert(exception->signature == MagickCoreSignature);
1254 switch (quantum_info->depth)
1258 register unsigned char
1261 for (x=0; x < (ssize_t) number_pixels; x++)
1263 pixel=ScaleQuantumToChar(GetPixelBlue(image,p));
1264 q=PopCharPixel(pixel,q);
1265 p+=GetPixelChannels(image);
1266 q+=quantum_info->pad;
1272 register unsigned short
1275 if (quantum_info->format == FloatingPointQuantumFormat)
1277 for (x=0; x < (ssize_t) number_pixels; x++)
1279 pixel=SinglePrecisionToHalf(QuantumScale*GetPixelBlue(image,p));
1280 q=PopShortPixel(quantum_info->endian,pixel,q);
1281 p+=GetPixelChannels(image);
1282 q+=quantum_info->pad;
1286 for (x=0; x < (ssize_t) number_pixels; x++)
1288 pixel=ScaleQuantumToShort(GetPixelBlue(image,p));
1289 q=PopShortPixel(quantum_info->endian,pixel,q);
1290 p+=GetPixelChannels(image);
1291 q+=quantum_info->pad;
1297 register unsigned int
1300 if (quantum_info->format == FloatingPointQuantumFormat)
1302 for (x=0; x < (ssize_t) number_pixels; x++)
1304 q=PopFloatPixel(quantum_info,(float) GetPixelBlue(image,p),q);
1305 p+=GetPixelChannels(image);
1306 q+=quantum_info->pad;
1310 for (x=0; x < (ssize_t) number_pixels; x++)
1312 pixel=ScaleQuantumToLong(GetPixelBlue(image,p));
1313 q=PopLongPixel(quantum_info->endian,pixel,q);
1314 p+=GetPixelChannels(image);
1315 q+=quantum_info->pad;
1321 if (quantum_info->format == FloatingPointQuantumFormat)
1323 for (x=0; x < (ssize_t) number_pixels; x++)
1325 q=PopDoublePixel(quantum_info,(double) GetPixelBlue(image,p),q);
1326 p+=GetPixelChannels(image);
1327 q+=quantum_info->pad;
1334 range=GetQuantumRange(quantum_info->depth);
1335 for (x=0; x < (ssize_t) number_pixels; x++)
1337 q=PopQuantumPixel(quantum_info,ScaleQuantumToAny(GetPixelBlue(image,p),
1339 p+=GetPixelChannels(image);
1340 q+=quantum_info->pad;
1347 static void ExportCbYCrYQuantum(const Image *image,QuantumInfo *quantum_info,
1348 const MagickSizeType number_pixels,const Quantum *magick_restrict p,
1349 unsigned char *magick_restrict q,ExceptionInfo *exception)
1358 register unsigned int
1367 assert(exception != (ExceptionInfo *) NULL);
1368 assert(exception->signature == MagickCoreSignature);
1371 switch (quantum_info->depth)
1375 if (quantum_info->pack == MagickFalse)
1377 for (x=0; x < (ssize_t) number_pixels; x+=2)
1379 for (i=0; i < 4; i++)
1385 quantum=GetPixelRed(image,p);
1390 quantum=GetPixelGreen(image,p);
1395 quantum=GetPixelBlue(image,p);
1399 cbcr[i]=(Quantum) quantum;
1402 pixel=(unsigned int) ((size_t) (cbcr[1]) << 22 | (size_t)
1403 (cbcr[0]) << 12 | (size_t) (cbcr[2]) << 2);
1404 q=PopLongPixel(quantum_info->endian,pixel,q);
1405 p+=GetPixelChannels(image);
1406 pixel=(unsigned int) ((size_t) (cbcr[3]) << 22 | (size_t)
1407 (cbcr[0]) << 12 | (size_t) (cbcr[2]) << 2);
1408 q=PopLongPixel(quantum_info->endian,pixel,q);
1409 p+=GetPixelChannels(image);
1410 q+=quantum_info->pad;
1421 for (x=0; x < (ssize_t) number_pixels; x+=2)
1423 for (i=0; i < 4; i++)
1429 quantum=GetPixelRed(image,p);
1434 quantum=GetPixelGreen(image,p);
1439 quantum=GetPixelBlue(image,p);
1443 cbcr[i]=(Quantum) quantum;
1446 range=GetQuantumRange(quantum_info->depth);
1447 q=PopQuantumPixel(quantum_info,ScaleQuantumToAny(cbcr[1],range),q);
1448 q=PopQuantumPixel(quantum_info,ScaleQuantumToAny(cbcr[0],range),q);
1449 q=PopQuantumPixel(quantum_info,ScaleQuantumToAny(cbcr[2],range),q);
1450 p+=GetPixelChannels(image);
1451 q=PopQuantumPixel(quantum_info,ScaleQuantumToAny(cbcr[3],range),q);
1452 q=PopQuantumPixel(quantum_info,ScaleQuantumToAny(cbcr[0],range),q);
1453 q=PopQuantumPixel(quantum_info,ScaleQuantumToAny(cbcr[2],range),q);
1454 p+=GetPixelChannels(image);
1455 q+=quantum_info->pad;
1462 static void ExportCMYKQuantum(const Image *image,QuantumInfo *quantum_info,
1463 const MagickSizeType number_pixels,const Quantum *magick_restrict p,
1464 unsigned char *magick_restrict q,ExceptionInfo *exception)
1469 if (image->colorspace != CMYKColorspace)
1471 (void) ThrowMagickException(exception,GetMagickModule(),ImageError,
1472 "ColorSeparatedImageRequired","`%s'",image->filename);
1475 switch (quantum_info->depth)
1479 register unsigned char
1482 for (x=0; x < (ssize_t) number_pixels; x++)
1484 pixel=ScaleQuantumToChar(GetPixelRed(image,p));
1485 q=PopCharPixel(pixel,q);
1486 pixel=ScaleQuantumToChar(GetPixelGreen(image,p));
1487 q=PopCharPixel(pixel,q);
1488 pixel=ScaleQuantumToChar(GetPixelBlue(image,p));
1489 q=PopCharPixel(pixel,q);
1490 pixel=ScaleQuantumToChar(GetPixelBlack(image,p));
1491 q=PopCharPixel(pixel,q);
1492 p+=GetPixelChannels(image);
1493 q+=quantum_info->pad;
1499 register unsigned short
1502 if (quantum_info->format == FloatingPointQuantumFormat)
1504 for (x=0; x < (ssize_t) number_pixels; x++)
1506 pixel=SinglePrecisionToHalf(QuantumScale*GetPixelRed(image,p));
1507 q=PopShortPixel(quantum_info->endian,pixel,q);
1508 pixel=SinglePrecisionToHalf(QuantumScale*GetPixelGreen(image,p));
1509 q=PopShortPixel(quantum_info->endian,pixel,q);
1510 pixel=SinglePrecisionToHalf(QuantumScale*GetPixelBlue(image,p));
1511 q=PopShortPixel(quantum_info->endian,pixel,q);
1512 pixel=SinglePrecisionToHalf(QuantumScale*GetPixelBlack(image,p));
1513 q=PopShortPixel(quantum_info->endian,pixel,q);
1514 p+=GetPixelChannels(image);
1515 q+=quantum_info->pad;
1519 for (x=0; x < (ssize_t) number_pixels; x++)
1521 pixel=ScaleQuantumToShort(GetPixelRed(image,p));
1522 q=PopShortPixel(quantum_info->endian,pixel,q);
1523 pixel=ScaleQuantumToShort(GetPixelGreen(image,p));
1524 q=PopShortPixel(quantum_info->endian,pixel,q);
1525 pixel=ScaleQuantumToShort(GetPixelBlue(image,p));
1526 q=PopShortPixel(quantum_info->endian,pixel,q);
1527 pixel=ScaleQuantumToShort(GetPixelBlack(image,p));
1528 q=PopShortPixel(quantum_info->endian,pixel,q);
1529 p+=GetPixelChannels(image);
1530 q+=quantum_info->pad;
1536 register unsigned int
1539 if (quantum_info->format == FloatingPointQuantumFormat)
1541 for (x=0; x < (ssize_t) number_pixels; x++)
1543 q=PopFloatPixel(quantum_info,(float) GetPixelRed(image,p),q);
1544 q=PopFloatPixel(quantum_info,(float) GetPixelGreen(image,p),q);
1545 q=PopFloatPixel(quantum_info,(float) GetPixelBlue(image,p),q);
1546 q=PopFloatPixel(quantum_info,(float) GetPixelBlack(image,p),q);
1547 p+=GetPixelChannels(image);
1548 q+=quantum_info->pad;
1552 for (x=0; x < (ssize_t) number_pixels; x++)
1554 pixel=ScaleQuantumToLong(GetPixelRed(image,p));
1555 q=PopLongPixel(quantum_info->endian,pixel,q);
1556 pixel=ScaleQuantumToLong(GetPixelGreen(image,p));
1557 q=PopLongPixel(quantum_info->endian,pixel,q);
1558 pixel=ScaleQuantumToLong(GetPixelBlue(image,p));
1559 q=PopLongPixel(quantum_info->endian,pixel,q);
1560 pixel=ScaleQuantumToLong(GetPixelBlack(image,p));
1561 q=PopLongPixel(quantum_info->endian,pixel,q);
1562 p+=GetPixelChannels(image);
1563 q+=quantum_info->pad;
1569 if (quantum_info->format == FloatingPointQuantumFormat)
1571 for (x=0; x < (ssize_t) number_pixels; x++)
1573 q=PopDoublePixel(quantum_info,(double) GetPixelRed(image,p),q);
1574 q=PopDoublePixel(quantum_info,(double) GetPixelGreen(image,p),q);
1575 q=PopDoublePixel(quantum_info,(double) GetPixelBlue(image,p),q);
1576 q=PopDoublePixel(quantum_info,(double) GetPixelBlack(image,p),q);
1577 p+=GetPixelChannels(image);
1578 q+=quantum_info->pad;
1588 range=GetQuantumRange(quantum_info->depth);
1589 for (x=0; x < (ssize_t) number_pixels; x++)
1591 q=PopQuantumPixel(quantum_info,ScaleQuantumToAny(GetPixelRed(image,p),
1593 q=PopQuantumPixel(quantum_info,ScaleQuantumToAny(GetPixelGreen(image,p),
1595 q=PopQuantumPixel(quantum_info,ScaleQuantumToAny(GetPixelBlue(image,p),
1597 q=PopQuantumPixel(quantum_info,ScaleQuantumToAny(GetPixelBlack(image,p),
1599 p+=GetPixelChannels(image);
1600 q+=quantum_info->pad;
1607 static void ExportCMYKAQuantum(const Image *image,QuantumInfo *quantum_info,
1608 const MagickSizeType number_pixels,const Quantum *magick_restrict p,
1609 unsigned char *magick_restrict q,ExceptionInfo *exception)
1614 if (image->colorspace != CMYKColorspace)
1616 (void) ThrowMagickException(exception,GetMagickModule(),ImageError,
1617 "ColorSeparatedImageRequired","`%s'",image->filename);
1620 switch (quantum_info->depth)
1624 register unsigned char
1627 for (x=0; x < (ssize_t) number_pixels; x++)
1629 pixel=ScaleQuantumToChar(GetPixelRed(image,p));
1630 q=PopCharPixel(pixel,q);
1631 pixel=ScaleQuantumToChar(GetPixelGreen(image,p));
1632 q=PopCharPixel(pixel,q);
1633 pixel=ScaleQuantumToChar(GetPixelBlue(image,p));
1634 q=PopCharPixel(pixel,q);
1635 pixel=ScaleQuantumToChar(GetPixelBlack(image,p));
1636 q=PopCharPixel(pixel,q);
1637 pixel=ScaleQuantumToChar(GetPixelAlpha(image,p));
1638 q=PopCharPixel(pixel,q);
1639 p+=GetPixelChannels(image);
1640 q+=quantum_info->pad;
1646 register unsigned short
1649 if (quantum_info->format == FloatingPointQuantumFormat)
1651 for (x=0; x < (ssize_t) number_pixels; x++)
1653 pixel=SinglePrecisionToHalf(QuantumScale*GetPixelRed(image,p));
1654 q=PopShortPixel(quantum_info->endian,pixel,q);
1655 pixel=SinglePrecisionToHalf(QuantumScale*GetPixelGreen(image,p));
1656 q=PopShortPixel(quantum_info->endian,pixel,q);
1657 pixel=SinglePrecisionToHalf(QuantumScale*GetPixelBlue(image,p));
1658 q=PopShortPixel(quantum_info->endian,pixel,q);
1659 pixel=SinglePrecisionToHalf(QuantumScale*GetPixelBlack(image,p));
1660 q=PopShortPixel(quantum_info->endian,pixel,q);
1661 pixel=SinglePrecisionToHalf(QuantumScale*GetPixelAlpha(image,p));
1662 q=PopShortPixel(quantum_info->endian,pixel,q);
1663 p+=GetPixelChannels(image);
1664 q+=quantum_info->pad;
1668 for (x=0; x < (ssize_t) number_pixels; x++)
1670 pixel=ScaleQuantumToShort(GetPixelRed(image,p));
1671 q=PopShortPixel(quantum_info->endian,pixel,q);
1672 pixel=ScaleQuantumToShort(GetPixelGreen(image,p));
1673 q=PopShortPixel(quantum_info->endian,pixel,q);
1674 pixel=ScaleQuantumToShort(GetPixelBlue(image,p));
1675 q=PopShortPixel(quantum_info->endian,pixel,q);
1676 pixel=ScaleQuantumToShort(GetPixelBlack(image,p));
1677 q=PopShortPixel(quantum_info->endian,pixel,q);
1678 pixel=ScaleQuantumToShort(GetPixelAlpha(image,p));
1679 q=PopShortPixel(quantum_info->endian,pixel,q);
1680 p+=GetPixelChannels(image);
1681 q+=quantum_info->pad;
1687 register unsigned int
1690 if (quantum_info->format == FloatingPointQuantumFormat)
1692 for (x=0; x < (ssize_t) number_pixels; x++)
1697 q=PopFloatPixel(quantum_info,(float) GetPixelRed(image,p),q);
1698 q=PopFloatPixel(quantum_info,(float) GetPixelGreen(image,p),q);
1699 q=PopFloatPixel(quantum_info,(float) GetPixelBlue(image,p),q);
1700 q=PopFloatPixel(quantum_info,(float) GetPixelBlack(image,p),q);
1701 pixel=(float) (GetPixelAlpha(image,p));
1702 q=PopFloatPixel(quantum_info,pixel,q);
1703 p+=GetPixelChannels(image);
1704 q+=quantum_info->pad;
1708 for (x=0; x < (ssize_t) number_pixels; x++)
1710 pixel=ScaleQuantumToLong(GetPixelRed(image,p));
1711 q=PopLongPixel(quantum_info->endian,pixel,q);
1712 pixel=ScaleQuantumToLong(GetPixelGreen(image,p));
1713 q=PopLongPixel(quantum_info->endian,pixel,q);
1714 pixel=ScaleQuantumToLong(GetPixelBlue(image,p));
1715 q=PopLongPixel(quantum_info->endian,pixel,q);
1716 pixel=ScaleQuantumToLong(GetPixelBlack(image,p));
1717 q=PopLongPixel(quantum_info->endian,pixel,q);
1718 pixel=ScaleQuantumToLong(GetPixelAlpha(image,p));
1719 q=PopLongPixel(quantum_info->endian,pixel,q);
1720 p+=GetPixelChannels(image);
1721 q+=quantum_info->pad;
1727 if (quantum_info->format == FloatingPointQuantumFormat)
1732 for (x=0; x < (ssize_t) number_pixels; x++)
1734 q=PopDoublePixel(quantum_info,(double) GetPixelRed(image,p),q);
1735 q=PopDoublePixel(quantum_info,(double) GetPixelGreen(image,p),q);
1736 q=PopDoublePixel(quantum_info,(double) GetPixelBlue(image,p),q);
1737 q=PopDoublePixel(quantum_info,(double) GetPixelBlack(image,p),q);
1738 pixel=(double) (GetPixelAlpha(image,p));
1739 q=PopDoublePixel(quantum_info,pixel,q);
1740 p+=GetPixelChannels(image);
1741 q+=quantum_info->pad;
1751 range=GetQuantumRange(quantum_info->depth);
1752 for (x=0; x < (ssize_t) number_pixels; x++)
1754 q=PopQuantumPixel(quantum_info,ScaleQuantumToAny(GetPixelRed(image,p),
1756 q=PopQuantumPixel(quantum_info,ScaleQuantumToAny(GetPixelGreen(image,p),
1758 q=PopQuantumPixel(quantum_info,ScaleQuantumToAny(GetPixelBlue(image,p),
1760 q=PopQuantumPixel(quantum_info,ScaleQuantumToAny(GetPixelBlack(image,p),
1762 q=PopQuantumPixel(quantum_info,ScaleQuantumToAny(GetPixelAlpha(image,p),
1764 p+=GetPixelChannels(image);
1765 q+=quantum_info->pad;
1772 static void ExportCMYKOQuantum(const Image *image,QuantumInfo *quantum_info,
1773 const MagickSizeType number_pixels,const Quantum *magick_restrict p,
1774 unsigned char *magick_restrict q,ExceptionInfo *exception)
1779 if (image->colorspace != CMYKColorspace)
1781 (void) ThrowMagickException(exception,GetMagickModule(),ImageError,
1782 "ColorSeparatedImageRequired","`%s'",image->filename);
1785 switch (quantum_info->depth)
1789 register unsigned char
1792 for (x=0; x < (ssize_t) number_pixels; x++)
1794 pixel=ScaleQuantumToChar(GetPixelRed(image,p));
1795 q=PopCharPixel(pixel,q);
1796 pixel=ScaleQuantumToChar(GetPixelGreen(image,p));
1797 q=PopCharPixel(pixel,q);
1798 pixel=ScaleQuantumToChar(GetPixelBlue(image,p));
1799 q=PopCharPixel(pixel,q);
1800 pixel=ScaleQuantumToChar(GetPixelBlack(image,p));
1801 q=PopCharPixel(pixel,q);
1802 pixel=ScaleQuantumToChar(GetPixelOpacity(image,p));
1803 q=PopCharPixel(pixel,q);
1804 p+=GetPixelChannels(image);
1805 q+=quantum_info->pad;
1811 register unsigned short
1814 if (quantum_info->format == FloatingPointQuantumFormat)
1816 for (x=0; x < (ssize_t) number_pixels; x++)
1818 pixel=SinglePrecisionToHalf(QuantumScale*GetPixelRed(image,p));
1819 q=PopShortPixel(quantum_info->endian,pixel,q);
1820 pixel=SinglePrecisionToHalf(QuantumScale*GetPixelGreen(image,p));
1821 q=PopShortPixel(quantum_info->endian,pixel,q);
1822 pixel=SinglePrecisionToHalf(QuantumScale*GetPixelBlue(image,p));
1823 q=PopShortPixel(quantum_info->endian,pixel,q);
1824 pixel=SinglePrecisionToHalf(QuantumScale*GetPixelBlack(image,p));
1825 q=PopShortPixel(quantum_info->endian,pixel,q);
1826 pixel=SinglePrecisionToHalf(QuantumScale*GetPixelOpacity(image,p));
1827 q=PopShortPixel(quantum_info->endian,pixel,q);
1828 p+=GetPixelChannels(image);
1829 q+=quantum_info->pad;
1833 for (x=0; x < (ssize_t) number_pixels; x++)
1835 pixel=ScaleQuantumToShort(GetPixelRed(image,p));
1836 q=PopShortPixel(quantum_info->endian,pixel,q);
1837 pixel=ScaleQuantumToShort(GetPixelGreen(image,p));
1838 q=PopShortPixel(quantum_info->endian,pixel,q);
1839 pixel=ScaleQuantumToShort(GetPixelBlue(image,p));
1840 q=PopShortPixel(quantum_info->endian,pixel,q);
1841 pixel=ScaleQuantumToShort(GetPixelBlack(image,p));
1842 q=PopShortPixel(quantum_info->endian,pixel,q);
1843 pixel=ScaleQuantumToShort(GetPixelOpacity(image,p));
1844 q=PopShortPixel(quantum_info->endian,pixel,q);
1845 p+=GetPixelChannels(image);
1846 q+=quantum_info->pad;
1852 register unsigned int
1855 if (quantum_info->format == FloatingPointQuantumFormat)
1857 for (x=0; x < (ssize_t) number_pixels; x++)
1862 q=PopFloatPixel(quantum_info,(float) GetPixelRed(image,p),q);
1863 q=PopFloatPixel(quantum_info,(float) GetPixelGreen(image,p),q);
1864 q=PopFloatPixel(quantum_info,(float) GetPixelBlue(image,p),q);
1865 q=PopFloatPixel(quantum_info,(float) GetPixelBlack(image,p),q);
1866 pixel=(float) (GetPixelOpacity(image,p));
1867 q=PopFloatPixel(quantum_info,pixel,q);
1868 p+=GetPixelChannels(image);
1869 q+=quantum_info->pad;
1873 for (x=0; x < (ssize_t) number_pixels; x++)
1875 pixel=ScaleQuantumToLong(GetPixelRed(image,p));
1876 q=PopLongPixel(quantum_info->endian,pixel,q);
1877 pixel=ScaleQuantumToLong(GetPixelGreen(image,p));
1878 q=PopLongPixel(quantum_info->endian,pixel,q);
1879 pixel=ScaleQuantumToLong(GetPixelBlue(image,p));
1880 q=PopLongPixel(quantum_info->endian,pixel,q);
1881 pixel=ScaleQuantumToLong(GetPixelBlack(image,p));
1882 q=PopLongPixel(quantum_info->endian,pixel,q);
1883 pixel=ScaleQuantumToLong(GetPixelOpacity(image,p));
1884 q=PopLongPixel(quantum_info->endian,pixel,q);
1885 p+=GetPixelChannels(image);
1886 q+=quantum_info->pad;
1892 if (quantum_info->format == FloatingPointQuantumFormat)
1897 for (x=0; x < (ssize_t) number_pixels; x++)
1899 q=PopDoublePixel(quantum_info,(double) GetPixelRed(image,p),q);
1900 q=PopDoublePixel(quantum_info,(double) GetPixelGreen(image,p),q);
1901 q=PopDoublePixel(quantum_info,(double) GetPixelBlue(image,p),q);
1902 q=PopDoublePixel(quantum_info,(double) GetPixelBlack(image,p),q);
1903 pixel=(double) (GetPixelOpacity(image,p));
1904 q=PopDoublePixel(quantum_info,pixel,q);
1905 p+=GetPixelChannels(image);
1906 q+=quantum_info->pad;
1916 range=GetQuantumRange(quantum_info->depth);
1917 for (x=0; x < (ssize_t) number_pixels; x++)
1919 q=PopQuantumPixel(quantum_info,ScaleQuantumToAny(GetPixelRed(image,p),
1921 q=PopQuantumPixel(quantum_info,ScaleQuantumToAny(GetPixelGreen(image,p),
1923 q=PopQuantumPixel(quantum_info,ScaleQuantumToAny(GetPixelBlue(image,p),
1925 q=PopQuantumPixel(quantum_info,ScaleQuantumToAny(GetPixelBlack(image,p),
1927 q=PopQuantumPixel(quantum_info,ScaleQuantumToAny(GetPixelOpacity(image,p),
1929 p+=GetPixelChannels(image);
1930 q+=quantum_info->pad;
1937 static void ExportGrayQuantum(const Image *image,QuantumInfo *quantum_info,
1938 const MagickSizeType number_pixels,const Quantum *magick_restrict p,
1939 unsigned char *magick_restrict q,ExceptionInfo *exception)
1947 assert(exception != (ExceptionInfo *) NULL);
1948 assert(exception->signature == MagickCoreSignature);
1949 switch (quantum_info->depth)
1956 register unsigned char
1965 if (quantum_info->min_is_white != MagickFalse)
1970 threshold=QuantumRange/2.0;
1971 for (x=((ssize_t) number_pixels-7); x > 0; x-=8)
1974 *q|=(GetPixelLuma(image,p) < threshold ? black : white) << 7;
1975 p+=GetPixelChannels(image);
1976 *q|=(GetPixelLuma(image,p) < threshold ? black : white) << 6;
1977 p+=GetPixelChannels(image);
1978 *q|=(GetPixelLuma(image,p) < threshold ? black : white) << 5;
1979 p+=GetPixelChannels(image);
1980 *q|=(GetPixelLuma(image,p) < threshold ? black : white) << 4;
1981 p+=GetPixelChannels(image);
1982 *q|=(GetPixelLuma(image,p) < threshold ? black : white) << 3;
1983 p+=GetPixelChannels(image);
1984 *q|=(GetPixelLuma(image,p) < threshold ? black : white) << 2;
1985 p+=GetPixelChannels(image);
1986 *q|=(GetPixelLuma(image,p) < threshold ? black : white) << 1;
1987 p+=GetPixelChannels(image);
1988 *q|=(GetPixelLuma(image,p) < threshold ? black : white) << 0;
1989 p+=GetPixelChannels(image);
1992 if ((number_pixels % 8) != 0)
1995 for (bit=7; bit >= (ssize_t) (8-(number_pixels % 8)); bit--)
1997 *q|=(GetPixelLuma(image,p) < threshold ? black : white) << bit;
1998 p+=GetPixelChannels(image);
2006 register unsigned char
2009 for (x=0; x < (ssize_t) (number_pixels-1) ; x+=2)
2011 pixel=ScaleQuantumToChar(ClampToQuantum(GetPixelLuma(image,p)));
2012 *q=(((pixel >> 4) & 0xf) << 4);
2013 p+=GetPixelChannels(image);
2014 pixel=ScaleQuantumToChar(ClampToQuantum(GetPixelLuma(image,p)));
2016 p+=GetPixelChannels(image);
2019 if ((number_pixels % 2) != 0)
2021 pixel=ScaleQuantumToChar(ClampToQuantum(GetPixelLuma(image,p)));
2022 *q=(((pixel >> 4) & 0xf) << 4);
2023 p+=GetPixelChannels(image);
2030 register unsigned char
2033 for (x=0; x < (ssize_t) number_pixels; x++)
2035 pixel=ScaleQuantumToChar(ClampToQuantum(GetPixelLuma(image,p)));
2036 q=PopCharPixel(pixel,q);
2037 p+=GetPixelChannels(image);
2038 q+=quantum_info->pad;
2044 range=GetQuantumRange(quantum_info->depth);
2045 if (quantum_info->pack == MagickFalse)
2047 register unsigned int
2050 for (x=0; x < (ssize_t) (number_pixels-2); x+=3)
2052 pixel=(unsigned int) (ScaleQuantumToAny(ClampToQuantum(
2053 GetPixelLuma(image,p+2*GetPixelChannels(image))),range) << 22 |
2054 ScaleQuantumToAny(ClampToQuantum(GetPixelLuma(image,p+
2055 GetPixelChannels(image))),range) << 12 | ScaleQuantumToAny(
2056 ClampToQuantum(GetPixelLuma(image,p)),range) << 2);
2057 q=PopLongPixel(quantum_info->endian,pixel,q);
2058 p+=3*GetPixelChannels(image);
2059 q+=quantum_info->pad;
2061 if (x < (ssize_t) number_pixels)
2064 if (x++ < (ssize_t) (number_pixels-1))
2065 pixel|=ScaleQuantumToAny(ClampToQuantum(GetPixelLuma(image,p+
2066 GetPixelChannels(image))),range) << 12;
2067 if (x++ < (ssize_t) number_pixels)
2068 pixel|=ScaleQuantumToAny(ClampToQuantum(GetPixelLuma(image,p)),
2070 q=PopLongPixel(quantum_info->endian,pixel,q);
2074 for (x=0; x < (ssize_t) number_pixels; x++)
2076 q=PopQuantumPixel(quantum_info,ScaleQuantumToAny(ClampToQuantum(
2077 GetPixelLuma(image,p)),range),q);
2078 p+=GetPixelChannels(image);
2079 q+=quantum_info->pad;
2085 register unsigned short
2088 range=GetQuantumRange(quantum_info->depth);
2089 if (quantum_info->pack == MagickFalse)
2091 for (x=0; x < (ssize_t) number_pixels; x++)
2093 pixel=ScaleQuantumToShort(ClampToQuantum(GetPixelLuma(image,p)));
2094 q=PopShortPixel(quantum_info->endian,(unsigned short) (pixel >> 4),
2096 p+=GetPixelChannels(image);
2097 q+=quantum_info->pad;
2101 for (x=0; x < (ssize_t) number_pixels; x++)
2103 q=PopQuantumPixel(quantum_info,ScaleQuantumToAny(ClampToQuantum(
2104 GetPixelLuma(image,p)),range),q);
2105 p+=GetPixelChannels(image);
2106 q+=quantum_info->pad;
2112 register unsigned short
2115 if (quantum_info->format == FloatingPointQuantumFormat)
2117 for (x=0; x < (ssize_t) number_pixels; x++)
2119 pixel=SinglePrecisionToHalf(QuantumScale*GetPixelLuma(image,p));
2120 q=PopShortPixel(quantum_info->endian,pixel,q);
2121 p+=GetPixelChannels(image);
2122 q+=quantum_info->pad;
2126 for (x=0; x < (ssize_t) number_pixels; x++)
2128 pixel=ScaleQuantumToShort(ClampToQuantum(GetPixelLuma(image,p)));
2129 q=PopShortPixel(quantum_info->endian,pixel,q);
2130 p+=GetPixelChannels(image);
2131 q+=quantum_info->pad;
2137 register unsigned int
2140 if (quantum_info->format == FloatingPointQuantumFormat)
2142 for (x=0; x < (ssize_t) number_pixels; x++)
2147 pixel=(float) GetPixelLuma(image,p);
2148 q=PopFloatPixel(quantum_info,pixel,q);
2149 p+=GetPixelChannels(image);
2150 q+=quantum_info->pad;
2154 for (x=0; x < (ssize_t) number_pixels; x++)
2156 pixel=ScaleQuantumToLong(ClampToQuantum(GetPixelLuma(image,p)));
2157 q=PopLongPixel(quantum_info->endian,pixel,q);
2158 p+=GetPixelChannels(image);
2159 q+=quantum_info->pad;
2165 if (quantum_info->format == FloatingPointQuantumFormat)
2167 for (x=0; x < (ssize_t) number_pixels; x++)
2172 pixel=GetPixelLuma(image,p);
2173 q=PopDoublePixel(quantum_info,pixel,q);
2174 p+=GetPixelChannels(image);
2175 q+=quantum_info->pad;
2182 range=GetQuantumRange(quantum_info->depth);
2183 for (x=0; x < (ssize_t) number_pixels; x++)
2185 q=PopQuantumPixel(quantum_info,ScaleQuantumToAny(ClampToQuantum(
2186 GetPixelLuma(image,p)),range),q);
2187 p+=GetPixelChannels(image);
2188 q+=quantum_info->pad;
2195 static void ExportGrayAlphaQuantum(const Image *image,QuantumInfo *quantum_info,
2196 const MagickSizeType number_pixels,const Quantum *magick_restrict p,
2197 unsigned char *magick_restrict q,ExceptionInfo *exception)
2205 assert(exception != (ExceptionInfo *) NULL);
2206 assert(exception->signature == MagickCoreSignature);
2207 switch (quantum_info->depth)
2214 register unsigned char
2224 if (quantum_info->min_is_white == MagickFalse)
2229 threshold=QuantumRange/2.0;
2230 for (x=((ssize_t) number_pixels-3); x > 0; x-=4)
2233 *q|=(GetPixelLuma(image,p) > threshold ? black : white) << 7;
2234 pixel=(unsigned char) (GetPixelAlpha(image,p) == OpaqueAlpha ?
2236 *q|=(((int) pixel != 0 ? 0x00 : 0x01) << 6);
2237 p+=GetPixelChannels(image);
2238 *q|=(GetPixelLuma(image,p) > threshold ? black : white) << 5;
2239 pixel=(unsigned char) (GetPixelAlpha(image,p) == OpaqueAlpha ?
2241 *q|=(((int) pixel != 0 ? 0x00 : 0x01) << 4);
2242 p+=GetPixelChannels(image);
2243 *q|=(GetPixelLuma(image,p) > threshold ? black : white) << 3;
2244 pixel=(unsigned char) (GetPixelAlpha(image,p) == OpaqueAlpha ?
2246 *q|=(((int) pixel != 0 ? 0x00 : 0x01) << 2);
2247 p+=GetPixelChannels(image);
2248 *q|=(GetPixelLuma(image,p) > threshold ? black : white) << 1;
2249 pixel=(unsigned char) (GetPixelAlpha(image,p) == OpaqueAlpha ?
2251 *q|=(((int) pixel != 0 ? 0x00 : 0x01) << 0);
2252 p+=GetPixelChannels(image);
2255 if ((number_pixels % 4) != 0)
2258 for (bit=0; bit <= (ssize_t) (number_pixels % 4); bit+=2)
2260 *q|=(GetPixelLuma(image,p) > threshold ? black : white) <<
2262 pixel=(unsigned char) (GetPixelAlpha(image,p) == OpaqueAlpha ?
2264 *q|=(((int) pixel != 0 ? 0x00 : 0x01) << (unsigned char)
2266 p+=GetPixelChannels(image);
2274 register unsigned char
2277 for (x=0; x < (ssize_t) number_pixels ; x++)
2279 pixel=ScaleQuantumToChar(ClampToQuantum(GetPixelLuma(image,p)));
2280 *q=(((pixel >> 4) & 0xf) << 4);
2281 pixel=(unsigned char) (16*QuantumScale*GetPixelAlpha(image,p)+0.5);
2283 p+=GetPixelChannels(image);
2290 register unsigned char
2293 for (x=0; x < (ssize_t) number_pixels; x++)
2295 pixel=ScaleQuantumToChar(ClampToQuantum(GetPixelLuma(image,p)));
2296 q=PopCharPixel(pixel,q);
2297 pixel=ScaleQuantumToChar(GetPixelAlpha(image,p));
2298 q=PopCharPixel(pixel,q);
2299 p+=GetPixelChannels(image);
2300 q+=quantum_info->pad;
2306 register unsigned short
2309 if (quantum_info->format == FloatingPointQuantumFormat)
2311 for (x=0; x < (ssize_t) number_pixels; x++)
2313 pixel=SinglePrecisionToHalf(QuantumScale*GetPixelLuma(image,p));
2314 q=PopShortPixel(quantum_info->endian,pixel,q);
2315 pixel=SinglePrecisionToHalf(QuantumScale*GetPixelAlpha(image,p));
2316 q=PopShortPixel(quantum_info->endian,pixel,q);
2317 p+=GetPixelChannels(image);
2318 q+=quantum_info->pad;
2322 for (x=0; x < (ssize_t) number_pixels; x++)
2324 pixel=ScaleQuantumToShort(ClampToQuantum(GetPixelLuma(image,p)));
2325 q=PopShortPixel(quantum_info->endian,pixel,q);
2326 pixel=ScaleQuantumToShort(GetPixelAlpha(image,p));
2327 q=PopShortPixel(quantum_info->endian,pixel,q);
2328 p+=GetPixelChannels(image);
2329 q+=quantum_info->pad;
2335 register unsigned int
2338 if (quantum_info->format == FloatingPointQuantumFormat)
2340 for (x=0; x < (ssize_t) number_pixels; x++)
2345 pixel=(float) GetPixelLuma(image,p);
2346 q=PopFloatPixel(quantum_info,pixel,q);
2347 pixel=(float) (GetPixelAlpha(image,p));
2348 q=PopFloatPixel(quantum_info,pixel,q);
2349 p+=GetPixelChannels(image);
2350 q+=quantum_info->pad;
2354 for (x=0; x < (ssize_t) number_pixels; x++)
2356 pixel=ScaleQuantumToLong(ClampToQuantum(GetPixelLuma(image,p)));
2357 q=PopLongPixel(quantum_info->endian,pixel,q);
2358 pixel=ScaleQuantumToLong(GetPixelAlpha(image,p));
2359 q=PopLongPixel(quantum_info->endian,pixel,q);
2360 p+=GetPixelChannels(image);
2361 q+=quantum_info->pad;
2367 if (quantum_info->format == FloatingPointQuantumFormat)
2369 for (x=0; x < (ssize_t) number_pixels; x++)
2374 pixel=GetPixelLuma(image,p);
2375 q=PopDoublePixel(quantum_info,pixel,q);
2376 pixel=(double) (GetPixelAlpha(image,p));
2377 q=PopDoublePixel(quantum_info,pixel,q);
2378 p+=GetPixelChannels(image);
2379 q+=quantum_info->pad;
2386 range=GetQuantumRange(quantum_info->depth);
2387 for (x=0; x < (ssize_t) number_pixels; x++)
2389 q=PopQuantumPixel(quantum_info,ScaleQuantumToAny(ClampToQuantum(
2390 GetPixelLuma(image,p)),range),q);
2391 q=PopQuantumPixel(quantum_info,ScaleQuantumToAny(GetPixelAlpha(image,p),
2393 p+=GetPixelChannels(image);
2394 q+=quantum_info->pad;
2401 static void ExportGreenQuantum(const Image *image,QuantumInfo *quantum_info,
2402 const MagickSizeType number_pixels,const Quantum *magick_restrict p,
2403 unsigned char *magick_restrict q,ExceptionInfo *exception)
2411 assert(exception != (ExceptionInfo *) NULL);
2412 assert(exception->signature == MagickCoreSignature);
2413 switch (quantum_info->depth)
2417 register unsigned char
2420 for (x=0; x < (ssize_t) number_pixels; x++)
2422 pixel=ScaleQuantumToChar(GetPixelGreen(image,p));
2423 q=PopCharPixel(pixel,q);
2424 p+=GetPixelChannels(image);
2425 q+=quantum_info->pad;
2431 register unsigned short
2434 if (quantum_info->format == FloatingPointQuantumFormat)
2436 for (x=0; x < (ssize_t) number_pixels; x++)
2438 pixel=SinglePrecisionToHalf(QuantumScale*GetPixelGreen(image,p));
2439 q=PopShortPixel(quantum_info->endian,pixel,q);
2440 p+=GetPixelChannels(image);
2441 q+=quantum_info->pad;
2445 for (x=0; x < (ssize_t) number_pixels; x++)
2447 pixel=ScaleQuantumToShort(GetPixelGreen(image,p));
2448 q=PopShortPixel(quantum_info->endian,pixel,q);
2449 p+=GetPixelChannels(image);
2450 q+=quantum_info->pad;
2456 register unsigned int
2459 if (quantum_info->format == FloatingPointQuantumFormat)
2461 for (x=0; x < (ssize_t) number_pixels; x++)
2463 q=PopFloatPixel(quantum_info,(float) GetPixelGreen(image,p),q);
2464 p+=GetPixelChannels(image);
2465 q+=quantum_info->pad;
2469 for (x=0; x < (ssize_t) number_pixels; x++)
2471 pixel=ScaleQuantumToLong(GetPixelGreen(image,p));
2472 q=PopLongPixel(quantum_info->endian,pixel,q);
2473 p+=GetPixelChannels(image);
2474 q+=quantum_info->pad;
2480 if (quantum_info->format == FloatingPointQuantumFormat)
2482 for (x=0; x < (ssize_t) number_pixels; x++)
2484 q=PopDoublePixel(quantum_info,(double) GetPixelGreen(image,p),q);
2485 p+=GetPixelChannels(image);
2486 q+=quantum_info->pad;
2493 range=GetQuantumRange(quantum_info->depth);
2494 for (x=0; x < (ssize_t) number_pixels; x++)
2496 q=PopQuantumPixel(quantum_info,ScaleQuantumToAny(GetPixelGreen(image,p),
2498 p+=GetPixelChannels(image);
2499 q+=quantum_info->pad;
2506 static void ExportIndexQuantum(const Image *image,QuantumInfo *quantum_info,
2507 const MagickSizeType number_pixels,const Quantum *magick_restrict p,
2508 unsigned char *magick_restrict q,ExceptionInfo *exception)
2516 if (image->storage_class != PseudoClass)
2518 (void) ThrowMagickException(exception,GetMagickModule(),ImageError,
2519 "ColormappedImageRequired","`%s'",image->filename);
2522 switch (quantum_info->depth)
2526 register unsigned char
2529 for (x=((ssize_t) number_pixels-7); x > 0; x-=8)
2531 pixel=(unsigned char) GetPixelIndex(image,p);
2532 *q=((pixel & 0x01) << 7);
2533 p+=GetPixelChannels(image);
2534 pixel=(unsigned char) GetPixelIndex(image,p);
2535 *q|=((pixel & 0x01) << 6);
2536 p+=GetPixelChannels(image);
2537 pixel=(unsigned char) GetPixelIndex(image,p);
2538 *q|=((pixel & 0x01) << 5);
2539 p+=GetPixelChannels(image);
2540 pixel=(unsigned char) GetPixelIndex(image,p);
2541 *q|=((pixel & 0x01) << 4);
2542 p+=GetPixelChannels(image);
2543 pixel=(unsigned char) GetPixelIndex(image,p);
2544 *q|=((pixel & 0x01) << 3);
2545 p+=GetPixelChannels(image);
2546 pixel=(unsigned char) GetPixelIndex(image,p);
2547 *q|=((pixel & 0x01) << 2);
2548 p+=GetPixelChannels(image);
2549 pixel=(unsigned char) GetPixelIndex(image,p);
2550 *q|=((pixel & 0x01) << 1);
2551 p+=GetPixelChannels(image);
2552 pixel=(unsigned char) GetPixelIndex(image,p);
2553 *q|=((pixel & 0x01) << 0);
2554 p+=GetPixelChannels(image);
2557 if ((number_pixels % 8) != 0)
2560 for (bit=7; bit >= (ssize_t) (8-(number_pixels % 8)); bit--)
2562 pixel=(unsigned char) GetPixelIndex(image,p);
2563 *q|=((pixel & 0x01) << (unsigned char) bit);
2564 p+=GetPixelChannels(image);
2572 register unsigned char
2575 for (x=0; x < (ssize_t) (number_pixels-1) ; x+=2)
2577 pixel=(unsigned char) GetPixelIndex(image,p);
2578 *q=((pixel & 0xf) << 4);
2579 p+=GetPixelChannels(image);
2580 pixel=(unsigned char) GetPixelIndex(image,p);
2581 *q|=((pixel & 0xf) << 0);
2582 p+=GetPixelChannels(image);
2585 if ((number_pixels % 2) != 0)
2587 pixel=(unsigned char) GetPixelIndex(image,p);
2588 *q=((pixel & 0xf) << 4);
2589 p+=GetPixelChannels(image);
2596 for (x=0; x < (ssize_t) number_pixels; x++)
2598 q=PopCharPixel((unsigned char) GetPixelIndex(image,p),q);
2599 p+=GetPixelChannels(image);
2600 q+=quantum_info->pad;
2606 if (quantum_info->format == FloatingPointQuantumFormat)
2608 for (x=0; x < (ssize_t) number_pixels; x++)
2610 q=PopShortPixel(quantum_info->endian,SinglePrecisionToHalf(
2611 QuantumScale*GetPixelIndex(image,p)),q);
2612 p+=GetPixelChannels(image);
2613 q+=quantum_info->pad;
2617 for (x=0; x < (ssize_t) number_pixels; x++)
2619 q=PopShortPixel(quantum_info->endian,(unsigned short)
2620 GetPixelIndex(image,p),q);
2621 p+=GetPixelChannels(image);
2622 q+=quantum_info->pad;
2628 if (quantum_info->format == FloatingPointQuantumFormat)
2630 for (x=0; x < (ssize_t) number_pixels; x++)
2632 q=PopFloatPixel(quantum_info,(float) GetPixelIndex(image,p),q);
2633 p+=GetPixelChannels(image);
2634 q+=quantum_info->pad;
2638 for (x=0; x < (ssize_t) number_pixels; x++)
2640 q=PopLongPixel(quantum_info->endian,(unsigned int)
2641 GetPixelIndex(image,p),q);
2642 p+=GetPixelChannels(image);
2643 q+=quantum_info->pad;
2649 if (quantum_info->format == FloatingPointQuantumFormat)
2651 for (x=0; x < (ssize_t) number_pixels; x++)
2653 q=PopDoublePixel(quantum_info,(double) GetPixelIndex(image,p),q);
2654 p+=GetPixelChannels(image);
2655 q+=quantum_info->pad;
2662 for (x=0; x < (ssize_t) number_pixels; x++)
2664 q=PopQuantumPixel(quantum_info,GetPixelIndex(image,p),q);
2665 p+=GetPixelChannels(image);
2666 q+=quantum_info->pad;
2673 static void ExportIndexAlphaQuantum(const Image *image,
2674 QuantumInfo *quantum_info,const MagickSizeType number_pixels,
2675 const Quantum *magick_restrict p,unsigned char *magick_restrict q,
2676 ExceptionInfo *exception)
2684 if (image->storage_class != PseudoClass)
2686 (void) ThrowMagickException(exception,GetMagickModule(),ImageError,
2687 "ColormappedImageRequired","`%s'",image->filename);
2690 switch (quantum_info->depth)
2694 register unsigned char
2697 for (x=((ssize_t) number_pixels-3); x > 0; x-=4)
2699 pixel=(unsigned char) GetPixelIndex(image,p);
2700 *q=((pixel & 0x01) << 7);
2701 pixel=(unsigned char) (GetPixelAlpha(image,p) == (Quantum)
2702 TransparentAlpha ? 1 : 0);
2703 *q|=((pixel & 0x01) << 6);
2704 p+=GetPixelChannels(image);
2705 pixel=(unsigned char) GetPixelIndex(image,p);
2706 *q|=((pixel & 0x01) << 5);
2707 pixel=(unsigned char) (GetPixelAlpha(image,p) == (Quantum)
2708 TransparentAlpha ? 1 : 0);
2709 *q|=((pixel & 0x01) << 4);
2710 p+=GetPixelChannels(image);
2711 pixel=(unsigned char) GetPixelIndex(image,p);
2712 *q|=((pixel & 0x01) << 3);
2713 pixel=(unsigned char) (GetPixelAlpha(image,p) == (Quantum)
2714 TransparentAlpha ? 1 : 0);
2715 *q|=((pixel & 0x01) << 2);
2716 p+=GetPixelChannels(image);
2717 pixel=(unsigned char) GetPixelIndex(image,p);
2718 *q|=((pixel & 0x01) << 1);
2719 pixel=(unsigned char) (GetPixelAlpha(image,p) == (Quantum)
2720 TransparentAlpha ? 1 : 0);
2721 *q|=((pixel & 0x01) << 0);
2722 p+=GetPixelChannels(image);
2725 if ((number_pixels % 4) != 0)
2728 for (bit=3; bit >= (ssize_t) (4-(number_pixels % 4)); bit-=2)
2730 pixel=(unsigned char) GetPixelIndex(image,p);
2731 *q|=((pixel & 0x01) << (unsigned char) (bit+4));
2732 pixel=(unsigned char) (GetPixelAlpha(image,p) == (Quantum)
2733 TransparentAlpha ? 1 : 0);
2734 *q|=((pixel & 0x01) << (unsigned char) (bit+4-1));
2735 p+=GetPixelChannels(image);
2743 register unsigned char
2746 for (x=0; x < (ssize_t) number_pixels ; x++)
2748 pixel=(unsigned char) GetPixelIndex(image,p);
2749 *q=((pixel & 0xf) << 4);
2750 pixel=(unsigned char) (16*QuantumScale*GetPixelAlpha(image,p)+0.5);
2751 *q|=((pixel & 0xf) << 0);
2752 p+=GetPixelChannels(image);
2759 register unsigned char
2762 for (x=0; x < (ssize_t) number_pixels; x++)
2764 q=PopCharPixel((unsigned char) GetPixelIndex(image,p),q);
2765 pixel=ScaleQuantumToChar(GetPixelAlpha(image,p));
2766 q=PopCharPixel(pixel,q);
2767 p+=GetPixelChannels(image);
2768 q+=quantum_info->pad;
2774 register unsigned short
2777 if (quantum_info->format == FloatingPointQuantumFormat)
2779 for (x=0; x < (ssize_t) number_pixels; x++)
2781 q=PopShortPixel(quantum_info->endian,(unsigned short)
2782 GetPixelIndex(image,p),q);
2783 pixel=SinglePrecisionToHalf(QuantumScale*GetPixelAlpha(image,p));
2784 q=PopShortPixel(quantum_info->endian,pixel,q);
2785 p+=GetPixelChannels(image);
2786 q+=quantum_info->pad;
2790 for (x=0; x < (ssize_t) number_pixels; x++)
2792 q=PopShortPixel(quantum_info->endian,(unsigned short)
2793 GetPixelIndex(image,p),q);
2794 pixel=ScaleQuantumToShort(GetPixelAlpha(image,p));
2795 q=PopShortPixel(quantum_info->endian,pixel,q);
2796 p+=GetPixelChannels(image);
2797 q+=quantum_info->pad;
2803 register unsigned int
2806 if (quantum_info->format == FloatingPointQuantumFormat)
2808 for (x=0; x < (ssize_t) number_pixels; x++)
2813 q=PopFloatPixel(quantum_info,(float) GetPixelIndex(image,p),q);
2814 pixel=(float) GetPixelAlpha(image,p);
2815 q=PopFloatPixel(quantum_info,pixel,q);
2816 p+=GetPixelChannels(image);
2817 q+=quantum_info->pad;
2821 for (x=0; x < (ssize_t) number_pixels; x++)
2823 q=PopLongPixel(quantum_info->endian,(unsigned int)
2824 GetPixelIndex(image,p),q);
2825 pixel=ScaleQuantumToLong(GetPixelAlpha(image,p));
2826 q=PopLongPixel(quantum_info->endian,pixel,q);
2827 p+=GetPixelChannels(image);
2828 q+=quantum_info->pad;
2834 if (quantum_info->format == FloatingPointQuantumFormat)
2836 for (x=0; x < (ssize_t) number_pixels; x++)
2841 q=PopDoublePixel(quantum_info,(double) GetPixelIndex(image,p),q);
2842 pixel=(double) GetPixelAlpha(image,p);
2843 q=PopDoublePixel(quantum_info,pixel,q);
2844 p+=GetPixelChannels(image);
2845 q+=quantum_info->pad;
2855 range=GetQuantumRange(quantum_info->depth);
2856 for (x=0; x < (ssize_t) number_pixels; x++)
2858 q=PopQuantumPixel(quantum_info,GetPixelIndex(image,p),q);
2859 q=PopQuantumPixel(quantum_info,ScaleQuantumToAny(GetPixelAlpha(image,p),
2861 p+=GetPixelChannels(image);
2862 q+=quantum_info->pad;
2869 static void ExportOpacityQuantum(const Image *image,QuantumInfo *quantum_info,
2870 const MagickSizeType number_pixels,const Quantum *magick_restrict p,
2871 unsigned char *magick_restrict q,ExceptionInfo *exception)
2879 assert(exception != (ExceptionInfo *) NULL);
2880 assert(exception->signature == MagickCoreSignature);
2881 switch (quantum_info->depth)
2885 register unsigned char
2888 for (x=0; x < (ssize_t) number_pixels; x++)
2890 pixel=ScaleQuantumToChar(GetPixelOpacity(image,p));
2891 q=PopCharPixel(pixel,q);
2892 p+=GetPixelChannels(image);
2893 q+=quantum_info->pad;
2899 register unsigned short
2902 if (quantum_info->format == FloatingPointQuantumFormat)
2904 for (x=0; x < (ssize_t) number_pixels; x++)
2906 pixel=SinglePrecisionToHalf(QuantumScale*GetPixelOpacity(image,p));
2907 q=PopShortPixel(quantum_info->endian,pixel,q);
2908 p+=GetPixelChannels(image);
2909 q+=quantum_info->pad;
2913 for (x=0; x < (ssize_t) number_pixels; x++)
2915 pixel=ScaleQuantumToShort(GetPixelOpacity(image,p));
2916 q=PopShortPixel(quantum_info->endian,pixel,q);
2917 p+=GetPixelChannels(image);
2918 q+=quantum_info->pad;
2924 register unsigned int
2927 if (quantum_info->format == FloatingPointQuantumFormat)
2929 for (x=0; x < (ssize_t) number_pixels; x++)
2931 q=PopFloatPixel(quantum_info,(float) GetPixelOpacity(image,p),q);
2932 p+=GetPixelChannels(image);
2933 q+=quantum_info->pad;
2937 for (x=0; x < (ssize_t) number_pixels; x++)
2939 pixel=ScaleQuantumToLong(GetPixelOpacity(image,p));
2940 q=PopLongPixel(quantum_info->endian,pixel,q);
2941 p+=GetPixelChannels(image);
2942 q+=quantum_info->pad;
2948 if (quantum_info->format == FloatingPointQuantumFormat)
2950 for (x=0; x < (ssize_t) number_pixels; x++)
2952 q=PopDoublePixel(quantum_info,(double) GetPixelOpacity(image,p),q);
2953 p+=GetPixelChannels(image);
2954 q+=quantum_info->pad;
2961 range=GetQuantumRange(quantum_info->depth);
2962 for (x=0; x < (ssize_t) number_pixels; x++)
2964 q=PopQuantumPixel(quantum_info,ScaleQuantumToAny(
2965 GetPixelOpacity(image,p),range),q);
2966 p+=GetPixelChannels(image);
2967 q+=quantum_info->pad;
2974 static void ExportRedQuantum(const Image *image,QuantumInfo *quantum_info,
2975 const MagickSizeType number_pixels,const Quantum *magick_restrict p,
2976 unsigned char *magick_restrict q,ExceptionInfo *exception)
2984 assert(exception != (ExceptionInfo *) NULL);
2985 assert(exception->signature == MagickCoreSignature);
2986 switch (quantum_info->depth)
2990 register unsigned char
2993 for (x=0; x < (ssize_t) number_pixels; x++)
2995 pixel=ScaleQuantumToChar(GetPixelRed(image,p));
2996 q=PopCharPixel(pixel,q);
2997 p+=GetPixelChannels(image);
2998 q+=quantum_info->pad;
3004 register unsigned short
3007 if (quantum_info->format == FloatingPointQuantumFormat)
3009 for (x=0; x < (ssize_t) number_pixels; x++)
3011 pixel=SinglePrecisionToHalf(QuantumScale*GetPixelRed(image,p));
3012 q=PopShortPixel(quantum_info->endian,pixel,q);
3013 p+=GetPixelChannels(image);
3014 q+=quantum_info->pad;
3018 for (x=0; x < (ssize_t) number_pixels; x++)
3020 pixel=ScaleQuantumToShort(GetPixelRed(image,p));
3021 q=PopShortPixel(quantum_info->endian,pixel,q);
3022 p+=GetPixelChannels(image);
3023 q+=quantum_info->pad;
3029 register unsigned int
3032 if (quantum_info->format == FloatingPointQuantumFormat)
3034 for (x=0; x < (ssize_t) number_pixels; x++)
3036 q=PopFloatPixel(quantum_info,(float) GetPixelRed(image,p),q);
3037 p+=GetPixelChannels(image);
3038 q+=quantum_info->pad;
3042 for (x=0; x < (ssize_t) number_pixels; x++)
3044 pixel=ScaleQuantumToLong(GetPixelRed(image,p));
3045 q=PopLongPixel(quantum_info->endian,pixel,q);
3046 p+=GetPixelChannels(image);
3047 q+=quantum_info->pad;
3053 if (quantum_info->format == FloatingPointQuantumFormat)
3055 for (x=0; x < (ssize_t) number_pixels; x++)
3057 q=PopDoublePixel(quantum_info,(double) GetPixelRed(image,p),q);
3058 p+=GetPixelChannels(image);
3059 q+=quantum_info->pad;
3066 range=GetQuantumRange(quantum_info->depth);
3067 for (x=0; x < (ssize_t) number_pixels; x++)
3069 q=PopQuantumPixel(quantum_info,ScaleQuantumToAny(GetPixelRed(image,p),
3071 p+=GetPixelChannels(image);
3072 q+=quantum_info->pad;
3079 static void ExportRGBQuantum(const Image *image,QuantumInfo *quantum_info,
3080 const MagickSizeType number_pixels,const Quantum *magick_restrict p,
3081 unsigned char *magick_restrict q,ExceptionInfo *exception)
3092 assert(exception != (ExceptionInfo *) NULL);
3093 assert(exception->signature == MagickCoreSignature);
3094 switch (quantum_info->depth)
3098 for (x=0; x < (ssize_t) number_pixels; x++)
3100 q=PopCharPixel(ScaleQuantumToChar(GetPixelRed(image,p)),q);
3101 q=PopCharPixel(ScaleQuantumToChar(GetPixelGreen(image,p)),q);
3102 q=PopCharPixel(ScaleQuantumToChar(GetPixelBlue(image,p)),q);
3103 p+=GetPixelChannels(image);
3104 q+=quantum_info->pad;
3110 register unsigned int
3113 range=GetQuantumRange(quantum_info->depth);
3114 if (quantum_info->pack == MagickFalse)
3116 for (x=0; x < (ssize_t) number_pixels; x++)
3118 pixel=(unsigned int) (
3119 ScaleQuantumToAny(GetPixelRed(image,p),range) << 22 |
3120 ScaleQuantumToAny(GetPixelGreen(image,p),range) << 12 |
3121 ScaleQuantumToAny(GetPixelBlue(image,p),range) << 2);
3122 q=PopLongPixel(quantum_info->endian,pixel,q);
3123 p+=GetPixelChannels(image);
3124 q+=quantum_info->pad;
3128 if (quantum_info->quantum == 32UL)
3130 for (x=0; x < (ssize_t) number_pixels; x++)
3132 pixel=(unsigned int) ScaleQuantumToAny(GetPixelRed(image,p),range);
3133 q=PopQuantumLongPixel(quantum_info,pixel,q);
3134 pixel=(unsigned int) ScaleQuantumToAny(GetPixelGreen(image,p),
3136 q=PopQuantumLongPixel(quantum_info,pixel,q);
3137 pixel=(unsigned int) ScaleQuantumToAny(GetPixelBlue(image,p),range);
3138 q=PopQuantumLongPixel(quantum_info,pixel,q);
3139 p+=GetPixelChannels(image);
3140 q+=quantum_info->pad;
3144 for (x=0; x < (ssize_t) number_pixels; x++)
3146 pixel=(unsigned int) ScaleQuantumToAny(GetPixelRed(image,p),range);
3147 q=PopQuantumPixel(quantum_info,pixel,q);
3148 pixel=(unsigned int) ScaleQuantumToAny(GetPixelGreen(image,p),range);
3149 q=PopQuantumPixel(quantum_info,pixel,q);
3150 pixel=(unsigned int) ScaleQuantumToAny(GetPixelBlue(image,p),range);
3151 q=PopQuantumPixel(quantum_info,pixel,q);
3152 p+=GetPixelChannels(image);
3153 q+=quantum_info->pad;
3159 register unsigned int
3162 range=GetQuantumRange(quantum_info->depth);
3163 if (quantum_info->pack == MagickFalse)
3165 for (x=0; x < (ssize_t) (3*number_pixels-1); x+=2)
3172 pixel=(unsigned int) ScaleQuantumToAny(GetPixelRed(image,p),
3178 pixel=(unsigned int) ScaleQuantumToAny(GetPixelGreen(image,p),
3184 pixel=(unsigned int) ScaleQuantumToAny(GetPixelBlue(image,p),
3186 p+=GetPixelChannels(image);
3190 q=PopShortPixel(quantum_info->endian,(unsigned short) (pixel << 4),
3197 pixel=(unsigned int) ScaleQuantumToAny(GetPixelRed(image,p),
3203 pixel=(unsigned int) ScaleQuantumToAny(GetPixelGreen(image,p),
3209 pixel=(unsigned int) ScaleQuantumToAny(GetPixelBlue(image,p),
3211 p+=GetPixelChannels(image);
3215 q=PopShortPixel(quantum_info->endian,(unsigned short) (pixel << 4),
3217 q+=quantum_info->pad;
3219 for (bit=0; bit < (ssize_t) (3*number_pixels % 2); bit++)
3221 switch ((x+bit) % 3)
3226 pixel=(unsigned int) ScaleQuantumToAny(GetPixelRed(image,p),
3232 pixel=(unsigned int) ScaleQuantumToAny(GetPixelGreen(image,p),
3238 pixel=(unsigned int) ScaleQuantumToAny(GetPixelBlue(image,p),
3240 p+=GetPixelChannels(image);
3244 q=PopShortPixel(quantum_info->endian,(unsigned short) (pixel << 4),
3246 q+=quantum_info->pad;
3249 p+=GetPixelChannels(image);
3252 if (quantum_info->quantum == 32UL)
3254 for (x=0; x < (ssize_t) number_pixels; x++)
3256 pixel=(unsigned int) ScaleQuantumToAny(GetPixelRed(image,p),range);
3257 q=PopQuantumLongPixel(quantum_info,pixel,q);
3258 pixel=(unsigned int) ScaleQuantumToAny(GetPixelGreen(image,p),
3260 q=PopQuantumLongPixel(quantum_info,pixel,q);
3261 pixel=(unsigned int) ScaleQuantumToAny(GetPixelBlue(image,p),range);
3262 q=PopQuantumLongPixel(quantum_info,pixel,q);
3263 p+=GetPixelChannels(image);
3264 q+=quantum_info->pad;
3268 for (x=0; x < (ssize_t) number_pixels; x++)
3270 pixel=(unsigned int) ScaleQuantumToAny(GetPixelRed(image,p),range);
3271 q=PopQuantumPixel(quantum_info,pixel,q);
3272 pixel=(unsigned int) ScaleQuantumToAny(GetPixelGreen(image,p),range);
3273 q=PopQuantumPixel(quantum_info,pixel,q);
3274 pixel=(unsigned int) ScaleQuantumToAny(GetPixelBlue(image,p),range);
3275 q=PopQuantumPixel(quantum_info,pixel,q);
3276 p+=GetPixelChannels(image);
3277 q+=quantum_info->pad;
3283 register unsigned short
3286 if (quantum_info->format == FloatingPointQuantumFormat)
3288 for (x=0; x < (ssize_t) number_pixels; x++)
3290 pixel=SinglePrecisionToHalf(QuantumScale*GetPixelRed(image,p));
3291 q=PopShortPixel(quantum_info->endian,pixel,q);
3292 pixel=SinglePrecisionToHalf(QuantumScale*GetPixelGreen(image,p));
3293 q=PopShortPixel(quantum_info->endian,pixel,q);
3294 pixel=SinglePrecisionToHalf(QuantumScale*GetPixelBlue(image,p));
3295 q=PopShortPixel(quantum_info->endian,pixel,q);
3296 p+=GetPixelChannels(image);
3297 q+=quantum_info->pad;
3301 for (x=0; x < (ssize_t) number_pixels; x++)
3303 pixel=ScaleQuantumToShort(GetPixelRed(image,p));
3304 q=PopShortPixel(quantum_info->endian,pixel,q);
3305 pixel=ScaleQuantumToShort(GetPixelGreen(image,p));
3306 q=PopShortPixel(quantum_info->endian,pixel,q);
3307 pixel=ScaleQuantumToShort(GetPixelBlue(image,p));
3308 q=PopShortPixel(quantum_info->endian,pixel,q);
3309 p+=GetPixelChannels(image);
3310 q+=quantum_info->pad;
3316 register unsigned int
3319 if (quantum_info->format == FloatingPointQuantumFormat)
3321 for (x=0; x < (ssize_t) number_pixels; x++)
3323 q=PopFloatPixel(quantum_info,(float) GetPixelRed(image,p),q);
3324 q=PopFloatPixel(quantum_info,(float) GetPixelGreen(image,p),q);
3325 q=PopFloatPixel(quantum_info,(float) GetPixelBlue(image,p),q);
3326 p+=GetPixelChannels(image);
3327 q+=quantum_info->pad;
3331 for (x=0; x < (ssize_t) number_pixels; x++)
3333 pixel=ScaleQuantumToLong(GetPixelRed(image,p));
3334 q=PopLongPixel(quantum_info->endian,pixel,q);
3335 pixel=ScaleQuantumToLong(GetPixelGreen(image,p));
3336 q=PopLongPixel(quantum_info->endian,pixel,q);
3337 pixel=ScaleQuantumToLong(GetPixelBlue(image,p));
3338 q=PopLongPixel(quantum_info->endian,pixel,q);
3339 p+=GetPixelChannels(image);
3340 q+=quantum_info->pad;
3346 if (quantum_info->format == FloatingPointQuantumFormat)
3348 for (x=0; x < (ssize_t) number_pixels; x++)
3350 q=PopDoublePixel(quantum_info,(double) GetPixelRed(image,p),q);
3351 q=PopDoublePixel(quantum_info,(double) GetPixelGreen(image,p),q);
3352 q=PopDoublePixel(quantum_info,(double) GetPixelBlue(image,p),q);
3353 p+=GetPixelChannels(image);
3354 q+=quantum_info->pad;
3361 range=GetQuantumRange(quantum_info->depth);
3362 for (x=0; x < (ssize_t) number_pixels; x++)
3364 q=PopQuantumPixel(quantum_info,ScaleQuantumToAny(GetPixelRed(image,p),
3366 q=PopQuantumPixel(quantum_info,ScaleQuantumToAny(GetPixelGreen(image,p),
3368 q=PopQuantumPixel(quantum_info,ScaleQuantumToAny(GetPixelBlue(image,p),
3370 p+=GetPixelChannels(image);
3371 q+=quantum_info->pad;
3378 static void ExportRGBAQuantum(const Image *image,QuantumInfo *quantum_info,
3379 const MagickSizeType number_pixels,const Quantum *magick_restrict p,
3380 unsigned char *magick_restrict q,ExceptionInfo *exception)
3388 assert(exception != (ExceptionInfo *) NULL);
3389 assert(exception->signature == MagickCoreSignature);
3390 switch (quantum_info->depth)
3394 register unsigned char
3397 for (x=0; x < (ssize_t) number_pixels; x++)
3399 pixel=ScaleQuantumToChar(GetPixelRed(image,p));
3400 q=PopCharPixel(pixel,q);
3401 pixel=ScaleQuantumToChar(GetPixelGreen(image,p));
3402 q=PopCharPixel(pixel,q);
3403 pixel=ScaleQuantumToChar(GetPixelBlue(image,p));
3404 q=PopCharPixel(pixel,q);
3405 pixel=ScaleQuantumToChar(GetPixelAlpha(image,p));
3406 q=PopCharPixel(pixel,q);
3407 p+=GetPixelChannels(image);
3408 q+=quantum_info->pad;
3414 register unsigned int
3417 range=GetQuantumRange(quantum_info->depth);
3418 if (quantum_info->pack == MagickFalse)
3432 for (x=0; x < (ssize_t) number_pixels; x++)
3434 for (i=0; i < 4; i++)
3438 case 0: quantum=GetPixelRed(image,p); break;
3439 case 1: quantum=GetPixelGreen(image,p); break;
3440 case 2: quantum=GetPixelBlue(image,p); break;
3441 case 3: quantum=GetPixelAlpha(image,p); break;
3447 pixel|=(size_t) (ScaleQuantumToAny((Quantum) quantum,
3453 pixel|=(size_t) (ScaleQuantumToAny((Quantum) quantum,
3459 pixel|=(size_t) (ScaleQuantumToAny((Quantum) quantum,
3461 q=PopLongPixel(quantum_info->endian,pixel,q);
3468 p+=GetPixelChannels(image);
3469 q+=quantum_info->pad;
3473 if (quantum_info->quantum == 32UL)
3475 for (x=0; x < (ssize_t) number_pixels; x++)
3477 pixel=(unsigned int) ScaleQuantumToAny(GetPixelRed(image,p),range);
3478 q=PopQuantumLongPixel(quantum_info,pixel,q);
3479 pixel=(unsigned int) ScaleQuantumToAny(GetPixelGreen(image,p),
3481 q=PopQuantumLongPixel(quantum_info,pixel,q);
3482 pixel=(unsigned int) ScaleQuantumToAny(GetPixelBlue(image,p),range);
3483 q=PopQuantumLongPixel(quantum_info,pixel,q);
3484 pixel=(unsigned int) ScaleQuantumToAny(GetPixelAlpha(image,p),
3486 q=PopQuantumLongPixel(quantum_info,pixel,q);
3487 p+=GetPixelChannels(image);
3488 q+=quantum_info->pad;
3492 for (x=0; x < (ssize_t) number_pixels; x++)
3494 pixel=(unsigned int) ScaleQuantumToAny(GetPixelRed(image,p),range);
3495 q=PopQuantumPixel(quantum_info,pixel,q);
3496 pixel=(unsigned int) ScaleQuantumToAny(GetPixelGreen(image,p),range);
3497 q=PopQuantumPixel(quantum_info,pixel,q);
3498 pixel=(unsigned int) ScaleQuantumToAny(GetPixelBlue(image,p),range);
3499 q=PopQuantumPixel(quantum_info,pixel,q);
3500 pixel=(unsigned int) ScaleQuantumToAny(GetPixelAlpha(image,p),range);
3501 q=PopQuantumPixel(quantum_info,pixel,q);
3502 p+=GetPixelChannels(image);
3503 q+=quantum_info->pad;
3509 register unsigned short
3512 if (quantum_info->format == FloatingPointQuantumFormat)
3514 for (x=0; x < (ssize_t) number_pixels; x++)
3516 pixel=SinglePrecisionToHalf(QuantumScale*GetPixelRed(image,p));
3517 q=PopShortPixel(quantum_info->endian,pixel,q);
3518 pixel=SinglePrecisionToHalf(QuantumScale*GetPixelGreen(image,p));
3519 q=PopShortPixel(quantum_info->endian,pixel,q);
3520 pixel=SinglePrecisionToHalf(QuantumScale*GetPixelBlue(image,p));
3521 q=PopShortPixel(quantum_info->endian,pixel,q);
3522 pixel=SinglePrecisionToHalf(QuantumScale*GetPixelAlpha(image,p));
3523 q=PopShortPixel(quantum_info->endian,pixel,q);
3524 p+=GetPixelChannels(image);
3525 q+=quantum_info->pad;
3529 for (x=0; x < (ssize_t) number_pixels; x++)
3531 pixel=ScaleQuantumToShort(GetPixelRed(image,p));
3532 q=PopShortPixel(quantum_info->endian,pixel,q);
3533 pixel=ScaleQuantumToShort(GetPixelGreen(image,p));
3534 q=PopShortPixel(quantum_info->endian,pixel,q);
3535 pixel=ScaleQuantumToShort(GetPixelBlue(image,p));
3536 q=PopShortPixel(quantum_info->endian,pixel,q);
3537 pixel=ScaleQuantumToShort(GetPixelAlpha(image,p));
3538 q=PopShortPixel(quantum_info->endian,pixel,q);
3539 p+=GetPixelChannels(image);
3540 q+=quantum_info->pad;
3546 register unsigned int
3549 if (quantum_info->format == FloatingPointQuantumFormat)
3551 for (x=0; x < (ssize_t) number_pixels; x++)
3556 q=PopFloatPixel(quantum_info,(float) GetPixelRed(image,p),q);
3557 q=PopFloatPixel(quantum_info,(float) GetPixelGreen(image,p),q);
3558 q=PopFloatPixel(quantum_info,(float) GetPixelBlue(image,p),q);
3559 pixel=(float) GetPixelAlpha(image,p);
3560 q=PopFloatPixel(quantum_info,pixel,q);
3561 p+=GetPixelChannels(image);
3562 q+=quantum_info->pad;
3566 for (x=0; x < (ssize_t) number_pixels; x++)
3568 pixel=ScaleQuantumToLong(GetPixelRed(image,p));
3569 q=PopLongPixel(quantum_info->endian,pixel,q);
3570 pixel=ScaleQuantumToLong(GetPixelGreen(image,p));
3571 q=PopLongPixel(quantum_info->endian,pixel,q);
3572 pixel=ScaleQuantumToLong(GetPixelBlue(image,p));
3573 q=PopLongPixel(quantum_info->endian,pixel,q);
3574 pixel=ScaleQuantumToLong(GetPixelAlpha(image,p));
3575 q=PopLongPixel(quantum_info->endian,pixel,q);
3576 p+=GetPixelChannels(image);
3577 q+=quantum_info->pad;
3583 if (quantum_info->format == FloatingPointQuantumFormat)
3588 for (x=0; x < (ssize_t) number_pixels; x++)
3590 q=PopDoublePixel(quantum_info,(double) GetPixelRed(image,p),q);
3591 q=PopDoublePixel(quantum_info,(double) GetPixelGreen(image,p),q);
3592 q=PopDoublePixel(quantum_info,(double) GetPixelBlue(image,p),q);
3593 pixel=(double) GetPixelAlpha(image,p);
3594 q=PopDoublePixel(quantum_info,pixel,q);
3595 p+=GetPixelChannels(image);
3596 q+=quantum_info->pad;
3603 range=GetQuantumRange(quantum_info->depth);
3604 for (x=0; x < (ssize_t) number_pixels; x++)
3606 q=PopQuantumPixel(quantum_info,ScaleQuantumToAny(GetPixelRed(image,p),
3608 q=PopQuantumPixel(quantum_info,ScaleQuantumToAny(GetPixelGreen(image,p),
3610 q=PopQuantumPixel(quantum_info,ScaleQuantumToAny(GetPixelBlue(image,p),
3612 q=PopQuantumPixel(quantum_info,ScaleQuantumToAny(GetPixelAlpha(image,p),
3614 p+=GetPixelChannels(image);
3615 q+=quantum_info->pad;
3622 static void ExportRGBOQuantum(const Image *image,QuantumInfo *quantum_info,
3623 const MagickSizeType number_pixels,const Quantum *magick_restrict p,
3624 unsigned char *magick_restrict q,ExceptionInfo *exception)
3632 assert(exception != (ExceptionInfo *) NULL);
3633 assert(exception->signature == MagickCoreSignature);
3634 switch (quantum_info->depth)
3638 register unsigned char
3641 for (x=0; x < (ssize_t) number_pixels; x++)
3643 pixel=ScaleQuantumToChar(GetPixelRed(image,p));
3644 q=PopCharPixel(pixel,q);
3645 pixel=ScaleQuantumToChar(GetPixelGreen(image,p));
3646 q=PopCharPixel(pixel,q);
3647 pixel=ScaleQuantumToChar(GetPixelBlue(image,p));
3648 q=PopCharPixel(pixel,q);
3649 pixel=ScaleQuantumToChar(GetPixelOpacity(image,p));
3650 q=PopCharPixel(pixel,q);
3651 p+=GetPixelChannels(image);
3652 q+=quantum_info->pad;
3658 register unsigned int
3661 range=GetQuantumRange(quantum_info->depth);
3662 if (quantum_info->pack == MagickFalse)
3676 for (x=0; x < (ssize_t) number_pixels; x++)
3678 for (i=0; i < 4; i++)
3682 case 0: quantum=GetPixelRed(image,p); break;
3683 case 1: quantum=GetPixelGreen(image,p); break;
3684 case 2: quantum=GetPixelBlue(image,p); break;
3685 case 3: quantum=GetPixelOpacity(image,p); break;
3691 pixel|=(size_t) (ScaleQuantumToAny((Quantum) quantum,
3697 pixel|=(size_t) (ScaleQuantumToAny((Quantum) quantum,
3703 pixel|=(size_t) (ScaleQuantumToAny((Quantum) quantum,
3705 q=PopLongPixel(quantum_info->endian,pixel,q);
3712 p+=GetPixelChannels(image);
3713 q+=quantum_info->pad;
3717 if (quantum_info->quantum == 32UL)
3719 for (x=0; x < (ssize_t) number_pixels; x++)
3721 pixel=(unsigned int) ScaleQuantumToAny(GetPixelRed(image,p),range);
3722 q=PopQuantumLongPixel(quantum_info,pixel,q);
3723 pixel=(unsigned int) ScaleQuantumToAny(GetPixelGreen(image,p),
3725 q=PopQuantumLongPixel(quantum_info,pixel,q);
3726 pixel=(unsigned int) ScaleQuantumToAny(GetPixelBlue(image,p),range);
3727 q=PopQuantumLongPixel(quantum_info,pixel,q);
3728 pixel=(unsigned int) ScaleQuantumToAny(GetPixelOpacity(image,p),
3730 q=PopQuantumLongPixel(quantum_info,pixel,q);
3731 p+=GetPixelChannels(image);
3732 q+=quantum_info->pad;
3736 for (x=0; x < (ssize_t) number_pixels; x++)
3738 pixel=(unsigned int) ScaleQuantumToAny(GetPixelRed(image,p),range);
3739 q=PopQuantumPixel(quantum_info,pixel,q);
3740 pixel=(unsigned int) ScaleQuantumToAny(GetPixelGreen(image,p),range);
3741 q=PopQuantumPixel(quantum_info,pixel,q);
3742 pixel=(unsigned int) ScaleQuantumToAny(GetPixelBlue(image,p),range);
3743 q=PopQuantumPixel(quantum_info,pixel,q);
3744 pixel=(unsigned int) ScaleQuantumToAny(GetPixelOpacity(image,p),range);
3745 q=PopQuantumPixel(quantum_info,pixel,q);
3746 p+=GetPixelChannels(image);
3747 q+=quantum_info->pad;
3753 register unsigned short
3756 if (quantum_info->format == FloatingPointQuantumFormat)
3758 for (x=0; x < (ssize_t) number_pixels; x++)
3760 pixel=SinglePrecisionToHalf(QuantumScale*GetPixelRed(image,p));
3761 q=PopShortPixel(quantum_info->endian,pixel,q);
3762 pixel=SinglePrecisionToHalf(QuantumScale*GetPixelGreen(image,p));
3763 q=PopShortPixel(quantum_info->endian,pixel,q);
3764 pixel=SinglePrecisionToHalf(QuantumScale*GetPixelBlue(image,p));
3765 q=PopShortPixel(quantum_info->endian,pixel,q);
3766 pixel=SinglePrecisionToHalf(QuantumScale*GetPixelOpacity(image,p));
3767 q=PopShortPixel(quantum_info->endian,pixel,q);
3768 p+=GetPixelChannels(image);
3769 q+=quantum_info->pad;
3773 for (x=0; x < (ssize_t) number_pixels; x++)
3775 pixel=ScaleQuantumToShort(GetPixelRed(image,p));
3776 q=PopShortPixel(quantum_info->endian,pixel,q);
3777 pixel=ScaleQuantumToShort(GetPixelGreen(image,p));
3778 q=PopShortPixel(quantum_info->endian,pixel,q);
3779 pixel=ScaleQuantumToShort(GetPixelBlue(image,p));
3780 q=PopShortPixel(quantum_info->endian,pixel,q);
3781 pixel=ScaleQuantumToShort(GetPixelOpacity(image,p));
3782 q=PopShortPixel(quantum_info->endian,pixel,q);
3783 p+=GetPixelChannels(image);
3784 q+=quantum_info->pad;
3790 register unsigned int
3793 if (quantum_info->format == FloatingPointQuantumFormat)
3795 for (x=0; x < (ssize_t) number_pixels; x++)
3800 q=PopFloatPixel(quantum_info,(float) GetPixelRed(image,p),q);
3801 q=PopFloatPixel(quantum_info,(float) GetPixelGreen(image,p),q);
3802 q=PopFloatPixel(quantum_info,(float) GetPixelBlue(image,p),q);
3803 pixel=(float) GetPixelOpacity(image,p);
3804 q=PopFloatPixel(quantum_info,pixel,q);
3805 p+=GetPixelChannels(image);
3806 q+=quantum_info->pad;
3810 for (x=0; x < (ssize_t) number_pixels; x++)
3812 pixel=ScaleQuantumToLong(GetPixelRed(image,p));
3813 q=PopLongPixel(quantum_info->endian,pixel,q);
3814 pixel=ScaleQuantumToLong(GetPixelGreen(image,p));
3815 q=PopLongPixel(quantum_info->endian,pixel,q);
3816 pixel=ScaleQuantumToLong(GetPixelBlue(image,p));
3817 q=PopLongPixel(quantum_info->endian,pixel,q);
3818 pixel=ScaleQuantumToLong(GetPixelOpacity(image,p));
3819 q=PopLongPixel(quantum_info->endian,pixel,q);
3820 p+=GetPixelChannels(image);
3821 q+=quantum_info->pad;
3827 if (quantum_info->format == FloatingPointQuantumFormat)
3832 for (x=0; x < (ssize_t) number_pixels; x++)
3834 q=PopDoublePixel(quantum_info,(double) GetPixelRed(image,p),q);
3835 q=PopDoublePixel(quantum_info,(double) GetPixelGreen(image,p),q);
3836 q=PopDoublePixel(quantum_info,(double) GetPixelBlue(image,p),q);
3837 pixel=(double) GetPixelOpacity(image,p);
3838 q=PopDoublePixel(quantum_info,pixel,q);
3839 p+=GetPixelChannels(image);
3840 q+=quantum_info->pad;
3847 range=GetQuantumRange(quantum_info->depth);
3848 for (x=0; x < (ssize_t) number_pixels; x++)
3850 q=PopQuantumPixel(quantum_info,ScaleQuantumToAny(GetPixelRed(image,p),
3852 q=PopQuantumPixel(quantum_info,ScaleQuantumToAny(GetPixelGreen(image,p),
3854 q=PopQuantumPixel(quantum_info,ScaleQuantumToAny(GetPixelBlue(image,p),
3856 q=PopQuantumPixel(quantum_info,ScaleQuantumToAny(GetPixelOpacity(image,p),
3858 p+=GetPixelChannels(image);
3859 q+=quantum_info->pad;
3866 MagickExport size_t ExportQuantumPixels(const Image *image,
3867 CacheView *image_view,QuantumInfo *quantum_info,
3868 const QuantumType quantum_type,unsigned char *magick_restrict pixels,
3869 ExceptionInfo *exception)
3874 register const Quantum
3880 register unsigned char
3886 assert(image != (Image *) NULL);
3887 assert(image->signature == MagickCoreSignature);
3888 if (image->debug != MagickFalse)
3889 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
3890 assert(quantum_info != (QuantumInfo *) NULL);
3891 assert(quantum_info->signature == MagickCoreSignature);
3892 if (pixels == (unsigned char *) NULL)
3893 pixels=(unsigned char *) GetQuantumPixels(quantum_info);
3894 if (image_view == (CacheView *) NULL)
3896 number_pixels=GetImageExtent(image);
3897 p=GetVirtualPixelQueue(image);
3901 number_pixels=GetCacheViewExtent(image_view);
3902 p=GetCacheViewVirtualPixelQueue(image_view);
3904 if (quantum_info->alpha_type == AssociatedQuantumAlpha)
3915 q=GetAuthenticPixelQueue(image);
3916 if (image_view != (CacheView *) NULL)
3917 q=GetCacheViewAuthenticPixelQueue(image_view);
3918 for (x=0; x < (ssize_t) image->columns; x++)
3923 if (GetPixelReadMask(image,q) == 0)
3925 q+=GetPixelChannels(image);
3928 Sa=QuantumScale*GetPixelAlpha(image,q);
3929 for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
3931 PixelChannel channel=GetPixelChannelChannel(image,i);
3932 PixelTrait traits=GetPixelChannelTraits(image,channel);
3933 if ((traits & UpdatePixelTrait) == 0)
3935 q[i]=ClampToQuantum(Sa*q[i]);
3937 q+=GetPixelChannels(image);
3940 if ((quantum_type == CbYCrQuantum) || (quantum_type == CbYCrAQuantum))
3948 q=GetAuthenticPixelQueue(image);
3949 if (image_view != (CacheView *) NULL)
3950 q=GetAuthenticPixelQueue(image);
3951 for (x=0; x < (ssize_t) number_pixels; x++)
3953 quantum=GetPixelRed(image,q);
3954 SetPixelRed(image,GetPixelGreen(image,q),q);
3955 SetPixelGreen(image,quantum,q);
3956 q+=GetPixelChannels(image);
3961 ResetQuantumState(quantum_info);
3962 extent=GetQuantumExtent(image,quantum_info,quantum_type);
3963 switch (quantum_type)
3967 ExportAlphaQuantum(image,quantum_info,number_pixels,p,q,exception);
3972 ExportBGRQuantum(image,quantum_info,number_pixels,p,q,exception);
3977 ExportBGRAQuantum(image,quantum_info,number_pixels,p,q,exception);
3982 ExportBGROQuantum(image,quantum_info,number_pixels,p,q,exception);
3987 ExportBlackQuantum(image,quantum_info,number_pixels,p,q,exception);
3993 ExportBlueQuantum(image,quantum_info,number_pixels,p,q,exception);
3998 ExportCMYKQuantum(image,quantum_info,number_pixels,p,q,exception);
4003 ExportCMYKAQuantum(image,quantum_info,number_pixels,p,q,exception);
4008 ExportCMYKOQuantum(image,quantum_info,number_pixels,p,q,exception);
4013 ExportCbYCrYQuantum(image,quantum_info,number_pixels,p,q,exception);
4018 ExportGrayQuantum(image,quantum_info,number_pixels,p,q,exception);
4021 case GrayAlphaQuantum:
4023 ExportGrayAlphaQuantum(image,quantum_info,number_pixels,p,q,exception);
4027 case MagentaQuantum:
4029 ExportGreenQuantum(image,quantum_info,number_pixels,p,q,exception);
4034 ExportIndexQuantum(image,quantum_info,number_pixels,p,q,exception);
4037 case IndexAlphaQuantum:
4039 ExportIndexAlphaQuantum(image,quantum_info,number_pixels,p,q,exception);
4045 ExportRedQuantum(image,quantum_info,number_pixels,p,q,exception);
4048 case OpacityQuantum:
4050 ExportOpacityQuantum(image,quantum_info,number_pixels,p,q,exception);
4056 ExportRGBQuantum(image,quantum_info,number_pixels,p,q,exception);
4062 ExportRGBAQuantum(image,quantum_info,number_pixels,p,q,exception);
4067 ExportRGBOQuantum(image,quantum_info,number_pixels,p,q,exception);
4073 if ((quantum_type == CbYCrQuantum) || (quantum_type == CbYCrAQuantum))
4081 q=GetAuthenticPixelQueue(image);
4082 if (image_view != (CacheView *) NULL)
4083 q=GetCacheViewAuthenticPixelQueue(image_view);
4084 for (x=0; x < (ssize_t) number_pixels; x++)
4086 quantum=GetPixelRed(image,q);
4087 SetPixelRed(image,GetPixelGreen(image,q),q);
4088 SetPixelGreen(image,quantum,q);
4089 q+=GetPixelChannels(image);