% July 1992 %
% %
% %
-% Copyright 1999-2010 ImageMagick Studio LLC, a non-profit organization %
+% Copyright 1999-2011 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 %
*/
static int CompareXPMColor(const void *target,const void *source)
-{
+{
const char
*p,
*q;
-
+
p=(const char *) target;
q=(const char *) source;
return(strcmp(p,q));
*indexes;
register ssize_t
- i,
x;
register PixelPacket
if (*p != '"')
continue;
count=(ssize_t) sscanf(p+1,"%lu %lu %lu %lu",&columns,&rows,&colors,&width);
- if (count == 4)
- break;
image->columns=columns;
image->rows=rows;
image->colors=colors;
+ if (count == 4)
+ break;
}
if ((count != 4) || (width > 10) || (image->columns == 0) ||
(image->rows == 0) || (image->colors == 0))
/*
Remove unquoted characters.
*/
- i=0;
active=MagickFalse;
q=xpm_buffer;
while (*p != '\0')
/*
Read image colormap.
*/
- i=1;
next=NextXPMLine(xpm_buffer);
for (j=0; (j < (ssize_t) image->colors) && (next != (char*) NULL); j++)
{
image->storage_class=DirectClass;
image->matte=MagickTrue;
}
- if (QueryColorDatabase(target,&image->colormap[j],exception) == MagickFalse)
+ status=QueryColorCompliance(target,AllCompliance,&image->colormap[j],
+ exception);
+ if (status == MagickFalse)
break;
}
if (j < (ssize_t) image->colors)
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% Procedure WritePICONImage() writes an image to a file in the Personal Icon
-% format.
+% WritePICONImage() writes an image to a file in the Personal Icon format.
%
% The format of the WritePICONImage method is:
%
exception=(&image->exception);
if (picon->storage_class == PseudoClass)
{
- CompressImageColormap(picon);
+ (void) CompressImageColormap(picon);
if (picon->matte != MagickFalse)
transparent=MagickTrue;
}
"static char *%s[] = {\n",basename);
(void) WriteBlobString(image,buffer);
(void) WriteBlobString(image,"/* columns rows colors chars-per-pixel */\n");
- (void) FormatMagickString(buffer,MaxTextExtent,"\"%lu %lu %lu %ld\",\n",
- (unsigned long) picon->columns,(unsigned long) picon->rows,(unsigned long)
- colors,(long) characters_per_pixel);
+ (void) FormatMagickString(buffer,MaxTextExtent,
+ "\"%.20g %.20g %.20g %.20g\",\n",(double) picon->columns,(double)
+ picon->rows,(double) colors,(double) characters_per_pixel);
(void) WriteBlobString(image,buffer);
GetMagickPixelPacket(image,&pixel);
for (i=0; i < (ssize_t) colors; i++)
symbol[j]=Cixel[k];
}
symbol[j]='\0';
- (void) FormatMagickString(buffer,MaxTextExtent,"\"%s c %s\",\n",symbol,
- name);
+ (void) FormatMagickString(buffer,MaxTextExtent,"\"%s c %s\",\n",
+ symbol,name);
(void) WriteBlobString(image,buffer);
}
/*
(void) FormatMagickString(buffer,MaxTextExtent,"\"%s\n",
y == (ssize_t) (picon->rows-1) ? "" : ",");
(void) WriteBlobString(image,buffer);
- status=SetImageProgress(image,SaveImageTag,y,picon->rows);
+ status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
+ picon->rows);
if (status == MagickFalse)
break;
}
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% Procedure WriteXPMImage() writes an image to a file in the X pixmap format.
+% WriteXPMImage() writes an image to a file in the X pixmap format.
%
% The format of the WriteXPMImage method is:
%
%
% o image: The image.
%
-%
*/
static MagickBooleanType WriteXPMImage(const ImageInfo *image_info,Image *image)
{
(void) FormatMagickString(buffer,MaxTextExtent,"xpm_%s",basename);
(void) CopyMagickString(basename,buffer,MaxTextExtent);
}
- for (i=0; basename[i] != '\0'; i++)
- if (isalpha((int) ((unsigned char) basename[i])) == 0)
+ if (isalpha((int) ((unsigned char) basename[0])) == 0)
+ basename[0]='_';
+ for (i=1; basename[i] != '\0'; i++)
+ if (isalnum((int) ((unsigned char) basename[i])) == 0)
basename[i]='_';
(void) FormatMagickString(buffer,MaxTextExtent,
"static char *%s[] = {\n",basename);
(void) WriteBlobString(image,buffer);
(void) WriteBlobString(image,"/* columns rows colors chars-per-pixel */\n");
- (void) FormatMagickString(buffer,MaxTextExtent,"\"%lu %lu %lu %ld\",\n",
- (unsigned long) image->columns,(unsigned long) image->rows,
- (unsigned long) image->colors,(long) characters_per_pixel);
+ (void) FormatMagickString(buffer,MaxTextExtent,
+ "\"%.20g %.20g %.20g %.20g \",\n",(double) image->columns,(double)
+ image->rows,(double) image->colors,(double) characters_per_pixel);
(void) WriteBlobString(image,buffer);
GetMagickPixelPacket(image,&pixel);
for (i=0; i < (ssize_t) image->colors; i++)
if (image->previous == (Image *) NULL)
{
status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
- image->rows);
+ image->rows);
if (status == MagickFalse)
break;
}