2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13 % Read Microsoft Direct Draw Surface Image Format %
20 % Copyright 1999-2011 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/blob.h"
44 #include "magick/blob-private.h"
45 #include "magick/cache.h"
46 #include "magick/colorspace.h"
47 #include "magick/exception.h"
48 #include "magick/exception-private.h"
49 #include "magick/image.h"
50 #include "magick/image-private.h"
51 #include "magick/list.h"
52 #include "magick/log.h"
53 #include "magick/magick.h"
54 #include "magick/memory_.h"
55 #include "magick/monitor.h"
56 #include "magick/monitor-private.h"
57 #include "magick/profile.h"
58 #include "magick/quantum-private.h"
59 #include "magick/static.h"
60 #include "magick/string_.h"
61 #include "magick/module.h"
62 #include "magick/transform.h"
63 #include "magick/studio.h"
64 #include "magick/blob.h"
65 #include "magick/blob-private.h"
66 #include "magick/colorspace.h"
67 #include "magick/exception.h"
68 #include "magick/exception-private.h"
69 #include "magick/compress.h"
70 #include "magick/image.h"
71 #include "magick/image-private.h"
72 #include "magick/list.h"
73 #include "magick/magick.h"
74 #include "magick/memory_.h"
75 #include "magick/monitor.h"
76 #include "magick/monitor-private.h"
77 #include "magick/quantum.h"
78 #include "magick/static.h"
79 #include "magick/string_.h"
84 #define DDSD_CAPS 0x00000001
85 #define DDSD_HEIGHT 0x00000002
86 #define DDSD_WIDTH 0x00000004
87 #define DDSD_PITCH 0x00000008
88 #define DDSD_PIXELFORMAT 0x00001000
89 #define DDSD_MIPMAPCOUNT 0x00020000
90 #define DDSD_LINEARSIZE 0x00080000
91 #define DDSD_DEPTH 0x00800000
93 #define DDPF_ALPHAPIXELS 0x00000001
94 #define DDPF_FOURCC 0x00000004
95 #define DDPF_RGB 0x00000040
97 #define FOURCC_DXT1 0x31545844
98 #define FOURCC_DXT3 0x33545844
99 #define FOURCC_DXT5 0x35545844
101 #define DDSCAPS_COMPLEX 0x00000008
102 #define DDSCAPS_TEXTURE 0x00001000
103 #define DDSCAPS_MIPMAP 0x00400000
105 #define DDSCAPS2_CUBEMAP 0x00000200
106 #define DDSCAPS2_CUBEMAP_POSITIVEX 0x00000400
107 #define DDSCAPS2_CUBEMAP_NEGATIVEX 0x00000800
108 #define DDSCAPS2_CUBEMAP_POSITIVEY 0x00001000
109 #define DDSCAPS2_CUBEMAP_NEGATIVEY 0x00002000
110 #define DDSCAPS2_CUBEMAP_POSITIVEZ 0x00004000
111 #define DDSCAPS2_CUBEMAP_NEGATIVEZ 0x00008000
112 #define DDSCAPS2_VOLUME 0x00200000
115 Structure declarations.
117 typedef struct _DDSPixelFormat
129 typedef struct _DDSInfo
145 typedef struct _DDSColors
154 typedef MagickBooleanType
155 DDSDecoder(Image *,DDSInfo *);
160 #define C565_r(x) (((x) & 0xF800) >> 11)
161 #define C565_g(x) (((x) & 0x07E0) >> 5)
162 #define C565_b(x) ((x) & 0x001F)
164 #define C565_red(x) ( (C565_r(x) << 3 | C565_r(x) >> 2))
165 #define C565_green(x) ( (C565_g(x) << 2 | C565_g(x) >> 4))
166 #define C565_blue(x) ( (C565_b(x) << 3 | C565_b(x) >> 2))
168 #define DIV2(x) ((x) > 1 ? ((x) >> 1) : 1)
173 static MagickBooleanType
174 ReadDDSInfo(Image *image, DDSInfo *dds_info);
177 CalculateColors(unsigned short c0, unsigned short c1,
178 DDSColors *c, MagickBooleanType ignoreAlpha);
180 static MagickBooleanType
181 ReadDXT1(Image *image, DDSInfo *dds_info);
183 static MagickBooleanType
184 ReadDXT3(Image *image, DDSInfo *dds_info);
186 static MagickBooleanType
187 ReadDXT5(Image *image, DDSInfo *dds_info);
189 static MagickBooleanType
190 ReadUncompressedRGB(Image *image, DDSInfo *dds_info);
192 static MagickBooleanType
193 ReadUncompressedRGBA(Image *image, DDSInfo *dds_info);
196 SkipDXTMipmaps(Image *image, DDSInfo *dds_info, int texel_size);
199 SkipRGBMipmaps(Image *image, DDSInfo *dds_info, int pixel_size);
202 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
206 % R e a d D D S I m a g e %
210 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
212 % ReadDDSImage() reads a DirectDraw Surface image file and returns it. It
213 % allocates the memory necessary for the new Image structure and returns a
214 % pointer to the new image.
216 % The format of the ReadDDSImage method is:
218 % Image *ReadDDSImage(const ImageInfo *image_info,ExceptionInfo *exception)
220 % A description of each parameter follows:
222 % o image_info: The image info.
224 % o exception: return any errors or warnings in this structure.
228 static inline size_t Min(size_t one, size_t two)
235 static Image *ReadDDSImage(const ImageInfo *image_info,ExceptionInfo *exception)
242 cubemap = MagickFalse,
243 volume = MagickFalse,
261 assert(image_info != (const ImageInfo *) NULL);
262 assert(image_info->signature == MagickSignature);
263 if (image_info->debug != MagickFalse)
264 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
265 image_info->filename);
266 assert(exception != (ExceptionInfo *) NULL);
267 assert(exception->signature == MagickSignature);
268 image=AcquireImage(image_info);
269 status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
270 if (status == MagickFalse)
272 image=DestroyImageList(image);
273 return((Image *) NULL);
277 Initialize image structure.
279 if (ReadDDSInfo(image, &dds_info) != MagickTrue) {
280 ThrowReaderException(CorruptImageError,"ImproperImageHeader");
283 if (dds_info.ddscaps2 & DDSCAPS2_CUBEMAP)
284 cubemap = MagickTrue;
286 if (dds_info.ddscaps2 & DDSCAPS2_VOLUME && dds_info.depth > 0)
289 (void) SeekBlob(image, 128, SEEK_SET);
292 Determine pixel format
294 if (dds_info.pixelformat.flags & DDPF_RGB)
296 compression = NoCompression;
297 if (dds_info.pixelformat.flags & DDPF_ALPHAPIXELS)
300 decoder = ReadUncompressedRGBA;
305 decoder = ReadUncompressedRGB;
308 else if (dds_info.pixelformat.flags & DDPF_FOURCC)
310 switch (dds_info.pixelformat.fourcc)
315 compression = DXT1Compression;
323 compression = DXT3Compression;
331 compression = DXT5Compression;
339 ThrowReaderException(CorruptImageError, "ImageTypeNotSupported");
345 /* Neither compressed nor uncompressed... thus unsupported */
346 ThrowReaderException(CorruptImageError, "ImageTypeNotSupported");
353 Determine number of faces defined in the cubemap
356 if (dds_info.ddscaps2 & DDSCAPS2_CUBEMAP_POSITIVEX) num_images++;
357 if (dds_info.ddscaps2 & DDSCAPS2_CUBEMAP_NEGATIVEX) num_images++;
358 if (dds_info.ddscaps2 & DDSCAPS2_CUBEMAP_POSITIVEY) num_images++;
359 if (dds_info.ddscaps2 & DDSCAPS2_CUBEMAP_NEGATIVEY) num_images++;
360 if (dds_info.ddscaps2 & DDSCAPS2_CUBEMAP_POSITIVEZ) num_images++;
361 if (dds_info.ddscaps2 & DDSCAPS2_CUBEMAP_NEGATIVEZ) num_images++;
365 num_images = dds_info.depth;
367 for (n = 0; n < num_images; n++)
371 /* Start a new image */
372 AcquireNextImage(image_info,image);
373 if (GetNextImageInList(image) == (Image *) NULL)
375 image = DestroyImageList(image);
376 return((Image *) NULL);
378 image=SyncNextImageInList(image);
381 image->matte = matte;
382 image->compression = compression;
383 image->columns = dds_info.width;
384 image->rows = dds_info.height;
385 image->storage_class = DirectClass;
386 image->endian = LSBEndian;
388 if (image_info->ping != MagickFalse)
390 (void) CloseBlob(image);
391 return(GetFirstImageInList(image));
394 if ((decoder)(image, &dds_info) != MagickTrue)
396 (void) CloseBlob(image);
397 return(GetFirstImageInList(image));
401 if (EOFBlob(image) != MagickFalse)
402 ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",
405 (void) CloseBlob(image);
406 return(GetFirstImageInList(image));
409 static MagickBooleanType ReadDDSInfo(Image *image, DDSInfo *dds_info)
415 /* Seek to start of header */
416 (void) SeekBlob(image, 4, SEEK_SET);
418 /* Check header field */
419 hdr_size = ReadBlobLSBLong(image);
423 /* Fill in DDS info struct */
424 dds_info->flags = ReadBlobLSBLong(image);
426 /* Check required flags */
427 required=(size_t) (DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT);
428 if ((dds_info->flags & required) != required)
431 dds_info->height = ReadBlobLSBLong(image);
432 dds_info->width = ReadBlobLSBLong(image);
433 dds_info->pitchOrLinearSize = ReadBlobLSBLong(image);
434 dds_info->depth = ReadBlobLSBLong(image);
435 dds_info->mipmapcount = ReadBlobLSBLong(image);
437 (void) SeekBlob(image, 44, SEEK_CUR); /* reserved region of 11 DWORDs */
439 /* Read pixel format structure */
440 hdr_size = ReadBlobLSBLong(image);
444 dds_info->pixelformat.flags = ReadBlobLSBLong(image);
445 dds_info->pixelformat.fourcc = ReadBlobLSBLong(image);
446 dds_info->pixelformat.rgb_bitcount = ReadBlobLSBLong(image);
447 dds_info->pixelformat.r_bitmask = ReadBlobLSBLong(image);
448 dds_info->pixelformat.g_bitmask = ReadBlobLSBLong(image);
449 dds_info->pixelformat.b_bitmask = ReadBlobLSBLong(image);
450 dds_info->pixelformat.alpha_bitmask = ReadBlobLSBLong(image);
452 dds_info->ddscaps1 = ReadBlobLSBLong(image);
453 dds_info->ddscaps2 = ReadBlobLSBLong(image);
454 (void) SeekBlob(image, 12, SEEK_CUR); /* 3 reserved DWORDs */
459 static void CalculateColors(unsigned short c0, unsigned short c1,
460 DDSColors *c, MagickBooleanType ignoreAlpha)
462 c->a[0] = c->a[1] = c->a[2] = c->a[3] = 0;
464 c->r[0] = (unsigned char) C565_red(c0);
465 c->g[0] = (unsigned char) C565_green(c0);
466 c->b[0] = (unsigned char) C565_blue(c0);
468 c->r[1] = (unsigned char) C565_red(c1);
469 c->g[1] = (unsigned char) C565_green(c1);
470 c->b[1] = (unsigned char) C565_blue(c1);
472 if (ignoreAlpha == MagickTrue || c0 > c1)
474 c->r[2] = (unsigned char) ((2 * c->r[0] + c->r[1]) / 3);
475 c->g[2] = (unsigned char) ((2 * c->g[0] + c->g[1]) / 3);
476 c->b[2] = (unsigned char) ((2 * c->b[0] + c->b[1]) / 3);
478 c->r[3] = (unsigned char) ((c->r[0] + 2 * c->r[1]) / 3);
479 c->g[3] = (unsigned char) ((c->g[0] + 2 * c->g[1]) / 3);
480 c->b[3] = (unsigned char) ((c->b[0] + 2 * c->b[1]) / 3);
484 c->r[2] = (unsigned char) ((c->r[0] + c->r[1]) / 2);
485 c->g[2] = (unsigned char) ((c->g[0] + c->g[1]) / 2);
486 c->b[2] = (unsigned char) ((c->b[0] + c->b[1]) / 2);
488 c->r[3] = c->g[3] = c->b[3] = 0;
493 static MagickBooleanType ReadDXT1(Image *image, DDSInfo *dds_info)
522 exception=(&image->exception);
523 for (y = 0; y < (ssize_t) dds_info->height; y += 4)
525 for (x = 0; x < (ssize_t) dds_info->width; x += 4)
527 /* Get 4x4 patch of pixels to write on */
528 q = QueueAuthenticPixels(image, x, y, Min(4, dds_info->width - x),
529 Min(4, dds_info->height - y),exception);
531 if (q == (PixelPacket *) NULL)
534 /* Read 8 bytes of data from the image */
535 c0 = ReadBlobLSBShort(image);
536 c1 = ReadBlobLSBShort(image);
537 bits = ReadBlobLSBLong(image);
539 CalculateColors(c0, c1, &colors, MagickFalse);
541 /* Write the pixels */
542 for (j = 0; j < 4; j++)
544 for (i = 0; i < 4; i++)
546 if ((x + i) < (ssize_t) dds_info->width && (y + j) < (ssize_t) dds_info->height)
548 code = (unsigned char) ((bits >> ((j*4+i)*2)) & 0x3);
549 q->red = ScaleCharToQuantum( colors.r[code] );
550 q->green = ScaleCharToQuantum( colors.g[code] );
551 q->blue = ScaleCharToQuantum( colors.b[code] );
552 q->opacity = ScaleCharToQuantum( colors.a[code] );
553 if (colors.a[code] && image->matte == MagickFalse)
555 image->matte = MagickTrue;
561 if (SyncAuthenticPixels(image,exception) == MagickFalse)
566 SkipDXTMipmaps(image, dds_info, 8);
571 static MagickBooleanType ReadDXT3(Image *image, DDSInfo *dds_info)
603 exception=(&image->exception);
604 for (y = 0; y < (ssize_t) dds_info->height; y += 4)
606 for (x = 0; x < (ssize_t) dds_info->width; x += 4)
608 /* Get 4x4 patch of pixels to write on */
609 q = QueueAuthenticPixels(image, x, y, Min(4, dds_info->width - x),
610 Min(4, dds_info->height - y),exception);
612 if (q == (PixelPacket *) NULL)
615 /* Read alpha values (8 bytes) */
616 a0 = ReadBlobLSBLong(image);
617 a1 = ReadBlobLSBLong(image);
619 /* Read 8 bytes of data from the image */
620 c0 = ReadBlobLSBShort(image);
621 c1 = ReadBlobLSBShort(image);
622 bits = ReadBlobLSBLong(image);
624 CalculateColors(c0, c1, &colors, MagickTrue);
626 /* Write the pixels */
627 for (j = 0; j < 4; j++)
629 for (i = 0; i < 4; i++)
631 if ((x + i) < (ssize_t) dds_info->width && (y + j) < (ssize_t) dds_info->height)
633 code = (bits >> ((4*j+i)*2)) & 0x3;
634 q->red = ScaleCharToQuantum( colors.r[code] );
635 q->green = ScaleCharToQuantum( colors.g[code] );
636 q->blue = ScaleCharToQuantum( colors.b[code] );
639 Extract alpha value: multiply 0..15 by 17 to get range 0..255
642 alpha = 17U * (unsigned char) ((a0 >> (4*(4*j+i))) & 0xf);
644 alpha = 17U * (unsigned char) ((a1 >> (4*(4*(j-2)+i))) & 0xf);
646 q->opacity = ScaleCharToQuantum( (unsigned char) (255 - alpha) );
653 if (SyncAuthenticPixels(image,exception) == MagickFalse)
658 SkipDXTMipmaps(image, dds_info, 16);
663 static MagickBooleanType ReadDXT5(Image *image, DDSInfo *dds_info)
699 exception=(&image->exception);
700 for (y = 0; y < (ssize_t) dds_info->height; y += 4)
702 for (x = 0; x < (ssize_t) dds_info->width; x += 4)
704 /* Get 4x4 patch of pixels to write on */
705 q = QueueAuthenticPixels(image, x, y, Min(4, dds_info->width - x),
706 Min(4, dds_info->height - y),exception);
708 if (q == (PixelPacket *) NULL)
711 /* Read alpha values (8 bytes) */
712 a0 = (unsigned char) ReadBlobByte(image);
713 a1 = (unsigned char) ReadBlobByte(image);
715 alpha_bits = (MagickSizeType)ReadBlobLSBLong(image)
716 | ((MagickSizeType)ReadBlobLSBShort(image) << 32);
718 /* Read 8 bytes of data from the image */
719 c0 = ReadBlobLSBShort(image);
720 c1 = ReadBlobLSBShort(image);
721 bits = ReadBlobLSBLong(image);
723 CalculateColors(c0, c1, &colors, MagickTrue);
725 /* Write the pixels */
726 for (j = 0; j < 4; j++)
728 for (i = 0; i < 4; i++)
730 if ((x + i) < (ssize_t) dds_info->width && (y + j) < (ssize_t) dds_info->height)
732 code = (bits >> ((4*j+i)*2)) & 0x3;
733 q->red = ScaleCharToQuantum( colors.r[code] );
734 q->green = ScaleCharToQuantum( colors.g[code] );
735 q->blue = ScaleCharToQuantum( colors.b[code] );
737 /* Extract alpha value */
738 alpha_code = (size_t) (alpha_bits >> (3*(4*j+i))) & 0x7;
741 else if (alpha_code == 1)
744 alpha = ((8-alpha_code) * a0 + (alpha_code-1) * a1) / 7;
745 else if (alpha_code == 6)
747 else if (alpha_code == 7)
750 alpha = (((6-alpha_code) * a0 + (alpha_code-1) * a1) / 5);
752 q->opacity = ScaleCharToQuantum( (unsigned char) (255 - alpha) );
759 if (SyncAuthenticPixels(image,exception) == MagickFalse)
764 SkipDXTMipmaps(image, dds_info, 16);
769 static MagickBooleanType ReadUncompressedRGB(Image *image, DDSInfo *dds_info)
780 exception=(&image->exception);
781 for (y = 0; y < (ssize_t) dds_info->height; y++)
783 q = QueueAuthenticPixels(image, 0, y, dds_info->width, 1,exception);
785 if (q == (PixelPacket *) NULL)
788 for (x = 0; x < (ssize_t) dds_info->width; x++)
790 q->blue = ScaleCharToQuantum( (unsigned char) ReadBlobByte(image) );
791 q->green = ScaleCharToQuantum( (unsigned char) ReadBlobByte(image) );
792 q->red = ScaleCharToQuantum( (unsigned char) ReadBlobByte(image) );
793 if (dds_info->pixelformat.rgb_bitcount == 32)
794 (void) ReadBlobByte(image);
798 if (SyncAuthenticPixels(image,exception) == MagickFalse)
802 SkipRGBMipmaps(image, dds_info, 3);
807 static MagickBooleanType ReadUncompressedRGBA(Image *image, DDSInfo *dds_info)
818 exception=(&image->exception);
819 for (y = 0; y < (ssize_t) dds_info->height; y++)
821 q = QueueAuthenticPixels(image, 0, y, dds_info->width, 1,exception);
823 if (q == (PixelPacket *) NULL)
826 for (x = 0; x < (ssize_t) dds_info->width; x++)
828 q->blue = ScaleCharToQuantum( (unsigned char) ReadBlobByte(image) );
829 q->green = ScaleCharToQuantum( (unsigned char) ReadBlobByte(image) );
830 q->red = ScaleCharToQuantum( (unsigned char) ReadBlobByte(image) );
831 q->opacity = ScaleCharToQuantum( (unsigned char) (255 - ReadBlobByte(image)) );
835 if (SyncAuthenticPixels(image,exception) == MagickFalse)
839 SkipRGBMipmaps(image, dds_info, 4);
845 Skip the mipmap images for compressed (DXTn) dds files
847 static void SkipDXTMipmaps(Image *image, DDSInfo *dds_info, int texel_size)
860 Only skip mipmaps for textures and cube maps
862 if (dds_info->ddscaps1 & DDSCAPS_MIPMAP
863 && (dds_info->ddscaps1 & DDSCAPS_TEXTURE
864 || dds_info->ddscaps2 & DDSCAPS2_CUBEMAP))
866 w = DIV2(dds_info->width);
867 h = DIV2(dds_info->height);
870 Mipmapcount includes the main image, so start from one
872 for (i = 1; (i < (ssize_t) dds_info->mipmapcount) && w && h; i++)
874 offset = (MagickOffsetType) ((w + 3) / 4) * ((h + 3) / 4) * texel_size;
875 (void) SeekBlob(image, offset, SEEK_CUR);
884 Skip the mipmap images for uncompressed (RGB or RGBA) dds files
886 static void SkipRGBMipmaps(Image *image, DDSInfo *dds_info, int pixel_size)
899 Only skip mipmaps for textures and cube maps
901 if (dds_info->ddscaps1 & DDSCAPS_MIPMAP
902 && (dds_info->ddscaps1 & DDSCAPS_TEXTURE
903 || dds_info->ddscaps2 & DDSCAPS2_CUBEMAP))
905 w = DIV2(dds_info->width);
906 h = DIV2(dds_info->height);
909 Mipmapcount includes the main image, so start from one
911 for (i=1; (i < (ssize_t) dds_info->mipmapcount) && w && h; i++)
913 offset = (MagickOffsetType) w * h * pixel_size;
914 (void) SeekBlob(image, offset, SEEK_CUR);
923 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
931 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
933 % IsDDS() returns MagickTrue if the image format type, identified by the
934 % magick string, is DDS.
936 % The format of the IsDDS method is:
938 % MagickBooleanType IsDDS(const unsigned char *magick,const size_t length)
940 % A description of each parameter follows:
942 % o magick: compare image format pattern against these bytes.
944 % o length: Specifies the length of the magick string.
947 static MagickBooleanType IsDDS(const unsigned char *magick,const size_t length)
951 if (LocaleNCompare((char *) magick,"DDS ", 4) == 0)
957 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
961 % R e g i s t e r D D S I m a g e %
965 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
967 % RegisterDDSImage() adds attributes for the DDS image format to
968 % the list of supported formats. The attributes include the image format
969 % tag, a method to read and/or write the format, whether the format
970 % supports the saving of more than one frame to the same file or blob,
971 % whether the format supports native in-memory I/O, and a brief
972 % description of the format.
974 % The format of the RegisterDDSImage method is:
976 % RegisterDDSImage(void)
979 ModuleExport size_t RegisterDDSImage(void)
984 entry = SetMagickInfo("DDS");
985 entry->decoder = (DecodeImageHandler *) ReadDDSImage;
986 entry->magick = (IsImageFormatHandler *) IsDDS;
987 entry->description = ConstantString("Microsoft DirectDraw Surface");
988 entry->module = ConstantString("DDS");
989 (void) RegisterMagickInfo(entry);
990 return(MagickImageCoderSignature);
995 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
999 % U n r e g i s t e r D D S I m a g e %
1003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1005 % UnregisterDDSImage() removes format registrations made by the
1006 % DDS module from the list of supported formats.
1008 % The format of the UnregisterDDSImage method is:
1010 % UnregisterDDSImage(void)
1013 ModuleExport void UnregisterDDSImage(void)
1015 (void) UnregisterMagickInfo("DDS");