diff options
| author | Joakim Verona | 2010-05-14 12:07:01 +0200 |
|---|---|---|
| committer | Joakim Verona | 2010-05-14 12:07:01 +0200 |
| commit | 431dab046cf9d7360d393a6dc2f1cac369cebe8f (patch) | |
| tree | b84a7a52770fef6924bbcb08f420e4eaf1eafb3a | |
| parent | 3b8916b60a47fae40b9833c2abb2ff3695ca5f81 (diff) | |
| download | emacs-431dab046cf9d7360d393a6dc2f1cac369cebe8f.tar.gz emacs-431dab046cf9d7360d393a6dc2f1cac369cebe8f.zip | |
configure support for MagickExportImagePixels and README
| -rw-r--r-- | README.imagemagick | 12 | ||||
| -rwxr-xr-x | configure | 226 | ||||
| -rw-r--r-- | configure.in | 6 | ||||
| -rw-r--r-- | src/config.in | 3 | ||||
| -rw-r--r-- | src/image.c | 34 |
5 files changed, 158 insertions, 123 deletions
diff --git a/README.imagemagick b/README.imagemagick index fb957d690ed..52214a23b25 100644 --- a/README.imagemagick +++ b/README.imagemagick | |||
| @@ -28,8 +28,6 @@ Tested on Fedora 12 so far, and the libmagick that ships with it. | |||
| 28 | Ubuntu 8.04 was also tested, but it seems it ships a broken ImageMagick. | 28 | Ubuntu 8.04 was also tested, but it seems it ships a broken ImageMagick. |
| 29 | Also need some way to handle render methods that only work on newer ImageMagicks | 29 | Also need some way to handle render methods that only work on newer ImageMagicks |
| 30 | 30 | ||
| 31 | ** suport "count" property in image-metadata | ||
| 32 | |||
| 33 | 31 | ||
| 34 | * NEWS entry | 32 | * NEWS entry |
| 35 | ** ImageMagick support | 33 | ** ImageMagick support |
| @@ -58,6 +56,16 @@ specifications: | |||
| 58 | - rotation | 56 | - rotation |
| 59 | - index | 57 | - index |
| 60 | 58 | ||
| 59 | See the ImageMagick manual for information on how these specifications | ||
| 60 | work. | ||
| 61 | |||
| 62 | The image-metadata function can be used to retrieve the total number | ||
| 63 | of images in an image bundle, and the :index property can be used to | ||
| 64 | show a particular image within the bundle. This is simmilar to how GIF | ||
| 65 | files work. | ||
| 66 | |||
| 67 | |||
| 68 | |||
| 61 | * Changelog entry | 69 | * Changelog entry |
| 62 | nothing yet | 70 | nothing yet |
| 63 | 71 | ||
| @@ -636,8 +636,8 @@ ac_includes_default="\ | |||
| 636 | #endif" | 636 | #endif" |
| 637 | 637 | ||
| 638 | ac_config_libobj_dir=src | 638 | ac_config_libobj_dir=src |
| 639 | ac_header_list= | ||
| 640 | ac_func_list= | 639 | ac_func_list= |
| 640 | ac_header_list= | ||
| 641 | ac_subst_vars='LTLIBOBJS | 641 | ac_subst_vars='LTLIBOBJS |
| 642 | LIB_GCC | 642 | LIB_GCC |
| 643 | LD_SWITCH_SYSTEM_EXTRA | 643 | LD_SWITCH_SYSTEM_EXTRA |
| @@ -1943,6 +1943,7 @@ $as_echo "$as_me: creating cache $cache_file" >&6;} | |||
| 1943 | >$cache_file | 1943 | >$cache_file |
| 1944 | fi | 1944 | fi |
| 1945 | 1945 | ||
| 1946 | ac_func_list="$ac_func_list MagickExportImagePixels" | ||
| 1946 | ac_header_list="$ac_header_list sys/time.h" | 1947 | ac_header_list="$ac_header_list sys/time.h" |
| 1947 | ac_header_list="$ac_header_list unistd.h" | 1948 | ac_header_list="$ac_header_list unistd.h" |
| 1948 | ac_func_list="$ac_func_list alarm" | 1949 | ac_func_list="$ac_func_list alarm" |
| @@ -11893,6 +11894,125 @@ _ACEOF | |||
| 11893 | CFLAGS="$CFLAGS $IMAGEMAGICK_CFLAGS" | 11894 | CFLAGS="$CFLAGS $IMAGEMAGICK_CFLAGS" |
| 11894 | LIBS="$IMAGEMAGICK_LIBS $LIBS" | 11895 | LIBS="$IMAGEMAGICK_LIBS $LIBS" |
| 11895 | fi | 11896 | fi |
| 11897 | |||
| 11898 | |||
| 11899 | cat >>confdefs.h <<\_ACEOF | ||
| 11900 | #define HAVE_MAGICKEXPORTIMAGEPIXELS 1 | ||
| 11901 | _ACEOF | ||
| 11902 | |||
| 11903 | |||
| 11904 | |||
| 11905 | |||
| 11906 | |||
| 11907 | for ac_func in $ac_func_list | ||
| 11908 | do | ||
| 11909 | as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` | ||
| 11910 | { $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 | ||
| 11911 | $as_echo_n "checking for $ac_func... " >&6; } | ||
| 11912 | if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then | ||
| 11913 | $as_echo_n "(cached) " >&6 | ||
| 11914 | else | ||
| 11915 | cat >conftest.$ac_ext <<_ACEOF | ||
| 11916 | /* confdefs.h. */ | ||
| 11917 | _ACEOF | ||
| 11918 | cat confdefs.h >>conftest.$ac_ext | ||
| 11919 | cat >>conftest.$ac_ext <<_ACEOF | ||
| 11920 | /* end confdefs.h. */ | ||
| 11921 | /* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func. | ||
| 11922 | For example, HP-UX 11i <limits.h> declares gettimeofday. */ | ||
| 11923 | #define $ac_func innocuous_$ac_func | ||
| 11924 | |||
| 11925 | /* System header to define __stub macros and hopefully few prototypes, | ||
| 11926 | which can conflict with char $ac_func (); below. | ||
| 11927 | Prefer <limits.h> to <assert.h> if __STDC__ is defined, since | ||
| 11928 | <limits.h> exists even on freestanding compilers. */ | ||
| 11929 | |||
| 11930 | #ifdef __STDC__ | ||
| 11931 | # include <limits.h> | ||
| 11932 | #else | ||
| 11933 | # include <assert.h> | ||
| 11934 | #endif | ||
| 11935 | |||
| 11936 | #undef $ac_func | ||
| 11937 | |||
| 11938 | /* Override any GCC internal prototype to avoid an error. | ||
| 11939 | Use char because int might match the return type of a GCC | ||
| 11940 | builtin and then its argument prototype would still apply. */ | ||
| 11941 | #ifdef __cplusplus | ||
| 11942 | extern "C" | ||
| 11943 | #endif | ||
| 11944 | char $ac_func (); | ||
| 11945 | /* The GNU C library defines this for functions which it implements | ||
| 11946 | to always fail with ENOSYS. Some functions are actually named | ||
| 11947 | something starting with __ and the normal name is an alias. */ | ||
| 11948 | #if defined __stub_$ac_func || defined __stub___$ac_func | ||
| 11949 | choke me | ||
| 11950 | #endif | ||
| 11951 | |||
| 11952 | int | ||
| 11953 | main () | ||
| 11954 | { | ||
| 11955 | return $ac_func (); | ||
| 11956 | ; | ||
| 11957 | return 0; | ||
| 11958 | } | ||
| 11959 | _ACEOF | ||
| 11960 | rm -f conftest.$ac_objext conftest$ac_exeext | ||
| 11961 | if { (ac_try="$ac_link" | ||
| 11962 | case "(($ac_try" in | ||
| 11963 | *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; | ||
| 11964 | *) ac_try_echo=$ac_try;; | ||
| 11965 | esac | ||
| 11966 | eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" | ||
| 11967 | $as_echo "$ac_try_echo") >&5 | ||
| 11968 | (eval "$ac_link") 2>conftest.er1 | ||
| 11969 | ac_status=$? | ||
| 11970 | grep -v '^ *+' conftest.er1 >conftest.err | ||
| 11971 | rm -f conftest.er1 | ||
| 11972 | cat conftest.err >&5 | ||
| 11973 | $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 | ||
| 11974 | (exit $ac_status); } && { | ||
| 11975 | test -z "$ac_c_werror_flag" || | ||
| 11976 | test ! -s conftest.err | ||
| 11977 | } && test -s conftest$ac_exeext && { | ||
| 11978 | test "$cross_compiling" = yes || | ||
| 11979 | $as_test_x conftest$ac_exeext | ||
| 11980 | }; then | ||
| 11981 | eval "$as_ac_var=yes" | ||
| 11982 | else | ||
| 11983 | $as_echo "$as_me: failed program was:" >&5 | ||
| 11984 | sed 's/^/| /' conftest.$ac_ext >&5 | ||
| 11985 | |||
| 11986 | eval "$as_ac_var=no" | ||
| 11987 | fi | ||
| 11988 | |||
| 11989 | rm -rf conftest.dSYM | ||
| 11990 | rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ | ||
| 11991 | conftest$ac_exeext conftest.$ac_ext | ||
| 11992 | fi | ||
| 11993 | ac_res=`eval 'as_val=${'$as_ac_var'} | ||
| 11994 | $as_echo "$as_val"'` | ||
| 11995 | { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 | ||
| 11996 | $as_echo "$ac_res" >&6; } | ||
| 11997 | as_val=`eval 'as_val=${'$as_ac_var'} | ||
| 11998 | $as_echo "$as_val"'` | ||
| 11999 | if test "x$as_val" = x""yes; then | ||
| 12000 | cat >>confdefs.h <<_ACEOF | ||
| 12001 | #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 | ||
| 12002 | _ACEOF | ||
| 12003 | |||
| 12004 | fi | ||
| 12005 | done | ||
| 12006 | |||
| 12007 | |||
| 12008 | |||
| 12009 | |||
| 12010 | |||
| 12011 | |||
| 12012 | |||
| 12013 | |||
| 12014 | |||
| 12015 | |||
| 11896 | fi | 12016 | fi |
| 11897 | 12017 | ||
| 11898 | 12018 | ||
| @@ -18276,110 +18396,6 @@ done | |||
| 18276 | 18396 | ||
| 18277 | 18397 | ||
| 18278 | 18398 | ||
| 18279 | for ac_func in $ac_func_list | ||
| 18280 | do | ||
| 18281 | as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` | ||
| 18282 | { $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 | ||
| 18283 | $as_echo_n "checking for $ac_func... " >&6; } | ||
| 18284 | if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then | ||
| 18285 | $as_echo_n "(cached) " >&6 | ||
| 18286 | else | ||
| 18287 | cat >conftest.$ac_ext <<_ACEOF | ||
| 18288 | /* confdefs.h. */ | ||
| 18289 | _ACEOF | ||
| 18290 | cat confdefs.h >>conftest.$ac_ext | ||
| 18291 | cat >>conftest.$ac_ext <<_ACEOF | ||
| 18292 | /* end confdefs.h. */ | ||
| 18293 | /* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func. | ||
| 18294 | For example, HP-UX 11i <limits.h> declares gettimeofday. */ | ||
| 18295 | #define $ac_func innocuous_$ac_func | ||
| 18296 | |||
| 18297 | /* System header to define __stub macros and hopefully few prototypes, | ||
| 18298 | which can conflict with char $ac_func (); below. | ||
| 18299 | Prefer <limits.h> to <assert.h> if __STDC__ is defined, since | ||
| 18300 | <limits.h> exists even on freestanding compilers. */ | ||
| 18301 | |||
| 18302 | #ifdef __STDC__ | ||
| 18303 | # include <limits.h> | ||
| 18304 | #else | ||
| 18305 | # include <assert.h> | ||
| 18306 | #endif | ||
| 18307 | |||
| 18308 | #undef $ac_func | ||
| 18309 | |||
| 18310 | /* Override any GCC internal prototype to avoid an error. | ||
| 18311 | Use char because int might match the return type of a GCC | ||
| 18312 | builtin and then its argument prototype would still apply. */ | ||
| 18313 | #ifdef __cplusplus | ||
| 18314 | extern "C" | ||
| 18315 | #endif | ||
| 18316 | char $ac_func (); | ||
| 18317 | /* The GNU C library defines this for functions which it implements | ||
| 18318 | to always fail with ENOSYS. Some functions are actually named | ||
| 18319 | something starting with __ and the normal name is an alias. */ | ||
| 18320 | #if defined __stub_$ac_func || defined __stub___$ac_func | ||
| 18321 | choke me | ||
| 18322 | #endif | ||
| 18323 | |||
| 18324 | int | ||
| 18325 | main () | ||
| 18326 | { | ||
| 18327 | return $ac_func (); | ||
| 18328 | ; | ||
| 18329 | return 0; | ||
| 18330 | } | ||
| 18331 | _ACEOF | ||
| 18332 | rm -f conftest.$ac_objext conftest$ac_exeext | ||
| 18333 | if { (ac_try="$ac_link" | ||
| 18334 | case "(($ac_try" in | ||
| 18335 | *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; | ||
| 18336 | *) ac_try_echo=$ac_try;; | ||
| 18337 | esac | ||
| 18338 | eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" | ||
| 18339 | $as_echo "$ac_try_echo") >&5 | ||
| 18340 | (eval "$ac_link") 2>conftest.er1 | ||
| 18341 | ac_status=$? | ||
| 18342 | grep -v '^ *+' conftest.er1 >conftest.err | ||
| 18343 | rm -f conftest.er1 | ||
| 18344 | cat conftest.err >&5 | ||
| 18345 | $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 | ||
| 18346 | (exit $ac_status); } && { | ||
| 18347 | test -z "$ac_c_werror_flag" || | ||
| 18348 | test ! -s conftest.err | ||
| 18349 | } && test -s conftest$ac_exeext && { | ||
| 18350 | test "$cross_compiling" = yes || | ||
| 18351 | $as_test_x conftest$ac_exeext | ||
| 18352 | }; then | ||
| 18353 | eval "$as_ac_var=yes" | ||
| 18354 | else | ||
| 18355 | $as_echo "$as_me: failed program was:" >&5 | ||
| 18356 | sed 's/^/| /' conftest.$ac_ext >&5 | ||
| 18357 | |||
| 18358 | eval "$as_ac_var=no" | ||
| 18359 | fi | ||
| 18360 | |||
| 18361 | rm -rf conftest.dSYM | ||
| 18362 | rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ | ||
| 18363 | conftest$ac_exeext conftest.$ac_ext | ||
| 18364 | fi | ||
| 18365 | ac_res=`eval 'as_val=${'$as_ac_var'} | ||
| 18366 | $as_echo "$as_val"'` | ||
| 18367 | { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 | ||
| 18368 | $as_echo "$ac_res" >&6; } | ||
| 18369 | as_val=`eval 'as_val=${'$as_ac_var'} | ||
| 18370 | $as_echo "$as_val"'` | ||
| 18371 | if test "x$as_val" = x""yes; then | ||
| 18372 | cat >>confdefs.h <<_ACEOF | ||
| 18373 | #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 | ||
| 18374 | _ACEOF | ||
| 18375 | |||
| 18376 | fi | ||
| 18377 | done | ||
| 18378 | |||
| 18379 | |||
| 18380 | |||
| 18381 | |||
| 18382 | |||
| 18383 | 18399 | ||
| 18384 | 18400 | ||
| 18385 | 18401 | ||
diff --git a/configure.in b/configure.in index 58cace5895f..4d65f779670 100644 --- a/configure.in +++ b/configure.in | |||
| @@ -1765,7 +1765,11 @@ if test "${with_imagemagick}" != "no"; then | |||
| 1765 | AC_DEFINE(HAVE_IMAGEMAGICK, 1, [Define to 1 if using imagemagick.]) | 1765 | AC_DEFINE(HAVE_IMAGEMAGICK, 1, [Define to 1 if using imagemagick.]) |
| 1766 | CFLAGS="$CFLAGS $IMAGEMAGICK_CFLAGS" | 1766 | CFLAGS="$CFLAGS $IMAGEMAGICK_CFLAGS" |
| 1767 | LIBS="$IMAGEMAGICK_LIBS $LIBS" | 1767 | LIBS="$IMAGEMAGICK_LIBS $LIBS" |
| 1768 | fi | 1768 | fi |
| 1769 | |||
| 1770 | AC_DEFINE(HAVE_MAGICKEXPORTIMAGEPIXELS, 1, [Define to 1 if MagickExportImagePixels is defined.]) | ||
| 1771 | AC_CHECK_FUNCS_ONCE(MagickExportImagePixels) | ||
| 1772 | |||
| 1769 | fi | 1773 | fi |
| 1770 | 1774 | ||
| 1771 | 1775 | ||
diff --git a/src/config.in b/src/config.in index 9020d976342..29b2a0b967f 100644 --- a/src/config.in +++ b/src/config.in | |||
| @@ -438,6 +438,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 438 | /* Define to 1 if you have the <mach/mach.h> header file. */ | 438 | /* Define to 1 if you have the <mach/mach.h> header file. */ |
| 439 | #undef HAVE_MACH_MACH_H | 439 | #undef HAVE_MACH_MACH_H |
| 440 | 440 | ||
| 441 | /* Define to 1 if you have the `MagickExportImagePixels' function. */ | ||
| 442 | #undef HAVE_MAGICKEXPORTIMAGEPIXELS | ||
| 443 | |||
| 441 | /* Define to 1 if you have the <maillock.h> header file. */ | 444 | /* Define to 1 if you have the <maillock.h> header file. */ |
| 442 | #undef HAVE_MAILLOCK_H | 445 | #undef HAVE_MAILLOCK_H |
| 443 | 446 | ||
diff --git a/src/image.c b/src/image.c index 1bc58db57b8..3ba36559839 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -7755,15 +7755,22 @@ imagemagick_load_image (f, img, contents, size, filename) | |||
| 7755 | long ino; | 7755 | long ino; |
| 7756 | image = image_spec_value (img->spec, QCindex, NULL); | 7756 | image = image_spec_value (img->spec, QCindex, NULL); |
| 7757 | ino = INTEGERP (image) ? XFASTINT (image) : 0; | 7757 | ino = INTEGERP (image) ? XFASTINT (image) : 0; |
| 7758 | |||
| 7759 | /* if (ino >= ) */ | ||
| 7760 | /* { */ | ||
| 7761 | /* image_error ("Invalid image number `%s' in image `%s'", */ | ||
| 7762 | /* image, img->spec); */ | ||
| 7763 | /* UNGCPRO; */ | ||
| 7764 | /* return 0; */ | ||
| 7765 | /* } */ | ||
| 7766 | 7758 | ||
| 7759 | |||
| 7760 | |||
| 7761 | if (ino >= MagickGetNumberImages(image_wand)) | ||
| 7762 | { | ||
| 7763 | image_error ("Invalid image number `%s' in image `%s'", | ||
| 7764 | image, img->spec); | ||
| 7765 | UNGCPRO; | ||
| 7766 | return 0; | ||
| 7767 | } | ||
| 7768 | |||
| 7769 | |||
| 7770 | if (MagickGetNumberImages(image_wand) > 1) | ||
| 7771 | img->data.lisp_val = Fcons (Qcount, | ||
| 7772 | Fcons (make_number (MagickGetNumberImages(image_wand)), | ||
| 7773 | img->data.lisp_val)); | ||
| 7767 | if(ino==0) | 7774 | if(ino==0) |
| 7768 | MagickSetFirstIterator(image_wand); | 7775 | MagickSetFirstIterator(image_wand); |
| 7769 | else | 7776 | else |
| @@ -7917,6 +7924,7 @@ imagemagick_load_image (f, img, contents, size, filename) | |||
| 7917 | 7924 | ||
| 7918 | */ | 7925 | */ |
| 7919 | pixelwidth=CharPixel;/*??? TODO figure out*/ | 7926 | pixelwidth=CharPixel;/*??? TODO figure out*/ |
| 7927 | #ifdef HAVE_MAGICKEXPORTIMAGEPIXELS | ||
| 7920 | MagickExportImagePixels(image_wand, | 7928 | MagickExportImagePixels(image_wand, |
| 7921 | 0,0, | 7929 | 0,0, |
| 7922 | width,height, | 7930 | width,height, |
| @@ -7924,16 +7932,12 @@ imagemagick_load_image (f, img, contents, size, filename) | |||
| 7924 | pixelwidth, | 7932 | pixelwidth, |
| 7925 | /*&(img->pixmap));*/ | 7933 | /*&(img->pixmap));*/ |
| 7926 | ximg->data); | 7934 | ximg->data); |
| 7935 | #else | ||
| 7936 | image_error("You dont have MagickExportImagePixels, upgrade ImageMagick if you want to try it!",Qnil,Qnil); | ||
| 7937 | #endif | ||
| 7927 | } | 7938 | } |
| 7928 | 7939 | ||
| 7929 | 7940 | ||
| 7930 | //TODO figure out imagecount here! | ||
| 7931 | if (MagickGetNumberImages(image_wand) > 1) | ||
| 7932 | img->data.lisp_val = Fcons (Qcount, | ||
| 7933 | Fcons (make_number (MagickGetNumberImages(image_wand)), | ||
| 7934 | img->data.lisp_val)); | ||
| 7935 | |||
| 7936 | |||
| 7937 | #ifdef COLOR_TABLE_SUPPORT | 7941 | #ifdef COLOR_TABLE_SUPPORT |
| 7938 | /* Remember colors allocated for this image. */ | 7942 | /* Remember colors allocated for this image. */ |
| 7939 | img->colors = colors_in_color_table (&img->ncolors); | 7943 | img->colors = colors_in_color_table (&img->ncolors); |