Re: .gif image fails to display correctly

2007-03-28 Thread Kim F. Storm
"Chris Moore" <[EMAIL PROTECTED]> writes:

> On 3/22/07, Kim F. Storm <[EMAIL PROTECTED]> wrote:
>> Chong Yidong <[EMAIL PROTECTED]> writes:
>
>> > Animated gifs aren't supported in Emacs.
>>
>> Mine does :-)
>>
>> ;;; animage.el --- animated image API
>
> That's quite nice, but it doesn't work on the high-colour image
> either.  Each frame is cleared before displaying the next.

That's a problem with the C-level GIF file parser - it doesn't
interpret the finer details of GIF images.  I'll look into that
after the release.

>
> Also, even after killing the image buffer, Emacs continues to use all
> available CPU time.  Shouldn't killing the buffer stop the animation
> loop from running?

It stops when the timer runs out.  Adding a "buffer live" check seems
like a good idea.

>
> And: are you looping all animated gifs?  Some aren't supposed to loop, I 
> think.

Probably yes...

-- 
Kim F. Storm <[EMAIL PROTECTED]> http://www.cua.dk



___
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug


Re: .gif image fails to display correctly

2007-03-26 Thread Chris Moore

On 3/22/07, Kim F. Storm <[EMAIL PROTECTED]> wrote:

Chong Yidong <[EMAIL PROTECTED]> writes:



> Animated gifs aren't supported in Emacs.

Mine does :-)

;;; animage.el --- animated image API


That's quite nice, but it doesn't work on the high-colour image
either.  Each frame is cleared before displaying the next.

Also, even after killing the image buffer, Emacs continues to use all
available CPU time.  Shouldn't killing the buffer stop the animation
loop from running?

And: are you looping all animated gifs?  Some aren't supposed to loop, I think.


___
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug


Re: .gif image fails to display correctly

2007-03-22 Thread Kim F. Storm
Chong Yidong <[EMAIL PROTECTED]> writes:

> Chris Moore <[EMAIL PROTECTED]> writes:
>
>> http://i.iinfo.cz/urs-att/gif2_e-115572866858321.gif is an example of
>> a .gif image which contains more than 256 colours.  It does this by
>> using multiple frames with a 0ms separation between them.
>>
>> Emacs only displays the first frame.
>>
>> This may well be something that isn't worth fixing in Emacs, but I
>> thought I should mention it anyway.
>
> Animated gifs aren't supported in Emacs.

Mine does :-)

;;; animage.el --- animated image API

;; Copyright (C) 2006 Free Software Foundation, Inc.

;; Author: Kim F. Storm <[EMAIL PROTECTED]>
;; Keywords: multimedia

;; This file is (not yet) part of GNU Emacs.

;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.

;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING.  If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.

;;; Commentary:

;;; Code:

(require 'image)

(defcustom image-animate-max-time 30
  "Time in seconds to animate images."
  :type 'integer
;  :version "22.1"
  :group 'image)

(defconst image-animated-types '(gif)
  "List of supported animated image types.")

;;;###autoload
(defun create-animated-image (file-or-data &optional type data-p &rest props)
  "Create an animated image.
FILE-OR-DATA is an image file name or image data.
Optional TYPE is a symbol describing the image type.  If TYPE is omitted
or nil, try to determine the image type from its first few bytes
of image data.  If that doesn't work, and FILE-OR-DATA is a file name,
use its file extension as image type.
Optional DATA-P non-nil means FILE-OR-DATA is a string containing image data.
Optional PROPS are additional image attributes to assign to the image,
like, e.g. `:mask MASK'.
Value is the image created, or nil if images of type TYPE are not supported.

Images should not be larger than specified by `max-image-size'."
  (setq type (image-type file-or-data type data-p))
  (when (image-type-available-p type)
(let* ((animate (memq type image-animated-types))
   (image
(append (list 'image :type type (if data-p :data :file) 
file-or-data)
(if animate '(:index 0 :mask heuristic))
props)))
  (if animate
  (image-animate-start image))
  image)))

(defun image-animate-timer (image)
  "Return the animation timer for image IMAGE."
  ;; See cancel-function-timers
  (let ((tail timer-list) timer)
(while tail
  (setq timer (car tail)
tail (cdr tail))
  (if (and (eq (aref timer 5) #'image-animate-timeout)
   (consp (aref timer 6))
   (eq (car (aref timer 6)) image))
  (setq tail nil)
(setq timer nil)))
timer))

(defun image-animate-start (image &optional max-time)
  "Start animation of image IMAGE.
Optional second arg MAX-TIME is number of seconds to animate image,
or t to animate infinitely."
  (let ((anim (image-animated-p image))
timer tmo)
(when anim
  (if (setq timer (image-animate-timer image))
  (setcar (nthcdr 3 (aref timer 6)) max-time)
(setq tmo (* (cdr anim) 0.01))
(setq max-time (or max-time image-animate-max-time))
(run-with-timer tmo nil #'image-animate-timeout
image 1 (car anim)
(if (numberp max-time)
(- max-time tmo)
  max-time))

(defun image-animate-stop (image)
  "Stop animation of image."
  (let ((timer (image-animate-timer image)))
(when timer
  (cancel-timer timer

(defun image-animate-timeout (image ino count time-left)
  (if (>= ino count)
  (setq ino 0))
  (plist-put (cdr image) :index ino)
  (force-window-update)
  (let ((anim (image-animated-p image)) tmo)
(when anim
  (setq tmo (* (cdr anim) 0.01))
  (unless (and (= ino 0) (numberp time-left) (< time-left tmo))
(run-with-timer tmo nil #'image-animate-timeout
image (1+ ino) count
(if (numberp time-left)
(- time-left tmo)
  time-left))

(defun image-animated-p (image)
  "Return non-nil if image is animated.
Actually, return value is a cons (IMAGES . DELAY) where IMAGES
is the number of sub-images in the animated image, and DELAY
is the delay in 100ths of a second until the next sub-image
shall be displayed."
  (cond
   ((eq (plist-get (cdr image)

Re: .gif image fails to display correctly

2007-03-21 Thread Chong Yidong
Chris Moore <[EMAIL PROTECTED]> writes:

> http://i.iinfo.cz/urs-att/gif2_e-115572866858321.gif is an example of
> a .gif image which contains more than 256 colours.  It does this by
> using multiple frames with a 0ms separation between them.
>
> Emacs only displays the first frame.
>
> This may well be something that isn't worth fixing in Emacs, but I
> thought I should mention it anyway.

Animated gifs aren't supported in Emacs.



___
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug


.gif image fails to display correctly

2007-03-21 Thread Chris Moore
http://i.iinfo.cz/urs-att/gif2_e-115572866858321.gif is an example of
a .gif image which contains more than 256 colours.  It does this by
using multiple frames with a 0ms separation between them.

Emacs only displays the first frame.

This may well be something that isn't worth fixing in Emacs, but I
thought I should mention it anyway.

In GNU Emacs 22.0.96.2 (i686-pc-linux-gnu, GTK+ Version 2.8.20)
 of 2007-03-20 on trpaslik
Windowing system distributor `The X.Org Foundation', version 11.0.70101000
configured using `configure  '--with-gtk' '--prefix' '/usr/local' '--with-xpm' 
'--with-jpeg' '--with-png' '--with-gif''


___
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug