From c5ce3cdfabd8754208d1e6ab4be4d574150affb6 Mon Sep 17 00:00:00 2001 From: Matthew Fidler Date: Tue, 12 Apr 2016 14:03:43 -0500 Subject: [PATCH] Use imagemagick when available --- mode-icons.el | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/mode-icons.el b/mode-icons.el index 04398f6..de6b7fb 100644 --- a/mode-icons.el +++ b/mode-icons.el @@ -454,20 +454,37 @@ ACTIVE is an indicator that the current window is active." (cond ((and mode-icons-grayscale-transform (eq type 'xpm-bw)) (create-image (mode-icons-get-icon-display-xpm-bw-face icon-path face) - 'xpm t :ascent 'center + ;; Use imagemagick for rescaling... + (or (and (fboundp 'imagemagick-types) + (memq 'png (imagemagick-types)) 'imagemagick) + 'xpm) + t :ascent 'center :face face :xpm-bw t :icon icon)) ((eq type 'xpm-bw) - `(image :type xpm :file ,icon-path :ascent center :face ',face :icon ,icon)) + (create-image icon-path + (or (and (fboundp 'imagemagick-types) + (memq 'png (imagemagick-types)) 'imagemagick) + 'xpm) + :ascent 'center + :face face + :icon icon)) ((and (eq type 'xpm) (or (and active mode-icons-desaturate-active) (and (not active) mode-icons-desaturate-inactive))) (create-image (mode-icons-desaturate-xpm icon-path face) - 'xpm t :ascent 'center - :face face :icon icon)) + (or (and (fboundp 'imagemagick-types) + (memq 'png (imagemagick-types)) 'imagemagick) + 'xpm) t :ascent 'center + :face face :icon icon)) (t - `(image :type ,(or (and (eq type 'jpg) 'jpeg) type) :file ,icon-path :ascent center :face ',face :icon ,icon))))) + (create-image icon-path + (or (and (fboundp 'imagemagick-types) + (memq (or (and (eq type 'jpg) 'jpeg) type) (imagemagick-types)) + 'imagemagick) + (or (and (eq type 'jpg) 'jpeg) type)) + :ascent 'center :face face :icon icon))))) ((and (eq type 'emoji) (setq tmp (mode-icons--get-emoji " " (list "" icon type) face))) (get-text-property 0 'display tmp)) ;; Shouldn't get here...