1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-21 03:52:16 -08:00

NS: Add native image support for HEIF, SVG and WEBP on GNUstep

* src/nsimage.m (ns_can_use_native_image_api): Handle HEIF, SVG
and WEBP image types on GNUstep.
* src/image.c (syms_of_image): Add conditional native image
support for HEIF, SVG and WEBP on GNUstep.  (Bug#80101)
This commit is contained in:
Yavor Doganov 2025-12-31 08:06:06 +02:00 committed by Eli Zaretskii
parent 709983fb08
commit cc3e6f368f
2 changed files with 31 additions and 5 deletions

View file

@ -13054,11 +13054,18 @@ non-numeric, there is no explicit limit on the size of images. */);
#if defined (HAVE_WEBP) \
|| (defined (HAVE_NATIVE_IMAGE_API) \
&& ((defined (HAVE_NS) && defined (NS_IMPL_COCOA)) \
|| defined (HAVE_HAIKU)))
&& (defined (HAVE_NS) || defined (HAVE_HAIKU)))
DEFSYM (Qwebp, "webp");
DEFSYM (Qwebpdemux, "webpdemux");
#if !defined (NS_IMPL_GNUSTEP) || defined (HAVE_WEBP)
add_image_type (Qwebp);
#else
/* On GNUstep, WEBP support is provided via ImageMagick only if
gnustep-gui is built with --enable-imagemagick. */
if (image_can_use_native_api (Qwebp))
add_image_type (Qwebp);
#endif /* NS_IMPL_GNUSTEP && !HAVE_WEBP */
#endif
#if defined (HAVE_IMAGEMAGICK)
@ -13081,18 +13088,27 @@ non-numeric, there is no explicit limit on the size of images. */);
DEFSYM (Qgobject, "gobject");
#endif /* HAVE_NTGUI */
#elif defined HAVE_NATIVE_IMAGE_API \
&& ((defined HAVE_NS && defined NS_IMPL_COCOA) \
|| defined HAVE_HAIKU)
&& (defined HAVE_NS || defined HAVE_HAIKU)
DEFSYM (Qsvg, "svg");
/* On Haiku, the SVG translator may not be installed. */
/* On Haiku, the SVG translator may not be installed. On GNUstep, SVG
support is provided by ImageMagick so not guaranteed. Furthermore,
some distros (e.g., Debian) ship ImageMagick's SVG module in a
separate binary package which may not be installed. */
if (image_can_use_native_api (Qsvg))
add_image_type (Qsvg);
#endif
#ifdef HAVE_NS
DEFSYM (Qheic, "heic");
#ifdef NS_IMPL_COCOA
add_image_type (Qheic);
#else
/* HEIC support in gnustep-gui is provided by ImageMagick. */
if (image_can_use_native_api (Qheic))
add_image_type (Qheic);
#endif /* NS_IMPL_GNUSTEP */
#endif
#if HAVE_NATIVE_IMAGE_API

View file

@ -102,6 +102,16 @@ ns_can_use_native_image_api (Lisp_Object type)
imageType = @"gif";
else if (EQ (type, Qtiff))
imageType = @"tiff";
#ifndef HAVE_RSVG
else if (EQ (type, Qsvg))
imageType = @"svg";
#endif
#ifndef HAVE_WEBP
else if (EQ (type, Qwebp))
imageType = @"webp";
#endif
else if (EQ (type, Qheic))
imageType = @"heic";
types = [NSImage imageFileTypes];
#endif