2
% Copyright (C) 2003 GraphicsMagick Group
3
% Copyright (C) 2002 ImageMagick Studio
4
% Copyright 1991-1999 E. I. du Pont de Nemours and Company
6
% This program is covered by multiple licenses, which are described in
7
% Copyright.txt. You should have received a copy of Copyright.txt with this
8
% package; otherwise see http://www.graphicsmagick.org/www/Copyright.html.
10
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
21
% Read Constant Color Image. %
30
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
38
#include "magick/studio.h"
39
#include "magick/blob.h"
40
#include "magick/color.h"
41
#include "magick/composite.h"
42
#include "magick/magick.h"
43
#include "magick/utility.h"
46
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
50
% R e a d X C I m a g e %
54
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
56
% Method ReadXCImage creates a constant image and initializes it to the
57
% X server color as specified by the filename. It allocates the memory
58
% necessary for the new Image structure and returns a pointer to the new
61
% The format of the ReadXCImage method is:
63
% Image *ReadXCImage(const ImageInfo *image_info,ExceptionInfo *exception)
65
% A description of each parameter follows:
67
% o image: Method ReadXCImage returns a pointer to the image after
68
% creating it. A null image is returned if there is a memory shortage
69
% or if the image cannot be read.
71
% o image_info: Specifies a pointer to a ImageInfo structure.
73
% o exception: return any errors or warnings in this structure.
77
static Image *ReadXCImage(const ImageInfo *image_info,ExceptionInfo *exception)
86
Initialize Image structure.
88
assert(image_info != (const ImageInfo *) NULL);
89
assert(image_info->signature == MagickSignature);
90
assert(exception != (ExceptionInfo *) NULL);
91
assert(exception->signature == MagickSignature);
92
image=AllocateImage(image_info);
93
if (image->columns == 0)
97
(void) strncpy(image->filename,image_info->filename,MaxTextExtent-1);
98
status=QueryColorDatabase((char *) image_info->filename,
99
&image->background_color,exception);
103
return((Image *) NULL);
105
if (!AllocateImageColormap(image,1))
106
ThrowReaderException(ResourceLimitError,MemoryAllocationFailed,image);
107
image->colormap[0]=image->background_color;
109
Initialize image pixels to the value of image->background_color
111
SetImage(image,image->background_color.opacity);
116
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
120
% R e g i s t e r X C I m a g e %
124
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
126
% Method RegisterXCImage adds attributes for the XC image format to
127
% the list of supported formats. The attributes include the image format
128
% tag, a method to read and/or write the format, whether the format
129
% supports the saving of more than one frame to the same file or blob,
130
% whether the format supports native in-memory I/O, and a brief
131
% description of the format.
133
% The format of the RegisterXCImage method is:
135
% RegisterXCImage(void)
138
ModuleExport void RegisterXCImage(void)
143
entry=SetMagickInfo("XC");
144
entry->decoder=(DecoderHandler) ReadXCImage;
147
entry->description=AcquireString("Constant image uniform color");
148
entry->module=AcquireString("XC");
149
(void) RegisterMagickInfo(entry);
153
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
157
% U n r e g i s t e r X C I m a g e %
161
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
163
% Method UnregisterXCImage removes format registrations made by the
164
% XC module from the list of supported formats.
166
% The format of the UnregisterXCImage method is:
168
% UnregisterXCImage(void)
171
ModuleExport void UnregisterXCImage(void)
173
(void) UnregisterMagickInfo("XC");