578
574
Convert PBM raw image to pixel packets.
580
quantum_info=AcquireQuantumInfo((const ImageInfo *) NULL,image);
581
if (quantum_info == (QuantumInfo *) NULL)
582
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
583
quantum_info->min_is_white=MagickTrue;
584
576
quantum_type=GrayQuantum;
585
577
if (image->storage_class == PseudoClass)
586
578
quantum_type=IndexQuantum;
587
pixels=GetQuantumPixels(quantum_info);
588
length=GetQuantumExtent(image,quantum_info,quantum_type);
579
quantum_info=AcquireQuantumInfo(image_info,image);
580
if (quantum_info == (QuantumInfo *) NULL)
581
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
582
SetQuantumMinIsWhite(quantum_info,MagickTrue);
583
extent=GetQuantumExtent(image,quantum_info,quantum_type);
584
image_view=AcquireCacheView(image);
585
#if defined(MAGICKCORE_OPENMP_SUPPORT)
586
#pragma omp parallel for schedule(dynamic,1) shared(row,status,quantum_type)
589
588
for (y=0; y < (long) image->rows; y++)
591
q=SetImagePixels(image,0,y,image->columns,1);
608
if (status == MagickFalse)
610
pixels=GetQuantumPixels(quantum_info);
611
#if defined(MAGICKCORE_OPENMP_SUPPORT)
612
#pragma omp critical (MagickCore_ReadPNMImage)
615
count=ReadBlob(image,extent,pixels);
616
if ((image->progress_monitor != (MagickProgressMonitor) NULL) &&
617
(image->previous == (Image *) NULL))
622
proceed=SetImageProgress(image,LoadImageTag,row,image->rows);
623
if (proceed == MagickFalse)
628
if (count != (ssize_t) extent)
630
q=QueueCacheViewAuthenticPixels(image_view,0,offset,image->columns,1,
592
632
if (q == (PixelPacket *) NULL)
594
count=ReadBlob(image,length,pixels);
595
if (count != (ssize_t) length)
597
length=ImportQuantumPixels(image,quantum_info,quantum_type,pixels);
598
if (count != (ssize_t) length)
600
if (SyncImagePixels(image) == MagickFalse)
602
if (image->previous == (Image *) NULL)
604
status=SetImageProgress(image,LoadImageTag,y,image->rows);
605
if (status == MagickFalse)
637
length=ImportQuantumPixels(image,image_view,quantum_info,quantum_type,
639
if (length != extent)
641
sync=SyncCacheViewAuthenticPixels(image_view,exception);
642
if (sync == MagickFalse)
645
image_view=DestroyCacheView(image_view);
646
quantum_info=DestroyQuantumInfo(quantum_info);
647
if (status == MagickFalse)
648
ThrowReaderException(CorruptImageError,"UnableToReadImageData");
609
649
SetQuantumImageType(image,quantum_type);
610
quantum_info=DestroyQuantumInfo(quantum_info);
619
658
Convert PGM raw image to pixel packets.
621
quantum_info=AcquireQuantumInfo((const ImageInfo *) NULL,image);
660
range=GetQuantumRange(image->depth);
661
quantum_type=GrayQuantum;
662
extent=(image->depth <= 8 ? 1 : 2)*image->columns;
663
quantum_info=AcquireQuantumInfo(image_info,image);
622
664
if (quantum_info == (QuantumInfo *) NULL)
623
665
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
624
quantum_type=GrayQuantum;
625
scale=GetQuantumScale(image->depth);
626
pixels=GetQuantumPixels(quantum_info);
627
length=(image->depth <= 8 ? 1 : 2)*image->columns;
666
image_view=AcquireCacheView(image);
667
#if defined(MAGICKCORE_OPENMP_SUPPORT)
668
#pragma omp parallel for schedule(dynamic,1) shared(row,status,quantum_type)
628
670
for (y=0; y < (long) image->rows; y++)
630
q=SetImagePixels(image,0,y,image->columns,1);
678
register const unsigned char
693
if (status == MagickFalse)
695
pixels=GetQuantumPixels(quantum_info);
696
#if defined(MAGICKCORE_OPENMP_SUPPORT)
697
#pragma omp critical (MagickCore_ReadPNMImage)
700
count=ReadBlob(image,extent,pixels);
701
if ((image->progress_monitor != (MagickProgressMonitor) NULL) &&
702
(image->previous == (Image *) NULL))
707
proceed=SetImageProgress(image,LoadImageTag,row,image->rows);
708
if (proceed == MagickFalse)
713
if (count != (ssize_t) extent)
715
q=QueueCacheViewAuthenticPixels(image_view,0,offset,image->columns,1,
631
717
if (q == (PixelPacket *) NULL)
633
count=ReadBlob(image,length,pixels);
634
if (count != (ssize_t) length)
635
ThrowReaderException(CorruptImageError,"UnableToReadImageData");
637
723
if ((image->depth == 8) || (image->depth == 16))
638
(void) ImportQuantumPixels(image,quantum_info,quantum_type,pixels);
724
(void) ImportQuantumPixels(image,image_view,quantum_info,
725
quantum_type,pixels,exception);
640
727
if (image->depth <= 8)
690
775
Convert PNM raster image to pixel packets.
692
777
type=BilevelType;
693
quantum_info=AcquireQuantumInfo((const ImageInfo *) NULL,image);
694
if (quantum_info == (QuantumInfo *) NULL)
695
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
696
778
quantum_type=RGBQuantum;
697
pixels=GetQuantumPixels(quantum_info);
698
length=3*(image->depth <= 8 ? 1 : 2)*image->columns;
699
scale=GetQuantumScale(image->depth);
779
extent=3*(image->depth <= 8 ? 1 : 2)*image->columns;
780
range=GetQuantumRange(image->depth);
781
quantum_info=AcquireQuantumInfo(image_info,image);
782
if (quantum_info == (QuantumInfo *) NULL)
783
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
784
image_view=AcquireCacheView(image);
785
#if defined(MAGICKCORE_OPENMP_SUPPORT)
786
#pragma omp parallel for schedule(dynamic,1) shared(row,status,type)
700
788
for (y=0; y < (long) image->rows; y++)
702
q=SetImagePixels(image,0,y,image->columns,1);
796
register const unsigned char
814
if (status == MagickFalse)
816
pixels=GetQuantumPixels(quantum_info);
817
#if defined(MAGICKCORE_OPENMP_SUPPORT)
818
#pragma omp critical (MagickCore_ReadPNMImage)
821
count=ReadBlob(image,extent,pixels);
822
if ((image->progress_monitor != (MagickProgressMonitor) NULL) &&
823
(image->previous == (Image *) NULL))
828
proceed=SetImageProgress(image,LoadImageTag,row,image->rows);
829
if (proceed == MagickFalse)
834
if (count != (ssize_t) extent)
836
q=QueueCacheViewAuthenticPixels(image_view,0,offset,image->columns,1,
703
838
if (q == (PixelPacket *) NULL)
705
count=ReadBlob(image,length,pixels);
706
if (count != (ssize_t) length)
707
ThrowReaderException(CorruptImageError,"UnableToReadImageData");
709
844
if ((image->depth == 8) || (image->depth == 16))
710
length=ImportQuantumPixels(image,quantum_info,quantum_type,pixels);
846
length=ImportQuantumPixels(image,image_view,quantum_info,
847
quantum_type,pixels,exception);
848
if (length != extent)
712
852
if (image->depth <= 8)
741
881
for (x=0; x < (long) image->columns; x++)
743
883
p=PushShortPixel(MSBEndian,p,&pixel);
744
r->red=ScaleAnyToQuantum(pixel,image->depth,scale);
745
p=PushShortPixel(MSBEndian,p,&pixel);
746
r->green=ScaleAnyToQuantum(pixel,image->depth,scale);
747
p=PushShortPixel(MSBEndian,p,&pixel);
748
r->blue=ScaleAnyToQuantum(pixel,image->depth,scale);
884
r->red=ScaleAnyToQuantum(pixel,range);
885
p=PushShortPixel(MSBEndian,p,&pixel);
886
r->green=ScaleAnyToQuantum(pixel,range);
887
p=PushShortPixel(MSBEndian,p,&pixel);
888
r->blue=ScaleAnyToQuantum(pixel,range);
788
929
Convert PAM raster image to pixel packets.
790
quantum_info=AcquireQuantumInfo((const ImageInfo *) NULL,image);
791
if (quantum_info == (QuantumInfo *) NULL)
792
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
793
pixels=GetQuantumPixels(quantum_info);
794
scale=GetQuantumScale(image->depth);
931
range=GetQuantumRange(image->depth);
795
932
switch (quantum_type)
797
934
case GrayQuantum:
798
935
case GrayAlphaQuantum:
800
length=(image->depth <= 8 ? 1 : 2)*image->columns;
803
940
case CMYKQuantum:
804
941
case CMYKAQuantum:
806
length=4*(image->depth <= 8 ? 1 : 2)*image->columns;
811
length=3*(image->depth <= 8 ? 1 : 2)*image->columns;
952
if (image->matte != MagickFalse)
954
extent=channels*(image->depth <= 8 ? 1 : 2)*image->columns;
955
quantum_info=AcquireQuantumInfo(image_info,image);
956
if (quantum_info == (QuantumInfo *) NULL)
957
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
958
image_view=AcquireCacheView(image);
959
#if defined(MAGICKCORE_OPENMP_SUPPORT)
960
#pragma omp parallel for schedule(dynamic,1) shared(row,status,quantum_type)
815
962
for (y=0; y < (long) image->rows; y++)
817
q=SetImagePixels(image,0,y,image->columns,1);
970
register const unsigned char
985
if (status == MagickFalse)
987
pixels=GetQuantumPixels(quantum_info);
988
#if defined(MAGICKCORE_OPENMP_SUPPORT)
989
#pragma omp critical (MagickCore_ReadPNMImage)
992
count=ReadBlob(image,extent,pixels);
993
if ((image->progress_monitor != (MagickProgressMonitor) NULL) &&
994
(image->previous == (Image *) NULL))
999
proceed=SetImageProgress(image,LoadImageTag,row,image->rows);
1000
if (proceed == MagickFalse)
1005
if (count != (ssize_t) extent)
1007
q=QueueCacheViewAuthenticPixels(image_view,0,offset,image->columns,1,
818
1009
if (q == (PixelPacket *) NULL)
820
indexes=GetIndexes(image);
821
count=ReadBlob(image,length,pixels);
822
if (count != (ssize_t) length)
823
ThrowReaderException(CorruptImageError,"UnableToReadImageData");
1014
indexes=GetCacheViewAuthenticIndexQueue(image_view);
825
1016
if ((image->depth == 8) || (image->depth == 16))
826
(void) ImportQuantumPixels(image,quantum_info,quantum_type,pixels);
1017
(void) ImportQuantumPixels(image,image_view,quantum_info,
1018
quantum_type,pixels,exception);
828
1020
switch (quantum_type)
881
1075
for (x=0; x < (long) image->columns; x++)
883
1077
p=PushCharPixel(p,&pixel);
884
q->red=ScaleAnyToQuantum(pixel,image->depth,scale);
885
p=PushCharPixel(p,&pixel);
886
q->green=ScaleAnyToQuantum(pixel,image->depth,scale);
887
p=PushCharPixel(p,&pixel);
888
q->blue=ScaleAnyToQuantum(pixel,image->depth,scale);
889
p=PushCharPixel(p,&pixel);
890
indexes[x]=ScaleAnyToQuantum(pixel,image->depth,scale);
1078
q->red=ScaleAnyToQuantum(pixel,range);
1079
p=PushCharPixel(p,&pixel);
1080
q->green=ScaleAnyToQuantum(pixel,range);
1081
p=PushCharPixel(p,&pixel);
1082
q->blue=ScaleAnyToQuantum(pixel,range);
1083
p=PushCharPixel(p,&pixel);
1084
indexes[x]=ScaleAnyToQuantum(pixel,range);
1085
q->opacity=OpaqueOpacity;
891
1086
if (image->matte != MagickFalse)
893
1088
p=PushCharPixel(p,&pixel);
894
q->opacity=ScaleAnyToQuantum(pixel,image->depth,scale);
1089
q->opacity=ScaleAnyToQuantum(pixel,range);
904
1099
for (x=0; x < (long) image->columns; x++)
906
1101
p=PushShortPixel(MSBEndian,p,&pixel);
907
q->red=ScaleAnyToQuantum(pixel,image->depth,scale);
908
p=PushShortPixel(MSBEndian,p,&pixel);
909
q->green=ScaleAnyToQuantum(pixel,image->depth,scale);
910
p=PushShortPixel(MSBEndian,p,&pixel);
911
q->blue=ScaleAnyToQuantum(pixel,image->depth,scale);
912
p=PushShortPixel(MSBEndian,p,&pixel);
913
indexes[x]=ScaleAnyToQuantum(pixel,image->depth,scale);
1102
q->red=ScaleAnyToQuantum(pixel,range);
1103
p=PushShortPixel(MSBEndian,p,&pixel);
1104
q->green=ScaleAnyToQuantum(pixel,range);
1105
p=PushShortPixel(MSBEndian,p,&pixel);
1106
q->blue=ScaleAnyToQuantum(pixel,range);
1107
p=PushShortPixel(MSBEndian,p,&pixel);
1108
indexes[x]=ScaleAnyToQuantum(pixel,range);
1109
q->opacity=OpaqueOpacity;
914
1110
if (image->matte != MagickFalse)
916
1112
p=PushShortPixel(MSBEndian,p,&pixel);
917
q->opacity=ScaleAnyToQuantum(pixel,image->depth,scale);
1113
q->opacity=ScaleAnyToQuantum(pixel,range);
931
1127
for (x=0; x < (long) image->columns; x++)
933
1129
p=PushCharPixel(p,&pixel);
934
q->red=ScaleAnyToQuantum(pixel,image->depth,scale);
935
p=PushCharPixel(p,&pixel);
936
q->green=ScaleAnyToQuantum(pixel,image->depth,scale);
937
p=PushCharPixel(p,&pixel);
938
q->blue=ScaleAnyToQuantum(pixel,image->depth,scale);
1130
q->red=ScaleAnyToQuantum(pixel,range);
1131
p=PushCharPixel(p,&pixel);
1132
q->green=ScaleAnyToQuantum(pixel,range);
1133
p=PushCharPixel(p,&pixel);
1134
q->blue=ScaleAnyToQuantum(pixel,range);
1135
q->opacity=OpaqueOpacity;
939
1136
if (image->matte != MagickFalse)
941
1138
p=PushCharPixel(p,&pixel);
942
q->opacity=ScaleAnyToQuantum(pixel,image->depth,scale);
1139
q->opacity=ScaleAnyToQuantum(pixel,range);
952
1149
for (x=0; x < (long) image->columns; x++)
954
1151
p=PushShortPixel(MSBEndian,p,&pixel);
955
q->red=ScaleAnyToQuantum(pixel,image->depth,scale);
956
p=PushShortPixel(MSBEndian,p,&pixel);
957
q->green=ScaleAnyToQuantum(pixel,image->depth,scale);
958
p=PushShortPixel(MSBEndian,p,&pixel);
959
q->blue=ScaleAnyToQuantum(pixel,image->depth,scale);
1152
q->red=ScaleAnyToQuantum(pixel,range);
1153
p=PushShortPixel(MSBEndian,p,&pixel);
1154
q->green=ScaleAnyToQuantum(pixel,range);
1155
p=PushShortPixel(MSBEndian,p,&pixel);
1156
q->blue=ScaleAnyToQuantum(pixel,range);
1157
q->opacity=OpaqueOpacity;
960
1158
if (image->matte != MagickFalse)
962
1160
p=PushShortPixel(MSBEndian,p,&pixel);
963
q->opacity=ScaleAnyToQuantum(pixel,image->depth,scale);
1161
q->opacity=ScaleAnyToQuantum(pixel,range);
971
if (SyncImagePixels(image) == MagickFalse)
973
if (image->previous == (Image *) NULL)
975
status=SetImageProgress(image,LoadImageTag,y,image->rows);
976
if (status == MagickFalse)
1169
sync=SyncCacheViewAuthenticPixels(image_view,exception);
1170
if (sync == MagickFalse)
1173
image_view=DestroyCacheView(image_view);
1174
quantum_info=DestroyQuantumInfo(quantum_info);
1175
if (status == MagickFalse)
1176
ThrowReaderException(CorruptImageError,"UnableToReadImageData");
980
1177
SetQuantumImageType(image,quantum_type);
981
quantum_info=DestroyQuantumInfo(quantum_info);
988
quantum_info=AcquireQuantumInfo((const ImageInfo *) NULL,image);
989
if (quantum_info == (QuantumInfo *) NULL)
990
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
991
quantum_info->format=FloatingPointQuantumFormat;
992
quantum_info->scale=(MagickRealType) QuantumRange*fabs(quantum_scale);
1184
Convert PFM raster image to pixel packets.
993
1186
quantum_type=format == 'f' ? GrayQuantum : RGBQuantum;
994
1187
image->endian=quantum_scale < 0.0 ? LSBEndian : MSBEndian;
995
pixels=GetQuantumPixels(quantum_info);
996
length=GetQuantumExtent(image,quantum_info,quantum_type);
997
for (y=(long) image->rows-1; y >= 0; y--)
1189
quantum_info=AcquireQuantumInfo(image_info,image);
1190
if (quantum_info == (QuantumInfo *) NULL)
1191
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
1192
status=SetQuantumDepth(image,quantum_info,32);
1193
if (status == MagickFalse)
1194
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
1195
status=SetQuantumFormat(image,quantum_info,FloatingPointQuantumFormat);
1196
if (status == MagickFalse)
1197
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
1198
SetQuantumScale(quantum_info,(MagickRealType) QuantumRange*
1199
fabs(quantum_scale));
1200
extent=GetQuantumExtent(image,quantum_info,quantum_type);
1201
image_view=AcquireCacheView(image);
1202
#if defined(MAGICKCORE_OPENMP_SUPPORT)
1203
#pragma omp parallel for schedule(dynamic,1) shared(row,status,quantum_type)
1205
for (y=0; y < (long) image->rows; y++)
999
q=SetImagePixels(image,0,y,image->columns,1);
1213
register PixelPacket
1225
if (status == MagickFalse)
1227
pixels=GetQuantumPixels(quantum_info);
1228
#if defined(MAGICKCORE_OPENMP_SUPPORT)
1229
#pragma omp critical (MagickCore_ReadPNMImage)
1232
count=ReadBlob(image,extent,pixels);
1233
if ((image->progress_monitor != (MagickProgressMonitor) NULL) &&
1234
(image->previous == (Image *) NULL))
1239
proceed=SetImageProgress(image,LoadImageTag,row,image->rows);
1240
if (proceed == MagickFalse)
1245
if ((size_t) count != extent)
1247
q=QueueCacheViewAuthenticPixels(image_view,0,(long) (image->rows-
1248
offset-1),image->columns,1,exception);
1000
1249
if (q == (PixelPacket *) NULL)
1002
count=ReadBlob(image,length,pixels);
1003
if ((size_t) count != length)
1005
length=ImportQuantumPixels(image,quantum_info,quantum_type,pixels);
1006
if (count != (ssize_t) length)
1007
ThrowReaderException(CorruptImageError,"UnableToReadImageData");
1008
if (SyncImagePixels(image) == MagickFalse)
1010
if (image->previous == (Image *) NULL)
1012
status=SetImageProgress(image,LoadImageTag,y,image->rows);
1013
if (status == MagickFalse)
1254
length=ImportQuantumPixels(image,image_view,quantum_info,quantum_type,
1256
if (length != extent)
1258
sync=SyncCacheViewAuthenticPixels(image_view,exception);
1259
if (sync == MagickFalse)
1262
image_view=DestroyCacheView(image_view);
1263
quantum_info=DestroyQuantumInfo(quantum_info);
1264
if (status == MagickFalse)
1265
ThrowReaderException(CorruptImageError,"UnableToReadImageData");
1017
1266
SetQuantumImageType(image,quantum_type);
1018
quantum_info=DestroyQuantumInfo(quantum_info);
1565
1815
pixels=GetQuantumPixels(quantum_info);
1566
1816
for (y=0; y < (long) image->rows; y++)
1568
p=AcquireImagePixels(image,0,y,image->columns,1,&image->exception);
1818
p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
1569
1819
if (p == (const PixelPacket *) NULL)
1571
length=ExportQuantumPixels(image,quantum_info,GrayQuantum,pixels);
1572
count=WriteBlob(image,length,pixels);
1573
if (count != (ssize_t) length)
1821
extent=ExportQuantumPixels(image,(const ViewInfo *) NULL,quantum_info,
1822
GrayQuantum,pixels,&image->exception);
1823
count=WriteBlob(image,extent,pixels);
1824
if (count != (ssize_t) extent)
1575
1826
if (image->previous == (Image *) NULL)
1600
1851
ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
1601
1852
quantum_info->min_is_white=MagickTrue;
1602
1853
pixels=GetQuantumPixels(quantum_info);
1603
length=GetQuantumExtent(image,quantum_info,GrayQuantum);
1604
scale=GetQuantumScale(image->depth);
1854
extent=GetQuantumExtent(image,quantum_info,GrayQuantum);
1855
range=GetQuantumRange(image->depth);
1605
1856
for (y=0; y < (long) image->rows; y++)
1607
p=AcquireImagePixels(image,0,y,image->columns,1,&image->exception);
1858
p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
1608
1859
if (p == (const PixelPacket *) NULL)
1611
1862
if ((image->depth == 8) || (image->depth == 16))
1612
length=ExportQuantumPixels(image,quantum_info,GrayQuantum,pixels);
1863
extent=ExportQuantumPixels(image,(const ViewInfo *) NULL,
1864
quantum_info,GrayQuantum,pixels,&image->exception);
1615
1867
if (image->depth <= 8)
1616
1868
for (x=0; x < (long) image->columns; x++)
1618
1870
if (IsGrayPixel(p) == MagickFalse)
1619
pixel=ScaleQuantumToAny(PixelIntensityToQuantum(p),
1620
image->depth,scale);
1871
pixel=ScaleQuantumToAny(PixelIntensityToQuantum(p),range);
1623
1874
if (image->depth == 8)
1624
1875
pixel=ScaleQuantumToChar(p->red);
1626
pixel=ScaleQuantumToAny(p->red,image->depth,scale);
1877
pixel=ScaleQuantumToAny(p->red,range);
1628
1879
q=PopCharPixel((unsigned char) pixel,q);
1676
1926
if (quantum_info == (QuantumInfo *) NULL)
1677
1927
ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
1678
1928
pixels=GetQuantumPixels(quantum_info);
1679
length=GetQuantumExtent(image,quantum_info,quantum_type);
1680
scale=GetQuantumScale(image->depth);
1929
extent=GetQuantumExtent(image,quantum_info,quantum_type);
1930
range=GetQuantumRange(image->depth);
1681
1931
for (y=0; y < (long) image->rows; y++)
1683
p=AcquireImagePixels(image,0,y,image->columns,1,&image->exception);
1933
p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
1684
1934
if (p == (const PixelPacket *) NULL)
1687
1937
if ((image->depth == 8) || (image->depth == 16))
1688
length=ExportQuantumPixels(image,quantum_info,quantum_type,pixels);
1938
extent=ExportQuantumPixels(image,(const ViewInfo *) NULL,
1939
quantum_info,quantum_type,pixels,&image->exception);
1691
1942
if (image->depth <= 8)
1692
1943
for (x=0; x < (long) image->columns; x++)
1694
pixel=ScaleQuantumToAny(p->red,image->depth,scale);
1695
q=PopCharPixel((unsigned char) pixel,q);
1696
pixel=ScaleQuantumToAny(p->green,image->depth,scale);
1697
q=PopCharPixel((unsigned char) pixel,q);
1698
pixel=ScaleQuantumToAny(p->blue,image->depth,scale);
1945
pixel=ScaleQuantumToAny(p->red,range);
1946
q=PopCharPixel((unsigned char) pixel,q);
1947
pixel=ScaleQuantumToAny(p->green,range);
1948
q=PopCharPixel((unsigned char) pixel,q);
1949
pixel=ScaleQuantumToAny(p->blue,range);
1699
1950
q=PopCharPixel((unsigned char) pixel,q);
1700
1951
if (image->matte != MagickFalse)
1702
1953
pixel=ScaleQuantumToAny((Quantum) (QuantumRange-
1703
p->opacity),image->depth,scale);
1704
1955
q=PopCharPixel((unsigned char) pixel,q);
1709
1960
for (x=0; x < (long) image->columns; x++)
1711
pixel=ScaleQuantumToAny(p->red,image->depth,scale);
1712
q=PopShortPixel(MSBEndian,(unsigned short) pixel,q);
1713
pixel=ScaleQuantumToAny(p->green,image->depth,scale);
1714
q=PopShortPixel(MSBEndian,(unsigned short) pixel,q);
1715
pixel=ScaleQuantumToAny(p->blue,image->depth,scale);
1962
pixel=ScaleQuantumToAny(p->red,range);
1963
q=PopShortPixel(MSBEndian,(unsigned short) pixel,q);
1964
pixel=ScaleQuantumToAny(p->green,range);
1965
q=PopShortPixel(MSBEndian,(unsigned short) pixel,q);
1966
pixel=ScaleQuantumToAny(p->blue,range);
1716
1967
q=PopShortPixel(MSBEndian,(unsigned short) pixel,q);
1717
1968
if (image->matte != MagickFalse)
1719
1970
pixel=ScaleQuantumToAny((Quantum) (QuantumRange-
1720
p->opacity),image->depth,scale);
1721
1972
q=PopShortPixel(MSBEndian,(unsigned short) pixel,q);
1725
length=(size_t) (q-pixels);
1976
extent=(size_t) (q-pixels);
1727
count=WriteBlob(image,length,pixels);
1728
if (count != (ssize_t) length)
1978
count=WriteBlob(image,extent,pixels);
1979
if (count != (ssize_t) extent)
1730
1981
if (image->previous == (Image *) NULL)
1750
2001
quantum_info=AcquireQuantumInfo((const ImageInfo *) NULL,image);
1751
2002
if ((quantum_info->format == UndefinedQuantumFormat) &&
1752
2003
(IsHighDynamicRangeImage(image,&image->exception) != MagickFalse))
1753
(void) SetQuantumFormat(image,FloatingPointQuantumFormat,quantum_info);
2005
status=SetQuantumFormat(image,quantum_info,
2006
FloatingPointQuantumFormat);
2007
if (status == MagickFalse)
2008
ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
1754
2010
pixels=GetQuantumPixels(quantum_info);
1755
scale=GetQuantumScale(image->depth);
2011
range=GetQuantumRange(image->depth);
1756
2012
for (y=0; y < (long) image->rows; y++)
1758
p=AcquireImagePixels(image,0,y,image->columns,1,&image->exception);
2014
p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
1759
2015
if (p == (const PixelPacket *) NULL)
1761
indexes=GetIndexes(image);
2017
indexes=GetVirtualIndexQueue(image);
1763
2019
if ((image->depth == 8) || (image->depth == 16))
1764
length=ExportQuantumPixels(image,quantum_info,quantum_type,pixels);
2020
extent=ExportQuantumPixels(image,(const ViewInfo *) NULL,
2021
quantum_info,quantum_type,pixels,&image->exception);
1767
2024
switch (quantum_type)
1805
2060
if (image->depth <= 8)
1806
2061
for (x=0; x < (long) image->columns; x++)
1808
pixel=ScaleQuantumToAny(p->red,image->depth,scale);
1809
q=PopCharPixel((unsigned char) pixel,q);
1810
pixel=ScaleQuantumToAny(p->green,image->depth,scale);
1811
q=PopCharPixel((unsigned char) pixel,q);
1812
pixel=ScaleQuantumToAny(p->blue,image->depth,scale);
1813
q=PopCharPixel((unsigned char) pixel,q);
1814
pixel=ScaleQuantumToAny(indexes[x],image->depth,scale);
2063
pixel=ScaleQuantumToAny(p->red,range);
2064
q=PopCharPixel((unsigned char) pixel,q);
2065
pixel=ScaleQuantumToAny(p->green,range);
2066
q=PopCharPixel((unsigned char) pixel,q);
2067
pixel=ScaleQuantumToAny(p->blue,range);
2068
q=PopCharPixel((unsigned char) pixel,q);
2069
pixel=ScaleQuantumToAny(indexes[x],range);
1815
2070
q=PopCharPixel((unsigned char) pixel,q);
1816
2071
if (image->matte != MagickFalse)
1818
2073
pixel=ScaleQuantumToAny((Quantum) (QuantumRange-
1819
p->opacity),image->depth,scale);
1820
2075
q=PopCharPixel((unsigned char) pixel,q);
1825
2080
for (x=0; x < (long) image->columns; x++)
1827
pixel=ScaleQuantumToAny(p->red,image->depth,scale);
1828
q=PopShortPixel(MSBEndian,(unsigned short) pixel,q);
1829
pixel=ScaleQuantumToAny(p->green,image->depth,scale);
1830
q=PopShortPixel(MSBEndian,(unsigned short) pixel,q);
1831
pixel=ScaleQuantumToAny(p->blue,image->depth,scale);
1832
q=PopShortPixel(MSBEndian,(unsigned short) pixel,q);
1833
pixel=ScaleQuantumToAny(indexes[x],image->depth,scale);
2082
pixel=ScaleQuantumToAny(p->red,range);
2083
q=PopShortPixel(MSBEndian,(unsigned short) pixel,q);
2084
pixel=ScaleQuantumToAny(p->green,range);
2085
q=PopShortPixel(MSBEndian,(unsigned short) pixel,q);
2086
pixel=ScaleQuantumToAny(p->blue,range);
2087
q=PopShortPixel(MSBEndian,(unsigned short) pixel,q);
2088
pixel=ScaleQuantumToAny(indexes[x],range);
1834
2089
q=PopShortPixel(MSBEndian,(unsigned short) pixel,q);
1835
2090
if (image->matte != MagickFalse)
1837
2092
pixel=ScaleQuantumToAny((Quantum) (QuantumRange-
1838
p->opacity),image->depth,scale);
1839
2094
q=PopShortPixel(MSBEndian,(unsigned short) pixel,q);
1847
2102
if (image->depth <= 8)
1848
2103
for (x=0; x < (long) image->columns; x++)
1850
pixel=ScaleQuantumToAny(p->red,image->depth,scale);
1851
q=PopCharPixel((unsigned char) pixel,q);
1852
pixel=ScaleQuantumToAny(p->green,image->depth,scale);
1853
q=PopCharPixel((unsigned char) pixel,q);
1854
pixel=ScaleQuantumToAny(p->blue,image->depth,scale);
2105
pixel=ScaleQuantumToAny(p->red,range);
2106
q=PopCharPixel((unsigned char) pixel,q);
2107
pixel=ScaleQuantumToAny(p->green,range);
2108
q=PopCharPixel((unsigned char) pixel,q);
2109
pixel=ScaleQuantumToAny(p->blue,range);
1855
2110
q=PopCharPixel((unsigned char) pixel,q);
1856
2111
if (image->matte != MagickFalse)
1858
2113
pixel=ScaleQuantumToAny((Quantum) (QuantumRange-
1859
p->opacity),image->depth,scale);
1860
2115
q=PopCharPixel((unsigned char) pixel,q);
1865
2120
for (x=0; x < (long) image->columns; x++)
1867
pixel=ScaleQuantumToAny(p->red,image->depth,scale);
1868
q=PopShortPixel(MSBEndian,(unsigned short) pixel,q);
1869
pixel=ScaleQuantumToAny(p->green,image->depth,scale);
1870
q=PopShortPixel(MSBEndian,(unsigned short) pixel,q);
1871
pixel=ScaleQuantumToAny(p->blue,image->depth,scale);
2122
pixel=ScaleQuantumToAny(p->red,range);
2123
q=PopShortPixel(MSBEndian,(unsigned short) pixel,q);
2124
pixel=ScaleQuantumToAny(p->green,range);
2125
q=PopShortPixel(MSBEndian,(unsigned short) pixel,q);
2126
pixel=ScaleQuantumToAny(p->blue,range);
1872
2127
q=PopShortPixel(MSBEndian,(unsigned short) pixel,q);
1873
2128
if (image->matte != MagickFalse)
1875
2130
pixel=ScaleQuantumToAny((Quantum) (QuantumRange-
1876
p->opacity),image->depth,scale);
1877
2132
q=PopShortPixel(MSBEndian,(unsigned short) pixel,q);
1906
2161
quantum_info=AcquireQuantumInfo((const ImageInfo *) NULL,image);
1907
2162
if (quantum_info == (QuantumInfo *) NULL)
1908
2163
ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
1909
(void) SetQuantumFormat(image,FloatingPointQuantumFormat,quantum_info);
2164
status=SetQuantumFormat(image,quantum_info,FloatingPointQuantumFormat);
2165
if (status == MagickFalse)
2166
ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
1910
2167
pixels=GetQuantumPixels(quantum_info);
1911
2168
for (y=(long) image->rows-1; y >= 0; y--)
1913
p=AcquireImagePixels(image,0,y,image->columns,1,&image->exception);
2170
p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
1914
2171
if (p == (const PixelPacket *) NULL)
1916
length=ExportQuantumPixels(image,quantum_info,quantum_type,pixels);
1917
(void) WriteBlob(image,length,pixels);
2173
extent=ExportQuantumPixels(image,(const ViewInfo *) NULL,quantum_info,
2174
quantum_type,pixels,&image->exception);
2175
(void) WriteBlob(image,extent,pixels);
1918
2176
if (image->previous == (Image *) NULL)
1920
2178
status=SetImageProgress(image,SaveImageTag,y,image->rows);