aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYavor Doganov2025-12-31 08:06:06 +0200
committerEli Zaretskii2026-01-17 14:06:29 +0200
commitcc3e6f368fe73dc0b7784e11b083dd240261de7d (patch)
tree433333f8f970a79450c1704f6b85b1bd6779d817 /src
parent709983fb085dc2bfe8e78e18abad0c119b18a6e3 (diff)
downloademacs-cc3e6f368fe73dc0b7784e11b083dd240261de7d.tar.gz
emacs-cc3e6f368fe73dc0b7784e11b083dd240261de7d.zip
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)
Diffstat (limited to 'src')
-rw-r--r--src/image.c26
-rw-r--r--src/nsimage.m10
2 files changed, 31 insertions, 5 deletions
diff --git a/src/image.c b/src/image.c
index ac6e76f10a7..71a091ea498 100644
--- a/src/image.c
+++ b/src/image.c
@@ -13054,11 +13054,18 @@ non-numeric, there is no explicit limit on the size of images. */);
13054 13054
13055#if defined (HAVE_WEBP) \ 13055#if defined (HAVE_WEBP) \
13056 || (defined (HAVE_NATIVE_IMAGE_API) \ 13056 || (defined (HAVE_NATIVE_IMAGE_API) \
13057 && ((defined (HAVE_NS) && defined (NS_IMPL_COCOA)) \ 13057 && (defined (HAVE_NS) || defined (HAVE_HAIKU)))
13058 || defined (HAVE_HAIKU)))
13059 DEFSYM (Qwebp, "webp"); 13058 DEFSYM (Qwebp, "webp");
13060 DEFSYM (Qwebpdemux, "webpdemux"); 13059 DEFSYM (Qwebpdemux, "webpdemux");
13060#if !defined (NS_IMPL_GNUSTEP) || defined (HAVE_WEBP)
13061 add_image_type (Qwebp); 13061 add_image_type (Qwebp);
13062#else
13063
13064 /* On GNUstep, WEBP support is provided via ImageMagick only if
13065 gnustep-gui is built with --enable-imagemagick. */
13066 if (image_can_use_native_api (Qwebp))
13067 add_image_type (Qwebp);
13068#endif /* NS_IMPL_GNUSTEP && !HAVE_WEBP */
13062#endif 13069#endif
13063 13070
13064#if defined (HAVE_IMAGEMAGICK) 13071#if defined (HAVE_IMAGEMAGICK)
@@ -13081,18 +13088,27 @@ non-numeric, there is no explicit limit on the size of images. */);
13081 DEFSYM (Qgobject, "gobject"); 13088 DEFSYM (Qgobject, "gobject");
13082#endif /* HAVE_NTGUI */ 13089#endif /* HAVE_NTGUI */
13083#elif defined HAVE_NATIVE_IMAGE_API \ 13090#elif defined HAVE_NATIVE_IMAGE_API \
13084 && ((defined HAVE_NS && defined NS_IMPL_COCOA) \ 13091 && (defined HAVE_NS || defined HAVE_HAIKU)
13085 || defined HAVE_HAIKU)
13086 DEFSYM (Qsvg, "svg"); 13092 DEFSYM (Qsvg, "svg");
13087 13093
13088 /* On Haiku, the SVG translator may not be installed. */ 13094 /* On Haiku, the SVG translator may not be installed. On GNUstep, SVG
13095 support is provided by ImageMagick so not guaranteed. Furthermore,
13096 some distros (e.g., Debian) ship ImageMagick's SVG module in a
13097 separate binary package which may not be installed. */
13089 if (image_can_use_native_api (Qsvg)) 13098 if (image_can_use_native_api (Qsvg))
13090 add_image_type (Qsvg); 13099 add_image_type (Qsvg);
13091#endif 13100#endif
13092 13101
13093#ifdef HAVE_NS 13102#ifdef HAVE_NS
13094 DEFSYM (Qheic, "heic"); 13103 DEFSYM (Qheic, "heic");
13104#ifdef NS_IMPL_COCOA
13095 add_image_type (Qheic); 13105 add_image_type (Qheic);
13106#else
13107
13108 /* HEIC support in gnustep-gui is provided by ImageMagick. */
13109 if (image_can_use_native_api (Qheic))
13110 add_image_type (Qheic);
13111#endif /* NS_IMPL_GNUSTEP */
13096#endif 13112#endif
13097 13113
13098#if HAVE_NATIVE_IMAGE_API 13114#if HAVE_NATIVE_IMAGE_API
diff --git a/src/nsimage.m b/src/nsimage.m
index 3c318c37cfd..426ce20eb05 100644
--- a/src/nsimage.m
+++ b/src/nsimage.m
@@ -102,6 +102,16 @@ ns_can_use_native_image_api (Lisp_Object type)
102 imageType = @"gif"; 102 imageType = @"gif";
103 else if (EQ (type, Qtiff)) 103 else if (EQ (type, Qtiff))
104 imageType = @"tiff"; 104 imageType = @"tiff";
105#ifndef HAVE_RSVG
106 else if (EQ (type, Qsvg))
107 imageType = @"svg";
108#endif
109#ifndef HAVE_WEBP
110 else if (EQ (type, Qwebp))
111 imageType = @"webp";
112#endif
113 else if (EQ (type, Qheic))
114 imageType = @"heic";
105 115
106 types = [NSImage imageFileTypes]; 116 types = [NSImage imageFileTypes];
107#endif 117#endif