Andy Piper <andy(a)xemacs.org> writes:
>gifs with different time delays (is this not a property of the
gif itself?
You
>hardcode it at 100ms) and would also allow each gif to be stopped
independently
It is but I have no idea what property.
It is in a graphics control extension block together with
transparency (which you probably need to implement for optimized
animations).
If I read gifrlib.h and the specification[1] correctly for such a SavedImage
the Function member must be == GRAPHICS_EXT_FUNC_CODE and then
ExtensionBlockCount should be 1, ExtensionBlocks[0].ByteCount should
be 4 and ExtensionBlocks[0].Bytes is an array of lengh 4 that contain
byte 1-4 from the block as given in the specification (see below).
i.e. the delay should be ((unsigned)Bytes[2] << 8) + Bytes[1] in
1/100's of a second.
In addition seem indicate netscape has its own extensions for looping :-(
http://lxr.mozilla.org/seamonkey/source/modules/libimg/gifcom/gif.cpp#549
1 | | | | | <Packed Fields> See below
+---------------+
2 | | Delay Time Unsigned
+- -+
3 | |
+---------------+
4 | | Transparent Color Index Byte
+---------------+
<Packed Fields> = Reserved 3 Bits
Disposal Method 3 Bits
User Input Flag 1 Bit
Transparent Color Flag 1 Bit
i) Extension Introducer - Identifies the beginning of an extension
ii) Graphic Control Label - Identifies the current block as a
Graphic Control Extension. This field contains the fixed value
0xF9.
iii) Block Size - Number of bytes in the block, after the Block
Size field and up to but not including the Block Terminator. This
field contains the fixed value 4.
iv) Disposal Method - Indicates the way in which the graphic is to
be treated after being displayed.
Values : 0 - No disposal specified. The decoder is
not required to take any action.
1 - Do not dispose. The graphic is to be left
in place.
2 - Restore to background color. The area used by the
graphic must be restored to the background color.
3 - Restore to previous. The decoder is required to
restore the area overwritten by the graphic with
what was there prior to rendering the graphic.
4-7 - To be defined.
v) User Input Flag - Indicates whether or not user input is
expected before continuing. If the flag is set, processing will
continue when user input is entered. The nature of the User input
is determined by the application (Carriage Return, Mouse Button
Click, etc.).
Values : 0 - User input is not expected.
1 - User input is expected.
When a Delay Time is used and the User Input Flag is set,
processing will continue when user input is received or when the
delay time expires, whichever occurs first.
vi) Transparency Flag - Indicates whether a transparency index is
given in the Transparent Index field. (This field is the least
significant bit of the byte.)
Values : 0 - Transparent Index is not given.
1 - Transparent Index is given.
vii) Delay Time - If not 0, this field specifies the number of
hundredths (1/100) of a second to wait before continuing with the
processing of the Data Stream. The clock starts ticking immediately
after the graphic is rendered. This field may be used in
conjunction with the User Input Flag field.
viii) Transparency Index - The Transparency Index is such that when
encountered, the corresponding pixel of the display device is not
modified and processing goes on to the next pixel. The index is
present if and only if the Transparency Flag is set to 1.
Footnotes:
[1]
http://members.aol.com/royalef/gif89a.txt