2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13 % Read/Write Brother PES Image Format %
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/property.h"
44 #include "magick/blob.h"
45 #include "magick/blob-private.h"
46 #include "magick/cache.h"
47 #include "magick/client.h"
48 #include "magick/colorspace.h"
49 #include "magick/constitute.h"
50 #include "magick/decorate.h"
51 #include "magick/exception.h"
52 #include "magick/exception-private.h"
53 #include "magick/gem.h"
54 #include "magick/geometry.h"
55 #include "magick/image.h"
56 #include "magick/image-private.h"
57 #include "magick/list.h"
58 #include "magick/magick.h"
59 #include "magick/memory_.h"
60 #include "magick/monitor.h"
61 #include "magick/monitor-private.h"
62 #include "magick/montage.h"
63 #include "magick/resize.h"
64 #include "magick/shear.h"
65 #include "magick/quantum-private.h"
66 #include "magick/static.h"
67 #include "magick/string_.h"
68 #include "magick/module.h"
69 #include "magick/transform.h"
70 #include "magick/utility.h"
73 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
81 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
83 % IsPES() returns MagickTrue if the image format type, identified by the
84 % magick string, is PES.
86 % The format of the IsPES method is:
88 % MagickBooleanType IsPES(const unsigned char *magick,const size_t length)
90 % A description of each parameter follows:
92 % o magick: compare image format pattern against these bytes.
94 % o length: Specifies the length of the magick string.
97 static MagickBooleanType IsPES(const unsigned char *magick,const size_t length)
101 if (LocaleNCompare((const char *) magick,"#PES",4) == 0)
107 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
111 % R e a d P E S I m a g e %
115 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
117 % ReadPESImage() reads a Brother PES image file and returns it. It allocates
118 % the memory necessary for the new Image structure and returns a pointer to
121 % The format of the ReadPESImage method is:
123 % image=ReadPESImage(image_info)
125 % A description of each parameter follows:
127 % o image_info: the image info.
129 % o exception: return any errors or warnings in this structure.
132 static Image *ReadPESImage(const ImageInfo *image_info,ExceptionInfo *exception)
143 assert(image_info != (const ImageInfo *) NULL);
144 assert(image_info->signature == MagickSignature);
145 if (image_info->debug != MagickFalse)
146 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
147 image_info->filename);
148 assert(exception != (ExceptionInfo *) NULL);
149 assert(exception->signature == MagickSignature);
150 image=AcquireImage(image_info);
151 status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
152 if (status == MagickFalse)
154 image=DestroyImageList(image);
155 return((Image *) NULL);
157 return(GetFirstImageInList(image));
161 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
165 % R e g i s t e r P E S I m a g e %
169 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
171 % RegisterPESImage() adds attributes for the PES image format to
172 % the list of supported formats. The attributes include the image format
173 % tag, a method to read and/or write the format, whether the format
174 % supports the saving of more than one frame to the same file or blob,
175 % whether the format supports native in-memory I/O, and a brief
176 % description of the format.
178 % The format of the RegisterPESImage method is:
180 % unsigned long RegisterPESImage(void)
183 ModuleExport unsigned long RegisterPESImage(void)
188 entry=SetMagickInfo("PES");
189 entry->decoder=(DecodeImageHandler *) ReadPESImage;
190 entry->magick=(IsImageFormatHandler *) IsPES;
191 entry->adjoin=MagickFalse;
192 entry->description=ConstantString("Brother PES");
193 entry->module=ConstantString("PES");
194 return(MagickImageCoderSignature);
198 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
202 % U n r e g i s t e r P E S I m a g e %
206 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
208 % UnregisterPESImage() removes format registrations made by the
209 % PES module from the list of supported formats.
211 % The format of the UnregisterPESImage method is:
213 % UnregisterPESImage(void)
216 ModuleExport void UnregisterPESImage(void)
218 (void) UnregisterMagickInfo("PES");