diff src/image.c @ 109857:d7a20b755b64

configure support for MagickExportImagePixels and README
author Joakim <joakim@localhost.localdomain>
date Fri, 14 May 2010 12:07:01 +0200
parents ecac5346ac63
children 68616bb3ae25
line wrap: on
line diff
--- a/src/image.c	Fri May 14 10:20:36 2010 +0200
+++ b/src/image.c	Fri May 14 12:07:01 2010 +0200
@@ -7755,15 +7755,22 @@
   long ino;
   image = image_spec_value (img->spec, QCindex, NULL);
   ino = INTEGERP (image) ? XFASTINT (image) : 0;
-  
-  /* if (ino >= ) */
-  /*   { */
-  /*     image_error ("Invalid image number `%s' in image `%s'", */
-  /*       	   image, img->spec); */
-  /*     UNGCPRO; */
-  /*     return 0; */
-  /*   } */
-
+
+
+
+  if (ino >= MagickGetNumberImages(image_wand)) 
+    { 
+      image_error ("Invalid image number `%s' in image `%s'", 
+         	   image, img->spec); 
+      UNGCPRO; 
+      return 0; 
+    } 
+
+ 
+  if (MagickGetNumberImages(image_wand) > 1)
+    img->data.lisp_val = Fcons (Qcount,
+                                Fcons (make_number (MagickGetNumberImages(image_wand)),
+                                       img->data.lisp_val));
   if(ino==0)
     MagickSetFirstIterator(image_wand);
   else
@@ -7917,6 +7924,7 @@
 
     */
     pixelwidth=CharPixel;/*??? TODO figure out*/
+#ifdef HAVE_MAGICKEXPORTIMAGEPIXELS    
     MagickExportImagePixels(image_wand,
                             0,0,
                             width,height,
@@ -7924,16 +7932,12 @@
                             pixelwidth, 
                             /*&(img->pixmap));*/
                             ximg->data);
+#else
+    image_error("You dont have MagickExportImagePixels, upgrade ImageMagick if you want to try it!",Qnil,Qnil);
+#endif    
   }
   
 
-  //TODO figure out imagecount here!
-  if (MagickGetNumberImages(image_wand) > 1)
-    img->data.lisp_val = Fcons (Qcount,
-				Fcons (make_number (MagickGetNumberImages(image_wand)),
-				       img->data.lisp_val));
-
-
 #ifdef COLOR_TABLE_SUPPORT
   /* Remember colors allocated for this image.  */
   img->colors = colors_in_color_table (&img->ncolors);