diff options
| author | Juanma Barranquero | 2004-06-14 20:58:36 +0000 |
|---|---|---|
| committer | Juanma Barranquero | 2004-06-14 20:58:36 +0000 |
| commit | 3c3b34d2dbbf7d8e334611172cd58ff5d2e765b4 (patch) | |
| tree | 088473d46c02239e94791ddb173d744ca476d27e | |
| parent | 4f224e64d05485d33670856b4604f78f9c6be77c (diff) | |
| download | emacs-3c3b34d2dbbf7d8e334611172cd58ff5d2e765b4.tar.gz emacs-3c3b34d2dbbf7d8e334611172cd58ff5d2e765b4.zip | |
(image-library-alist): New variable to map image types to external
libraries. Initialized to nil, unless system-specific configs change it.
(image-type-available-p): Determine whether an image type is available by
calling `init-image-library'.
| -rw-r--r-- | lisp/image.el | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/lisp/image.el b/lisp/image.el index d2eb264f91e..88e38186d7b 100644 --- a/lisp/image.el +++ b/lisp/image.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; image.el --- image API | 1 | ;;; image.el --- image API |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1998, 99, 2000, 01, 04 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Maintainer: FSF | 5 | ;; Maintainer: FSF |
| 6 | ;; Keywords: multimedia | 6 | ;; Keywords: multimedia |
| @@ -48,6 +48,17 @@ IMAGE-TYPE must be a pair (PREDICATE . TYPE). PREDICATE is called | |||
| 48 | with one argument, a string containing the image data. If PREDICATE returns | 48 | with one argument, a string containing the image data. If PREDICATE returns |
| 49 | a non-nil value, TYPE is the image's type.") | 49 | a non-nil value, TYPE is the image's type.") |
| 50 | 50 | ||
| 51 | ;;;###autoload | ||
| 52 | (defvar image-library-alist nil | ||
| 53 | "Alist of image types vs external libraries needed to display them. | ||
| 54 | |||
| 55 | Each element is a list (IMAGE-TYPE LIBRARY...), where the car is a symbol | ||
| 56 | representing a supported image type, and the rest are strings giving | ||
| 57 | alternate filenames for the corresponding external libraries to load. | ||
| 58 | They are tried in the order they appear on the list; if none of them can | ||
| 59 | be loaded, the running session of Emacs won't display the image type. | ||
| 60 | No entries are needed for pbm and xbm images; they're always supported.") | ||
| 61 | ;;;###autoload (put 'image-library-alist 'risky-local-variable t) | ||
| 51 | 62 | ||
| 52 | (defun image-jpeg-p (data) | 63 | (defun image-jpeg-p (data) |
| 53 | "Value is non-nil if DATA, a string, consists of JFIF image data. | 64 | "Value is non-nil if DATA, a string, consists of JFIF image data. |
| @@ -111,8 +122,8 @@ be determined." | |||
| 111 | (defun image-type-available-p (type) | 122 | (defun image-type-available-p (type) |
| 112 | "Value is non-nil if image type TYPE is available. | 123 | "Value is non-nil if image type TYPE is available. |
| 113 | Image types are symbols like `xbm' or `jpeg'." | 124 | Image types are symbols like `xbm' or `jpeg'." |
| 114 | (and (boundp 'image-types) (not (null (memq type image-types))))) | 125 | (and (fboundp 'init-image-library) |
| 115 | 126 | (init-image-library type image-library-alist))) | |
| 116 | 127 | ||
| 117 | ;;;###autoload | 128 | ;;;###autoload |
| 118 | (defun create-image (file-or-data &optional type data-p &rest props) | 129 | (defun create-image (file-or-data &optional type data-p &rest props) |