all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alexander Shukaev <haroogan@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: [Emacs-diffs] ImageMagick Support on Windows
Date: Tue, 14 Oct 2014 23:33:38 +0200	[thread overview]
Message-ID: <CAKu-7Wx8tqwmGmB+N9zdpNNEJvA2cOoadWRSAfW5e1CE_UKVPQ@mail.gmail.com> (raw)
In-Reply-To: <CAKu-7WyVVfZWmn6mg9NV7KQDOmQ6MtgwD8MP-qtymeU_CyeWUw@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 1387 bytes --]

I have amended the patches and currently they look as attached. However, I
think we have a problem here. After applying them, during the build, the
"./temacs --batch --load loadup bootstrap" command crashes when it reaches:

Loading .../src/emacs/lisp/image.el (source)...

I cannot say 100% what could be the cause of this, but I can give my 99%
that this is because some ImageMagick library has not been loaded. If you
look at one of my previous messages:

Nevertheless, on the linking stage I see:
>


-lMagickWand-6.Q16HDRI -lMagickCore-6.Q16HDRI


So these are the import libraries needed to resolve utilized ImageMagick
functions. Their respective DLLs on my system are:

libMagickWand-6.Q16HDRI-2.dll
libMagickCore-6.Q16HDRI-2.dll

It means that we should somehow add these 2 libraries as mandatory to the
"dynamic-library-alist". But from what I infer from the documentation, this:

'(imagemagick "libMagickWand-6.Q16HDRI-2.dll"
"libMagickCore-6.Q16HDRI-2.dll")

is not the correct way of doing that since this sublist, in fact,
represents alternatives to the same single library. In other words, I don't
see how certain feature can be assigned more than one mandatory DLL.

Looking forward to your thoughts on the subject. Please, review the patches
first, so that we can be sure that the problem indeed stems from what I
just described rather than something else preceding it.

