some work on fixing GM

graphicsmagick + magicksave is a bit tricky :(
This commit is contained in:
John Cupitt 2018-04-23 13:44:56 +01:00
parent b8ff9c2069
commit 12cbe7c2e4
2 changed files with 54 additions and 0 deletions

View File

@ -670,6 +670,26 @@ if test x"$magick6" = x"yes"; then
CFLAGS="$save_CFLAGS"
fi
if test x"$magick6" = x"yes"; then
# more recent magick6s have AcquireImage rather than AllocateImage argh
save_LIBS="$LIBS"
LIBS="$LIBS $MAGICK_LIBS"
AC_CHECK_FUNCS(AcquireImage,
AC_DEFINE(HAVE_ACQUIREIMAGE,1,
[define if your magick has AcquireImage.]))
LIBS="$save_LIBS"
fi
if test x"$magick6" = x"yes"; then
# more recent magick6s have SetImageExtent
save_LIBS="$LIBS"
LIBS="$LIBS $MAGICK_LIBS"
AC_CHECK_FUNCS(SetImageExtent,
AC_DEFINE(HAVE_SETIMAGEEXTENT,1,
[define if your magick has SetImageExtent.]))
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],

View File

@ -104,7 +104,13 @@ Image*
magick_acquire_image(const ImageInfo *image_info, ExceptionInfo *exception)
{
(void) exception;
#ifdef HAVE_ACQUIREIMAGE
return( AcquireImage( image_info ) );
#else /*!HAVE_ACQUIREIMAGE*/
/* IM5-ish and GraphicsMagick use AllocateImage().
*/
return( AllocateImage( image_info ) );
#endif
}
void
@ -112,7 +118,13 @@ magick_acquire_next_image( const ImageInfo *image_info, Image *image,
ExceptionInfo *exception )
{
(void) exception;
#ifdef HAVE_ACQUIREIMAGE
AcquireNextImage( image_info, image );
#else /*!HAVE_ACQUIREIMAGE*/
/* IM5-ish and GraphicsMagick use AllocateNextImage().
*/
AllocateNextImage( image_info, image );
#endif
}
int
@ -120,7 +132,18 @@ magick_set_image_size( Image *image, const size_t width, const size_t height,
ExceptionInfo *exception )
{
(void) exception;
#ifdef HAVE_SETIMAGEEXTENT
return( SetImageExtent( image, width, height ) );
#else /*!HAVE_SETIMAGEEXTENT*/
image->columns = width;
image->rows = height;
/* imagemagick does a SyncImagePixelCache() at the end of
* SetImageExtent(), but GM does not really have an equivalent. Just
* always return True.
*/
return( MagickTrue );
#endif /*HAVE_SETIMAGEEXTENT*/
}
int
@ -129,6 +152,17 @@ magick_import_pixels( Image *image, const ssize_t x, const ssize_t y,
const StorageType type,const void *pixels, ExceptionInfo *exception )
{
(void) exception;
/* GM does not seem to have a simple equivalent, unfortunately.
*
* 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?
*/
return( ImportImagePixels( image, x, y, width, height, map,
type, pixels ) );
}