* wl-demo.el (wl-demo-insert-image): Make Emacs 21 use BITMAP-MULE for xbm if
authoryamaoka <yamaoka>
Wed, 12 Dec 2001 04:50:10 +0000 (04:50 +0000)
committeryamaoka <yamaoka>
Wed, 12 Dec 2001 04:50:10 +0000 (04:50 +0000)
 the new redisplay engine is not available.

wl/ChangeLog
wl/wl-demo.el

index 60124d1..331297b 100644 (file)
@@ -1,5 +1,10 @@
 2001-12-12  Katsumi Yamaoka  <yamaoka@jpl.org>
 
+       * wl-demo.el (wl-demo-insert-image): Make Emacs 21 use BITMAP-MULE
+       for xbm if the new redisplay engine is not available.
+
+2001-12-12  Katsumi Yamaoka  <yamaoka@jpl.org>
+
        * wl-demo.el (wl-demo-image-type-alist): Add bitmap for Emacs 21.
        (wl-demo-insert-image): Decode bitmap data line by line when Emacs
        21 is running (cf. mule-ja:08245).
index 10c36ba..2db1cb1 100644 (file)
@@ -172,7 +172,32 @@ Return a number of lines that an image occupies in the buffer."
                 (insert "\n")
                 (/ (+ (* 2 (glyph-height image) (window-height)) height)
                    (* 2 height)))
+               ((and wl-on-emacs21
+                     (or (eq 'xpm image-type)
+                         (and (eq 'xbm image-type)
+                              (image-type-available-p 'xbm))))
+                ;; Use the new redisplay engine on Emacs 21.
+                (setq image (create-image file image-type)
+                      width (image-size image)
+                      height (cdr width)
+                      width (car width))
+                (when (eq 'xbm image-type)
+                  (let ((bg (face-background 'wl-highlight-logo-face))
+                        (fg (face-foreground 'wl-highlight-logo-face)))
+                    (when (stringp bg)
+                      (plist-put (cdr image) ':background bg))
+                    (when (stringp fg)
+                      (plist-put (cdr image) ':foreground fg))))
+                (insert (propertize " " 'display
+                                    (list 'space ':align-to
+                                          (max 0 (round (- (window-width)
+                                                           width)
+                                                        2)))))
+                (insert-image image)
+                (insert "\n")
+                (round height))
                ((eq 'bitmap image-type)
+                ;; Use ready-composed bitmap image.
                 (require 'bitmap)
                 (if wl-on-emacs21
                     (progn
@@ -196,26 +221,6 @@ Return a number of lines that an image occupies in the buffer."
                 (put-text-property (point-min) (point-max)
                                    'face 'wl-highlight-logo-face)
                 (count-lines (point-min) (goto-char (point-max))))
-               ((>= emacs-major-version 21)
-                (setq image (create-image file image-type)
-                      width (image-size image)
-                      height (cdr width)
-                      width (car width))
-                (when (eq 'xbm image-type)
-                  (let ((bg (face-background 'wl-highlight-logo-face))
-                        (fg (face-foreground 'wl-highlight-logo-face)))
-                    (when (stringp bg)
-                      (plist-put (cdr image) ':background bg))
-                    (when (stringp fg)
-                      (plist-put (cdr image) ':foreground fg))))
-                (insert (propertize " " 'display
-                                    (list 'space ':align-to
-                                          (max 0 (round (- (window-width)
-                                                           width)
-                                                        2)))))
-                (insert-image image)
-                (insert "\n")
-                (round height))
                ((eq 'xbm image-type)
                 (message "Composing a bitmap image...")
                 (require 'bitmap)