[-- Attachment #1.2: Type: text/html, Size: 2223 bytes --]

[-- Attachment #2: configure.ac.patch --]
[-- Type: application/octet-stream, Size: 488 bytes --]

--- configure.ac.orig	2014-10-14 12:14:49.116021200 +0200
+++ configure.ac	2014-10-14 16:27:06.702869900 +0200
@@ -2291,6 +2291,11 @@
       OLD_CFLAGS=$CFLAGS
       OLD_LIBS=$LIBS
       CFLAGS="$CFLAGS $IMAGEMAGICK_CFLAGS"
+      # Windows loads libMagick dynamically
+      if test "${opsys}" = "mingw32"; then
+       	IMAGEMAGICK_LIBS=
+      fi
+
       LIBS="$IMAGEMAGICK_LIBS $LIBS"
       AC_CHECK_FUNCS(MagickExportImagePixels MagickMergeImageLayers)
       CFLAGS=$OLD_CFLAGS

[-- Attachment #3: image.c.patch --]
[-- Type: application/octet-stream, Size: 22474 bytes --]

--- src/image.c.orig	2014-10-14 21:40:35.406433500 +0200
+++ src/image.c	2014-10-14 21:39:50.856516900 +0200
@@ -7919,6 +7919,156 @@
 					    MagickPixelPacket *);
 #endif
 
+#ifdef WINDOWSNT
+
+/* ImageMagick library details.  */
+DEF_IMGLIB_FN (MagickWand *, CloneMagickWand, (const MagickWand *));
+DEF_IMGLIB_FN (ExceptionInfo *, DestroyExceptionInfo, (ExceptionInfo *));
+DEF_IMGLIB_FN (MagickWand *, DestroyMagickWand, (MagickWand *));
+DEF_IMGLIB_FN (PixelIterator *, DestroyPixelIterator, (PixelIterator *));
+DEF_IMGLIB_FN (PixelWand *, DestroyPixelWand, (PixelWand *));
+DEF_IMGLIB_FN (char *, DestroyString, (char *));
+DEF_IMGLIB_FN (void, GetExceptionInfo, (ExceptionInfo *));
+DEF_IMGLIB_FN (char **, GetMagickList, (const char *, size_t *, ExceptionInfo *));
+DEF_IMGLIB_FN (MagickBooleanType, MagickCropImage, (MagickWand *, const size_t, const size_t, const ssize_t, const ssize_t));
+DEF_IMGLIB_FN (MagickBooleanType, MagickExportImagePixels, (MagickWand *, const ssize_t, const ssize_t, const size_t, const size_t, const char *, const StorageType, void *));
+DEF_IMGLIB_FN (MagickWand *, MagickFlattenImages, (MagickWand *));
+DEF_IMGLIB_FN (char *, MagickGetException, (const MagickWand *, ExceptionType *));
+DEF_IMGLIB_FN (MagickWand *, MagickGetImage, (MagickWand *));
+DEF_IMGLIB_FN (size_t, MagickGetImageDelay, (MagickWand *));
+DEF_IMGLIB_FN (DisposeType, MagickGetImageDispose, (MagickWand *));
+DEF_IMGLIB_FN (size_t, MagickGetImageHeight, (MagickWand *));
+DEF_IMGLIB_FN (MagickBooleanType, MagickGetImagePage, (MagickWand *, size_t *, size_t *, ssize_t *, ssize_t *));
+DEF_IMGLIB_FN (char *, MagickGetImageSignature, (MagickWand *));
+DEF_IMGLIB_FN (size_t, MagickGetImageWidth, (MagickWand *));
+DEF_IMGLIB_FN (size_t, MagickGetNumberImages, (MagickWand *));
+DEF_IMGLIB_FN (MagickWand *, MagickMergeImageLayers, (MagickWand *, const ImageLayerMethod));
+DEF_IMGLIB_FN (MagickBooleanType, MagickReadImage, (MagickWand *, const char *));
+DEF_IMGLIB_FN (MagickBooleanType, MagickReadImageBlob, (MagickWand *, const void *, const size_t));
+DEF_IMGLIB_FN (void *, MagickRelinquishMemory, (void *));
+DEF_IMGLIB_FN (MagickBooleanType, MagickRotateImage, (MagickWand *, const PixelWand *, const double));
+DEF_IMGLIB_FN (MagickBooleanType, MagickScaleImage, (MagickWand *, const size_t, const size_t));
+DEF_IMGLIB_FN (MagickBooleanType, MagickSetFilename, (MagickWand *, const char *));
+DEF_IMGLIB_FN (MagickBooleanType, MagickSetImageBackgroundColor, (MagickWand *, const PixelWand *));
+DEF_IMGLIB_FN (MagickBooleanType, MagickSetIteratorIndex, (MagickWand *, const ssize_t));
+DEF_IMGLIB_FN (void, MagickWandGenesis, (void));
+DEF_IMGLIB_FN (void, MagickWandTerminus, (void));
+DEF_IMGLIB_FN (MagickWand *, NewMagickWand, (void));
+DEF_IMGLIB_FN (PixelIterator *, NewPixelIterator, (MagickWand *));
+DEF_IMGLIB_FN (PixelWand *, NewPixelWand, (void));
+DEF_IMGLIB_FN (double, PixelGetAlpha, (const PixelWand *));
+DEF_IMGLIB_FN (void, PixelGetMagickColor, (PixelWand *, MagickPixelPacket *));
+DEF_IMGLIB_FN (PixelWand **, PixelGetNextIteratorRow, (PixelIterator *, size_t *));
+DEF_IMGLIB_FN (void, PixelSetBlue, (PixelWand *, const double));
+DEF_IMGLIB_FN (void, PixelSetGreen, (PixelWand *, const double));
+DEF_IMGLIB_FN (MagickBooleanType, PixelSetIteratorRow, (PixelIterator *, const ssize_t));
+DEF_IMGLIB_FN (void, PixelSetMagickColor, (PixelWand *, const MagickPixelPacket *));
+DEF_IMGLIB_FN (void, PixelSetRed, (PixelWand *, const double));
+DEF_IMGLIB_FN (MagickBooleanType, PixelSyncIterator, (PixelIterator *));
+
+static bool
+init_imagemagick_functions (void)
+{
+  HMODULE library;
+
+  if (!(library = w32_delayed_load (Qimagemagick)))
+   return 0;
+
+  LOAD_IMGLIB_FN (library, CloneMagickWand);
+  LOAD_IMGLIB_FN (library, DestroyExceptionInfo);
+  LOAD_IMGLIB_FN (library, DestroyMagickWand);
+  LOAD_IMGLIB_FN (library, DestroyPixelIterator);
+  LOAD_IMGLIB_FN (library, DestroyPixelWand);
+  LOAD_IMGLIB_FN (library, DestroyString);
+  LOAD_IMGLIB_FN (library, GetExceptionInfo);
+  LOAD_IMGLIB_FN (library, GetMagickList);
+  LOAD_IMGLIB_FN (library, MagickCropImage);
+  LOAD_IMGLIB_FN (library, MagickExportImagePixels);
+  LOAD_IMGLIB_FN (library, MagickFlattenImages);
+  LOAD_IMGLIB_FN (library, MagickGetException);
+  LOAD_IMGLIB_FN (library, MagickGetImage);
+  LOAD_IMGLIB_FN (library, MagickGetImageDelay);
+  LOAD_IMGLIB_FN (library, MagickGetImageDispose);
+  LOAD_IMGLIB_FN (library, MagickGetImageHeight);
+  LOAD_IMGLIB_FN (library, MagickGetImagePage);
+  LOAD_IMGLIB_FN (library, MagickGetImageSignature);
+  LOAD_IMGLIB_FN (library, MagickGetImageWidth);
+  LOAD_IMGLIB_FN (library, MagickGetNumberImages);
+  LOAD_IMGLIB_FN (library, MagickMergeImageLayers);
+  LOAD_IMGLIB_FN (library, MagickReadImage);
+  LOAD_IMGLIB_FN (library, MagickReadImageBlob);
+  LOAD_IMGLIB_FN (library, MagickRelinquishMemory);
+  LOAD_IMGLIB_FN (library, MagickRotateImage);
+  LOAD_IMGLIB_FN (library, MagickScaleImage);
+  LOAD_IMGLIB_FN (library, MagickSetFilename);
+  LOAD_IMGLIB_FN (library, MagickSetImageBackgroundColor);
+  LOAD_IMGLIB_FN (library, MagickSetIteratorIndex);
+  LOAD_IMGLIB_FN (library, MagickWandGenesis);
+  LOAD_IMGLIB_FN (library, MagickWandTerminus);
+  LOAD_IMGLIB_FN (library, NewMagickWand);
+  LOAD_IMGLIB_FN (library, NewPixelIterator);
+  LOAD_IMGLIB_FN (library, NewPixelWand);
+  LOAD_IMGLIB_FN (library, PixelGetAlpha);
+  LOAD_IMGLIB_FN (library, PixelGetMagickColor);
+  LOAD_IMGLIB_FN (library, PixelGetNextIteratorRow);
+  LOAD_IMGLIB_FN (library, PixelSetBlue);
+  LOAD_IMGLIB_FN (library, PixelSetGreen);
+  LOAD_IMGLIB_FN (library, PixelSetIteratorRow);
+  LOAD_IMGLIB_FN (library, PixelSetMagickColor);
+  LOAD_IMGLIB_FN (library, PixelSetRed);
+  LOAD_IMGLIB_FN (library, PixelSyncIterator);
+
+  return 1;
+}
+
+#else
+
+#define fn_CloneMagickWand               CloneMagickWand
+#define fn_DestroyExceptionInfo          DestroyExceptionInfo
+#define fn_DestroyMagickWand             DestroyMagickWand
+#define fn_DestroyPixelIterator          DestroyPixelIterator
+#define fn_DestroyPixelWand              DestroyPixelWand
+#define fn_DestroyString                 DestroyString
+#define fn_GetExceptionInfo              GetExceptionInfo
+#define fn_GetMagickList                 GetMagickList
+#define fn_MagickCropImage               MagickCropImage
+#define fn_MagickExportImagePixels       MagickExportImagePixels
+#define fn_MagickFlattenImages           MagickFlattenImages
+#define fn_MagickGetException            MagickGetException
+#define fn_MagickGetImage                MagickGetImage
+#define fn_MagickGetImageDelay           MagickGetImageDelay
+#define fn_MagickGetImageDispose         MagickGetImageDispose
+#define fn_MagickGetImageHeight          MagickGetImageHeight
+#define fn_MagickGetImagePage            MagickGetImagePage
+#define fn_MagickGetImageSignature       MagickGetImageSignature
+#define fn_MagickGetImageWidth           MagickGetImageWidth
+#define fn_MagickGetNumberImages         MagickGetNumberImages
+#define fn_MagickMergeImageLayers        MagickMergeImageLayers
+#define fn_MagickReadImage               MagickReadImage
+#define fn_MagickReadImageBlob           MagickReadImageBlob
+#define fn_MagickRelinquishMemory        MagickRelinquishMemory
+#define fn_MagickRotateImage             MagickRotateImage
+#define fn_MagickScaleImage              MagickScaleImage
+#define fn_MagickSetFilename             MagickSetFilename
+#define fn_MagickSetImageBackgroundColor MagickSetImageBackgroundColor
+#define fn_MagickSetIteratorIndex        MagickSetIteratorIndex
+#define fn_MagickWandGenesis             MagickWandGenesis
+#define fn_MagickWandTerminus            MagickWandTerminus
+#define fn_NewMagickWand                 NewMagickWand
+#define fn_NewPixelIterator              NewPixelIterator
+#define fn_NewPixelWand                  NewPixelWand
+#define fn_PixelGetAlpha                 PixelGetAlpha
+#define fn_PixelGetMagickColor           PixelGetMagickColor
+#define fn_PixelGetNextIteratorRow       PixelGetNextIteratorRow
+#define fn_PixelSetBlue                  PixelSetBlue
+#define fn_PixelSetGreen                 PixelSetGreen
+#define fn_PixelSetIteratorRow           PixelSetIteratorRow
+#define fn_PixelSetMagickColor           PixelSetMagickColor
+#define fn_PixelSetRed                   PixelSetRed
+#define fn_PixelSyncIterator             PixelSyncIterator
+
+#endif /* WINDOWSNT */
+
 /* Log ImageMagick error message.
    Useful when a ImageMagick function returns the status `MagickFalse'.  */
 
@@ -7928,11 +8078,11 @@
   char *description;
   ExceptionType severity;
 
-  description = MagickGetException (wand, &severity);
+  description = fn_MagickGetException (wand, &severity);
   image_error ("ImageMagick error: %s",
 	       build_string (description),
 	       Qnil);
-  MagickRelinquishMemory (description);
+  fn_MagickRelinquishMemory (description);
 }
 
 /* Possibly give ImageMagick some extra help to determine the image
@@ -8011,7 +8161,7 @@
       else
 	{
 	  if (cache->wand)
-	    DestroyMagickWand (cache->wand);
+	    fn_DestroyMagickWand (cache->wand);
 	  *pcache = cache->next;
 	  xfree (cache);
 	}
@@ -8021,7 +8171,7 @@
 static struct animation_cache *
 imagemagick_get_animation_cache (MagickWand *wand)
 {
-  char *signature = MagickGetImageSignature (wand);
+  char *signature = fn_MagickGetImageSignature (wand);
   struct animation_cache *cache;
   struct animation_cache **pcache = &animation_cache;
 
@@ -8040,7 +8190,7 @@
       pcache = &cache->next;
     }
 
-  DestroyString (signature);
+  fn_DestroyString (signature);
   cache->update_time = current_timespec ();
   return cache;
 }
@@ -8053,18 +8203,18 @@
   size_t dest_width, dest_height;
   struct animation_cache *cache = imagemagick_get_animation_cache (super_wand);
 
-  MagickSetIteratorIndex (super_wand, 0);
+  fn_MagickSetIteratorIndex (super_wand, 0);
 
   if (ino == 0 || cache->wand == NULL || cache->index > ino)
     {
-      composite_wand = MagickGetImage (super_wand);
+      composite_wand = fn_MagickGetImage (super_wand);
       if (cache->wand)
-	DestroyMagickWand (cache->wand);
+	fn_DestroyMagickWand (cache->wand);
     }
   else
     composite_wand = cache->wand;
 
-  dest_height = MagickGetImageHeight (composite_wand);
+  dest_height = fn_MagickGetImageHeight (composite_wand);
 
   for (i = max (1, cache->index + 1); i <= ino; i++)
     {
@@ -8077,32 +8227,32 @@
       DisposeType dispose;
       ptrdiff_t lines = 0;
 
-      MagickSetIteratorIndex (super_wand, i);
-      sub_wand = MagickGetImage (super_wand);
+      fn_MagickSetIteratorIndex (super_wand, i);
+      sub_wand = fn_MagickGetImage (super_wand);
 
-      MagickGetImagePage (sub_wand, &source_width, &source_height,
+      fn_MagickGetImagePage (sub_wand, &source_width, &source_height,
 			  &source_left, &source_top);
 
       /* This flag says how to handle transparent pixels.  */
-      dispose = MagickGetImageDispose (sub_wand);
+      dispose = fn_MagickGetImageDispose (sub_wand);
 
-      source_iterator = NewPixelIterator (sub_wand);
+      source_iterator = fn_NewPixelIterator (sub_wand);
       if (! source_iterator)
 	{
-	  DestroyMagickWand (composite_wand);
-	  DestroyMagickWand (sub_wand);
+	  fn_DestroyMagickWand (composite_wand);
+	  fn_DestroyMagickWand (sub_wand);
 	  cache->wand = NULL;
 	  image_error ("Imagemagick pixel iterator creation failed",
 		       Qnil, Qnil);
 	  return NULL;
 	}
 
-      dest_iterator = NewPixelIterator (composite_wand);
+      dest_iterator = fn_NewPixelIterator (composite_wand);
       if (! dest_iterator)
 	{
-	  DestroyMagickWand (composite_wand);
-	  DestroyMagickWand (sub_wand);
-	  DestroyPixelIterator (source_iterator);
+	  fn_DestroyMagickWand (composite_wand);
+	  fn_DestroyMagickWand (sub_wand);
+	  fn_DestroyPixelIterator (source_iterator);
 	  cache->wand = NULL;
 	  image_error ("Imagemagick pixel iterator creation failed",
 		       Qnil, Qnil);
@@ -8113,12 +8263,12 @@
 	 iterator to where the sub-image should start. */
       if (source_top > 0)
 	{
-	  PixelSetIteratorRow (dest_iterator, source_top);
+	  fn_PixelSetIteratorRow (dest_iterator, source_top);
 	  lines = source_top;
 	}
 
-      while ((source = PixelGetNextIteratorRow (source_iterator, &source_width))
-	     != NULL)
+      while ((source = fn_PixelGetNextIteratorRow (source_iterator,
+	     &source_width)) != NULL)
 	{
 	  ptrdiff_t x;
 
@@ -8127,7 +8277,7 @@
 	  if (++lines >= dest_height)
 	    break;
 
-	  dest = PixelGetNextIteratorRow (dest_iterator, &dest_width);
+	  dest = fn_PixelGetNextIteratorRow (dest_iterator, &dest_width);
 	  for (x = 0; x < source_width; x++)
 	    {
 	      /* Sanity check.  This shouldn't happen, but apparently
@@ -8137,23 +8287,23 @@
 	      /* Normally we only copy over non-transparent pixels,
 		 but if the disposal method is "Background", then we
 		 copy over all pixels.  */
-	      if (dispose == BackgroundDispose || PixelGetAlpha (source[x]))
+	      if (dispose == BackgroundDispose || fn_PixelGetAlpha (source[x]))
 		{
-		  PixelGetMagickColor (source[x], &pixel);
-		  PixelSetMagickColor (dest[x + source_left], &pixel);
+		  fn_PixelGetMagickColor (source[x], &pixel);
+		  fn_PixelSetMagickColor (dest[x + source_left], &pixel);
 		}
 	    }
-	  PixelSyncIterator (dest_iterator);
+	  fn_PixelSyncIterator (dest_iterator);
 	}
 
-      DestroyPixelIterator (source_iterator);
-      DestroyPixelIterator (dest_iterator);
-      DestroyMagickWand (sub_wand);
+      fn_DestroyPixelIterator (source_iterator);
+      fn_DestroyPixelIterator (dest_iterator);
+      fn_DestroyMagickWand (sub_wand);
     }
 
   /* Cache a copy for the next iteration.  The current wand will be
      destroyed by the caller. */
-  cache->wand = CloneMagickWand (composite_wand);
+  cache->wand = fn_CloneMagickWand (composite_wand);
   cache->index = ino;
 
   return composite_wand;
@@ -8202,57 +8352,57 @@
      find out things about it.  */
 
   /* Initialize the imagemagick environment.  */
-  MagickWandGenesis ();
+  fn_MagickWandGenesis ();
   image = image_spec_value (img->spec, QCindex, NULL);
   ino = INTEGERP (image) ? XFASTINT (image) : 0;
-  image_wand = NewMagickWand ();
+  image_wand = fn_NewMagickWand ();
 
   if (filename)
-    status = MagickReadImage (image_wand, filename);
+    status = fn_MagickReadImage (image_wand, filename);
   else
     {
       filename_hint = imagemagick_filename_hint (img->spec, hint_buffer);
-      MagickSetFilename (image_wand, filename_hint);
-      status = MagickReadImageBlob (image_wand, contents, size);
+      fn_MagickSetFilename (image_wand, filename_hint);
+      status = fn_MagickReadImageBlob (image_wand, contents, size);
     }
 
   if (status == MagickFalse)
     {
       imagemagick_error (image_wand);
-      DestroyMagickWand (image_wand);
+      fn_DestroyMagickWand (image_wand);
       return 0;
     }
 
-  if (ino < 0 || ino >= MagickGetNumberImages (image_wand))
+  if (ino < 0 || ino >= fn_MagickGetNumberImages (image_wand))
     {
       image_error ("Invalid image number `%s' in image `%s'",
 		   image, img->spec);
-      DestroyMagickWand (image_wand);
+      fn_DestroyMagickWand (image_wand);
       return 0;
     }
 
-  if (MagickGetImageDelay (image_wand) > 0)
+  if (fn_MagickGetImageDelay (image_wand) > 0)
     img->lisp_data =
       Fcons (Qdelay,
-             Fcons (make_float (MagickGetImageDelay (image_wand) / 100.0),
+             Fcons (make_float (fn_MagickGetImageDelay (image_wand) / 100.0),
                     img->lisp_data));
 
-  if (MagickGetNumberImages (image_wand) > 1)
+  if (fn_MagickGetNumberImages (image_wand) > 1)
     img->lisp_data =
       Fcons (Qcount,
-             Fcons (make_number (MagickGetNumberImages (image_wand)),
+             Fcons (make_number (fn_MagickGetNumberImages (image_wand)),
                     img->lisp_data));
 
   /* If we have an animated image, get the new wand based on the
      "super-wand". */
-  if (MagickGetNumberImages (image_wand) > 1)
+  if (fn_MagickGetNumberImages (image_wand) > 1)
     {
       MagickWand *super_wand = image_wand;
       image_wand = imagemagick_compute_animated_image (super_wand, ino);
       if (! image_wand)
 	image_wand = super_wand;
       else
-	DestroyMagickWand (super_wand);
+	fn_DestroyMagickWand (super_wand);
     }
 
   /* Retrieve the frame's background color, for use later.  */
@@ -8265,19 +8415,19 @@
 	|| !x_defined_color (f, SSDATA (specified_bg), &bgcolor, 0))
       x_query_frame_background_color (f, &bgcolor);
 
-    bg_wand = NewPixelWand ();
-    PixelSetRed   (bg_wand, (double) bgcolor.red   / 65535);
-    PixelSetGreen (bg_wand, (double) bgcolor.green / 65535);
-    PixelSetBlue  (bg_wand, (double) bgcolor.blue  / 65535);
+    bg_wand = fn_NewPixelWand ();
+    fn_PixelSetRed   (bg_wand, (double) bgcolor.red   / 65535);
+    fn_PixelSetGreen (bg_wand, (double) bgcolor.green / 65535);
+    fn_PixelSetBlue  (bg_wand, (double) bgcolor.blue  / 65535);
   }
 
-  compute_image_size (MagickGetImageWidth (image_wand),
-		      MagickGetImageHeight (image_wand),
+  compute_image_size (fn_MagickGetImageWidth (image_wand),
+		      fn_MagickGetImageHeight (image_wand),
 		      img->spec, &desired_width, &desired_height);
 
   if (desired_width != -1 && desired_height != -1)
     {
-      status = MagickScaleImage (image_wand, desired_width, desired_height);
+      status = fn_MagickScaleImage (image_wand, desired_width, desired_height);
       if (status == MagickFalse)
 	{
 	  image_error ("Imagemagick scale failed", Qnil, Qnil);
@@ -8310,7 +8460,7 @@
 	      if (CONSP (crop) && TYPE_RANGED_INTEGERP (ssize_t, XCAR (crop)))
 		{
 		  ssize_t crop_y = XINT (XCAR (crop));
-		  MagickCropImage (image_wand, crop_width, crop_height,
+		  fn_MagickCropImage (image_wand, crop_width, crop_height,
 				   crop_x, crop_y);
 		}
 	    }
@@ -8327,7 +8477,7 @@
   if (FLOATP (value))
     {
       rotation = extract_float (value);
-      status = MagickRotateImage (image_wand, bg_wand, rotation);
+      status = fn_MagickRotateImage (image_wand, bg_wand, rotation);
       if (status == MagickFalse)
         {
           image_error ("Imagemagick image rotate failed", Qnil, Qnil);
@@ -8342,20 +8492,20 @@
      (e.g. etc/images/splash.svg shows a white background always).  */
   {
     MagickWand *new_wand;
-    MagickSetImageBackgroundColor (image_wand, bg_wand);
+    fn_MagickSetImageBackgroundColor (image_wand, bg_wand);
 #ifdef HAVE_MAGICKMERGEIMAGELAYERS
-    new_wand = MagickMergeImageLayers (image_wand, MergeLayer);
+    new_wand = fn_MagickMergeImageLayers (image_wand, MergeLayer);
 #else
-    new_wand = MagickFlattenImages (image_wand);
+    new_wand = fn_MagickFlattenImages (image_wand);
 #endif
-    DestroyMagickWand (image_wand);
+    fn_DestroyMagickWand (image_wand);
     image_wand = new_wand;
   }
 
   /* Finally we are done manipulating the image.  Figure out the
      resulting width/height and transfer ownership to Emacs.  */
-  image_height = MagickGetImageHeight (image_wand);
-  image_width = MagickGetImageWidth (image_wand);
+  image_height = fn_MagickGetImageHeight (image_wand);
+  image_width = fn_MagickGetImageWidth (image_wand);
 
   if (! (image_width <= INT_MAX && image_height <= INT_MAX
 	 && check_image_size (f, image_width, image_height)))
@@ -8411,7 +8561,7 @@
         seems about 3 times as fast as pixel pushing(not carefully measured)
       */
       pixelwidth = CharPixel; /*??? TODO figure out*/
-      MagickExportImagePixels (image_wand, 0, 0, width, height,
+      fn_MagickExportImagePixels (image_wand, 0, 0, width, height,
 			       exportdepth, pixelwidth, ximg->data);
     }
   else
@@ -8436,7 +8586,7 @@
          images.  */
 
       /* Copy pixels from the imagemagick image structure to the x image map. */
-      iterator = NewPixelIterator (image_wand);
+      iterator = fn_NewPixelIterator (image_wand);
       if (! iterator)
         {
 #ifdef COLOR_TABLE_SUPPORT
@@ -8448,17 +8598,17 @@
           goto imagemagick_error;
         }
 
-      image_height = MagickGetImageHeight (image_wand);
+      image_height = fn_MagickGetImageHeight (image_wand);
       for (y = 0; y < image_height; y++)
         {
 	  size_t row_width;
-	  pixels = PixelGetNextIteratorRow (iterator, &row_width);
+	  pixels = fn_PixelGetNextIteratorRow (iterator, &row_width);
           if (! pixels)
             break;
 	  int xlim = min (row_width, width);
 	  for (x = 0; x < xlim; x++)
             {
-              PixelGetMagickColor (pixels[x], &pixel);
+              fn_PixelGetMagickColor (pixels[x], &pixel);
               XPutPixel (ximg, x, y,
                          lookup_rgb_color (f,
 					   color_scale * pixel.red,
@@ -8466,7 +8616,7 @@
 					   color_scale * pixel.blue));
             }
         }
-      DestroyPixelIterator (iterator);
+      fn_DestroyPixelIterator (iterator);
     }
 
 #ifdef COLOR_TABLE_SUPPORT
@@ -8482,19 +8632,19 @@
   image_put_x_image (f, img, ximg, 0);
 
   /* Final cleanup. image_wand should be the only resource left. */
-  DestroyMagickWand (image_wand);
-  if (bg_wand) DestroyPixelWand (bg_wand);
+  fn_DestroyMagickWand (image_wand);
+  if (bg_wand) fn_DestroyPixelWand (bg_wand);
 
   /* `MagickWandTerminus' terminates the imagemagick environment.  */
-  MagickWandTerminus ();
+  fn_MagickWandTerminus ();
 
   return 1;
 
  imagemagick_error:
-  DestroyMagickWand (image_wand);
-  if (bg_wand) DestroyPixelWand (bg_wand);
+  fn_DestroyMagickWand (image_wand);
+  if (bg_wand) fn_DestroyPixelWand (bg_wand);
 
-  MagickWandTerminus ();
+  fn_MagickWandTerminus ();
   /* TODO more cleanup.  */
   image_error ("Error parsing IMAGEMAGICK image `%s'", img->spec, Qnil);
   return 0;
@@ -8565,18 +8715,18 @@
   char **imtypes;
   size_t i;
 
-  GetExceptionInfo(&ex);
-  imtypes = GetMagickList ("*", &numf, &ex);
-  DestroyExceptionInfo(&ex);
+  fn_GetExceptionInfo(&ex);
+  imtypes = fn_GetMagickList ("*", &numf, &ex);
+  fn_DestroyExceptionInfo(&ex);
 
   for (i = 0; i < numf; i++)
     {
       Lisp_Object imagemagicktype = intern (imtypes[i]);
       typelist = Fcons (imagemagicktype, typelist);
-      imtypes[i] = MagickRelinquishMemory (imtypes[i]);
+      imtypes[i] = fn_MagickRelinquishMemory (imtypes[i]);
     }
 
-  MagickRelinquishMemory (imtypes);
+  fn_MagickRelinquishMemory (imtypes);
   return Fnreverse (typelist);
 }
 

[-- Attachment #4: w32-win.el.patch --]
[-- Type: application/octet-stream, Size: 477 bytes --]

--- lisp/term/w32-win.el.orig	2014-10-14 12:15:29.630533700 +0200
+++ lisp/term/w32-win.el	2014-10-14 16:33:53.311610000 +0200
@@ -260,6 +260,7 @@
 	 (if (>= libgif-version 50000)
 	     '(gif "libgif-6.dll" "giflib5.dll" "gif.dll")
 	 '(gif "libgif-5.dll" "giflib4.dll" "libungif4.dll" "libungif.dll")))
+       '(imagemagick "libMagickWand-6.Q16HDRI-2.dll")
        '(svg "librsvg-2-2.dll")
        '(gdk-pixbuf "libgdk_pixbuf-2.0-0.dll")
        '(glib "libglib-2.0-0.dll")

  reply	other threads:[~2014-10-14 21:33 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.170157.1413191181.1146.emacs-diffs@gnu.org>
2014-10-13  9:29 ` [Emacs-diffs] ImageMagick Support on Windows Eli Zaretskii
2014-10-14 10:17   ` Alexander Shukaev
2014-10-14 12:16     ` Eli Zaretskii
2014-10-14 14:00       ` Alexander Shukaev
2014-10-14 15:15         ` Eli Zaretskii
2014-10-14 16:17           ` Alexander Shukaev
2014-10-14 18:32             ` Alexander Shukaev
2014-10-14 21:33               ` Alexander Shukaev [this message]
2014-10-15  5:49                 ` Eli Zaretskii
2014-10-15  9:27                   ` Alexander Shukaev
2014-10-15  9:38                     ` rzl24ozi
2014-10-15 10:35                       ` Eli Zaretskii
2014-10-15 12:02                         ` Alexander Shukaev
2014-10-15 12:36                           ` Eli Zaretskii
2014-10-15 10:30                     ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAKu-7Wx8tqwmGmB+N9zdpNNEJvA2cOoadWRSAfW5e1CE_UKVPQ@mail.gmail.com \
    --to=haroogan@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.