home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: Graphics / Graphics.zip / anigif02.zip / grammar.txt < prev    next >
Text File  |  1997-02-22  |  14KB  |  335 lines

  1.  
  2.                         ANIGIF 0.01 Grammar Listing
  3.  
  4.     Here are the script commands to create animated GIFs. PLEASE see the
  5.     example script files (*.SCR) in the archive to see how they work.
  6.     Those items highlighted with (**) MUST be present in EVERY script.
  7.     Everything else is optional and may appear more than once in the
  8.     script.
  9.  
  10.     For the image raster data and application extension data lines you will
  11.     need an editor that can edit LONG lines, 750+ characters. TEDIT.EXE or
  12.     E.EXE that come with OS/2 do the job nicely.
  13.  
  14.     Included in the distribution archive is DOCument GIF, you can use it to
  15.     do most of the work for creating scripts by running it with the -1
  16.     switch like so:
  17.  
  18.         DOCGIF -1 FOO.GIF > BAR.SCR
  19.  
  20.     This command would take FOO.GIF and disassemble it in single line
  21.     output mode with console output redirected to BAR.SCR. While it doesn't
  22.     write the script for you, it does take a lot of the work out of it.
  23.  
  24.         Legal stuff:
  25.  
  26.             Parts of the document were ripped directly from the
  27.             GIF89a specification. Get it, you ARE going to need
  28.             it. If any problems arise out of my use of those
  29.             sections, let me know and I'll remove them.
  30.  
  31.  ______________________________________________________________________________
  32.  
  33.                           GIF General File Format
  34.  ______________________________________________________________________________
  35.  
  36.                            +-------------------+
  37.                            | GIF Signature     |  (**)
  38.                            +-------------------+
  39.                            | Screen Descriptor |  (**)
  40.                            +-------------------+
  41.                            | Global Color Map  |
  42.                            +-------------------+
  43.                            |...             ...|
  44.                            +-------------------+
  45.                            | Image Descriptor  |
  46.                            +-------------------+
  47.                            | Local Color Map   |
  48.                            +-------------------+
  49.                            |   Raster Data     |
  50.                            +-------------------+
  51.                            |...             ...|
  52.                            | GIF Terminator    |  (**)
  53.                            +-------------------+
  54.  
  55.              (**) These all must be present and in this order.
  56.                   All other blocks are optional. The GIF
  57.                   Terminator must be the very last block in
  58.                   the file.
  59.  
  60.  ______________________________________________________________________________
  61.  
  62.                               Grammar Syntax
  63.  ______________________________________________________________________________
  64.  
  65.                   | = or
  66.                   \ = next line is an extension of current line
  67.                   (**) required
  68.  ______________________________________________________________________________
  69.  
  70.                               Script Commands
  71.  ______________________________________________________________________________
  72.  
  73.     All commands and data should start out in column 1 of each line. Please
  74.     see BG.SCR and TEST.SCR for more extensive examples (they will actually
  75.     create GIF files if you feed them to ANImate GIF). All parameters must
  76.     be present for all commands.
  77.  
  78.  
  79. SetDocumentHeader = GIF87a | GIF89a                                    (**)
  80.  
  81.   SetDocumentHeader inserts the correct GIF version into the output data
  82.   stream. Example:
  83.  
  84.         SetDocumentHeader = GIF89a
  85.  
  86.                                  --+---+--
  87.  
  88. SetLogicalScreenDescriptor = <logical screen width> \                  (**)
  89.                              <logical screen height> \
  90.                              <global color table size> \
  91.                              <sorted color table flag> \
  92.                              <color resolution> \
  93.                              <global color table present flag> \
  94.                              <background color index> \
  95.                              <pixel aspect ratio>
  96.  
  97.     SetLogicalScreenDescriptor describes the "big picture" for all the
  98.     images in a file. The parameters are:
  99.  
  100.     <logical screen width>              Raster width in pixels.
  101.  
  102.     <logical screen height>             Raster height in pixels.
  103.  
  104.     <global color table size>           0 - 7. See Fig. 1. This is the
  105.                                         number of colors in the global
  106.                                         color table.
  107.  
  108.     <sorted color table flag>           1 = Sorted color table.
  109.                                         0 = Color table not sorted.
  110.  
  111.     <color resolution>                  0 - 7. See Fig. 1. This is the
  112.                                         total number of colors in the
  113.                                         palette the image was created
  114.                                         from.
  115.  
  116.     <global color table present flag>   1 = Global color table present.
  117.                                         0 = Color table not present.
  118.  
  119.     <background color index>            Color index of screen background
  120.                                         color.
  121.  
  122.     <pixel aspect ratio>                0 - 255.
  123.  
  124.                         Setting             Colors
  125.                         ---------------------------
  126.                            0                  2
  127.                            1                  4
  128.                            2                  8
  129.                            3                  16
  130.                            4                  32
  131.                            5                  64
  132.                            6                  128
  133.                            7                  256
  134.                         ---------------------------
  135.                                   Fig. 1
  136.  
  137.                                  --+---+--
  138.  
  139. SetRGBColorTable = <number of colors>
  140. [upto 8 rgb hex values per rgbdef line]
  141. EndSet
  142.  
  143.     SetRGBColorTable inserts a color table into the output data stream.
  144.     Example:
  145.  
  146.             SetRGBColorTable = 2
  147.             000000 FFFFFF
  148.             EndSet
  149.  
  150.     This would insert a color table with 2 entries into the data stream,
  151.     the colors being black and white.
  152.  
  153.                                  --+---+--
  154.  
  155. SetImageDescriptor = <image left position> \
  156.                      <image top position> \
  157.                      <image width> \
  158.                      <image height> \
  159.                      <local color table size> \
  160.                      <color table sorted flag> \
  161.                      <image interlaced flag> \
  162.                      <local color table present flag>
  163.  
  164. [can set a color table here with `SetRGBColorTable']
  165.  
  166. [count_of_bytes_on_this_line] [upto 255 byte values per line]
  167. EndSet
  168.  
  169.     SetImageDescriptor defines the attributes for an image. The parameters
  170.     are:
  171.  
  172.     <image left position>               Column number of the top of the
  173.                                         image.
  174.  
  175.     <image top position>                Row number of the left side of the
  176.                                         image.
  177.  
  178.     <image width>                       Width of the image in pixels.
  179.  
  180.     <image height>                      Height of image in pixels.
  181.  
  182.     <local color table size>            0 - 7. See Fig. 1. This is the
  183.                                         number of colors in the local color
  184.                                         table.
  185.  
  186.     <color table sorted flag>           1 = Local color table is sorted.
  187.                                         0 = Color table not sorted.
  188.  
  189.     <image interlaced flag>             1 = Image is interlaced.
  190.                                         0 = Image is not interlaced.
  191.  
  192.     <local color table present flag>    1 = Local color table present.
  193.                                         0 = No local color table.
  194.  
  195.     If a local color table needs to be inserted, use SetRGBColorTable to
  196.     insert it before the raster data.
  197.  
  198.     The raster data is presented in a <count> <byte1 byte2 ...> fashion. An
  199.     example may help:
  200.  
  201.     05 10 1F 2E 3D FF
  202.  
  203.     05 is the number of bytes following, the rest is the actual data. NOTE:
  204.     all of the entries for these lines are in HEXADECIMAL (base 16) format.
  205.     Each line will translate into a data sub-block, so please don't succumb
  206.     to the temptation to make these lines look pretty in your editor by
  207.     using a number of them with small byte counts. The resultant image will
  208.     be a valid GIF but space will be wasted in the data stream.
  209.  
  210.                                  --+---+--
  211.  
  212. SetGraphicControlBlock = <transparent color flag> \
  213.                          <user input wanted flag> \
  214.                          <disposal method> \
  215.                          <delay time> \
  216.                          <transparent color index>
  217.  
  218.     SetGraphicControlBlock inserts a Graphic Control Block into the output
  219.     stream. Parameters are:
  220.  
  221.     <transparent color flag>        1 = Image has a transparent color.
  222.                                     0 = No transparent color.
  223.  
  224.     <user input wanted flag>        1 = User input wanted.
  225.                                     0 = No input.
  226.  
  227.     <disposal method>               0 - 3. Methods are:
  228.                                         0 - None.
  229.                                         1 - Do not dispose (0).
  230.                                         2 - Restore to background.
  231.                                         3 - Restore to previous.
  232.  
  233.     <delay time>                    0 - 65535. Delay time, specify the
  234.                                     number of 1/100s to wait before
  235.                                     processing continues.
  236.  
  237.     <transparent color index>       0 - 255. Index of the transparent
  238.                                     color.
  239.  
  240.                                  --+---+--
  241.  
  242. SetComment = <comment text>
  243.  
  244.     SetComment inserts a comment into the data stream. Example:
  245.  
  246.     SetComment = This is a comment no one will see.
  247.  
  248.     Only one line of upto 254 characters may be inserted with the command.
  249.  
  250.                                  --+---+--
  251.  
  252. SetPlainText = <text left position> \
  253.                <text top position> \
  254.                <text grid width> \
  255.                <text grid height> \
  256.                <character cell width> \
  257.                <character cell height> \
  258.                <foreground color index> \
  259.                <background color index>
  260. [text, only one here, sorry..]
  261.  
  262.     SetPlainText inserts a text block that will be rendered on the image.
  263.     The parameters are:
  264.  
  265.     <text left position>        Column number in pixels of the left edge of
  266.                                 the text grid.
  267.  
  268.     <text top position>         Row number in pixels of the top edge of the
  269.                                 text grid.
  270.  
  271.     <text grid width>           Width in pixels of the text grid.
  272.  
  273.     <text grid height>          Height in pixels of the text grid.
  274.  
  275.     <character cell width>      Character cell width in pixels.
  276.  
  277.     <character cell height>     Character cell height in pixels.
  278.  
  279.     <foreground color index>    Foreground (text) color index.
  280.  
  281.     <background color index>    Background color index.
  282.  
  283.     One and only one line of text may follow, upto 254 characters.
  284.  
  285.                                  --+---+--
  286.  
  287. SetApplicationExtension = "Application ID" "Application Authorization Code"
  288. [count_of_bytes_on_this_line] [upto 255 byte values per line]
  289. EndSet
  290.  
  291.     SetApplicationExtension inserts an application defined extension into
  292.     the output stream. A common use of this is to insert the "Netscape
  293.     Looping" block for animated GIFs that are seen on many Web pages.
  294.     Parameters are:
  295.  
  296.     "Application ID"                    8 character identification string
  297.                                         of the application defining this
  298.                                         block.
  299.  
  300.     "Application Authorization Code"    3 character authentification string
  301.                                         used to authenticate the defining
  302.                                         application.
  303.  
  304.     The data is presented in a <count> <byte1 byte2 ...> fashion. An
  305.     example may help:
  306.  
  307.     05 10 1F 2E 3D FF
  308.  
  309.     05 is the number of bytes following, the rest is the actual data. NOTE:
  310.     all of the entries for these lines are in HEXADECIMAL (base 16) format.
  311.     Each line will translate into a data sub-block, so please don't succumb
  312.     to the temptation to make these lines look pretty in your editor by
  313.     using a number of them with small byte counts. The resultant file will
  314.     be valid but, space will be wasted in the data stream.
  315.  
  316.                                  --+---+--
  317.  
  318. SetNetscapeLoop = <loop iterations>
  319.  
  320.     SetNetscapeLoop inserts the Netscape 2.0 loop block into the output
  321.     stream. Its one and only argument is the number of times you want the
  322.     animation to repeat. Currently I believe all versions of Netscape
  323.     ignore this (please let me know if this has been fixed). However, you
  324.     should still set this to reasonable value.
  325.  
  326.                                  --+---+--
  327.  
  328. SetEOI                                                                 (**)
  329.  
  330.     SetEOI inserts the End Of Information block into the output stream.
  331.     This MUST be the last block in your script.
  332.  
  333.                                  --+---+--
  334.  
  335.