summaryrefslogtreecommitdiff
path: root/lisp/image.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/image.el')
-rw-r--r--lisp/image.el17
1 files changed, 10 insertions, 7 deletions
diff --git a/lisp/image.el b/lisp/image.el
index db820949eda..8d12b680ea9 100644
--- a/lisp/image.el
+++ b/lisp/image.el
@@ -29,6 +29,7 @@
"Image support."
:group 'multimedia)
+(declare-function image-flush "image.c" (spec &optional frame))
(defalias 'image-refresh 'image-flush)
(defconst image-type-header-regexps
@@ -247,6 +248,7 @@ compatibility with versions of Emacs that lack the variable
;; Used to be in image-type-header-regexps, but now not used anywhere
;; (since 2009-08-28).
(defun image-jpeg-p (data)
+ (declare (obsolete "It is unused inside Emacs and will be removed." "27.1"))
"Value is non-nil if DATA, a string, consists of JFIF image data.
We accept the tag Exif because that is the same format."
(setq data (ignore-errors (string-to-unibyte data)))
@@ -973,17 +975,19 @@ default is 20%."
0.8)))
(defun image--get-image ()
- (let ((image (get-text-property (point) 'display)))
+ "Return the image at point."
+ (let ((image (get-char-property (point) 'display)))
(unless (eq (car-safe image) 'image)
(error "No image under point"))
image))
(defun image--get-imagemagick-and-warn ()
- (unless (fboundp 'imagemagick-types)
+ (unless (or (fboundp 'imagemagick-types) (featurep 'ns))
(error "Cannot rescale images without ImageMagick support"))
(let ((image (image--get-image)))
(image-flush image)
- (plist-put (cdr image) :type 'imagemagick)
+ (when (fboundp 'imagemagick-types)
+ (plist-put (cdr image) :type 'imagemagick))
image))
(defun image--change-size (factor)
@@ -1003,6 +1007,8 @@ default is 20%."
(setq new (nconc new (list key val))))))
new)))
+(declare-function image-size "image.c" (spec &optional pixels frame))
+
(defun image--current-scaling (image new-image)
;; The image may be scaled due to many reasons (:scale, :max-width,
;; etc), so find out what the current scaling is based on the
@@ -1025,10 +1031,7 @@ default is 20%."
(defun image-save ()
"Save the image under point."
(interactive)
- (let ((image (get-text-property (point) 'display)))
- (when (or (not (consp image))
- (not (eq (car image) 'image)))
- (error "No image under point"))
+ (let ((image (image--get-image)))
(with-temp-buffer
(let ((file (plist-get (cdr image) :file)))
(if file