2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13 % Read Constant Color Image. %
20 % Copyright 1999-2010 ImageMagick Studio LLC, a non-profit organization %
21 % dedicated to making software imaging solutions freely available. %
23 % You may not use this file except in compliance with the License. You may %
24 % obtain a copy of the License at %
26 % http://www.imagemagick.org/script/license.php %
28 % Unless required by applicable law or agreed to in writing, software %
29 % distributed under the License is distributed on an "AS IS" BASIS, %
30 % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %
31 % See the License for the specific language governing permissions and %
32 % limitations under the License. %
34 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
42 #include "magick/studio.h"
43 #include "magick/blob.h"
44 #include "magick/blob-private.h"
45 #include "magick/cache.h"
46 #include "magick/color.h"
47 #include "magick/color-private.h"
48 #include "magick/exception.h"
49 #include "magick/exception-private.h"
50 #include "magick/image.h"
51 #include "magick/image-private.h"
52 #include "magick/list.h"
53 #include "magick/magick.h"
54 #include "magick/memory_.h"
55 #include "magick/pixel-private.h"
56 #include "magick/quantum-private.h"
57 #include "magick/static.h"
58 #include "magick/string_.h"
59 #include "magick/module.h"
62 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
66 % R e a d X C I m a g e %
70 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
72 % ReadXCImage creates a constant image and initializes it to the
73 % X server color as specified by the filename. It allocates the memory
74 % necessary for the new Image structure and returns a pointer to the new
77 % The format of the ReadXCImage method is:
79 % Image *ReadXCImage(const ImageInfo *image_info,ExceptionInfo *exception)
81 % A description of each parameter follows:
85 % o image_info: the image info.
87 % o exception: return any errors or warnings in this structure.
90 static Image *ReadXCImage(const ImageInfo *image_info,ExceptionInfo *exception)
118 Initialize Image structure.
120 assert(image_info != (const ImageInfo *) NULL);
121 assert(image_info->signature == MagickSignature);
122 if (image_info->debug != MagickFalse)
123 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
124 image_info->filename);
125 assert(exception != (ExceptionInfo *) NULL);
126 assert(exception->signature == MagickSignature);
127 image=AcquireImage(image_info);
128 if (image->columns == 0)
130 if (image->rows == 0)
132 (void) CopyMagickString(image->filename,image_info->filename,MaxTextExtent);
133 status=QueryMagickColor((char *) image_info->filename,&color,exception);
134 if (status == MagickFalse)
136 image=DestroyImage(image);
137 return((Image *) NULL);
139 image->colorspace=color.colorspace;
140 image->matte=color.matte;
142 SetPixelPacket(image,&color,&pixel,&index);
143 for (y=0; y < (long) image->rows; y++)
145 q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
146 if (q == (PixelPacket *) NULL)
148 for (x=0; x < (long) image->columns; x++)
150 if (image->colorspace == CMYKColorspace)
152 indexes=GetAuthenticIndexQueue(image);
153 for (x=0; x < (long) image->columns; x++)
156 if (SyncAuthenticPixels(image,exception) == MagickFalse)
159 return(GetFirstImageInList(image));
163 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
167 % R e g i s t e r X C I m a g e %
171 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
173 % RegisterXCImage() adds attributes for the XC image format to
174 % the list of supported formats. The attributes include the image format
175 % tag, a method to read and/or write the format, whether the format
176 % supports the saving of more than one frame to the same file or blob,
177 % whether the format supports native in-memory I/O, and a brief
178 % description of the format.
180 % The format of the RegisterXCImage method is:
182 % unsigned long RegisterXCImage(void)
185 ModuleExport unsigned long RegisterXCImage(void)
190 entry=SetMagickInfo("XC");
191 entry->decoder=(DecodeImageHandler *) ReadXCImage;
192 entry->adjoin=MagickFalse;
193 entry->format_type=ExplicitFormatType;
194 entry->raw=MagickTrue;
195 entry->endian_support=MagickTrue;
196 entry->description=ConstantString("Constant image uniform color");
197 entry->module=ConstantString("XC");
198 (void) RegisterMagickInfo(entry);
199 return(MagickImageCoderSignature);
203 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
207 % U n r e g i s t e r X C I m a g e %
211 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
213 % UnregisterXCImage() removes format registrations made by the
214 % XC module from the list of supported formats.
216 % The format of the UnregisterXCImage method is:
218 % UnregisterXCImage(void)
221 ModuleExport void UnregisterXCImage(void)
223 (void) UnregisterMagickInfo("XC");