From 9648f9e622471b36111847c0ed352303c8c09504 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 26 Nov 2018 17:37:16 -0800 Subject: [PATCH] Support ImageMagick version 7 Backport from master. * configure.ac (HAVE_IMAGEMAGICK7): New macro. (HAVE_IMAGEMAGICK): Also define if using ImageMagick 7 or later. * src/image.c [HAVE_IMAGEMAGICK7]: Include and instead of and . (PixelSetMagickColor, MagickPixelPacket) [HAVE_IMAGEMAGICK7]: New compatibility definitions. --- configure.ac | 15 +++++++++------ src/image.c | 13 +++++++++++-- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/configure.ac b/configure.ac index dc6d776d45..a4d0feaad5 100644 --- a/configure.ac +++ b/configure.ac @@ -2521,11 +2521,14 @@ AC_DEFUN HAVE_IMAGEMAGICK=no if test "${HAVE_X11}" = "yes" || test "${HAVE_NS}" = "yes" || test "${HAVE_W32}" = "yes"; then if test "${with_imagemagick}" != "no"; then - ## 6.3.5 is the earliest version known to work; see Bug#17339. - ## 6.8.2 makes Emacs crash; see Bug#13867. - ## 7 and later have not been ported to; See Bug#25967. - IMAGEMAGICK_MODULE="Wand >= 6.3.5 Wand != 6.8.2 Wand < 7" - EMACS_CHECK_MODULES([IMAGEMAGICK], [$IMAGEMAGICK_MODULE]) + EMACS_CHECK_MODULES([IMAGEMAGICK], [MagickWand >= 7]) + if test $HAVE_IMAGEMAGICK = yes; then + AC_DEFINE([HAVE_IMAGEMAGICK7], 1, [Define to 1 if using ImageMagick7.]) + else + ## 6.3.5 is the earliest version known to work; see Bug#17339. + ## 6.8.2 makes Emacs crash; see Bug#13867. + EMACS_CHECK_MODULES([IMAGEMAGICK], [Wand >= 6.3.5 Wand != 6.8.2]) + fi if test $HAVE_IMAGEMAGICK = yes; then OLD_CFLAGS=$CFLAGS @@ -5404,7 +5407,7 @@ AC_DEFUN Does Emacs use -lrsvg-2? ${HAVE_RSVG} Does Emacs use cairo? ${HAVE_CAIRO} Does Emacs use -llcms2? ${HAVE_LCMS2} - Does Emacs use imagemagick (version 6)? ${HAVE_IMAGEMAGICK} + Does Emacs use imagemagick? ${HAVE_IMAGEMAGICK} Does Emacs support sound? ${HAVE_SOUND} Does Emacs use -lgpm? ${HAVE_GPM} Does Emacs use -ldbus? ${HAVE_DBUS} diff --git a/src/image.c b/src/image.c index a6b2d9060b..cc99f33d5f 100644 --- a/src/image.c +++ b/src/image.c @@ -8272,11 +8272,20 @@ imagemagick_image_p (Lisp_Object object) /* The GIF library also defines DrawRectangle, but its never used in Emacs. Therefore rename the function so it doesn't collide with ImageMagick. */ #define DrawRectangle DrawRectangleGif -#include + +#ifdef HAVE_IMAGEMAGICK7 +# include +# include +/* ImageMagick 7 compatibility definitions. */ +# define PixelSetMagickColor PixelSetPixelColor +typedef PixelInfo MagickPixelPacket; +#else +# include +# include +#endif /* ImageMagick 6.5.3 through 6.6.5 hid PixelGetMagickColor for some reason. Emacs seems to work fine with the hidden version, so unhide it. */ -#include #if 0x653 <= MagickLibVersion && MagickLibVersion <= 0x665 extern WandExport void PixelGetMagickColor (const PixelWand *, MagickPixelPacket *); -- 2.19.1