diff --git a/configure.ac b/configure.ac index 4164099b..5fdb7f50 100644 --- a/configure.ac +++ b/configure.ac @@ -690,6 +690,26 @@ if test x"$magick6" = x"yes"; then LIBS="$save_LIBS" fi +if test x"$magick6" = x"yes"; then + # GM uses SetImageAttribute(), IM uses SetImageProperty() + save_LIBS="$LIBS" + LIBS="$LIBS $MAGICK_LIBS" + AC_CHECK_FUNCS(SetImageProperty, + AC_DEFINE(HAVE_SETIMAGEPROPERTY,1, + [define if your magick has SetImageProperty.])) + LIBS="$save_LIBS" +fi + +if test x"$magick6" = x"yes"; then + # GM is missing InheritException + save_LIBS="$LIBS" + LIBS="$LIBS $MAGICK_LIBS" + AC_CHECK_FUNCS(InheritException, + AC_DEFINE(HAVE_INHERITEXCEPTION,1, + [define if your magick has InheritException.])) + LIBS="$save_LIBS" +fi + # have flags to turn load and save off independently ... some people will want # save but not load, for example AC_ARG_ENABLE([magickload], diff --git a/libvips/foreign/magick.c b/libvips/foreign/magick.c index 40c6939e..500132b1 100644 --- a/libvips/foreign/magick.c +++ b/libvips/foreign/magick.c @@ -82,13 +82,6 @@ magick_set_property( Image *image, const char *property, const char *value, (void) SetImageProperty( image, property, value, exception ); } -int -magick_set_image_colorspace( Image *image, const ColorspaceType colorspace, - ExceptionInfo *exception) -{ - return( SetImageColorspace( image, colorspace, exception ) ); -} - void magick_inherit_exception( ExceptionInfo *exception, Image *image ) { @@ -149,19 +142,20 @@ magick_set_image_size( Image *image, const size_t width, const size_t height, int magick_import_pixels( Image *image, const ssize_t x, const ssize_t y, const size_t width, const size_t height, const char *map, - const StorageType type,const void *pixels, ExceptionInfo *exception ) + const StorageType type, const void *pixels, ExceptionInfo *exception ) { (void) exception; /* GM does not seem to have a simple equivalent, unfortunately. + * + * Looks like we'd need to call * * extern MagickExport PixelPacket * *SetImagePixels(Image *image,const long x,const long y, * const unsigned long columns,const unsigned * long rows); * - * gets a pointer into the image which we can then write to, use that - * perhaps? + * then repack pixels into that area using map and storage_type. */ return( ImportImagePixels( image, x, y, width, height, map, type, pixels ) ); @@ -172,21 +166,19 @@ magick_set_property( Image *image, const char *property, const char *value, ExceptionInfo *exception ) { (void) exception; +#ifdef HAVE_SETIMAGEPROPERTY (void) SetImageProperty( image, property, value ); -} - -int -magick_set_image_colorspace( Image *image, const ColorspaceType colorspace, - ExceptionInfo *exception ) -{ - (void) exception; - return( SetImageColorspace( image, colorspace ) ); +#else /*!HAVE_SETIMAGEPROPERTY*/ + (void) SetImageAttribute( image, property, value ); +#endif /*HAVE_SETIMAGEPROPERTY*/ } void magick_inherit_exception( ExceptionInfo *exception, Image *image ) { +#ifdef HAVE_INHERITEXCEPTION InheritException( exception, &image->exception ); +#endif /*HAVE_INHERITEXCEPTION*/ } #endif /*HAVE_MAGICK6*/ diff --git a/libvips/foreign/magick.h b/libvips/foreign/magick.h index 97690f81..507e7e11 100644 --- a/libvips/foreign/magick.h +++ b/libvips/foreign/magick.h @@ -46,8 +46,8 @@ Image *magick_acquire_image( const ImageInfo *image_info, ExceptionInfo *exception ); void magick_acquire_next_image( const ImageInfo *image_info, Image *image, ExceptionInfo *exception ); -int magick_set_image_size( Image *image, const size_t width, const size_t height, - ExceptionInfo *exception ); +int magick_set_image_size( Image *image, + const size_t width, const size_t height, ExceptionInfo *exception ); int magick_import_pixels( Image *image, const ssize_t x, const ssize_t y, const size_t width, const size_t height, const char *map, const StorageType type,const void *pixels, ExceptionInfo *exception );