]> granicus.if.org Git - imagemagick/blob - coders/cut.c
2b7b93474e3adbd68ac013ba0c90987494dc36a7
[imagemagick] / coders / cut.c
1 /*
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %                                                                             %
4 %                                                                             %
5 %                              CCC  U   U  TTTTT                              %
6 %                             C     U   U    T                                %
7 %                             C     U   U    T                                %
8 %                             C     U   U    T                                %
9 %                              CCC   UUU     T                                %
10 %                                                                             %
11 %                                                                             %
12 %                         Read DR Halo Image Format                           %
13 %                                                                             %
14 %                              Software Design                                %
15 %                              Jaroslav Fojtik                                %
16 %                                 June 2000                                   %
17 %                                                                             %
18 %                                                                             %
19 %  Permission is hereby granted, free of charge, to any person obtaining a    %
20 %  copy of this software and associated documentation files ("ImageMagick"),  %
21 %  to deal in ImageMagick without restriction, including without limitation   %
22 %  the rights to use, copy, modify, merge, publish, distribute, sublicense,   %
23 %  and/or sell copies of ImageMagick, and to permit persons to whom the       %
24 %  ImageMagick is furnished to do so, subject to the following conditions:    %
25 %                                                                             %
26 %  The above copyright notice and this permission notice shall be included in %
27 %  all copies or substantial portions of ImageMagick.                         %
28 %                                                                             %
29 %  The software is provided "as is", without warranty of any kind, express or %
30 %  implied, including but not limited to the warranties of merchantability,   %
31 %  fitness for a particular purpose and noninfringement.  In no event shall   %
32 %  ImageMagick Studio be liable for any claim, damages or other liability,    %
33 %  whether in an action of contract, tort or otherwise, arising from, out of  %
34 %  or in connection with ImageMagick or the use or other dealings in          %
35 %  ImageMagick.                                                               %
36 %                                                                             %
37 %  Except as contained in this notice, the name of the ImageMagick Studio     %
38 %  shall not be used in advertising or otherwise to promote the sale, use or  %
39 %  other dealings in ImageMagick without prior written authorization from the %
40 %  ImageMagick Studio.                                                        %
41 %                                                                             %
42 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
43 %
44 %
45 */
46 \f
47 /*
48   Include declarations.
49 */
50 #include "MagickCore/studio.h"
51 #include "MagickCore/attribute.h"
52 #include "MagickCore/blob.h"
53 #include "MagickCore/blob-private.h"
54 #include "MagickCore/cache.h"
55 #include "MagickCore/color.h"
56 #include "MagickCore/color-private.h"
57 #include "MagickCore/colormap.h"
58 #include "MagickCore/colormap-private.h"
59 #include "MagickCore/exception.h"
60 #include "MagickCore/exception-private.h"
61 #include "MagickCore/image.h"
62 #include "MagickCore/image-private.h"
63 #include "MagickCore/list.h"
64 #include "MagickCore/magick.h"
65 #include "MagickCore/memory_.h"
66 #include "MagickCore/pixel-accessor.h"
67 #include "MagickCore/quantum-private.h"
68 #include "MagickCore/static.h"
69 #include "MagickCore/string_.h"
70 #include "MagickCore/module.h"
71 #include "MagickCore/utility.h"
72 #include "MagickCore/utility-private.h"
73 \f
74 typedef struct
75 {
76   unsigned Width;
77   unsigned Height;
78   unsigned Reserved;
79 } CUTHeader;
80
81 typedef struct
82 {
83   char FileId[2];
84   unsigned Version;
85   unsigned Size;
86   char FileType;
87   char SubType;
88   unsigned BoardID;
89   unsigned GraphicsMode;
90   unsigned MaxIndex;
91   unsigned MaxRed;
92   unsigned MaxGreen;
93   unsigned MaxBlue;
94   char PaletteId[20];
95 } CUTPalHeader;
96
97 \f
98 static void InsertRow(ssize_t depth,unsigned char *p,ssize_t y,Image *image)
99 {
100   ExceptionInfo
101     *exception;
102
103   size_t bit; ssize_t x;
104   register Quantum *q;
105   Quantum index;
106
107   index=0;
108   exception=(&image->exception);
109   switch (depth)
110   {
111     case 1:  /* Convert bitmap scanline. */
112       {
113         q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
114         if (q == (Quantum *) NULL)
115           break;
116         for (x=0; x < ((ssize_t) image->columns-7); x+=8)
117         {
118           for (bit=0; bit < 8; bit++)
119           {
120             index=(Quantum) ((((*p) & (0x80 >> bit)) != 0) ? 0x01 : 0x00);
121             SetPixelIndex(image,index,q);
122             q+=GetPixelChannels(image);
123           }
124           p++;
125         }
126         if ((image->columns % 8) != 0)
127           {
128             for (bit=0; bit < (image->columns % 8); bit++)
129               {
130                 index=(Quantum) ((((*p) & (0x80 >> bit)) != 0) ? 0x01 : 0x00);
131                 SetPixelIndex(image,index,q);
132                 q+=GetPixelChannels(image);
133               }
134             p++;
135           }
136         if (SyncAuthenticPixels(image,exception) == MagickFalse)
137           break;
138         break;
139       }
140     case 2:  /* Convert PseudoColor scanline. */
141       {
142         q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
143         if (q == (Quantum *) NULL)
144           break;
145         for (x=0; x < ((ssize_t) image->columns-1); x+=2)
146         {
147           index=ConstrainColormapIndex(image,(*p >> 6) & 0x3);
148           SetPixelIndex(image,index,q);
149           q+=GetPixelChannels(image);
150           index=ConstrainColormapIndex(image,(*p >> 4) & 0x3);
151           SetPixelIndex(image,index,q);
152           q+=GetPixelChannels(image);
153           index=ConstrainColormapIndex(image,(*p >> 2) & 0x3);
154           SetPixelIndex(image,index,q);
155           q+=GetPixelChannels(image);
156           index=ConstrainColormapIndex(image,(*p) & 0x3);
157           SetPixelIndex(image,index,q);
158           q+=GetPixelChannels(image);
159           p++;
160         }
161         if ((image->columns % 4) != 0)
162           {
163             index=ConstrainColormapIndex(image,(*p >> 6) & 0x3);
164             SetPixelIndex(image,index,q);
165             q+=GetPixelChannels(image);
166             if ((image->columns % 4) >= 1)
167
168               {
169                 index=ConstrainColormapIndex(image,(*p >> 4) & 0x3);
170                 SetPixelIndex(image,index,q);
171                 q+=GetPixelChannels(image);
172                 if ((image->columns % 4) >= 2)
173
174                   {
175                     index=ConstrainColormapIndex(image,(*p >> 2) & 0x3);
176                     SetPixelIndex(image,index,q);
177                     q+=GetPixelChannels(image);
178                   }
179               }
180             p++;
181           }
182         if (SyncAuthenticPixels(image,exception) == MagickFalse)
183           break;
184         break;
185       }
186
187     case 4:  /* Convert PseudoColor scanline. */
188       {
189         q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
190         if (q == (Quantum *) NULL)
191           break;
192         for (x=0; x < ((ssize_t) image->columns-1); x+=2)
193         {
194             index=ConstrainColormapIndex(image,(*p >> 4) & 0xf);
195             SetPixelIndex(image,index,q);
196             q+=GetPixelChannels(image);
197             index=ConstrainColormapIndex(image,(*p) & 0xf);
198             SetPixelIndex(image,index,q);
199             q+=GetPixelChannels(image);
200             p++;
201           }
202         if ((image->columns % 2) != 0)
203           {
204             index=ConstrainColormapIndex(image,(*p >> 4) & 0xf);
205             SetPixelIndex(image,index,q);
206             q+=GetPixelChannels(image);
207             p++;
208           }
209         if (SyncAuthenticPixels(image,exception) == MagickFalse)
210           break;
211         break;
212       }
213     case 8: /* Convert PseudoColor scanline. */
214       {
215         q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
216         if (q == (Quantum *) NULL) break;
217         for (x=0; x < (ssize_t) image->columns; x++)
218         {
219           index=ConstrainColormapIndex(image,*p);
220           SetPixelIndex(image,index,q);
221           p++;
222           q+=GetPixelChannels(image);
223         }
224         if (SyncAuthenticPixels(image,exception) == MagickFalse)
225           break;
226       }
227       break;
228
229     }
230 }
231
232 /*
233    Compute the number of colors in Grayed R[i]=G[i]=B[i] image
234 */
235 static int GetCutColors(Image *image)
236 {
237   ExceptionInfo
238     *exception;
239
240   Quantum
241     intensity,
242     scale_intensity;
243
244   register Quantum
245     *q;
246
247   ssize_t
248     x,
249     y;
250
251   exception=(&image->exception);
252   intensity=0;
253   scale_intensity=ScaleCharToQuantum(16);
254   for (y=0; y < (ssize_t) image->rows; y++)
255   {
256     q=GetAuthenticPixels(image,0,y,image->columns,1,exception);
257     for (x=0; x < (ssize_t) image->columns; x++)
258     {
259       if (intensity < GetPixelRed(image,q))
260         intensity=GetPixelRed(image,q);
261       if (intensity >= scale_intensity)
262         return(255);
263       q+=GetPixelChannels(image);
264     }
265   }
266   if (intensity < ScaleCharToQuantum(2))
267     return(2);
268   if (intensity < ScaleCharToQuantum(16))
269     return(16);
270   return((int) intensity);
271 }
272 \f
273 /*
274 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
275 %                                                                             %
276 %                                                                             %
277 %                                                                             %
278 %   R e a d C U T I m a g e                                                   %
279 %                                                                             %
280 %                                                                             %
281 %                                                                             %
282 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
283 %
284 %  ReadCUTImage() reads an CUT X image file and returns it.  It
285 %  allocates the memory necessary for the new Image structure and returns a
286 %  pointer to the new image.
287 %
288 %  The format of the ReadCUTImage method is:
289 %
290 %      Image *ReadCUTImage(const ImageInfo *image_info,ExceptionInfo *exception)
291 %
292 %  A description of each parameter follows:
293 %
294 %    o image_info: the image info.
295 %
296 %    o exception: return any errors or warnings in this structure.
297 %
298 */
299 static Image *ReadCUTImage(const ImageInfo *image_info,ExceptionInfo *exception)
300 {
301   Image *image,*palette;
302   ImageInfo *clone_info;
303   MagickBooleanType status;
304
305   MagickOffsetType
306     offset;
307
308   size_t EncodedByte;
309   unsigned char RunCount,RunValue,RunCountMasked;
310   CUTHeader  Header;
311   CUTPalHeader PalHeader;
312   ssize_t depth;
313   ssize_t i,j;
314   ssize_t ldblk;
315   unsigned char *BImgBuff=NULL,*ptrB;
316   register Quantum *q;
317
318   /*
319     Open image file.
320   */
321   assert(image_info != (const ImageInfo *) NULL);
322   assert(image_info->signature == MagickSignature);
323   if (image_info->debug != MagickFalse)
324     (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
325       image_info->filename);
326   assert(exception != (ExceptionInfo *) NULL);
327   assert(exception->signature == MagickSignature);
328   image=AcquireImage(image_info);
329   status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
330   if (status == MagickFalse)
331     {
332       image=DestroyImageList(image);
333       return((Image *) NULL);
334     }
335   /*
336     Read CUT image.
337   */
338   palette=NULL;
339   clone_info=NULL;
340   Header.Width=ReadBlobLSBShort(image);
341   Header.Height=ReadBlobLSBShort(image);
342   Header.Reserved=ReadBlobLSBShort(image);
343
344   if (Header.Width==0 || Header.Height==0 || Header.Reserved!=0)
345     CUT_KO:  ThrowReaderException(CorruptImageError,"ImproperImageHeader");
346
347   /*---This code checks first line of image---*/
348   EncodedByte=ReadBlobLSBShort(image);
349   RunCount=(unsigned char) ReadBlobByte(image);
350   RunCountMasked=RunCount & 0x7F;
351   ldblk=0;
352   while((int) RunCountMasked!=0)  /*end of line?*/
353     {
354       i=1;
355       if((int) RunCount<0x80) i=(ssize_t) RunCountMasked;
356       offset=SeekBlob(image,TellBlob(image)+i,SEEK_SET);
357       if (offset < 0)
358         ThrowReaderException(CorruptImageError,"ImproperImageHeader");
359       if(EOFBlob(image) != MagickFalse) goto CUT_KO;  /*wrong data*/
360       EncodedByte-=i+1;
361       ldblk+=(ssize_t) RunCountMasked;
362
363       RunCount=(unsigned char) ReadBlobByte(image);
364       if(EOFBlob(image) != MagickFalse)  goto CUT_KO;  /*wrong data: unexpected eof in line*/
365       RunCountMasked=RunCount & 0x7F;
366     }
367   if(EncodedByte!=1) goto CUT_KO;  /*wrong data: size incorrect*/
368   i=0;        /*guess a number of bit planes*/
369   if(ldblk==(int) Header.Width)   i=8;
370   if(2*ldblk==(int) Header.Width) i=4;
371   if(8*ldblk==(int) Header.Width) i=1;
372   if(i==0) goto CUT_KO;    /*wrong data: incorrect bit planes*/
373   depth=i;
374
375   image->columns=Header.Width;
376   image->rows=Header.Height;
377   image->depth=8;
378   image->colors=(size_t) (GetQuantumRange(1UL*i)+1);
379
380   if (image_info->ping) goto Finish;
381
382   /* ----- Do something with palette ----- */
383   if ((clone_info=CloneImageInfo(image_info)) == NULL) goto NoPalette;
384
385
386   i=(ssize_t) strlen(clone_info->filename);
387   j=i;
388   while(--i>0)
389     {
390       if(clone_info->filename[i]=='.')
391         {
392           break;
393         }
394       if(clone_info->filename[i]=='/' || clone_info->filename[i]=='\\' ||
395          clone_info->filename[i]==':' )
396         {
397           i=j;
398           break;
399         }
400     }
401
402   (void) CopyMagickString(clone_info->filename+i,".PAL",(size_t)
403     (MaxTextExtent-i));
404   if((clone_info->file=fopen_utf8(clone_info->filename,"rb"))==NULL)
405     {
406       (void) CopyMagickString(clone_info->filename+i,".pal",(size_t)
407         (MaxTextExtent-i));
408       if((clone_info->file=fopen_utf8(clone_info->filename,"rb"))==NULL)
409         {
410           clone_info->filename[i]='\0';
411           if((clone_info->file=fopen_utf8(clone_info->filename,"rb"))==NULL)
412             {
413               clone_info=DestroyImageInfo(clone_info);
414               clone_info=NULL;
415               goto NoPalette;
416             }
417         }
418     }
419
420   if( (palette=AcquireImage(clone_info))==NULL ) goto NoPalette;
421   status=OpenBlob(clone_info,palette,ReadBinaryBlobMode,exception);
422   if (status == MagickFalse)
423     {
424     ErasePalette:
425       palette=DestroyImage(palette);
426       palette=NULL;
427       goto NoPalette;
428     }
429
430
431   if(palette!=NULL)
432     {
433       (void) ReadBlob(palette,2,(unsigned char *) PalHeader.FileId);
434       if(strncmp(PalHeader.FileId,"AH",2) != 0) goto ErasePalette;
435       PalHeader.Version=ReadBlobLSBShort(palette);
436       PalHeader.Size=ReadBlobLSBShort(palette);
437       PalHeader.FileType=(char) ReadBlobByte(palette);
438       PalHeader.SubType=(char) ReadBlobByte(palette);
439       PalHeader.BoardID=ReadBlobLSBShort(palette);
440       PalHeader.GraphicsMode=ReadBlobLSBShort(palette);
441       PalHeader.MaxIndex=ReadBlobLSBShort(palette);
442       PalHeader.MaxRed=ReadBlobLSBShort(palette);
443       PalHeader.MaxGreen=ReadBlobLSBShort(palette);
444       PalHeader.MaxBlue=ReadBlobLSBShort(palette);
445       (void) ReadBlob(palette,20,(unsigned char *) PalHeader.PaletteId);
446
447       if(PalHeader.MaxIndex<1) goto ErasePalette;
448       image->colors=PalHeader.MaxIndex+1;
449       if (AcquireImageColormap(image,image->colors,exception) == MagickFalse) goto NoMemory;
450
451       if(PalHeader.MaxRed==0) PalHeader.MaxRed=(unsigned int) QuantumRange;  /*avoid division by 0*/
452       if(PalHeader.MaxGreen==0) PalHeader.MaxGreen=(unsigned int) QuantumRange;
453       if(PalHeader.MaxBlue==0) PalHeader.MaxBlue=(unsigned int) QuantumRange;
454
455       for(i=0;i<=(int) PalHeader.MaxIndex;i++)
456         {      /*this may be wrong- I don't know why is palette such strange*/
457           j=(ssize_t) TellBlob(palette);
458           if((j % 512)>512-6)
459             {
460               j=((j / 512)+1)*512;
461               offset=SeekBlob(palette,j,SEEK_SET);
462               if (offset < 0)
463                 ThrowReaderException(CorruptImageError,"ImproperImageHeader");
464             }
465           image->colormap[i].red=(Quantum) ReadBlobLSBShort(palette);
466           if (QuantumRange != (Quantum) PalHeader.MaxRed)
467             {
468               image->colormap[i].red=ClampToQuantum(((double)
469                 image->colormap[i].red*QuantumRange+(PalHeader.MaxRed>>1))/
470                 PalHeader.MaxRed);
471             }
472           image->colormap[i].green=(Quantum) ReadBlobLSBShort(palette);
473           if (QuantumRange != (Quantum) PalHeader.MaxGreen)
474             {
475               image->colormap[i].green=ClampToQuantum
476                 (((double) image->colormap[i].green*QuantumRange+(PalHeader.MaxGreen>>1))/PalHeader.MaxGreen);
477             }
478           image->colormap[i].blue=(Quantum) ReadBlobLSBShort(palette);
479           if (QuantumRange != (Quantum) PalHeader.MaxBlue)
480             {
481               image->colormap[i].blue=ClampToQuantum
482                 (((double)image->colormap[i].blue*QuantumRange+(PalHeader.MaxBlue>>1))/PalHeader.MaxBlue);
483             }
484
485         }
486     }
487
488
489
490  NoPalette:
491   if(palette==NULL)
492     {
493
494       image->colors=256;
495       if (AcquireImageColormap(image,image->colors,exception) == MagickFalse)
496         {
497         NoMemory:
498           ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
499             }
500
501       for (i=0; i < (ssize_t)image->colors; i++)
502         {
503           image->colormap[i].red=ScaleCharToQuantum((unsigned char) i);
504           image->colormap[i].green=ScaleCharToQuantum((unsigned char) i);
505           image->colormap[i].blue=ScaleCharToQuantum((unsigned char) i);
506         }
507     }
508
509
510   /* ----- Load RLE compressed raster ----- */
511   BImgBuff=(unsigned char *) AcquireQuantumMemory((size_t) ldblk,
512     sizeof(*BImgBuff));  /*Ldblk was set in the check phase*/
513   if(BImgBuff==NULL) goto NoMemory;
514
515   offset=SeekBlob(image,6 /*sizeof(Header)*/,SEEK_SET);
516   if (offset < 0)
517     ThrowReaderException(CorruptImageError,"ImproperImageHeader");
518   for (i=0; i < (int) Header.Height; i++)
519   {
520       EncodedByte=ReadBlobLSBShort(image);
521
522       ptrB=BImgBuff;
523       j=ldblk;
524
525       RunCount=(unsigned char) ReadBlobByte(image);
526       RunCountMasked=RunCount & 0x7F;
527
528       while ((int) RunCountMasked != 0)
529       {
530           if((ssize_t) RunCountMasked>j)
531             {    /*Wrong Data*/
532               RunCountMasked=(unsigned char) j;
533               if(j==0)
534                 {
535                   break;
536                 }
537             }
538
539           if((int) RunCount>0x80)
540             {
541               RunValue=(unsigned char) ReadBlobByte(image);
542               (void) ResetMagickMemory(ptrB,(int) RunValue,(size_t) RunCountMasked);
543             }
544           else {
545             (void) ReadBlob(image,(size_t) RunCountMasked,ptrB);
546           }
547
548           ptrB+=(int) RunCountMasked;
549           j-=(int) RunCountMasked;
550
551           if (EOFBlob(image) != MagickFalse) goto Finish;  /* wrong data: unexpected eof in line */
552           RunCount=(unsigned char) ReadBlobByte(image);
553           RunCountMasked=RunCount & 0x7F;
554         }
555
556       InsertRow(depth,BImgBuff,i,image);
557     }
558   (void) SyncImage(image);
559
560
561   /*detect monochrome image*/
562
563   if(palette==NULL)
564     {    /*attempt to detect binary (black&white) images*/
565       if ((image->storage_class == PseudoClass) &&
566           (IsImageGray(image,&image->exception) != MagickFalse))
567         {
568           if(GetCutColors(image)==2)
569             {
570               for (i=0; i < (ssize_t)image->colors; i++)
571                 {
572                   register Quantum
573                     sample;
574                   sample=ScaleCharToQuantum((unsigned char) i);
575                   if(image->colormap[i].red!=sample) goto Finish;
576                   if(image->colormap[i].green!=sample) goto Finish;
577                   if(image->colormap[i].blue!=sample) goto Finish;
578                 }
579
580               image->colormap[1].red=image->colormap[1].green=
581                 image->colormap[1].blue=(Quantum) QuantumRange;
582               for (i=0; i < (ssize_t)image->rows; i++)
583                 {
584                   q=QueueAuthenticPixels(image,0,i,image->columns,1,exception);
585                   for (j=0; j < (ssize_t)image->columns; j++)
586                     {
587                       if (GetPixelRed(image,q) == ScaleCharToQuantum(1))
588                         {
589                           SetPixelRed(image,QuantumRange,q);
590                           SetPixelGreen(image,QuantumRange,q);
591                           SetPixelBlue(image,QuantumRange,q);
592                         }
593                       q+=GetPixelChannels(image);
594                     }
595                   if (SyncAuthenticPixels(image,exception) == MagickFalse) goto Finish;
596                 }
597             }
598         }
599     }
600
601  Finish:
602   if (BImgBuff != NULL)
603     BImgBuff=(unsigned char *) RelinquishMagickMemory(BImgBuff);
604   if (palette != NULL)
605     palette=DestroyImage(palette);
606   if (clone_info != NULL)
607     clone_info=DestroyImageInfo(clone_info);
608   if (EOFBlob(image) != MagickFalse)
609     ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",
610       image->filename);
611   (void) CloseBlob(image);
612   return(GetFirstImageInList(image));
613 }
614 \f
615 /*
616 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
617 %                                                                             %
618 %                                                                             %
619 %                                                                             %
620 %   R e g i s t e r C U T I m a g e                                           %
621 %                                                                             %
622 %                                                                             %
623 %                                                                             %
624 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
625 %
626 %  RegisterCUTImage() adds attributes for the CUT image format to
627 %  the list of supported formats.  The attributes include the image format
628 %  tag, a method to read and/or write the format, whether the format
629 %  supports the saving of more than one frame to the same file or blob,
630 %  whether the format supports native in-memory I/O, and a brief
631 %  description of the format.
632 %
633 %  The format of the RegisterCUTImage method is:
634 %
635 %      size_t RegisterCUTImage(void)
636 %
637 */
638 ModuleExport size_t RegisterCUTImage(void)
639 {
640   MagickInfo
641     *entry;
642
643   entry=SetMagickInfo("CUT");
644   entry->decoder=(DecodeImageHandler *) ReadCUTImage;
645   entry->seekable_stream=MagickTrue;
646   entry->description=ConstantString("DR Halo");
647   entry->module=ConstantString("CUT");
648   (void) RegisterMagickInfo(entry);
649   return(MagickImageCoderSignature);
650 }
651 \f
652 /*
653 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
654 %                                                                             %
655 %                                                                             %
656 %                                                                             %
657 %   U n r e g i s t e r C U T I m a g e                                       %
658 %                                                                             %
659 %                                                                             %
660 %                                                                             %
661 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
662 %
663 %  UnregisterCUTImage() removes format registrations made by the
664 %  CUT module from the list of supported formats.
665 %
666 %  The format of the UnregisterCUTImage method is:
667 %
668 %      UnregisterCUTImage(void)
669 %
670 */
671 ModuleExport void UnregisterCUTImage(void)
672 {
673   (void) UnregisterMagickInfo("CUT");
674 }