ReadTIFFImage(const ImageInfo *,ExceptionInfo *);
static MagickBooleanType
- WriteGROUP4Image(const ImageInfo *,Image *),
- WritePTIFImage(const ImageInfo *,Image *),
- WriteTIFFImage(const ImageInfo *,Image *);
+ WriteGROUP4Image(const ImageInfo *,Image *,ExceptionInfo *),
+ WritePTIFImage(const ImageInfo *,Image *,ExceptionInfo *),
+ WriteTIFFImage(const ImageInfo *,Image *,ExceptionInfo *);
#endif
\f
/*
if (length < 4)
return(MagickFalse);
}
- profile=AcquireStringInfo((size_t) length);
- SetStringInfoDatum(profile,datum+i);
+ profile=BlobToStringInfo(datum+i,(size_t) length);
+ if (profile == (StringInfo *) NULL)
+ ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
+ image->filename);
status=SetImageProfile(image,name,profile);
profile=DestroyStringInfo(profile);
if (status == MagickFalse)
if (status == -1)
break;
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
- if (q == (const Quantum *) NULL)
+ if (q == (Quantum *) NULL)
break;
length=ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,
quantum_type,pixels,exception);
if (status == -1)
break;
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
- if (q == (const Quantum *) NULL)
+ if (q == (Quantum *) NULL)
break;
length=ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,
quantum_type,pixels,exception);
if (status == -1)
break;
q=GetAuthenticPixels(image,0,y,image->columns,1,exception);
- if (q == (const Quantum *) NULL)
+ if (q == (Quantum *) NULL)
break;
if (image->colorspace != CMYKColorspace)
switch (i)
*restrict q;
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
- if (q == (const Quantum *) NULL)
+ if (q == (Quantum *) NULL)
break;
if (i == 0)
{
SetPixelAlpha(image,ScaleCharToQuantum((unsigned char)
(TIFFGetA(*p))),q);
p++;
- q+=GetPixelComponents(image);
+ q+=GetPixelChannels(image);
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
TIFFClose(tiff);
ThrowReaderException(CoderError,"ImageIsNotTiled");
}
- (void) SetImageStorageClass(image,DirectClass);
+ (void) SetImageStorageClass(image,DirectClass,&image->exception);
number_pixels=columns*rows;
tile_pixels=(uint32 *) AcquireQuantumMemory(number_pixels,
sizeof(*tile_pixels));
if ((ssize_t) (x+columns) < (ssize_t) image->columns)
columns_remaining=columns;
p=tile_pixels+(rows-rows_remaining)*columns;
- q=tile+(image->columns*(rows_remaining-1)+x);
+ q=tile+GetPixelChannels(image)*(image->columns*(rows_remaining-1)+
+ x);
for (row=rows_remaining; row > 0; row--)
{
if (image->matte != MagickFalse)
SetPixelAlpha(image,ScaleCharToQuantum((unsigned char)
TIFFGetA(*p)),q);
p++;
- q+=GetPixelComponents(image);
+ q+=GetPixelChannels(image);
}
else
for (column=columns_remaining; column > 0; column--)
SetPixelBlue(image,ScaleCharToQuantum((unsigned char)
TIFFGetB(*p)),q);
p++;
- q+=GetPixelComponents(image);
+ q+=GetPixelChannels(image);
}
p+=columns-columns_remaining;
- q-=GetPixelComponents(image)*(image->columns+columns_remaining);
+ q-=GetPixelChannels(image)*(image->columns+columns_remaining);
}
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
*restrict q;
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
- if (q == (const Quantum *) NULL)
+ if (q == (Quantum *) NULL)
break;
- q+=GetPixelComponents(image)*(image->columns-1);
+ q+=GetPixelChannels(image)*(image->columns-1);
for (x=0; x < (ssize_t) image->columns; x++)
{
SetPixelRed(image,ScaleCharToQuantum((unsigned char)
SetPixelAlpha(image,ScaleCharToQuantum((unsigned char)
TIFFGetA(*p)),q);
p--;
- q-=GetPixelComponents(image);;
+ q-=GetPixelChannels(image);;
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
% The format of the WriteGROUP4Image method is:
%
% MagickBooleanType WriteGROUP4Image(const ImageInfo *image_info,
-% Image *image)
+% Image *image,ExceptionInfo *)
%
% A description of each parameter follows:
%
%
% o image: The image.
%
+% o exception: return any errors or warnings in this structure.
+%
*/
static MagickBooleanType WriteGROUP4Image(const ImageInfo *image_info,
- Image *image)
+ Image *image,ExceptionInfo *exception)
{
char
filename[MaxTextExtent];
assert(image->signature == MagickSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
- status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception);
+ assert(exception != (ExceptionInfo *) NULL);
+ assert(exception->signature == MagickSignature);
+ status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception);
if (status == MagickFalse)
return(status);
- huffman_image=CloneImage(image,0,0,MagickTrue,&image->exception);
+ huffman_image=CloneImage(image,0,0,MagickTrue,exception);
if (huffman_image == (Image *) NULL)
{
(void) CloseBlob(image);
file=fdopen(unique_file,"wb");
if ((unique_file == -1) || (file == (FILE *) NULL))
{
- ThrowFileException(&image->exception,FileOpenError,
- "UnableToCreateTemporaryFile",filename);
+ ThrowFileException(exception,FileOpenError,"UnableToCreateTemporaryFile",
+ filename);
return(MagickFalse);
}
(void) FormatLocaleString(huffman_image->filename,MaxTextExtent,"tiff:%s",
write_info->compression=Group4Compression;
write_info->type=BilevelType;
(void) SetImageOption(write_info,"quantum:polarity","min-is-white");
- status=WriteTIFFImage(write_info,huffman_image);
+ status=WriteTIFFImage(write_info,huffman_image,exception);
(void) fflush(file);
write_info=DestroyImageInfo(write_info);
if (status == MagickFalse)
{
- InheritException(&image->exception,&huffman_image->exception);
huffman_image=DestroyImage(huffman_image);
(void) fclose(file);
(void) RelinquishUniqueFileResource(filename);
huffman_image=DestroyImage(huffman_image);
(void) fclose(file);
(void) RelinquishUniqueFileResource(filename);
- ThrowFileException(&image->exception,FileOpenError,"UnableToOpenFile",
+ ThrowFileException(exception,FileOpenError,"UnableToOpenFile",
image_info->filename);
return(MagickFalse);
}
% The format of the WritePTIFImage method is:
%
% MagickBooleanType WritePTIFImage(const ImageInfo *image_info,
-% Image *image)
+% Image *image,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
%
% o image: The image.
%
+% o exception: return any errors or warnings in this structure.
+%
*/
static MagickBooleanType WritePTIFImage(const ImageInfo *image_info,
- Image *image)
+ Image *image,ExceptionInfo *exception)
{
Image
*images,
images=NewImageList();
for (next=image; next != (Image *) NULL; next=GetNextImageInList(next))
{
- AppendImageToList(&images,CloneImage(next,0,0,MagickFalse,
- &image->exception));
+ AppendImageToList(&images,CloneImage(next,0,0,MagickFalse,exception));
columns=next->columns;
rows=next->rows;
while ((columns > 64) && (rows > 64))
columns/=2;
rows/=2;
pyramid_image=ResizeImage(next,columns,rows,UndefinedFilter,image->blur,
- &image->exception);
+ exception);
AppendImageToList(&images,pyramid_image);
}
}
write_info=CloneImageInfo(image_info);
*write_info->magick='\0';
write_info->adjoin=MagickTrue;
- status=WriteTIFFImage(write_info,GetFirstImageInList(images));
+ status=WriteTIFFImage(write_info,GetFirstImageInList(images),exception);
images=DestroyImageList(images);
write_info=DestroyImageInfo(write_info);
return(status);
% The format of the WriteTIFFImage method is:
%
% MagickBooleanType WriteTIFFImage(const ImageInfo *image_info,
-% Image *image)
+% Image *image,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
%
% o image: The image.
%
+% o exception: return any errors or warnings in this structure.
+%
*/
typedef struct _TIFFInfo
}
static MagickBooleanType WriteTIFFImage(const ImageInfo *image_info,
- Image *image)
+ Image *image,ExceptionInfo *exception)
{
#if !defined(TIFFDefaultStripSize)
#define TIFFDefaultStripSize(tiff,request) (8192UL/TIFFScanlineSize(tiff))
assert(image->signature == MagickSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
- status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception);
+ assert(exception != (ExceptionInfo *) NULL);
+ assert(exception->signature == MagickSignature);
+ assert(exception != (ExceptionInfo *) NULL);
+ assert(exception->signature == MagickSignature);
+ status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception);
if (status == MagickFalse)
return(status);
- (void) MagickSetThreadValue(tiff_exception,&image->exception);
+ (void) MagickSetThreadValue(tiff_exception,exception);
error_handler=TIFFSetErrorHandler((TIFFErrorHandler) TIFFErrors);
warning_handler=TIFFSetWarningHandler((TIFFErrorHandler) TIFFWarnings);
endian_type=UndefinedEndian;
ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
if ((image->storage_class != PseudoClass) && (image->depth >= 32) &&
(quantum_info->format == UndefinedQuantumFormat) &&
- (IsHighDynamicRangeImage(image,&image->exception) != MagickFalse))
+ (IsHighDynamicRangeImage(image,exception) != MagickFalse))
{
status=SetQuantumFormat(image,quantum_info,FloatingPointQuantumFormat);
if (status == MagickFalse)
if ((compress_tag != COMPRESSION_NONE) &&
(TIFFIsCODECConfigured(compress_tag) == 0))
{
- (void) ThrowMagickException(&image->exception,GetMagickModule(),
- CoderError,"CompressionNotSupported","`%s'",CommandOptionToMnemonic(
+ (void) ThrowMagickException(exception,GetMagickModule(),CoderError,
+ "CompressionNotSupported","`%s'",CommandOptionToMnemonic(
MagickCompressOptions,(ssize_t) compression));
compress_tag=COMPRESSION_NONE;
compression=NoCompression;
break;
default:
{
- (void) ThrowMagickException(&image->exception,GetMagickModule(),
- CoderError,"CompressionNotSupported","`%s'",CommandOptionToMnemonic(
+ (void) ThrowMagickException(exception,GetMagickModule(),CoderError,
+ "CompressionNotSupported","`%s'",CommandOptionToMnemonic(
MagickCompressOptions,(ssize_t) compression));
compress_tag=COMPRESSION_NONE;
compression=NoCompression;
}
case JPEGCompression:
{
- (void) SetImageStorageClass(image,DirectClass);
+ (void) SetImageStorageClass(image,DirectClass,exception);
(void) SetImageDepth(image,8);
break;
}
{
photometric=PHOTOMETRIC_YCBCR;
(void) TIFFSetField(tiff,TIFFTAG_YCBCRSUBSAMPLING,1,1);
- (void) SetImageStorageClass(image,DirectClass);
+ (void) SetImageStorageClass(image,DirectClass,exception);
(void) SetImageDepth(image,8);
}
else
(image_info->type != TrueColorMatteType))
{
if ((image_info->type != PaletteType) &&
- (IsImageGray(image,&image->exception) != MagickFalse))
+ (IsImageGray(image,exception) != MagickFalse))
{
photometric=(uint16) (quantum_info->min_is_white !=
MagickFalse ? PHOTOMETRIC_MINISWHITE :
PHOTOMETRIC_MINISBLACK);
(void) TIFFSetField(tiff,TIFFTAG_SAMPLESPERPIXEL,1);
if ((image_info->depth == 0) && (image->matte == MagickFalse) &&
- (IsImageMonochrome(image,&image->exception) != MagickFalse))
+ (IsImageMonochrome(image,exception) != MagickFalse))
{
status=SetQuantumDepth(image,quantum_info,1);
if (status == MagickFalse)
register const Quantum
*restrict p;
- p=GetVirtualPixels(image,0,y,image->columns,1,
- &image->exception);
+ p=GetVirtualPixels(image,0,y,image->columns,1,exception);
if (p == (const Quantum *) NULL)
break;
length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
- quantum_type,pixels,&image->exception);
+ quantum_type,pixels,exception);
(void) length;
if (TIFFWritePixels(tiff,&tiff_info,y,0,image) == -1)
break;
register const Quantum
*restrict p;
- p=GetVirtualPixels(image,0,y,image->columns,1,
- &image->exception);
+ p=GetVirtualPixels(image,0,y,image->columns,1,exception);
if (p == (const Quantum *) NULL)
break;
length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
- RedQuantum,pixels,&image->exception);
+ RedQuantum,pixels,exception);
if (TIFFWritePixels(tiff,&tiff_info,y,0,image) == -1)
break;
}
register const Quantum
*restrict p;
- p=GetVirtualPixels(image,0,y,image->columns,1,
- &image->exception);
+ p=GetVirtualPixels(image,0,y,image->columns,1,exception);
if (p == (const Quantum *) NULL)
break;
length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
- GreenQuantum,pixels,&image->exception);
+ GreenQuantum,pixels,exception);
if (TIFFWritePixels(tiff,&tiff_info,y,1,image) == -1)
break;
}
register const Quantum
*restrict p;
- p=GetVirtualPixels(image,0,y,image->columns,1,
- &image->exception);
+ p=GetVirtualPixels(image,0,y,image->columns,1,exception);
if (p == (const Quantum *) NULL)
break;
length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
- BlueQuantum,pixels,&image->exception);
+ BlueQuantum,pixels,exception);
if (TIFFWritePixels(tiff,&tiff_info,y,2,image) == -1)
break;
}
register const Quantum
*restrict p;
- p=GetVirtualPixels(image,0,y,image->columns,1,
- &image->exception);
+ p=GetVirtualPixels(image,0,y,image->columns,1,exception);
if (p == (const Quantum *) NULL)
break;
length=ExportQuantumPixels(image,(CacheView *) NULL,
- quantum_info,AlphaQuantum,pixels,&image->exception);
+ quantum_info,AlphaQuantum,pixels,exception);
if (TIFFWritePixels(tiff,&tiff_info,y,3,image) == -1)
break;
}
register const Quantum
*restrict p;
- p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
+ p=GetVirtualPixels(image,0,y,image->columns,1,exception);
if (p == (const Quantum *) NULL)
break;
length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
- quantum_type,pixels,&image->exception);
+ quantum_type,pixels,exception);
if (TIFFWritePixels(tiff,&tiff_info,y,0,image) == -1)
break;
if (image->previous == (Image *) NULL)
register const Quantum
*restrict p;
- p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
+ p=GetVirtualPixels(image,0,y,image->columns,1,exception);
if (p == (const Quantum *) NULL)
break;
length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
- quantum_type,pixels,&image->exception);
+ quantum_type,pixels,exception);
if (TIFFWritePixels(tiff,&tiff_info,y,0,image) == -1)
break;
if (image->previous == (Image *) NULL)