emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master ec1312d 7/7: Add native HEIC support on macOS (bug#51381)


From: Alan Third
Subject: master ec1312d 7/7: Add native HEIC support on macOS (bug#51381)
Date: Wed, 22 Dec 2021 15:49:24 -0500 (EST)

branch: master
commit ec1312d76a6bb9b4011ab66adad1614a31747af8
Author: Alan Third <alan@idiocy.org>
Commit: Alan Third <alan@idiocy.org>

    Add native HEIC support on macOS (bug#51381)
    
    * lisp/image.el (image-type-header-regexps):
    (image-type-file-name-regexps):
    (image-type-auto-detectable): Add auto-detect code for heic.
    * src/image.c (syms_of_image): Add heic as an image type under NS.
    * src/nsimage.m (ns_can_use_native_image_api): Add heic to list of
    possible image types in the native image support lookup.
---
 lisp/image.el | 7 ++++---
 src/image.c   | 5 +++++
 src/nsimage.m | 2 ++
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/lisp/image.el b/lisp/image.el
index cedefc0..702985f 100644
--- a/lisp/image.el
+++ b/lisp/image.el
@@ -58,7 +58,7 @@ static \\(unsigned \\)?char \\1_bits" . xbm)
                "\\(?:!DOCTYPE[ \t\r\n]+[^>]*>[ \t\r\n]*<[ \t\r\n]*" comment-re 
"*\\)?"
                "[Ss][Vv][Gg]"))
      . svg)
-    )
+    
("\\`....ftyp\\(heic\\|heix\\|hevc\\|heim\\|heis\\|hevm\\|hevs\\|mif1\\|msf1\\)"
 . heic))
   "Alist of (REGEXP . IMAGE-TYPE) pairs used to auto-detect image types.
 When the first bytes of an image file match REGEXP, it is assumed to
 be of image type IMAGE-TYPE if IMAGE-TYPE is a symbol.  If not a symbol,
@@ -78,7 +78,7 @@ a non-nil value, TYPE is the image's type.")
     ("\\.ps\\'" . postscript)
     ("\\.tiff?\\'" . tiff)
     ("\\.svgz?\\'" . svg)
-    )
+    ("\\.hei[cf]s?\\'" . heic))
   "Alist of (REGEXP . IMAGE-TYPE) pairs used to identify image files.
 When the name of an image file match REGEXP, it is assumed to
 be of image type IMAGE-TYPE.")
@@ -97,7 +97,8 @@ be of image type IMAGE-TYPE.")
     (tiff . maybe)
     (svg . maybe)
     (webp . maybe)
-    (postscript . nil))
+    (postscript . nil)
+    (heic . maybe))
   "Alist of (IMAGE-TYPE . AUTODETECT) pairs used to auto-detect image files.
 \(See `image-type-auto-detected-p').
 
diff --git a/src/image.c b/src/image.c
index 3904ab7..1d83065 100644
--- a/src/image.c
+++ b/src/image.c
@@ -11481,6 +11481,11 @@ non-numeric, there is no explicit limit on the size of 
images.  */);
 #endif /* HAVE_NTGUI  */
 #endif /* HAVE_RSVG  */
 
+#ifdef HAVE_NS
+  DEFSYM (Qheic, "heic");
+  add_image_type (Qheic);
+#endif
+
 #if HAVE_NATIVE_IMAGE_API
   DEFSYM (Qnative_image, "native-image");
 # ifdef HAVE_NTGUI
diff --git a/src/nsimage.m b/src/nsimage.m
index dd2bb3b..98efc9c 100644
--- a/src/nsimage.m
+++ b/src/nsimage.m
@@ -76,6 +76,8 @@ ns_can_use_native_image_api (Lisp_Object type)
     imageType = @"public.tiff";
   else if (EQ (type, Qsvg))
     imageType = @"public.svg-image";
+  else if (EQ (type, Qheic))
+    imageType = @"public.heic";
 
   /* NSImage also supports a host of other types such as PDF and BMP,
      but we don't yet support these in image.c.  */



reply via email to

[Prev in Thread] Current Thread [Next in Thread]