Merge pull request #1224 from DarthSim/feature/gm_magicksave
vips_magicksave for GraphicsMagick
This commit is contained in:
commit
71664346c0
10
configure.ac
10
configure.ac
@ -799,11 +799,13 @@ if test x"$enable_magicksave" != x"yes"; then
|
|||||||
AC_CHECK_FUNCS(ImportImagePixels,[
|
AC_CHECK_FUNCS(ImportImagePixels,[
|
||||||
AC_DEFINE(HAVE_IMPORTIMAGEPIXELS,1,
|
AC_DEFINE(HAVE_IMPORTIMAGEPIXELS,1,
|
||||||
[define if you have ImportImagePixels.])
|
[define if you have ImportImagePixels.])
|
||||||
],[
|
],[]
|
||||||
AC_MSG_WARN([ImportImagePixels not found; disabling magicksave])
|
|
||||||
enable_magicksave=no
|
|
||||||
]
|
|
||||||
)
|
)
|
||||||
|
AC_CHECK_FUNCS(ImagesToBlob,[
|
||||||
|
AC_DEFINE(HAVE_IMAGESTOBLOB,1,
|
||||||
|
[define if you have ImagesToBlob.])
|
||||||
|
],[]
|
||||||
|
)
|
||||||
LIBS="$save_LIBS"
|
LIBS="$save_LIBS"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -78,6 +78,13 @@ magick_import_pixels( Image *image, const ssize_t x, const ssize_t y,
|
|||||||
type, pixels, exception ) );
|
type, pixels, exception ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void *
|
||||||
|
magick_images_to_blob( const ImageInfo *image_info, Image *images, size_t *length,
|
||||||
|
ExceptionInfo *exception )
|
||||||
|
{
|
||||||
|
return( ImagesToBlob( image_info, images, length, exception ) );
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
magick_set_property( Image *image, const char *property, const char *value,
|
magick_set_property( Image *image, const char *property, const char *value,
|
||||||
ExceptionInfo *exception )
|
ExceptionInfo *exception )
|
||||||
@ -193,10 +200,31 @@ magick_import_pixels( Image *image, const ssize_t x, const ssize_t y,
|
|||||||
return( ImportImagePixels( image, x, y, width, height, map,
|
return( ImportImagePixels( image, x, y, width, height, map,
|
||||||
type, pixels ) );
|
type, pixels ) );
|
||||||
#else /*!HAVE_IMPORTIMAGEPIXELS*/
|
#else /*!HAVE_IMPORTIMAGEPIXELS*/
|
||||||
|
g_assert(image != (Image *) NULL);
|
||||||
|
g_assert(image->signature == MagickSignature);
|
||||||
|
|
||||||
|
Image *constitute_image=
|
||||||
|
ConstituteImage(width,height,map,type,pixels,&image->exception);
|
||||||
|
if (constitute_image) {
|
||||||
|
(void) CompositeImage(image,CopyCompositeOp,constitute_image,x,y);
|
||||||
|
DestroyImage(constitute_image);
|
||||||
|
return (image->exception.severity == UndefinedException);
|
||||||
|
}
|
||||||
return( MagickFalse );
|
return( MagickFalse );
|
||||||
#endif /*HAVE_IMPORTIMAGEPIXELS*/
|
#endif /*HAVE_IMPORTIMAGEPIXELS*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void *
|
||||||
|
magick_images_to_blob( const ImageInfo *image_info, Image *images, size_t *length,
|
||||||
|
ExceptionInfo *exception )
|
||||||
|
{
|
||||||
|
#ifdef HAVE_IMAGESTOBLOB
|
||||||
|
return( ImagesToBlob( image_info, images, length, exception ) );
|
||||||
|
#else
|
||||||
|
return( ImageToBlob( image_info, images, length, exception ) );
|
||||||
|
#endif /*HAVE_IMAGESTOBLOB*/
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
magick_set_property( Image *image, const char *property, const char *value,
|
magick_set_property( Image *image, const char *property, const char *value,
|
||||||
ExceptionInfo *exception )
|
ExceptionInfo *exception )
|
||||||
|
@ -51,6 +51,8 @@ int magick_set_image_size( Image *image,
|
|||||||
int magick_import_pixels( Image *image, const ssize_t x, const ssize_t y,
|
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 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 *magick_images_to_blob( const ImageInfo *image_info, Image *images, size_t *length,
|
||||||
|
ExceptionInfo *exception );
|
||||||
void magick_set_property( Image *image, const char *property, const char *value,
|
void magick_set_property( Image *image, const char *property, const char *value,
|
||||||
ExceptionInfo *exception );
|
ExceptionInfo *exception );
|
||||||
void magick_set_image_option( ImageInfo *image_info,
|
void magick_set_image_option( ImageInfo *image_info,
|
||||||
|
@ -112,7 +112,7 @@ magick_write_block( VipsRegion *region, VipsRect *area, void *a )
|
|||||||
{
|
{
|
||||||
VipsForeignSaveMagick *magick = (VipsForeignSaveMagick *) a;
|
VipsForeignSaveMagick *magick = (VipsForeignSaveMagick *) a;
|
||||||
|
|
||||||
MagickBooleanType status;
|
int status;
|
||||||
void *p;
|
void *p;
|
||||||
|
|
||||||
p = VIPS_REGION_ADDR( region, area->left, area->top );
|
p = VIPS_REGION_ADDR( region, area->left, area->top );
|
||||||
@ -221,7 +221,7 @@ vips_foreign_save_magick_build( VipsObject *object )
|
|||||||
magick->exception = magick_acquire_exception();
|
magick->exception = magick_acquire_exception();
|
||||||
magick->image_info = CloneImageInfo( NULL );
|
magick->image_info = CloneImageInfo( NULL );
|
||||||
|
|
||||||
magick->storage_type = UndefinedPixel;
|
magick->storage_type = CharPixel;
|
||||||
switch( im->BandFmt ) {
|
switch( im->BandFmt ) {
|
||||||
case VIPS_FORMAT_UCHAR:
|
case VIPS_FORMAT_UCHAR:
|
||||||
magick->storage_type = CharPixel;
|
magick->storage_type = CharPixel;
|
||||||
@ -465,8 +465,8 @@ vips_foreign_save_magick_buffer_build( VipsObject *object )
|
|||||||
build( object ) )
|
build( object ) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
|
||||||
if( !(obuf = ImagesToBlob( magick->image_info, magick->images,
|
if( !(obuf = magick_images_to_blob( magick->image_info, magick->images,
|
||||||
&olen, magick->exception )) ) {
|
&olen, magick->exception )) ) {
|
||||||
magick_inherit_exception( magick->exception, magick->images );
|
magick_inherit_exception( magick->exception, magick->images );
|
||||||
magick_vips_error( class->nickname, magick->exception );
|
magick_vips_error( class->nickname, magick->exception );
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user