2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6 % TTTTT IIIII L EEEEE %
10 % T IIIII LLLLL EEEEE %
13 % Return A Tiled Image Using Texture. %
20 % Copyright 1999-2012 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 "MagickCore/studio.h"
43 #include "MagickCore/blob.h"
44 #include "MagickCore/blob-private.h"
45 #include "MagickCore/constitute.h"
46 #include "MagickCore/exception.h"
47 #include "MagickCore/exception-private.h"
48 #include "MagickCore/image.h"
49 #include "MagickCore/image-private.h"
50 #include "MagickCore/list.h"
51 #include "MagickCore/magick.h"
52 #include "MagickCore/memory_.h"
53 #include "MagickCore/monitor.h"
54 #include "MagickCore/monitor-private.h"
55 #include "MagickCore/quantum-private.h"
56 #include "MagickCore/static.h"
57 #include "MagickCore/string_.h"
58 #include "MagickCore/module.h"
61 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
65 % R e a d T I L E I m a g e %
69 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
71 % ReadTILEImage tiles a texture on an image. It allocates the
72 % memory necessary for the new Image structure and returns a pointer to the
75 % The format of the ReadTILEImage method is:
77 % Image *ReadTILEImage(const ImageInfo *image_info,
78 % ExceptionInfo *exception)
80 % A description of each parameter follows:
82 % o image_info: the image info.
84 % o exception: return any errors or warnings in this structure.
87 static Image *ReadTILEImage(const ImageInfo *image_info,
88 ExceptionInfo *exception)
98 Initialize Image structure.
100 assert(image_info != (const ImageInfo *) NULL);
101 assert(image_info->signature == MagickSignature);
102 if (image_info->debug != MagickFalse)
103 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
104 image_info->filename);
105 assert(exception != (ExceptionInfo *) NULL);
106 assert(exception->signature == MagickSignature);
107 read_info=CloneImageInfo(image_info);
108 SetImageInfoBlob(read_info,(void *) NULL,0);
109 *read_info->magick='\0';
110 tile_image=ReadImage(read_info,exception);
111 read_info=DestroyImageInfo(read_info);
112 if (tile_image == (Image *) NULL)
113 return((Image *) NULL);
114 image=AcquireImage(image_info,exception);
115 if ((image->columns == 0) || (image->rows == 0))
116 ThrowReaderException(OptionError,"MustSpecifyImageSize");
117 if (*image_info->filename == '\0')
118 ThrowReaderException(OptionError,"MustSpecifyAnImageName");
119 image->matte=tile_image->matte;
120 if (image->matte != MagickFalse)
121 (void) SetImageBackgroundColor(image,exception);
122 (void) CopyMagickString(image->filename,image_info->filename,MaxTextExtent);
123 if (LocaleCompare(tile_image->magick,"PATTERN") == 0)
125 tile_image->tile_offset.x=0;
126 tile_image->tile_offset.y=0;
128 (void) TextureImage(image,tile_image,exception);
129 tile_image=DestroyImage(tile_image);
130 return(GetFirstImageInList(image));
134 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
138 % R e g i s t e r T I L E I m a g e %
142 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
144 % RegisterTILEImage() adds attributes for the TILE image format to
145 % the list of supported formats. The attributes include the image format
146 % tag, a method to read and/or write the format, whether the format
147 % supports the saving of more than one frame to the same file or blob,
148 % whether the format supports native in-memory I/O, and a brief
149 % description of the format.
151 % The format of the RegisterTILEImage method is:
153 % size_t RegisterTILEImage(void)
156 ModuleExport size_t RegisterTILEImage(void)
161 entry=SetMagickInfo("TILE");
162 entry->decoder=(DecodeImageHandler *) ReadTILEImage;
163 entry->raw=MagickTrue;
164 entry->endian_support=MagickTrue;
165 entry->format_type=ImplicitFormatType;
166 entry->description=ConstantString("Tile image with a texture");
167 entry->module=ConstantString("TILE");
168 (void) RegisterMagickInfo(entry);
169 return(MagickImageCoderSignature);
173 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
177 % U n r e g i s t e r T I L E I m a g e %
181 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
183 % UnregisterTILEImage() removes format registrations made by the
184 % TILE module from the list of supported formats.
186 % The format of the UnregisterTILEImage method is:
188 % UnregisterTILEImage(void)
191 ModuleExport void UnregisterTILEImage(void)
193 (void) UnregisterMagickInfo("TILE");