2010-04-24.6.1-6 Cristy <quetzlzacatenango@image...>
* Do not declare timestruct under MinGW.
+ * Respect -compose option for the montag utility (bug report by Anthony).
2010-04-17 6.6.1-5 Cristy <quetzlzacatenango@image...>
* Only write one ICC profile to PSD image.
#define BI_JPEG 4
#undef BI_PNG
#define BI_PNG 5
-#if !defined(__WINDOWS__) || defined(__MINGW32__)
+#if !defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(__MINGW32__)
#define BI_RGB 0
#define BI_RLE8 1
#define BI_RLE4 2
static MagickBooleanType DecodeImage(Image *image,
const MagickBooleanType compression,unsigned char *pixels)
{
-#if !defined(__WINDOWS__) || defined(__MINGW32__)
+#if !defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(__MINGW32__)
#define BI_RGB 0
#define BI_RLE8 1
#define BI_RLE4 2
#include "magick/string_.h"
#include "magick/module.h"
#if defined(MAGICKCORE_FPX_DELEGATE)
-#if !defined(vms) && !defined(macintosh) && !defined(__WINDOWS__)
+#if !defined(vms) && !defined(macintosh) && !defined(MAGICKCORE_WINDOWS_SUPPORT)
#include <fpxlib.h>
#else
#include "Fpxlib.h"
/*
Define declarations.
*/
-#if !defined(__WINDOWS__) || defined(__MINGW32__)
+#if !defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(__MINGW32__)
#define BI_RGB 0
#define BI_RLE8 1
#define BI_BITFIELDS 3
break;
}
}
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
(void) WriteBlobString(ofile,"\"\r\n");
#else
#if defined(macintosh)
#include "magick/threshold.h"
#include "magick/utility.h"
#if defined(MAGICKCORE_XML_DELEGATE)
-# if defined(__WINDOWS__)
+# if defined(MAGICKCORE_WINDOWS_SUPPORT)
# if defined(__MINGW32__)
# define _MSC_VER
# else
int
status;
-#if defined(MAGICKCORE_GS_DELEGATE) || defined(__WINDOWS__)
+#if defined(MAGICKCORE_GS_DELEGATE) || defined(MAGICKCORE_WINDOWS_SUPPORT)
char
**argv;
register long
i;
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
ghost_info=NTGhostscriptDLLVectors();
#else
GhostInfo
0,&code);
(ghost_info->exit)(interpreter);
(ghost_info->delete_instance)(interpreter);
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
NTGhostscriptUnLoadDLL();
#endif
for (i=0; i < (long) argc; i++)
int
status;
-#if defined(MAGICKCORE_GS_DELEGATE) || defined(__WINDOWS__)
+#if defined(MAGICKCORE_GS_DELEGATE) || defined(MAGICKCORE_WINDOWS_SUPPORT)
char
**argv;
register long
i;
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
ghost_info=NTGhostscriptDLLVectors();
#else
GhostInfo
0,&code);
(ghost_info->exit)(interpreter);
(ghost_info->delete_instance)(interpreter);
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
NTGhostscriptUnLoadDLL();
#endif
for (i=0; i < (long) argc; i++)
#include "magick/token.h"
#include "magick/utility.h"
#if defined(MAGICKCORE_XML_DELEGATE)
-# if defined(__WINDOWS__)
+# if defined(MAGICKCORE_WINDOWS_SUPPORT)
# if defined(__MINGW32__)
# define _MSC_VER
# else
#include "magick/string_.h"
#include "magick/module.h"
#if defined(MAGICKCORE_XML_DELEGATE)
-# if defined(__WINDOWS__)
+# if defined(MAGICKCORE_WINDOWS_SUPPORT)
# if defined(__MINGW32__)
# define _MSC_VER
# else
<configure name="NAME" value="ImageMagick"/>
<configure name="LIB_VERSION" value="0x661"/>
<configure name="LIB_VERSION_NUMBER" value="6,6,1,6"/>
- <configure name="RELEASE_DATE" value="2010-04-23"/>
+ <configure name="RELEASE_DATE" value="2010-04-24"/>
<configure name="CONFIGURE" value="./configure "/>
<configure name="PREFIX" value="/usr/local"/>
<configure name="EXEC-PREFIX" value="/usr/local"/>
fi
-AC_TYPE_BOOLEAN
# Define off_t to a suitable type, if standard headers do not define it.
ac_fn_c_check_type "$LINENO" "off_t" "ac_cv_type_off_t" "$ac_includes_default"
#include "lt__dirent.h"
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
void
closedir (DIR *entry)
return &entry->file_info;
}
-#endif /*defined(__WINDOWS__)*/
+#endif /*defined(MAGICKCORE_WINDOWS_SUPPORT)*/
#include <stdlib.h>
#include <sys/types.h>
-#if defined(__CYGWIN32__)
-# if !defined(__CYGWIN__)
-# define __CYGWIN__ __CYGWIN32__
-# endif
-#endif
-
-#if defined(_WIN32) || defined(WIN32)
-# if !defined(__WINDOWS__)
-# if defined(_WIN32)
-# define __WINDOWS__ _WIN32
-# else
-# if defined(WIN32)
-# define __WINDOWS__ WIN32
-# endif
-# endif
-# endif
-#endif
-
-#if defined(_WIN64) || defined(WIN64)
-# if !defined(__WINDOWS__)
-# if defined(_WIN64)
-# define __WINDOWS__ _WIN64
-# else
-# if !defined(WIN64)
-# define __WINDOWS__ WIN64
-# endif
-# endif
-# endif
-#endif
+#if defined(WIN32) || defined(WIN64)
+# define MAGICKCORE_WINDOWS_SUPPORT
+#else
+# define MAGICKCORE_POSIX_SUPPORT
+#endif
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(__CYGWIN__) && !defined(__MINGW32__)
# if defined(_MT) && defined(_DLL) && !defined(_MAGICKDLL_) && !defined(_LIB) && !defined(MAGICK_STATIC_LINK)
# define _MAGICKDLL_
# endif
#include "magick/string-private.h"
#include "magick/token.h"
#include "magick/utility.h"
-#if defined(MAGICKCORE_HAVE_MMAP_FILEIO) && !defined(__WINDOWS__)
+#if defined(MAGICKCORE_HAVE_MMAP_FILEIO) && !defined(MAGICKCORE_WINDOWS_SUPPORT)
# include <sys/mman.h>
#endif
#if defined(MAGICKCORE_ZLIB_DELEGATE)
((*filename == '\0') && (image_info->file == (FILE *) NULL)))
{
image->blob->file=(*type == 'r') ? stdin : stdout;
-#if defined(__WINDOWS__) || defined(__OS2__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(__OS2__)
if (strchr(type,'b') != (char *) NULL)
setmode(_fileno(image->blob->file),_O_BINARY);
#endif
*mode=(*type);
mode[1]='\0';
image->blob->file=fdopen(StringToLong(filename+3),mode);
-#if defined(__WINDOWS__) || defined(__OS2__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(__OS2__)
if (strchr(type,'b') != (char *) NULL)
setmode(_fileno(image->blob->file),_O_BINARY);
#endif
% %
% %
% %
+% A c q u i r e I m a g e C o l o r m a p %
+% %
+% %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% AcquireImageColormap() allocates an image colormap and initializes
+% it to a linear gray colorspace. If the image already has a colormap,
+% it is replaced. AcquireImageColormap() returns MagickTrue if successful,
+% otherwise MagickFalse if there is not enough memory.
+%
+% The format of the AcquireImageColormap method is:
+%
+% MagickBooleanType AcquireImageColormap(Image *image,
+% const unsigned long colors)
+%
+% A description of each parameter follows:
+%
+% o image: the image.
+%
+% o colors: the number of colors in the image colormap.
+%
+*/
+
+static inline unsigned long MagickMax(const unsigned long x,
+ const unsigned long y)
+{
+ if (x > y)
+ return(x);
+ return(y);
+}
+
+static inline unsigned long MagickMin(const unsigned long x,
+ const unsigned long y)
+{
+ if (x < y)
+ return(x);
+ return(y);
+}
+
+MagickExport MagickBooleanType AcquireImageColormap(Image *image,
+ const unsigned long colors)
+{
+ register long
+ i;
+
+ size_t
+ length;
+
+ /*
+ Allocate image colormap.
+ */
+ assert(image != (Image *) NULL);
+ assert(image->signature == MagickSignature);
+ if (image->debug != MagickFalse)
+ (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
+ image->colors=colors;
+ length=(size_t) colors;
+ if (image->colormap == (PixelPacket *) NULL)
+ image->colormap=(PixelPacket *) AcquireQuantumMemory(length,
+ sizeof(*image->colormap));
+ else
+ image->colormap=(PixelPacket *) ResizeQuantumMemory(image->colormap,length,
+ sizeof(*image->colormap));
+ if (image->colormap == (PixelPacket *) NULL)
+ ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
+ image->filename);
+ for (i=0; i < (long) image->colors; i++)
+ {
+ unsigned long
+ pixel;
+
+ pixel=(unsigned long) (i*(QuantumRange/MagickMax(colors-1,1)));
+ image->colormap[i].red=(Quantum) pixel;
+ image->colormap[i].green=(Quantum) pixel;
+ image->colormap[i].blue=(Quantum) pixel;
+ image->colormap[i].opacity=OpaqueOpacity;
+ }
+ return(SetImageStorageClass(image,PseudoClass));
+}
+\f
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+% %
+% %
% C y c l e C o l o r m a p I m a g e %
% %
% %
#endif
extern MagickExport MagickBooleanType
+ AcquireImageColormap(Image *,const unsigned long),
CycleColormapImage(Image *,const long),
SortColormapByIntensity(Image *);
}
paths=DestroyLinkedList(paths,RelinquishMagickMemory);
}
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
{
char
*blob;
#if defined(MAGICKCORE_SHARE_PATH)
(void) AppendValueToLinkedList(paths,ConstantString(MAGICKCORE_SHARE_PATH));
#endif
-#if defined(__WINDOWS__) && !(defined(MAGICKCORE_CONFIGURE_PATH) || defined(MAGICKCORE_SHARE_CONFIGURE_PATH))
+#if defined(MAGICKCORE_WINDOWS_SUPPORT) && !(defined(MAGICKCORE_CONFIGURE_PATH) || defined(MAGICKCORE_SHARE_CONFIGURE_PATH))
{
char
*registry_key;
home=DestroyString(home);
}
}
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
{
char
module_path[MaxTextExtent];
#endif
#if !defined(MagickDLLCall)
-# if defined(__WINDOWS__)
+# if defined(MAGICKCORE_WINDOWS_SUPPORT)
# define MagickDLLCall __stdcall
# else
# define MagickDLLCall
*commands;
commands=AcquireString(token);
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
if (strchr(commands,'@') != (char *) NULL)
{
char
blob=FileToBlob(path,~0,length,exception);
}
#endif
-#if defined(__WINDOWS__) && !(defined(MAGICKCORE_CONFIGURE_PATH) || defined(MAGICKCORE_SHARE_CONFIGURE_PATH))
+#if defined(MAGICKCORE_WINDOWS_SUPPORT) && !(defined(MAGICKCORE_CONFIGURE_PATH) || defined(MAGICKCORE_SHARE_CONFIGURE_PATH))
if (blob == (void *) NULL)
{
char
*/
if ((blob == (void *) NULL) && (IsPathAccessible(path) != MagickFalse))
blob=FileToBlob(path,~0,length,exception);
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
/*
Search Windows registry.
*/
% %
% %
% %
-% A c q u i r e I m a g e C o l o r m a p %
-% %
-% %
-% %
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-% AcquireImageColormap() allocates an image colormap and initializes
-% it to a linear gray colorspace. If the image already has a colormap,
-% it is replaced. AcquireImageColormap() returns MagickTrue if successful,
-% otherwise MagickFalse if there is not enough memory.
-%
-% The format of the AcquireImageColormap method is:
-%
-% MagickBooleanType AcquireImageColormap(Image *image,
-% const unsigned long colors)
-%
-% A description of each parameter follows:
-%
-% o image: the image.
-%
-% o colors: the number of colors in the image colormap.
-%
-*/
-
-static inline unsigned long MagickMax(const unsigned long x,
- const unsigned long y)
-{
- if (x > y)
- return(x);
- return(y);
-}
-
-static inline unsigned long MagickMin(const unsigned long x,
- const unsigned long y)
-{
- if (x < y)
- return(x);
- return(y);
-}
-
-MagickExport MagickBooleanType AcquireImageColormap(Image *image,
- const unsigned long colors)
-{
- register long
- i;
-
- size_t
- length;
-
- /*
- Allocate image colormap.
- */
- assert(image != (Image *) NULL);
- assert(image->signature == MagickSignature);
- if (image->debug != MagickFalse)
- (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
- image->colors=colors;
- length=(size_t) colors;
- if (image->colormap == (PixelPacket *) NULL)
- image->colormap=(PixelPacket *) AcquireQuantumMemory(length,
- sizeof(*image->colormap));
- else
- image->colormap=(PixelPacket *) ResizeQuantumMemory(image->colormap,length,
- sizeof(*image->colormap));
- if (image->colormap == (PixelPacket *) NULL)
- ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
- image->filename);
- for (i=0; i < (long) image->colors; i++)
- {
- unsigned long
- pixel;
-
- pixel=(unsigned long) (i*(QuantumRange/MagickMax(colors-1,1)));
- image->colormap[i].red=(Quantum) pixel;
- image->colormap[i].green=(Quantum) pixel;
- image->colormap[i].blue=(Quantum) pixel;
- image->colormap[i].opacity=OpaqueOpacity;
- }
- return(SetImageStorageClass(image,PseudoClass));
-}
-\f
-/*
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% %
-% %
-% %
% A c q u i r e I m a g e I n f o %
% %
% %
GetImageReferenceCount(Image *);
extern MagickExport MagickBooleanType
- AcquireImageColormap(Image *,const unsigned long),
ClipImage(Image *),
ClipImagePath(Image *,const char *,const MagickBooleanType),
GetImageAlphaChannel(const Image *),
}
paths=DestroyLinkedList(paths,RelinquishMagickMemory);
}
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
{
char
*blob;
}
if ((log_info->handler_mask & DebugHandler) != 0)
{
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
OutputDebugString(text);
#endif
}
if ((log_info->handler_mask & EventHandler) != 0)
{
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
(void) NTReportEvent(text,MagickFalse);
#endif
}
#define MAGICKCORE_QUANTUM_DEPTH 16
#endif
-#if defined(__WINDOWS__) && !defined(__MINGW32__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(__MINGW32__)
# define MagickLLConstant(c) (MagickOffsetType) (c ## i64)
# define MagickULLConstant(c) (MagickSizeType) (c ## ui64)
#else
Typedef declarations.
*/
typedef unsigned int MagickStatusType;
-#if !defined(__WINDOWS__)
+#if !defined(MAGICKCORE_WINDOWS_SUPPORT)
#if (MAGICKCORE_SIZEOF_UNSIGNED_LONG_LONG == 8)
typedef long long MagickOffsetType;
typedef unsigned long long MagickSizeType;
#include "magick/memory_.h"
#include "magick/mime.h"
#include "magick/module.h"
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
# include "magick/nt-feature.h"
#endif
#include "magick/random_.h"
return(MACIsMagickConflict(magick));
#elif defined(vms)
return(VMSIsMagickConflict(magick));
-#elif defined(__WINDOWS__)
+#elif defined(MAGICKCORE_WINDOWS_SUPPORT)
return(NTIsMagickConflict(magick));
#else
return(MagickFalse);
if (signal_number == SIGHUP)
exit(signal_number);
#endif
-#if defined(SIGINT) && !defined(__WINDOWS__)
+#if defined(SIGINT) && !defined(MAGICKCORE_WINDOWS_SUPPORT)
if (signal_number == SIGINT)
exit(signal_number);
#endif
(void) SetLogEventMask(events);
events=DestroyString(events);
}
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
#if defined(_DEBUG) && !defined(__BORLANDC__) && !defined(__MINGW32__)
if (IsEventLogging() != MagickFalse)
{
if (signal_handlers[SIGHUP] == (SignalHandler *) NULL)
signal_handlers[SIGHUP]=RegisterMagickSignalHandler(SIGHUP);
#endif
-#if defined(SIGINT) && !defined(__WINDOWS__)
+#if defined(SIGINT) && !defined(MAGICKCORE_WINDOWS_SUPPORT)
if (signal_handlers[SIGINT] == (SignalHandler *) NULL)
signal_handlers[SIGINT]=RegisterMagickSignalHandler(SIGINT);
#endif
(void) TypeComponentGenesis();
(void) MimeComponentGenesis();
(void) ConstituteComponentGenesis();
+#if defined(MAGICKCORE_X11_DELEGATE)
(void) XComponentGenesis();
+#endif
}
\f
/*
MimeComponentTerminus();
TypeComponentTerminus();
ColorComponentTerminus();
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
NTGhostscriptUnLoadDLL();
#endif
MagicComponentTerminus();
return(MagickTrue);
}
#else
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
{
const char
*registery_key;
}
#endif
#endif
-#if !defined(MAGICKCORE_CODER_PATH) && !defined(__WINDOWS__)
-# error MAGICKCORE_CODER_PATH or __WINDOWS__ must be defined when MAGICKCORE_INSTALLED_SUPPORT is defined
+#if !defined(MAGICKCORE_CODER_PATH) && !defined(MAGICKCORE_WINDOWS_SUPPORT)
+# error MAGICKCORE_CODER_PATH or MAGICKCORE_WINDOWS_SUPPORT must be defined when MAGICKCORE_INSTALLED_SUPPORT is defined
#endif
#else
{
if (IsPathAccessible(path) != MagickFalse)
return(MagickTrue);
}
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
{
/*
Search module path.
(void) FormatMagickString(name,MaxTextExtent,"%s.la",tag);
(void) LocaleLower(name);
#else
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
if (LocaleNCompare("IM_MOD_",tag,7) == 0)
(void) CopyMagickString(name,tag,MaxTextExtent);
else
Include declarations.
*/
#include "magick/studio.h"
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
#include "magick/client.h"
#include "magick/log.h"
#include "magick/magick.h"
/*
External declarations.
*/
-#if !defined(__WINDOWS__)
+#if !defined(MAGICKCORE_WINDOWS_SUPPORT)
extern "C" BOOL WINAPI
DllMain(HINSTANCE handle,DWORD reason,LPVOID lpvReserved);
#endif
return(0);
}
\f
+#if !defined(__MINGW32__)
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% o time_zone: the time zone.
%
*/
-#if !defined(__MINGW32__)
MagickExport int gettimeofday (struct timeval *time_value,
struct timezone *time_zone)
{
# define fseeko _fseeki64
#endif
#if !defined(fstat) && !defined(__BORLANDC__)
-#if defined(__WINDOWS__) && !defined(Windows95) && \
+#if defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(Windows95) && \
!(defined(_MSC_VER) && (_MSC_VER < 1400)) && (__MSVCRT_VERSION__ < 0x800)
# define fstat _fstati64
#else
# define spawnvp _spawnvp
#endif
#if !defined(stat) && !defined(__BORLANDC__)
-#if defined(__WINDOWS__) && !defined(Windows95) && \
+#if defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(Windows95) && \
!(defined(_MSC_VER) && (_MSC_VER < 1400)) && (__MSVCRT_VERSION__ < 0x800)
# define stat _stati64
#else
# define write _write
#endif
#if !defined(wstat) && !defined(__BORLANDC__)
-#if defined(__WINDOWS__) && !defined(Windows95) && \
+#if defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(Windows95) && \
!(defined(_MSC_VER) && (_MSC_VER < 1400)) && (__MSVCRT_VERSION__ < 0x800)
# define wstat _wstati64
#else
#endif
#endif
-#if defined(_MT) && defined(__WINDOWS__)
+#if defined(_MT) && defined(MAGICKCORE_WINDOWS_SUPPORT)
# define SAFE_GLOBAL __declspec(thread)
#else
# define SAFE_GLOBAL
Include declarations.
*/
#include "magick/studio.h"
-#if defined(__WINDOWS__) || defined(__CYGWIN__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(__CYGWIN__)
#define WIN32_LEAN_AND_MEAN
#define VC_EXTRALEAN
#include <windows.h>
% o image: the image.
%
*/
+static MagickBooleanType DirectToColormapImage(Image *image,
+ ExceptionInfo *exception)
+{
+ CacheView
+ *image_view;
+
+ long
+ y;
+
+ MagickBooleanType
+ status;
+
+ register long
+ i;
+
+ unsigned long
+ number_colors;
+
+ status=MagickTrue;
+ number_colors=(unsigned long) (image->columns*image->rows);
+ if (AcquireImageColormap(image,number_colors) == MagickFalse)
+ ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
+ image->filename);
+ i=0;
+ image_view=AcquireCacheView(image);
+ for (y=0; y < (long) image->rows; y++)
+ {
+ register const PixelPacket
+ *restrict p;
+
+ register long
+ x;
+
+ p=GetCacheViewVirtualPixels(image_view,0,y,image->columns,1,exception);
+ if (p == (const PixelPacket *) NULL)
+ break;
+ for (x=0; x < (long) image->columns; x++)
+ image->colormap[i++]=(*p++);
+ }
+ image_view=DestroyCacheView(image_view);
+ return(status);
+}
+
MagickExport MagickBooleanType QuantizeImage(const QuantizeInfo *quantize_info,
Image *image)
{
if ((image->storage_class == PseudoClass) &&
(image->colors <= maximum_colors))
return(MagickTrue);
+ if ((image->columns*image->rows) <= maximum_colors)
+ return(DirectToColormapImage(image,&image->exception));
depth=quantize_info->tree_depth;
if (depth == 0)
{
%
*/
-#if !defined(__WINDOWS__)
+#if !defined(MAGICKCORE_WINDOWS_SUPPORT)
static ssize_t ReadRandom(int file,unsigned char *source,size_t length)
{
register unsigned char
filename=DestroyString(filename);
}
#endif
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
{
double
seconds;
directory=GetPolicyValue("temporary-path");
if (directory == (char *) NULL)
directory=GetEnvironmentValue("TMPDIR");
-#if defined(__WINDOWS__) || defined(__OS2__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(__OS2__)
if (directory == (char *) NULL)
directory=GetEnvironmentValue("TMP");
if (directory == (char *) NULL)
extern "C" {
#endif
-#if defined(__CYGWIN32__)
-# if !defined(__CYGWIN__)
-# define __CYGWIN__ __CYGWIN32__
-# endif
-#endif
-
-#if defined(_WIN32) || defined(WIN32)
-# if !defined(__WINDOWS__)
-# if defined(_WIN32)
-# define __WINDOWS__ _WIN32
-# else
-# if defined(WIN32)
-# define __WINDOWS__ WIN32
-# endif
-# endif
-# endif
-#endif
-
-#if defined(_WIN64) || defined(WIN64)
-# if !defined(__WINDOWS__)
-# if defined(_WIN64)
-# define __WINDOWS__ _WIN64
-# else
-# if defined(WIN64)
-# define __WINDOWS__ WIN64
-# endif
-# endif
-# endif
-#endif
-
-#if !defined(vms) && !defined(macintosh) && !defined(__WINDOWS__)
-# define MAGICKCORE_POSIX_SUPPORT
+#if defined(WIN32) || defined(WIN64)
+# define MAGICKCORE_WINDOWS_SUPPORT
+#else
+# define MAGICKCORE_POSIX_SUPPORT
#endif
#define MAGICKCORE_IMPLEMENTATION 1
# undef MAGICKCORE_BUILD_MODULES
#endif
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(__CYGWIN__) && !defined(__MINGW32__)
# if defined(_MT) && defined(_DLL) && !defined(_MAGICKDLL_) && !defined(_LIB)
# define _MAGICKDLL_
# endif
#if defined(MAGICKCORE_HAVE_UNISTD_H)
# include <unistd.h>
#endif
-#if defined(__WINDOWS__) && defined(_DEBUG)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT) && defined(_DEBUG)
#define _CRTDBG_MAP_ALLOC
#endif
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
# include <direct.h>
# if !defined(MAGICKCORE_HAVE_STRERROR)
# define HAVE_STRERROR
#if defined(MAGICKCORE_HAVE_PTHREAD)
# include <pthread.h>
-#elif defined(__WINDOWS__)
+#elif defined(MAGICKCORE_WINDOWS_SUPPORT)
# define MAGICKCORE_HAVE_WINTHREADS 1
#include <windows.h>
#endif
# endif
#endif
-#if defined(__WINDOWS__) || defined(MAGICKCORE_POSIX_SUPPORT)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(MAGICKCORE_POSIX_SUPPORT)
# include <sys/types.h>
# include <sys/stat.h>
# if defined(MAGICKCORE_HAVE_FTIME)
# define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
# endif
# include "magick/magick-type.h"
-# if !defined(__WINDOWS__)
+# if !defined(MAGICKCORE_WINDOWS_SUPPORT)
# include <sys/time.h>
# if defined(MAGICKCORE_HAVE_SYS_TIMES_H)
# include <sys/times.h>
#if defined(S_IRUSR) && defined(S_IWUSR)
# define S_MODE (S_IRUSR | S_IWUSR)
-#elif defined (__WINDOWS__)
+#elif defined (MAGICKCORE_WINDOWS_SUPPORT)
# define S_MODE (_S_IREAD | _S_IWRITE)
#else
# define S_MODE 0600
#endif
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
# include "magick/nt-base.h"
#endif
#if defined(macintosh)
SetWarningHandler(MACWarningHandler)
# endif
# endif
-# if defined(__WINDOWS__)
+# if defined(MAGICKCORE_WINDOWS_SUPPORT)
# define DirectorySeparator "\\"
# define DirectoryListSeparator ';'
# define EditorOptions ""
#define PATH_MAX 4096
#endif
-#if defined(MAGICKCORE_LTDL_DELEGATE) || (defined(__WINDOWS__) && defined(_DLL) && !defined(_LIB))
+#if defined(MAGICKCORE_LTDL_DELEGATE) || (defined(MAGICKCORE_WINDOWS_SUPPORT) && defined(_DLL) && !defined(_LIB))
# define MAGICKCORE_MODULES_SUPPORT
#endif
/*
I/O defines.
*/
-#if defined(__WINDOWS__) && !defined(Windows95) && !defined(__BORLANDC__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(Windows95) && !defined(__BORLANDC__)
#define MagickSeek(file,offset,whence) _lseeki64(file,offset,whence)
#define MagickTell(file) _telli64(file)
#else
#if defined(MAGICKCORE_HAVE_PTHREAD)
typedef pthread_mutex_t MagickMutexType;
-#elif defined(__WINDOWS__)
+#elif defined(MAGICKCORE_WINDOWS_SUPPORT)
typedef CRITICAL_SECTION MagickMutexType;
#else
typedef unsigned long MagickMutexType;
{
#if defined(MAGICKCORE_HAVE_PTHREAD)
return(pthread_self());
-#elif defined(__WINDOWS__)
+#elif defined(MAGICKCORE_WINDOWS_SUPPORT)
return(GetCurrentThreadId());
#else
return(getpid());
magick_thread.id=pthread_self();
return(magick_thread.signature);
}
-#elif defined(__WINDOWS__)
+#elif defined(MAGICKCORE_WINDOWS_SUPPORT)
return((unsigned long) GetCurrentThreadId());
#else
return((unsigned long) getpid());
#if defined(MAGICKCORE_HAVE_PTHREAD)
if (pthread_equal(id,pthread_self()) != 0)
return(MagickTrue);
-#elif defined(__WINDOWS__)
+#elif defined(MAGICKCORE_WINDOWS_SUPPORT)
if (id == GetCurrentThreadId())
return(MagickTrue);
#else
return((double) times(&timer)/CLK_TCK);
#else
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
return(NTElapsedTime());
#else
return((double) clock()/CLK_TCK);
(void) times(&timer);
return((double) (timer.tms_utime+timer.tms_stime)/CLK_TCK);
#else
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
return(NTUserTime());
#else
return((double) clock()/CLK_TCK);
#define FC_WEIGHT_HEAVY FC_WEIGHT_BLACK
#endif
#endif
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
# include "magick/nt-feature.h"
#endif
\f
(instantiate_type == MagickFalse))
{
(void) LoadTypeLists(MagickTypeFilename,exception);
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
(void) NTLoadTypeLists(type_list,exception);
#endif
#if defined(MAGICKCORE_FONTCONFIG_DELEGATE)
status=MagickTrue;
type_info=(TypeInfo *) NULL;
token=AcquireString(xml);
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
/*
Determine the Ghostscript font path.
*/
*path;
path=ConstantString(token);
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
if (strchr(path,'@') != (char *) NULL)
SubstituteString(&path,"@ghostscript_font_path@",font_path);
#endif
*path;
path=ConstantString(token);
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
if (strchr(path,'@') != (char *) NULL)
SubstituteString(&path,"@ghostscript_font_path@",font_path);
#endif
}
}
#endif
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
NTGetExecutionPath(path,extent);
#endif
#if defined(__GNU__)
/*
Not UTF-8, just copy.
*/
- length=strlen(source);
+ length=strlen((const char *) source);
utf16=(wchar_t *) AcquireQuantumMemory(length+1,sizeof(*utf16));
if (utf16 == (wchar_t *) NULL)
return((wchar_t *) NULL);
if (*entry->d_name == '.')
continue;
if ((IsPathDirectory(entry->d_name) > 0) ||
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
(GlobExpression(entry->d_name,pattern,MagickTrue) != MagickFalse))
#else
(GlobExpression(entry->d_name,pattern,MagickFalse) != MagickFalse))
}
}
#endif
-#elif defined(__WINDOWS__)
+#elif defined(MAGICKCORE_WINDOWS_SUPPORT)
{
int
mode;
#define MagickLibAddendum "-6"
#define MagickLibInterface 3
#define MagickLibMinInterface 3
-#define MagickReleaseDate "2010-04-23"
-#define MagickChangeDate "20100417"
+#define MagickReleaseDate "2010-04-24"
+#define MagickChangeDate "20100424"
#define MagickAuthoritativeURL "http://www.imagemagick.org"
#define MagickHomeURL "file:///usr/local/share/doc/ImageMagick-6.6.1/index.html"
#if (MAGICKCORE_QUANTUM_DEPTH == 8)
(void) XFlush(display);
if (milliseconds == 0)
return;
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
Sleep(milliseconds);
#elif defined(vms)
{
windows->im_retain_colors=XInternAtom(display,"IM_RETAIN_COLORS",MagickFalse);
windows->im_exit=XInternAtom(display,"IM_EXIT",MagickFalse);
windows->dnd_protocols=XInternAtom(display,"DndProtocol",MagickFalse);
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
(void) XSynchronize(display,IsWindows95());
#endif
if (IsEventLogging())
{ "XPM", UndefinedCompression, 0.0 },
{ "XPS", UndefinedCompression, 0.0 },
{ "XV", UndefinedCompression, 0.0 },
-#if !defined(__WINDOWS__)
+#if !defined(MAGICKCORE_WINDOWS_SUPPORT)
{ "XWD", UndefinedCompression, 0.0 },
#endif
{ "YUV", UndefinedCompression, 0.0 },
%
*/
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
int WINAPI WinMain(HINSTANCE instance,HINSTANCE last,LPSTR command,int state)
{
char
%
*/
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
int WINAPI WinMain(HINSTANCE instance,HINSTANCE last,LPSTR command,int state)
{
char
%
*/
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
int WINAPI WinMain(HINSTANCE instance,HINSTANCE last,LPSTR command,int state)
{
char
#include <stdlib.h>
#include <sys/types.h>
-#if defined(__CYGWIN32__)
-# if !defined(__CYGWIN__)
-# define __CYGWIN__ __CYGWIN32__
-# endif
-#endif
-#if defined(_WIN32) || defined(WIN32)
-# if !defined(__WINDOWS__)
-# if defined(_WIN32)
-# define __WINDOWS__ _WIN32
-# else
-# if defined(WIN32)
-# define __WINDOWS__ WIN32
-# endif
-# endif
-# endif
-#endif
-
-#if defined(_WIN64) || defined(WIN64)
-# if !defined(__WINDOWS__)
-# if defined(_WIN64)
-# define __WINDOWS__ _WIN64
-# else
-# if defined(WIN64)
-# define __WINDOWS__ WIN64
-# endif
-# endif
-# endif
-#endif
+#if defined(WIN32) || defined(WIN64)
+# define MAGICKCORE_WINDOWS_SUPPORT
+#else
+# define MAGICKCORE_POSIX_SUPPORT
+#endif
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(__CYGWIN__) && !defined(__MINGW32__)
# if defined(_MT) && defined(_DLL) && !defined(_MAGICKDLL_) && !defined(_LIB)
# define _MAGICKDLL_
# endif
extern "C" {
#endif
-#if defined(__CYGWIN32__)
-# if !defined(__CYGWIN__)
-# define __CYGWIN__ __CYGWIN32__
-# endif
-#endif
-
-#if defined(_WIN32) || defined(WIN32)
-# if !defined(__WINDOWS__)
-# if defined(_WIN32)
-# define __WINDOWS__ _WIN32
-# else
-# if defined(WIN32)
-# define __WINDOWS__ WIN32
-# endif
-# endif
-# endif
-#endif
-
-#if defined(_WIN64) || defined(WIN64)
-# if !defined(__WINDOWS__)
-# if defined(_WIN64)
-# define __WINDOWS__ _WIN64
-# else
-# if defined(WIN64)
-# define __WINDOWS__ WIN64
-# endif
-# endif
-# endif
-#endif
-
-#if !defined(vms) && !defined(macintosh) && !defined(__WINDOWS__)
-# define MAGICKCORE_POSIX_SUPPORT
-#endif
+#if defined(WIN32) || defined(WIN64)
+# define MAGICKCORE_WINDOWS_SUPPORT
+#else
+# define MAGICKCORE_POSIX_SUPPORT
+#endif
#define MAGICKWAND_IMPLEMENTATION 1
# define _MAGICKLIB_
#endif
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(__CYGWIN__) && !defined(__MINGW32__)
# if defined(_MT) && defined(_DLL) && !defined(_MAGICKDLL_) && !defined(_LIB)
# define _MAGICKDLL_
# endif
#if defined(MAGICKCORE_HAVE_UNISTD_H)
# include <unistd.h>
#endif
-#if defined(__WINDOWS__) && defined(_DEBUG)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT) && defined(_DEBUG)
#define _CRTDBG_MAP_ALLOC
#endif
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
# include <direct.h>
# if !defined(MAGICKCORE_HAVE_STRERROR)
# define HAVE_STRERROR
# endif
#endif
-#if defined(__WINDOWS__) && defined(_DEBUG)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT) && defined(_DEBUG)
#define _CRTDBG_MAP_ALLOC
#endif
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
# include <direct.h>
# if !defined(MAGICKCORE_HAVE_STRERROR)
# define HAVE_STRERROR
#if defined(MAGICKCORE_HAVE_PTHREAD)
# include <pthread.h>
-#elif defined(__WINDOWS__)
+#elif defined(MAGICKCORE_WINDOWS_SUPPORT)
# define MAGICKCORE_HAVE_WINTHREADS 1
#include <windows.h>
#endif
# endif
#endif
-#if defined(__WINDOWS__) || defined(MAGICKCORE_POSIX_SUPPORT)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(MAGICKCORE_POSIX_SUPPORT)
# include <sys/types.h>
# include <sys/stat.h>
# if defined(MAGICKCORE_HAVE_FTIME)
# define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
# endif
# include "wand/MagickWand.h"
-# if !defined(__WINDOWS__)
+# if !defined(MAGICKCORE_WINDOWS_SUPPORT)
# include <sys/time.h>
# if defined(MAGICKCORE_HAVE_SYS_TIMES_H)
# include <sys/times.h>
#if defined(S_IRUSR) && defined(S_IWUSR)
# define S_MODE (S_IRUSR | S_IWUSR)
-#elif defined (__WINDOWS__)
+#elif defined (MAGICKCORE_WINDOWS_SUPPORT)
# define S_MODE (_S_IREAD | _S_IWRITE)
#else
# define S_MODE 0600
#endif
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
# include "magick/nt-base.h"
#endif
#if defined(macintosh)
SetWarningHandler(MACWarningHandler)
# endif
# endif
-# if defined(__WINDOWS__)
+# if defined(MAGICKCORE_WINDOWS_SUPPORT)
# define DirectorySeparator "\\"
# define DirectoryListSeparator ';'
# define EditorOptions ""
/*
I/O defines.
*/
-#if defined(__WINDOWS__) && !defined(Windows95) && !defined(__BORLANDC__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(Windows95) && !defined(__BORLANDC__)
#define MagickSeek(file,offset,whence) _lseeki64(file,offset,whence)
#define MagickTell(file) _telli64(file)
#else