% March 2008 %
% %
% %
-% Copyright 1999-2011 ImageMagick Studio LLC, a non-profit organization %
+% Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization %
% dedicated to making software imaging solutions freely available. %
% %
% You may not use this file except in compliance with the License. You may %
} DDSColors;
typedef MagickBooleanType
- DDSDecoder(Image *,DDSInfo *);
+ DDSDecoder(Image *,DDSInfo *,ExceptionInfo *);
/*
Macros
DDSColors *c, MagickBooleanType ignoreAlpha);
static MagickBooleanType
- ReadDXT1(Image *image, DDSInfo *dds_info);
+ ReadDXT1(Image *, DDSInfo *,ExceptionInfo *);
static MagickBooleanType
- ReadDXT3(Image *image, DDSInfo *dds_info);
+ ReadDXT3(Image *image, DDSInfo *dds_info,ExceptionInfo *);
static MagickBooleanType
- ReadDXT5(Image *image, DDSInfo *dds_info);
+ ReadDXT5(Image *image, DDSInfo *dds_info,ExceptionInfo *);
static MagickBooleanType
- ReadUncompressedRGB(Image *image, DDSInfo *dds_info);
+ ReadUncompressedRGB(Image *image, DDSInfo *dds_info,ExceptionInfo *);
static MagickBooleanType
- ReadUncompressedRGBA(Image *image, DDSInfo *dds_info);
+ ReadUncompressedRGBA(Image *image, DDSInfo *dds_info,ExceptionInfo *);
static void
SkipDXTMipmaps(Image *image, DDSInfo *dds_info, int texel_size);
MagickBooleanType
status,
cubemap = MagickFalse,
- volume = MagickFalse,
- matte;
-
+ volume = MagickFalse;
+
CompressionType
compression;
DDSDecoder
*decoder;
+ PixelTrait
+ alpha_trait;
+
size_t
n, num_images;
image_info->filename);
assert(exception != (ExceptionInfo *) NULL);
assert(exception->signature == MagickSignature);
- image=AcquireImage(image_info);
+ image=AcquireImage(image_info,exception);
status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
if (status == MagickFalse)
{
compression = NoCompression;
if (dds_info.pixelformat.flags & DDPF_ALPHAPIXELS)
{
- matte = MagickTrue;
+ alpha_trait = BlendPixelTrait;
decoder = ReadUncompressedRGBA;
}
else
{
- matte = MagickTrue;
+ alpha_trait = UndefinedPixelTrait;
decoder = ReadUncompressedRGB;
}
}
{
case FOURCC_DXT1:
{
- matte = MagickFalse;
+ alpha_trait = UndefinedPixelTrait;
compression = DXT1Compression;
decoder = ReadDXT1;
break;
case FOURCC_DXT3:
{
- matte = MagickTrue;
+ alpha_trait = BlendPixelTrait;
compression = DXT3Compression;
decoder = ReadDXT3;
break;
case FOURCC_DXT5:
{
- matte = MagickTrue;
+ alpha_trait = BlendPixelTrait;
compression = DXT5Compression;
decoder = ReadDXT5;
break;
if (n != 0)
{
/* Start a new image */
- AcquireNextImage(image_info,image);
+ AcquireNextImage(image_info,image,exception);
if (GetNextImageInList(image) == (Image *) NULL)
{
image = DestroyImageList(image);
image=SyncNextImageInList(image);
}
- image->matte = matte;
+ image->alpha_trait=alpha_trait;
image->compression = compression;
image->columns = dds_info.width;
image->rows = dds_info.height;
return(GetFirstImageInList(image));
}
- if ((decoder)(image, &dds_info) != MagickTrue)
+ if ((decoder)(image, &dds_info, exception) != MagickTrue)
{
(void) CloseBlob(image);
return(GetFirstImageInList(image));
}
}
-static MagickBooleanType ReadDXT1(Image *image, DDSInfo *dds_info)
+static MagickBooleanType ReadDXT1(Image *image, DDSInfo *dds_info,
+ ExceptionInfo *exception)
{
DDSColors
colors;
- ExceptionInfo
- *exception;
-
register Quantum
*q;
c0,
c1;
- exception=(&image->exception);
for (y = 0; y < (ssize_t) dds_info->height; y += 4)
{
for (x = 0; x < (ssize_t) dds_info->width; x += 4)
SetPixelGreen(image,ScaleCharToQuantum(colors.g[code]),q);
SetPixelBlue(image,ScaleCharToQuantum(colors.b[code]),q);
SetPixelAlpha(image,ScaleCharToQuantum(colors.a[code]),q);
- if (colors.a[code] && (image->matte == MagickFalse))
- image->matte=MagickTrue; /* Correct matte */
+ if (colors.a[code] && (image->alpha_trait != BlendPixelTrait))
+ image->alpha_trait=BlendPixelTrait; /* Correct matte */
q+=GetPixelChannels(image);
}
}
return MagickTrue;
}
-static MagickBooleanType ReadDXT3(Image *image, DDSInfo *dds_info)
+static MagickBooleanType ReadDXT3(Image *image, DDSInfo *dds_info,
+ ExceptionInfo *exception)
{
DDSColors
colors;
- ExceptionInfo
- *exception;
-
register Quantum
*q;
c0,
c1;
- exception=(&image->exception);
for (y = 0; y < (ssize_t) dds_info->height; y += 4)
{
for (x = 0; x < (ssize_t) dds_info->width; x += 4)
return MagickTrue;
}
-static MagickBooleanType ReadDXT5(Image *image, DDSInfo *dds_info)
+static MagickBooleanType ReadDXT5(Image *image, DDSInfo *dds_info,
+ ExceptionInfo *exception)
{
DDSColors
colors;
- ExceptionInfo
- *exception;
-
MagickSizeType
alpha_bits;
c0,
c1;
- exception=(&image->exception);
for (y = 0; y < (ssize_t) dds_info->height; y += 4)
{
for (x = 0; x < (ssize_t) dds_info->width; x += 4)
return MagickTrue;
}
-static MagickBooleanType ReadUncompressedRGB(Image *image, DDSInfo *dds_info)
+static MagickBooleanType ReadUncompressedRGB(Image *image, DDSInfo *dds_info,
+ ExceptionInfo *exception)
{
- ExceptionInfo
- *exception;
-
ssize_t
x, y;
register Quantum
*q;
- exception=(&image->exception);
for (y = 0; y < (ssize_t) dds_info->height; y++)
{
q = QueueAuthenticPixels(image, 0, y, dds_info->width, 1,exception);
return MagickTrue;
}
-static MagickBooleanType ReadUncompressedRGBA(Image *image, DDSInfo *dds_info)
+static MagickBooleanType ReadUncompressedRGBA(Image *image, DDSInfo *dds_info,
+ ExceptionInfo *exception)
{
- ExceptionInfo
- *exception;
-
ssize_t
x, y;
register Quantum
*q;
- exception=(&image->exception);
for (y = 0; y < (ssize_t) dds_info->height; y++)
{
q = QueueAuthenticPixels(image, 0, y, dds_info->width, 1,exception);