home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Spezial
/
SPEZIAL2_97.zip
/
SPEZIAL2_97.iso
/
ANWEND
/
MULTIMED
/
ANIGIF02
/
grammar.txt
< prev
next >
Wrap
Text File
|
1997-02-22
|
14KB
|
335 lines
ANIGIF 0.01 Grammar Listing
Here are the script commands to create animated GIFs. PLEASE see the
example script files (*.SCR) in the archive to see how they work.
Those items highlighted with (**) MUST be present in EVERY script.
Everything else is optional and may appear more than once in the
script.
For the image raster data and application extension data lines you will
need an editor that can edit LONG lines, 750+ characters. TEDIT.EXE or
E.EXE that come with OS/2 do the job nicely.
Included in the distribution archive is DOCument GIF, you can use it to
do most of the work for creating scripts by running it with the -1
switch like so:
DOCGIF -1 FOO.GIF > BAR.SCR
This command would take FOO.GIF and disassemble it in single line
output mode with console output redirected to BAR.SCR. While it doesn't
write the script for you, it does take a lot of the work out of it.
Legal stuff:
Parts of the document were ripped directly from the
GIF89a specification. Get it, you ARE going to need
it. If any problems arise out of my use of those
sections, let me know and I'll remove them.
______________________________________________________________________________
GIF General File Format
______________________________________________________________________________
+-------------------+
| GIF Signature | (**)
+-------------------+
| Screen Descriptor | (**)
+-------------------+
| Global Color Map |
+-------------------+
|... ...|
+-------------------+
| Image Descriptor |
+-------------------+
| Local Color Map |
+-------------------+
| Raster Data |
+-------------------+
|... ...|
| GIF Terminator | (**)
+-------------------+
(**) These all must be present and in this order.
All other blocks are optional. The GIF
Terminator must be the very last block in
the file.
______________________________________________________________________________
Grammar Syntax
______________________________________________________________________________
| = or
\ = next line is an extension of current line
(**) required
______________________________________________________________________________
Script Commands
______________________________________________________________________________
All commands and data should start out in column 1 of each line. Please
see BG.SCR and TEST.SCR for more extensive examples (they will actually
create GIF files if you feed them to ANImate GIF). All parameters must
be present for all commands.
SetDocumentHeader = GIF87a | GIF89a (**)
SetDocumentHeader inserts the correct GIF version into the output data
stream. Example:
SetDocumentHeader = GIF89a
--+---+--
SetLogicalScreenDescriptor = <logical screen width> \ (**)
<logical screen height> \
<global color table size> \
<sorted color table flag> \
<color resolution> \
<global color table present flag> \
<background color index> \
<pixel aspect ratio>
SetLogicalScreenDescriptor describes the "big picture" for all the
images in a file. The parameters are:
<logical screen width> Raster width in pixels.
<logical screen height> Raster height in pixels.
<global color table size> 0 - 7. See Fig. 1. This is the
number of colors in the global
color table.
<sorted color table flag> 1 = Sorted color table.
0 = Color table not sorted.
<color resolution> 0 - 7. See Fig. 1. This is the
total number of colors in the
palette the image was created
from.
<global color table present flag> 1 = Global color table present.
0 = Color table not present.
<background color index> Color index of screen background
color.
<pixel aspect ratio> 0 - 255.
Setting Colors
---------------------------
0 2
1 4
2 8
3 16
4 32
5 64
6 128
7 256
---------------------------
Fig. 1
--+---+--
SetRGBColorTable = <number of colors>
[upto 8 rgb hex values per rgbdef line]
EndSet
SetRGBColorTable inserts a color table into the output data stream.
Example:
SetRGBColorTable = 2
000000 FFFFFF
EndSet
This would insert a color table with 2 entries into the data stream,
the colors being black and white.
--+---+--
SetImageDescriptor = <image left position> \
<image top position> \
<image width> \
<image height> \
<local color table size> \
<color table sorted flag> \
<image interlaced flag> \
<local color table present flag>
[can set a color table here with `SetRGBColorTable']
[count_of_bytes_on_this_line] [upto 255 byte values per line]
EndSet
SetImageDescriptor defines the attributes for an image. The parameters
are:
<image left position> Column number of the top of the
image.
<image top position> Row number of the left side of the
image.
<image width> Width of the image in pixels.
<image height> Height of image in pixels.
<local color table size> 0 - 7. See Fig. 1. This is the
number of colors in the local color
table.
<color table sorted flag> 1 = Local color table is sorted.
0 = Color table not sorted.
<image interlaced flag> 1 = Image is interlaced.
0 = Image is not interlaced.
<local color table present flag> 1 = Local color table present.
0 = No local color table.
If a local color table needs to be inserted, use SetRGBColorTable to
insert it before the raster data.
The raster data is presented in a <count> <byte1 byte2 ...> fashion. An
example may help:
05 10 1F 2E 3D FF
05 is the number of bytes following, the rest is the actual data. NOTE:
all of the entries for these lines are in HEXADECIMAL (base 16) format.
Each line will translate into a data sub-block, so please don't succumb
to the temptation to make these lines look pretty in your editor by
using a number of them with small byte counts. The resultant image will
be a valid GIF but space will be wasted in the data stream.
--+---+--
SetGraphicControlBlock = <transparent color flag> \
<user input wanted flag> \
<disposal method> \
<delay time> \
<transparent color index>
SetGraphicControlBlock inserts a Graphic Control Block into the output
stream. Parameters are:
<transparent color flag> 1 = Image has a transparent color.
0 = No transparent color.
<user input wanted flag> 1 = User input wanted.
0 = No input.
<disposal method> 0 - 3. Methods are:
0 - None.
1 - Do not dispose (0).
2 - Restore to background.
3 - Restore to previous.
<delay time> 0 - 65535. Delay time, specify the
number of 1/100s to wait before
processing continues.
<transparent color index> 0 - 255. Index of the transparent
color.
--+---+--
SetComment = <comment text>
SetComment inserts a comment into the data stream. Example:
SetComment = This is a comment no one will see.
Only one line of upto 254 characters may be inserted with the command.
--+---+--
SetPlainText = <text left position> \
<text top position> \
<text grid width> \
<text grid height> \
<character cell width> \
<character cell height> \
<foreground color index> \
<background color index>
[text, only one here, sorry..]
SetPlainText inserts a text block that will be rendered on the image.
The parameters are:
<text left position> Column number in pixels of the left edge of
the text grid.
<text top position> Row number in pixels of the top edge of the
text grid.
<text grid width> Width in pixels of the text grid.
<text grid height> Height in pixels of the text grid.
<character cell width> Character cell width in pixels.
<character cell height> Character cell height in pixels.
<foreground color index> Foreground (text) color index.
<background color index> Background color index.
One and only one line of text may follow, upto 254 characters.
--+---+--
SetApplicationExtension = "Application ID" "Application Authorization Code"
[count_of_bytes_on_this_line] [upto 255 byte values per line]
EndSet
SetApplicationExtension inserts an application defined extension into
the output stream. A common use of this is to insert the "Netscape
Looping" block for animated GIFs that are seen on many Web pages.
Parameters are:
"Application ID" 8 character identification string
of the application defining this
block.
"Application Authorization Code" 3 character authentification string
used to authenticate the defining
application.
The data is presented in a <count> <byte1 byte2 ...> fashion. An
example may help:
05 10 1F 2E 3D FF
05 is the number of bytes following, the rest is the actual data. NOTE:
all of the entries for these lines are in HEXADECIMAL (base 16) format.
Each line will translate into a data sub-block, so please don't succumb
to the temptation to make these lines look pretty in your editor by
using a number of them with small byte counts. The resultant file will
be valid but, space will be wasted in the data stream.
--+---+--
SetNetscapeLoop = <loop iterations>
SetNetscapeLoop inserts the Netscape 2.0 loop block into the output
stream. Its one and only argument is the number of times you want the
animation to repeat. Currently I believe all versions of Netscape
ignore this (please let me know if this has been fixed). However, you
should still set this to reasonable value.
--+---+--
SetEOI (**)
SetEOI inserts the End Of Information block into the output stream.
This MUST be the last block in your script.
--+---+--