cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1 | /* |
| 2 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 3 | % % |
| 4 | % % |
| 5 | % % |
| 6 | % U U IIIII L % |
| 7 | % U U I L % |
| 8 | % U U I L % |
| 9 | % U U I L % |
| 10 | % UUU IIIII LLLLL % |
| 11 | % % |
| 12 | % % |
| 13 | % Write X-Motif UIL Table. % |
| 14 | % % |
| 15 | % Software Design % |
| 16 | % John Cristy % |
| 17 | % July 1992 % |
| 18 | % % |
| 19 | % % |
cristy | 7e41fe8 | 2010-12-04 23:12:08 +0000 | [diff] [blame] | 20 | % Copyright 1999-2011 ImageMagick Studio LLC, a non-profit organization % |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 21 | % dedicated to making software imaging solutions freely available. % |
| 22 | % % |
| 23 | % You may not use this file except in compliance with the License. You may % |
| 24 | % obtain a copy of the License at % |
| 25 | % % |
| 26 | % http://www.imagemagick.org/script/license.php % |
| 27 | % % |
| 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. % |
| 33 | % % |
| 34 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 35 | % |
| 36 | % |
| 37 | */ |
| 38 | |
| 39 | /* |
| 40 | Include declarations. |
| 41 | */ |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 42 | #include "MagickCore/studio.h" |
| 43 | #include "MagickCore/blob.h" |
| 44 | #include "MagickCore/blob-private.h" |
| 45 | #include "MagickCore/cache.h" |
| 46 | #include "MagickCore/color.h" |
| 47 | #include "MagickCore/color-private.h" |
| 48 | #include "MagickCore/colorspace.h" |
cristy | 510d06a | 2011-07-06 23:43:54 +0000 | [diff] [blame] | 49 | #include "MagickCore/colorspace-private.h" |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 50 | #include "MagickCore/exception.h" |
| 51 | #include "MagickCore/exception-private.h" |
| 52 | #include "MagickCore/image-private.h" |
| 53 | #include "MagickCore/magick.h" |
| 54 | #include "MagickCore/memory_.h" |
| 55 | #include "MagickCore/monitor.h" |
| 56 | #include "MagickCore/monitor-private.h" |
| 57 | #include "MagickCore/pixel-accessor.h" |
| 58 | #include "MagickCore/quantum-private.h" |
| 59 | #include "MagickCore/static.h" |
| 60 | #include "MagickCore/string_.h" |
| 61 | #include "MagickCore/module.h" |
| 62 | #include "MagickCore/utility.h" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 63 | |
| 64 | /* |
| 65 | Forward declarations. |
| 66 | */ |
| 67 | static MagickBooleanType |
| 68 | WriteUILImage(const ImageInfo *,Image *); |
| 69 | |
| 70 | /* |
| 71 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 72 | % % |
| 73 | % % |
| 74 | % % |
| 75 | % R e g i s t e r U I L I m a g e % |
| 76 | % % |
| 77 | % % |
| 78 | % % |
| 79 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 80 | % |
| 81 | % RegisterUILImage() adds attributes for the UIL image format to |
| 82 | % the list of supported formats. The attributes include the image format |
| 83 | % tag, a method to read and/or write the format, whether the format |
| 84 | % supports the saving of more than one frame to the same file or blob, |
| 85 | % whether the format supports native in-memory I/O, and a brief |
| 86 | % description of the format. |
| 87 | % |
| 88 | % The format of the RegisterUILImage method is: |
| 89 | % |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 90 | % size_t RegisterUILImage(void) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 91 | % |
| 92 | */ |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 93 | ModuleExport size_t RegisterUILImage(void) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 94 | { |
| 95 | MagickInfo |
| 96 | *entry; |
| 97 | |
| 98 | entry=SetMagickInfo("UIL"); |
| 99 | entry->encoder=(EncodeImageHandler *) WriteUILImage; |
| 100 | entry->adjoin=MagickFalse; |
| 101 | entry->description=ConstantString("X-Motif UIL table"); |
| 102 | entry->module=ConstantString("UIL"); |
| 103 | (void) RegisterMagickInfo(entry); |
| 104 | return(MagickImageCoderSignature); |
| 105 | } |
| 106 | |
| 107 | /* |
| 108 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 109 | % % |
| 110 | % % |
| 111 | % % |
| 112 | % U n r e g i s t e r U I L I m a g e % |
| 113 | % % |
| 114 | % % |
| 115 | % % |
| 116 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 117 | % |
| 118 | % UnregisterUILImage() removes format registrations made by the |
| 119 | % UIL module from the list of supported formats. |
| 120 | % |
| 121 | % The format of the UnregisterUILImage method is: |
| 122 | % |
| 123 | % UnregisterUILImage(void) |
| 124 | % |
| 125 | */ |
| 126 | ModuleExport void UnregisterUILImage(void) |
| 127 | { |
| 128 | (void) UnregisterMagickInfo("UIL"); |
| 129 | } |
| 130 | |
| 131 | /* |
| 132 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 133 | % % |
| 134 | % % |
| 135 | % % |
| 136 | % W r i t e U I L I m a g e % |
| 137 | % % |
| 138 | % % |
| 139 | % % |
| 140 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 141 | % |
| 142 | % Procedure WriteUILImage() writes an image to a file in the X-Motif UIL table |
| 143 | % format. |
| 144 | % |
| 145 | % The format of the WriteUILImage method is: |
| 146 | % |
| 147 | % MagickBooleanType WriteUILImage(const ImageInfo *image_info,Image *image) |
| 148 | % |
| 149 | % A description of each parameter follows. |
| 150 | % |
| 151 | % o image_info: the image info. |
| 152 | % |
| 153 | % o image: The image. |
| 154 | % |
| 155 | */ |
| 156 | static MagickBooleanType WriteUILImage(const ImageInfo *image_info,Image *image) |
| 157 | { |
| 158 | #define MaxCixels 92 |
| 159 | |
| 160 | char |
| 161 | basename[MaxTextExtent], |
| 162 | buffer[MaxTextExtent], |
| 163 | name[MaxTextExtent], |
cristy | bd899c2 | 2009-11-26 23:51:49 +0000 | [diff] [blame] | 164 | *symbol; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 165 | |
| 166 | ExceptionInfo |
| 167 | *exception; |
| 168 | |
| 169 | int |
| 170 | j; |
| 171 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 172 | MagickBooleanType |
| 173 | status, |
| 174 | transparent; |
| 175 | |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 176 | PixelInfo |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 177 | pixel; |
| 178 | |
| 179 | MagickSizeType |
| 180 | number_pixels; |
| 181 | |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 182 | register const Quantum |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 183 | *p; |
| 184 | |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 185 | register ssize_t |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 186 | i, |
| 187 | x; |
| 188 | |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 189 | size_t |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 190 | characters_per_pixel, |
| 191 | colors; |
| 192 | |
cristy | c6da28e | 2011-04-28 01:41:35 +0000 | [diff] [blame] | 193 | ssize_t |
| 194 | k, |
| 195 | y; |
| 196 | |
| 197 | static const char |
| 198 | Cixel[MaxCixels+1] = " .XoO+@#$%&*=-;:>,<1234567890qwertyuipasdfghjk" |
| 199 | "lzxcvbnmMNBVCZASDFGHJKLPIUYTREWQ!~^/()_`'][{}|"; |
| 200 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 201 | /* |
| 202 | Open output image file. |
| 203 | */ |
| 204 | assert(image_info != (const ImageInfo *) NULL); |
| 205 | assert(image_info->signature == MagickSignature); |
| 206 | assert(image != (Image *) NULL); |
| 207 | assert(image->signature == MagickSignature); |
| 208 | if (image->debug != MagickFalse) |
| 209 | (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); |
| 210 | status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception); |
| 211 | if (status == MagickFalse) |
| 212 | return(status); |
cristy | 510d06a | 2011-07-06 23:43:54 +0000 | [diff] [blame] | 213 | if (IsRGBColorspace(image->colorspace) == MagickFalse) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 214 | (void) TransformImageColorspace(image,RGBColorspace); |
| 215 | exception=(&image->exception); |
| 216 | transparent=MagickFalse; |
| 217 | i=0; |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 218 | p=(const Quantum *) NULL; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 219 | if (image->storage_class == PseudoClass) |
| 220 | colors=image->colors; |
| 221 | else |
| 222 | { |
| 223 | unsigned char |
| 224 | *matte_image; |
| 225 | |
| 226 | /* |
| 227 | Convert DirectClass to PseudoClass image. |
| 228 | */ |
| 229 | matte_image=(unsigned char *) NULL; |
| 230 | if (image->matte != MagickFalse) |
| 231 | { |
| 232 | /* |
| 233 | Map all the transparent pixels. |
| 234 | */ |
| 235 | number_pixels=(MagickSizeType) image->columns*image->rows; |
| 236 | if (number_pixels != ((MagickSizeType) (size_t) number_pixels)) |
| 237 | ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed"); |
| 238 | matte_image=(unsigned char *) AcquireQuantumMemory(image->columns, |
| 239 | image->rows*sizeof(*matte_image)); |
| 240 | if (matte_image == (unsigned char *) NULL) |
| 241 | ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed"); |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 242 | for (y=0; y < (ssize_t) image->rows; y++) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 243 | { |
| 244 | p=GetVirtualPixels(image,0,y,image->columns,1,exception); |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 245 | if (p == (const Quantum *) NULL) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 246 | break; |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 247 | for (x=0; x < (ssize_t) image->columns; x++) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 248 | { |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 249 | matte_image[i]=(unsigned char) (GetPixelAlpha(image,p) == |
| 250 | (Quantum) TransparentAlpha ? 1 : 0); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 251 | if (matte_image[i] != 0) |
| 252 | transparent=MagickTrue; |
| 253 | i++; |
cristy | ed23157 | 2011-07-14 02:18:59 +0000 | [diff] [blame] | 254 | p+=GetPixelChannels(image); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 255 | } |
| 256 | } |
| 257 | } |
| 258 | (void) SetImageType(image,PaletteType); |
| 259 | colors=image->colors; |
| 260 | if (transparent != MagickFalse) |
| 261 | { |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 262 | register Quantum |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 263 | *q; |
| 264 | |
| 265 | colors++; |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 266 | for (y=0; y < (ssize_t) image->rows; y++) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 267 | { |
| 268 | q=GetAuthenticPixels(image,0,y,image->columns,1,exception); |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 269 | if (q == (const Quantum *) NULL) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 270 | break; |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 271 | for (x=0; x < (ssize_t) image->columns; x++) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 272 | { |
| 273 | if (matte_image[i] != 0) |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 274 | SetPixelIndex(image,image->colors,q); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 275 | p++; |
cristy | ed23157 | 2011-07-14 02:18:59 +0000 | [diff] [blame] | 276 | q+=GetPixelChannels(image); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 277 | } |
| 278 | } |
| 279 | } |
| 280 | if (matte_image != (unsigned char *) NULL) |
| 281 | matte_image=(unsigned char *) RelinquishMagickMemory(matte_image); |
| 282 | } |
| 283 | /* |
| 284 | Compute the character per pixel. |
| 285 | */ |
| 286 | characters_per_pixel=1; |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 287 | for (k=MaxCixels; (ssize_t) colors > k; k*=MaxCixels) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 288 | characters_per_pixel++; |
| 289 | /* |
| 290 | UIL header. |
| 291 | */ |
cristy | bd899c2 | 2009-11-26 23:51:49 +0000 | [diff] [blame] | 292 | symbol=AcquireString(""); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 293 | (void) WriteBlobString(image,"/* UIL */\n"); |
| 294 | GetPathComponent(image->filename,BasePath,basename); |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 295 | (void) FormatLocaleString(buffer,MaxTextExtent, |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 296 | "value\n %s_ct : color_table(\n",basename); |
| 297 | (void) WriteBlobString(image,buffer); |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 298 | GetPixelInfo(image,&pixel); |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 299 | for (i=0; i < (ssize_t) colors; i++) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 300 | { |
| 301 | /* |
| 302 | Define UIL color. |
| 303 | */ |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 304 | SetPixelInfoPacket(image,image->colormap+i,&pixel); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 305 | pixel.colorspace=RGBColorspace; |
| 306 | pixel.depth=8; |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 307 | pixel.alpha=(MagickRealType) OpaqueAlpha; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 308 | GetColorTuple(&pixel,MagickTrue,name); |
| 309 | if (transparent != MagickFalse) |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 310 | if (i == (ssize_t) (colors-1)) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 311 | (void) CopyMagickString(name,"None",MaxTextExtent); |
| 312 | /* |
| 313 | Write UIL color. |
| 314 | */ |
| 315 | k=i % MaxCixels; |
| 316 | symbol[0]=Cixel[k]; |
| 317 | for (j=1; j < (int) characters_per_pixel; j++) |
| 318 | { |
| 319 | k=((i-k)/MaxCixels) % MaxCixels; |
| 320 | symbol[j]=Cixel[k]; |
| 321 | } |
| 322 | symbol[j]='\0'; |
cristy | bd899c2 | 2009-11-26 23:51:49 +0000 | [diff] [blame] | 323 | (void) SubstituteString(&symbol,"'","''"); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 324 | if (LocaleCompare(name,"None") == 0) |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 325 | (void) FormatLocaleString(buffer,MaxTextExtent, |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 326 | " background color = '%s'",symbol); |
| 327 | else |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 328 | (void) FormatLocaleString(buffer,MaxTextExtent, |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 329 | " color('%s',%s) = '%s'",name, |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 330 | GetPixelPacketIntensity(image->colormap+i) < |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 331 | ((Quantum) QuantumRange/2) ? "background" : "foreground",symbol); |
| 332 | (void) WriteBlobString(image,buffer); |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 333 | (void) FormatLocaleString(buffer,MaxTextExtent,"%s", |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 334 | (i == (ssize_t) (colors-1) ? ");\n" : ",\n")); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 335 | (void) WriteBlobString(image,buffer); |
| 336 | } |
| 337 | /* |
| 338 | Define UIL pixels. |
| 339 | */ |
| 340 | GetPathComponent(image->filename,BasePath,basename); |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 341 | (void) FormatLocaleString(buffer,MaxTextExtent, |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 342 | " %s_icon : icon(color_table = %s_ct,\n",basename,basename); |
| 343 | (void) WriteBlobString(image,buffer); |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 344 | for (y=0; y < (ssize_t) image->rows; y++) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 345 | { |
| 346 | p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception); |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 347 | if (p == (const Quantum *) NULL) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 348 | break; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 349 | (void) WriteBlobString(image," \""); |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 350 | for (x=0; x < (ssize_t) image->columns; x++) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 351 | { |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 352 | k=((ssize_t) GetPixelIndex(image,p) % MaxCixels); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 353 | symbol[0]=Cixel[k]; |
| 354 | for (j=1; j < (int) characters_per_pixel; j++) |
| 355 | { |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 356 | k=(((int) GetPixelIndex(image,p)-k)/MaxCixels) % |
| 357 | MaxCixels; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 358 | symbol[j]=Cixel[k]; |
| 359 | } |
| 360 | symbol[j]='\0'; |
| 361 | (void) CopyMagickString(buffer,symbol,MaxTextExtent); |
| 362 | (void) WriteBlobString(image,buffer); |
cristy | ed23157 | 2011-07-14 02:18:59 +0000 | [diff] [blame] | 363 | p+=GetPixelChannels(image); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 364 | } |
cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame] | 365 | (void) FormatLocaleString(buffer,MaxTextExtent,"\"%s\n", |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 366 | (y == (ssize_t) (image->rows-1) ? ");" : ",")); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 367 | (void) WriteBlobString(image,buffer); |
cristy | cee9711 | 2010-05-28 00:44:52 +0000 | [diff] [blame] | 368 | status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y, |
cristy | c6da28e | 2011-04-28 01:41:35 +0000 | [diff] [blame] | 369 | image->rows); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 370 | if (status == MagickFalse) |
| 371 | break; |
| 372 | } |
cristy | bd899c2 | 2009-11-26 23:51:49 +0000 | [diff] [blame] | 373 | symbol=DestroyString(symbol); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 374 | (void) CloseBlob(image); |
| 375 | return(MagickTrue); |
| 376 | } |