root/ImageMagick/trunk/coders/cut.c

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