diff options
author | Glenn Morris <rgm@gnu.org> | 2012-02-03 00:44:30 -0800 |
---|---|---|
committer | Glenn Morris <rgm@gnu.org> | 2012-02-03 00:44:30 -0800 |
commit | eea14f31d16a37857c02c5404056a657775a1949 (patch) | |
tree | 555d485b586f2bd41f78df2b355bfcaeded90153 /lisp/image.el | |
parent | 204e728ddae60b1f49b4064a6fdb2de6d6835672 (diff) | |
download | emacs-eea14f31d16a37857c02c5404056a657775a1949.tar.gz |
Document animated image API
* doc/lispref/display.texi (GIF Images): Mention animation.
Remove commented-out old example of animation.
(Animated Images): New subsection.
* doc/lispref/elisp.texi (Top):
* doc/lispref/vol1.texi (Top):
* doc/lispref/vol2.texi (Top): Add Animated Images menu entry.
* lisp/image-mode.el (image-animate-loop, image-toggle-animation): Doc fixes.
* lisp/image.el (image-animated-p): Doc fix. Use image-animated-types.
(image-animate-timeout): Doc fix.
* etc/NEWS: Markup.
Diffstat (limited to 'lisp/image.el')
-rw-r--r-- | lisp/image.el | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/lisp/image.el b/lisp/image.el index 15b82d12dcd..24089b0c7c9 100644 --- a/lisp/image.el +++ b/lisp/image.el @@ -595,13 +595,15 @@ Example: "List of supported animated image types.") (defun image-animated-p (image) - "Return non-nil if image can be animated. -Actually, the return value is a cons (NIMAGES . DELAY), where -NIMAGES is the number of sub-images in the animated image and -DELAY is the delay in second until the next sub-image shall be -displayed." + "Return non-nil if IMAGE can be animated. +To be capable of being animated, an image must be of a type +listed in `image-animated-types', and contain more than one +sub-image, with a specified animation delay. The actual return +value is a cons (NIMAGES . DELAY), where NIMAGES is the number +of sub-images in the animated image and DELAY is the delay in +seconds until the next sub-image should be displayed." (cond - ((eq (plist-get (cdr image) :type) 'gif) + ((memq (plist-get (cdr image) :type) image-animated-types) (let* ((metadata (image-metadata image)) (images (plist-get metadata 'count)) (delay (plist-get metadata 'delay))) @@ -609,6 +611,7 @@ displayed." (if (< delay 0) (setq delay 0.1)) (cons images delay)))))) +;; "Destructively"? (defun image-animate (image &optional index limit) "Start animating IMAGE. Animation occurs by destructively altering the IMAGE spec list. @@ -639,16 +642,20 @@ number, play until that number of seconds has elapsed." (setq timer nil))) timer)) +;; FIXME? The delay may not be the same for different sub-images, +;; hence we need to call image-animated-p to return it. +;; But it also returns count, so why do we bother passing that as an +;; argument? (defun image-animate-timeout (image n count time-elapsed limit) "Display animation frame N of IMAGE. N=0 refers to the initial animation frame. COUNT is the total number of frames in the animation. -DELAY is the time between animation frames, in seconds. TIME-ELAPSED is the total time that has elapsed since `image-animate-start' was called. LIMIT determines when to stop. If t, loop forever. If nil, stop after displaying the last animation frame. Otherwise, stop - after LIMIT seconds have elapsed." + after LIMIT seconds have elapsed. +The minimum delay between successive frames is 0.01s." (plist-put (cdr image) :index n) (force-window-update) (setq n (1+ n)) |