Mercurial > emacs
changeset 109857:d7a20b755b64
configure support for MagickExportImagePixels and README
author | Joakim <joakim@localhost.localdomain> |
---|---|
date | Fri, 14 May 2010 12:07:01 +0200 |
parents | 4baaa8ac0f74 |
children | 73108272ef0b |
files | README.imagemagick configure configure.in src/config.in src/image.c |
diffstat | 5 files changed, 159 insertions(+), 124 deletions(-) [+] |
line wrap: on
line diff
--- a/README.imagemagick Fri May 14 10:20:36 2010 +0200 +++ b/README.imagemagick Fri May 14 12:07:01 2010 +0200 @@ -28,8 +28,6 @@ Ubuntu 8.04 was also tested, but it seems it ships a broken ImageMagick. Also need some way to handle render methods that only work on newer ImageMagicks -** suport "count" property in image-metadata - * NEWS entry ** ImageMagick support @@ -58,6 +56,16 @@ - rotation - index +See the ImageMagick manual for information on how these specifications +work. + +The image-metadata function can be used to retrieve the total number +of images in an image bundle, and the :index property can be used to +show a particular image within the bundle. This is simmilar to how GIF +files work. + + + * Changelog entry nothing yet
--- a/configure Fri May 14 10:20:36 2010 +0200 +++ b/configure Fri May 14 12:07:01 2010 +0200 @@ -636,8 +636,8 @@ #endif" ac_config_libobj_dir=src +ac_func_list= ac_header_list= -ac_func_list= ac_subst_vars='LTLIBOBJS LIB_GCC LD_SWITCH_SYSTEM_EXTRA @@ -1943,6 +1943,7 @@ >$cache_file fi +ac_func_list="$ac_func_list MagickExportImagePixels" ac_header_list="$ac_header_list sys/time.h" ac_header_list="$ac_header_list unistd.h" ac_func_list="$ac_func_list alarm" @@ -11893,6 +11894,125 @@ CFLAGS="$CFLAGS $IMAGEMAGICK_CFLAGS" LIBS="$IMAGEMAGICK_LIBS $LIBS" fi + + +cat >>confdefs.h <<\_ACEOF +#define HAVE_MAGICKEXPORTIMAGEPIXELS 1 +_ACEOF + + + + + +for ac_func in $ac_func_list +do +as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 +$as_echo_n "checking for $ac_func... " >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func. + For example, HP-UX 11i <limits.h> declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + <limits.h> exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif + +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + eval "$as_ac_var=yes" +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +as_val=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + + + + + + + + + fi @@ -18276,110 +18396,6 @@ -for ac_func in $ac_func_list -do -as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 -$as_echo_n "checking for $ac_func... " >&6; } -if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func. - For example, HP-UX 11i <limits.h> declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer <limits.h> to <assert.h> if __STDC__ is defined, since - <limits.h> exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include <limits.h> -#else -# include <assert.h> -#endif - -#undef $ac_func - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_$ac_func || defined __stub___$ac_func -choke me -#endif - -int -main () -{ -return $ac_func (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then - eval "$as_ac_var=yes" -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - eval "$as_ac_var=no" -fi - -rm -rf conftest.dSYM -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -fi -ac_res=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -as_val=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - - - - -
--- a/configure.in Fri May 14 10:20:36 2010 +0200 +++ b/configure.in Fri May 14 12:07:01 2010 +0200 @@ -1765,7 +1765,11 @@ AC_DEFINE(HAVE_IMAGEMAGICK, 1, [Define to 1 if using imagemagick.]) CFLAGS="$CFLAGS $IMAGEMAGICK_CFLAGS" LIBS="$IMAGEMAGICK_LIBS $LIBS" - fi + fi + + AC_DEFINE(HAVE_MAGICKEXPORTIMAGEPIXELS, 1, [Define to 1 if MagickExportImagePixels is defined.]) + AC_CHECK_FUNCS_ONCE(MagickExportImagePixels) + fi
--- a/src/config.in Fri May 14 10:20:36 2010 +0200 +++ b/src/config.in Fri May 14 12:07:01 2010 +0200 @@ -438,6 +438,9 @@ /* Define to 1 if you have the <mach/mach.h> header file. */ #undef HAVE_MACH_MACH_H +/* Define to 1 if you have the `MagickExportImagePixels' function. */ +#undef HAVE_MAGICKEXPORTIMAGEPIXELS + /* Define to 1 if you have the <maillock.h> header file. */ #undef HAVE_MAILLOCK_H
--- 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);