% July 1992 %
% %
% %
-% 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 %
/*
Include declarations.
*/
-#include "magick/studio.h"
-#include "magick/blob.h"
-#include "magick/blob-private.h"
-#include "magick/cache.h"
-#include "magick/color.h"
-#include "magick/color-private.h"
-#include "magick/colorspace.h"
-#include "magick/exception.h"
-#include "magick/exception-private.h"
-#include "magick/image-private.h"
-#include "magick/magick.h"
-#include "magick/memory_.h"
-#include "magick/monitor.h"
-#include "magick/monitor-private.h"
-#include "magick/pixel-private.h"
-#include "magick/quantum-private.h"
-#include "magick/static.h"
-#include "magick/string_.h"
-#include "magick/module.h"
-#include "magick/utility.h"
+#include "MagickCore/studio.h"
+#include "MagickCore/attribute.h"
+#include "MagickCore/blob.h"
+#include "MagickCore/blob-private.h"
+#include "MagickCore/cache.h"
+#include "MagickCore/color.h"
+#include "MagickCore/color-private.h"
+#include "MagickCore/colorspace.h"
+#include "MagickCore/colorspace-private.h"
+#include "MagickCore/exception.h"
+#include "MagickCore/exception-private.h"
+#include "MagickCore/image-private.h"
+#include "MagickCore/magick.h"
+#include "MagickCore/memory_.h"
+#include "MagickCore/monitor.h"
+#include "MagickCore/monitor-private.h"
+#include "MagickCore/pixel-accessor.h"
+#include "MagickCore/quantum-private.h"
+#include "MagickCore/static.h"
+#include "MagickCore/string_.h"
+#include "MagickCore/module.h"
+#include "MagickCore/utility.h"
\f
/*
Forward declarations.
*/
static MagickBooleanType
- WriteUILImage(const ImageInfo *,Image *);
+ WriteUILImage(const ImageInfo *,Image *,ExceptionInfo *);
\f
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% The format of the WriteUILImage method is:
%
-% MagickBooleanType WriteUILImage(const ImageInfo *image_info,Image *image)
+% MagickBooleanType WriteUILImage(const ImageInfo *image_info,
+% Image *image,ExceptionInfo *exception)
%
% A description of each parameter follows.
%
%
% o image: The image.
%
+% o exception: return any errors or warnings in this structure.
+%
*/
-static MagickBooleanType WriteUILImage(const ImageInfo *image_info,Image *image)
+static MagickBooleanType WriteUILImage(const ImageInfo *image_info,Image *image,
+ ExceptionInfo *exception)
{
#define MaxCixels 92
name[MaxTextExtent],
*symbol;
- ExceptionInfo
- *exception;
-
int
j;
- ssize_t
- k,
- y;
-
MagickBooleanType
status,
transparent;
- MagickPixelPacket
- pixel;
-
MagickSizeType
number_pixels;
- register const IndexPacket
- *indexes;
+ PixelInfo
+ pixel;
- register const PixelPacket
+ register const Quantum
*p;
register ssize_t
i,
x;
- static const char
- Cixel[MaxCixels+1] = " .XoO+@#$%&*=-;:>,<1234567890qwertyuipasdfghjk"
- "lzxcvbnmMNBVCZASDFGHJKLPIUYTREWQ!~^/()_`'][{}|";
-
size_t
characters_per_pixel,
colors;
+ ssize_t
+ k,
+ y;
+
+ static const char
+ Cixel[MaxCixels+1] = " .XoO+@#$%&*=-;:>,<1234567890qwertyuipasdfghjk"
+ "lzxcvbnmMNBVCZASDFGHJKLPIUYTREWQ!~^/()_`'][{}|";
+
/*
Open output image file.
*/
assert(image->signature == MagickSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
- status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception);
+ assert(exception != (ExceptionInfo *) NULL);
+ assert(exception->signature == MagickSignature);
+ status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception);
if (status == MagickFalse)
return(status);
- if (image->colorspace != RGBColorspace)
- (void) TransformImageColorspace(image,RGBColorspace);
- exception=(&image->exception);
+ if (IssRGBCompatibleColorspace(image->colorspace) == MagickFalse)
+ (void) TransformImageColorspace(image,sRGBColorspace,exception);
transparent=MagickFalse;
i=0;
- p=(const PixelPacket *) NULL;
+ p=(const Quantum *) NULL;
if (image->storage_class == PseudoClass)
colors=image->colors;
else
Convert DirectClass to PseudoClass image.
*/
matte_image=(unsigned char *) NULL;
- if (image->matte != MagickFalse)
+ if (image->alpha_trait == BlendPixelTrait)
{
/*
Map all the transparent pixels.
for (y=0; y < (ssize_t) image->rows; y++)
{
p=GetVirtualPixels(image,0,y,image->columns,1,exception);
- if (p == (const PixelPacket *) NULL)
+ if (p == (const Quantum *) NULL)
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
- matte_image[i]=(unsigned char)
- (p->opacity == (Quantum) TransparentOpacity ? 1 : 0);
+ matte_image[i]=(unsigned char) (GetPixelAlpha(image,p) ==
+ (Quantum) TransparentAlpha ? 1 : 0);
if (matte_image[i] != 0)
transparent=MagickTrue;
i++;
- p++;
+ p+=GetPixelChannels(image);
}
}
}
- (void) SetImageType(image,PaletteType);
+ (void) SetImageType(image,PaletteType,exception);
colors=image->colors;
if (transparent != MagickFalse)
{
- register IndexPacket
- *indexes;
-
- register PixelPacket
+ register Quantum
*q;
colors++;
for (y=0; y < (ssize_t) image->rows; y++)
{
q=GetAuthenticPixels(image,0,y,image->columns,1,exception);
- if (q == (PixelPacket *) NULL)
+ if (q == (Quantum *) NULL)
break;
- indexes=GetAuthenticIndexQueue(image);
for (x=0; x < (ssize_t) image->columns; x++)
{
if (matte_image[i] != 0)
- indexes[x]=(IndexPacket) image->colors;
+ SetPixelIndex(image,image->colors,q);
p++;
+ q+=GetPixelChannels(image);
}
}
}
symbol=AcquireString("");
(void) WriteBlobString(image,"/* UIL */\n");
GetPathComponent(image->filename,BasePath,basename);
- (void) FormatMagickString(buffer,MaxTextExtent,
+ (void) FormatLocaleString(buffer,MaxTextExtent,
"value\n %s_ct : color_table(\n",basename);
(void) WriteBlobString(image,buffer);
- GetMagickPixelPacket(image,&pixel);
+ GetPixelInfo(image,&pixel);
for (i=0; i < (ssize_t) colors; i++)
{
/*
Define UIL color.
*/
- SetMagickPixelPacket(image,image->colormap+i,(IndexPacket *) NULL,&pixel);
- pixel.colorspace=RGBColorspace;
+ pixel=image->colormap[i];
+ pixel.colorspace=sRGBColorspace;
pixel.depth=8;
- pixel.opacity=(MagickRealType) OpaqueOpacity;
+ pixel.alpha=(double) OpaqueAlpha;
GetColorTuple(&pixel,MagickTrue,name);
if (transparent != MagickFalse)
if (i == (ssize_t) (colors-1))
symbol[j]='\0';
(void) SubstituteString(&symbol,"'","''");
if (LocaleCompare(name,"None") == 0)
- (void) FormatMagickString(buffer,MaxTextExtent,
+ (void) FormatLocaleString(buffer,MaxTextExtent,
" background color = '%s'",symbol);
else
- (void) FormatMagickString(buffer,MaxTextExtent,
+ (void) FormatLocaleString(buffer,MaxTextExtent,
" color('%s',%s) = '%s'",name,
- PixelIntensityToQuantum(image->colormap+i) <
- ((Quantum) QuantumRange/2) ? "background" : "foreground",symbol);
+ GetPixelInfoIntensity(image->colormap+i) <
+ (QuantumRange/2) ? "background" : "foreground",symbol);
(void) WriteBlobString(image,buffer);
- (void) FormatMagickString(buffer,MaxTextExtent,"%s",
+ (void) FormatLocaleString(buffer,MaxTextExtent,"%s",
(i == (ssize_t) (colors-1) ? ");\n" : ",\n"));
(void) WriteBlobString(image,buffer);
}
Define UIL pixels.
*/
GetPathComponent(image->filename,BasePath,basename);
- (void) FormatMagickString(buffer,MaxTextExtent,
+ (void) FormatLocaleString(buffer,MaxTextExtent,
" %s_icon : icon(color_table = %s_ct,\n",basename,basename);
(void) WriteBlobString(image,buffer);
for (y=0; y < (ssize_t) image->rows; y++)
{
- p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
- if (p == (const PixelPacket *) NULL)
+ p=GetVirtualPixels(image,0,y,image->columns,1,exception);
+ if (p == (const Quantum *) NULL)
break;
- indexes=GetVirtualIndexQueue(image);
(void) WriteBlobString(image," \"");
for (x=0; x < (ssize_t) image->columns; x++)
{
- k=((ssize_t) indexes[x] % MaxCixels);
+ k=((ssize_t) GetPixelIndex(image,p) % MaxCixels);
symbol[0]=Cixel[k];
for (j=1; j < (int) characters_per_pixel; j++)
{
- k=(((int) indexes[x]-k)/MaxCixels) % MaxCixels;
+ k=(((int) GetPixelIndex(image,p)-k)/MaxCixels) %
+ MaxCixels;
symbol[j]=Cixel[k];
}
symbol[j]='\0';
(void) CopyMagickString(buffer,symbol,MaxTextExtent);
(void) WriteBlobString(image,buffer);
- p++;
+ p+=GetPixelChannels(image);
}
- (void) FormatMagickString(buffer,MaxTextExtent,"\"%s\n",
+ (void) FormatLocaleString(buffer,MaxTextExtent,"\"%s\n",
(y == (ssize_t) (image->rows-1) ? ");" : ","));
(void) WriteBlobString(image,buffer);
status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
- image->rows);
+ image->rows);
if (status == MagickFalse)
break;
}