% July 1992 %
% %
% %
-% Copyright 1999-2011 ImageMagick Studio LLC, a non-profit organization %
+% Copyright 1999-2012 ImageMagick Studio LLC, a non-profit organization %
% dedicated to making software imaging solutions freely available. %
% %
% You may not use this file except in compliance with the License. You may %
Include declarations.
*/
#include "MagickCore/studio.h"
+#include "MagickCore/attribute.h"
#include "MagickCore/blob.h"
#include "MagickCore/blob-private.h"
#include "MagickCore/cache.h"
Forward declarations.
*/
static MagickBooleanType
- WriteXBMImage(const ImageInfo *,Image *);
+ WriteXBMImage(const ImageInfo *,Image *,ExceptionInfo *);
\f
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
image_info->filename);
assert(exception != (ExceptionInfo *) NULL);
assert(exception->signature == MagickSignature);
- image=AcquireImage(image_info);
+ image=AcquireImage(image_info,exception);
status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
if (status == MagickFalse)
{
/*
Initialize image structure.
*/
- if (AcquireImageColormap(image,image->colors) == MagickFalse)
+ if (AcquireImageColormap(image,image->colors,exception) == MagickFalse)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
/*
Initialize colormap.
*/
- image->colormap[0].red=(Quantum) QuantumRange;
- image->colormap[0].green=(Quantum) QuantumRange;
- image->colormap[0].blue=(Quantum) QuantumRange;
+ image->colormap[0].red=QuantumRange;
+ image->colormap[0].green=QuantumRange;
+ image->colormap[0].blue=QuantumRange;
image->colormap[1].red=(Quantum) 0;
image->colormap[1].green=(Quantum) 0;
image->colormap[1].blue=(Quantum) 0;
Read hex image data.
*/
padding=0;
- if (((image->columns % 16) != 0) &&
- ((image->columns % 16) < 9) && (version == 10))
+ if (((image->columns % 16) != 0) && ((image->columns % 16) < 9) &&
+ (version == 10))
padding=1;
bytes_per_line=(image->columns+7)/8+padding;
length=(size_t) image->rows;
for (y=0; y < (ssize_t) image->rows; y++)
{
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
- if (q == (const Quantum *) NULL)
+ if (q == (Quantum *) NULL)
break;
bit=0;
byte=0;
{
if (bit == 0)
byte=(size_t) (*p++);
- SetPixelIndex(image,(byte & 0x01) != 0 ? 0x01 : 0x00,q);
+ SetPixelIndex(image,(Quantum) ((byte & 0x01) != 0 ? 0x01 : 0x00),q);
bit++;
byte>>=1;
if (bit == 8)
break;
}
data=(unsigned char *) RelinquishMagickMemory(data);
- (void) SyncImage(image);
+ (void) SyncImage(image,exception);
(void) CloseBlob(image);
return(GetFirstImageInList(image));
}
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% Procedure WriteXBMImage() writes an image to a file in the X bitmap format.
+% WriteXBMImage() writes an image to a file in the X bitmap format.
%
% The format of the WriteXBMImage method is:
%
-% MagickBooleanType WriteXBMImage(const ImageInfo *image_info,Image *image)
+% MagickBooleanType WriteXBMImage(const ImageInfo *image_info,
+% 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 WriteXBMImage(const ImageInfo *image_info,Image *image)
+static MagickBooleanType WriteXBMImage(const ImageInfo *image_info,Image *image,
+ ExceptionInfo *exception)
{
char
basename[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);
- if (IsRGBColorspace(image->colorspace) == MagickFalse)
- (void) TransformImageColorspace(image,RGBColorspace);
+ if (IssRGBCompatibleColorspace(image->colorspace) == MagickFalse)
+ (void) TransformImageColorspace(image,sRGBColorspace,exception);
/*
Write X bitmap header.
*/
/*
Convert MIFF to X bitmap pixels.
*/
- (void) SetImageType(image,BilevelType);
+ (void) SetImageType(image,BilevelType,exception);
bit=0;
byte=0;
count=0;
(void) WriteBlob(image,strlen(buffer),(unsigned char *) buffer);
for (y=0; y < (ssize_t) image->rows; y++)
{
- 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;
for (x=0; x < (ssize_t) image->columns; x++)
{
byte>>=1;
- if (GetPixelIntensity(image,p) < ((MagickRealType) QuantumRange/2.0))
+ if (GetPixelIntensity(image,p) < (QuantumRange/2))
byte|=0x80;
bit++;
if (bit == 8)