home *** CD-ROM | disk | FTP | other *** search
/ Chip Hitware 6 B / CHIP_HITWARE6_B.iso / gry / wkiss / tools / ks_utils.lzh / GS_SPEC.TXT < prev    next >
Text File  |  1994-10-07  |  10KB  |  437 lines

  1.  
  2. This is a poor translation of kissgs.doc. Comments, questions and
  3. corrections are greatly welcomed.
  4.  
  5. KISS/GS        ( KISS General Specification ) Manual        by K.O.S.
  6.  
  7.  
  8. <<<<<<<<    KISS/GS (v1.00) $Date: 1994/09/23 23:30:37 $    >>>>>>>>
  9.  
  10.     ***********************************************************
  11.  
  12.     This is an abridged translation of the official document about KISS data format.
  13.     However parts of it are undefined and will be updated gradually.
  14.  
  15.     ***********************************************************
  16.  
  17.  
  18.  
  19. 1.    Introduction
  20.  
  21.     KISS - a paper doll program has been developped for computers
  22.     based on NEC PC-9801VM2 architecture since March 1991.
  23.     Many people have enjoyed and implemented KISS for other computers.
  24.     Now KISS is running on many platforms.
  25.  
  26.     Now we make a reference manual about new KISS data format, that is,
  27.  
  28.         KISS General Specification : KISS/GS
  29.  
  30.     and release this.
  31.  
  32.  
  33.  
  34. 2.    Abstract of new specification
  35.  
  36.     New style KISS data is upper compatible with the old style.
  37.  
  38.  
  39.     * color (cel)        16 colors   ->    16 or 256 colors
  40.     * color (palette)    4096 colors ->    4096 or 16,777,216 colors
  41.     * screen size        640 x 400   ->    768 x 480 or more
  42.     * cel and object max    128         ->  256 or more
  43.  
  44.     Multiple palette files available.
  45.     (-> 4-1 multipalette)
  46.  
  47.     A header is added to cel/palette files to store additional information.
  48.  
  49.     At implemention some limitations may exist about hardware and software resources.
  50.     So implementation level is indicated in the following form:
  51.  
  52.         KISS/GSn ( n = 1,2,3,... )
  53.  
  54.     (-> 7 KISS/GS Ranks)
  55.  
  56.  
  57.  
  58.  
  59. 3.    Basic concepts
  60.  
  61.  
  62.     3-1    KISS functions
  63.  
  64.     KISS is a image viewer program with transparency processing.
  65.     It is able to display overlapped pictures
  66.     and allow the user to manipulate them with real-time mouse operation.
  67.  
  68.  
  69.     3-2    Files
  70.  
  71.     KISS needs the following files.
  72.  
  73.     * Cel file
  74.  
  75.         Image data to be moved.
  76.         An array of pixels.
  77.         Pixel code 0 is transparent pixel.
  78.  
  79.     * Palette file
  80.  
  81.         Defines actual colors of pixels.
  82.  
  83.     * Configuration file
  84.  
  85.         Describes the overlapping order and positions of cels, etc.
  86.         KISS reads this first and refers it to read other files.
  87.         This file is a text file created with a text editor.
  88.         Some parts of it may be changed by KISS program's save function.
  89.  
  90.  
  91.  
  92.     3-3    Technical terms
  93.  
  94.     * Cel        A minimum element of pictures.
  95.  
  96.     * Object    A unit of pictures for moving;
  97.             composed of one or more cels.
  98.  
  99.     * Palette group    Color information of one screen.
  100.  
  101.     * Set        Data composed of a palette group and object positions.
  102.  
  103.  
  104.  
  105.  
  106.  
  107. 4.    GS-KISS new feature
  108.  
  109.     4-1    Multipalette
  110.  
  111.         Before KISS/GS, all cels are drawn according to
  112.         a single palette table in the palette file.
  113.         Now, cels can be drawn with individual palette tables.
  114.  
  115.         The total number of colors must be less than or equal to 256.
  116.  
  117.         Each cel requires information about which palette it uses.
  118.  
  119.  
  120.  
  121. 5.    Details of the configuration file
  122.  
  123.     Each line must be shorter than 256 bytes.
  124.  
  125.     Palette/cel filenames are composed of the basename (max 8 bytes) +
  126.     the suffix (max 3 bytes).  Upper and lower cases are identical.
  127.     The character set used in filenames is [_0-9a-z].
  128.  
  129.     The character at the top of each line is one of the following:
  130.  
  131.     * '='    Memory size
  132.  
  133.         Description: =<memory>K
  134.  
  135.         For KISS v1.0 compatibility.
  136.         KISS v2.0 or later ignores it.
  137.         Its use is discouraged.
  138.  
  139.         Example:
  140.         |
  141.         |=260K
  142.         |
  143.  
  144.  
  145.     * '('    Screen size
  146.  
  147.         Description: (<horizontal size>,<vertical size>)
  148.  
  149.         Defines the screen size.
  150.         If omitted, (448,320) is assumed for KISS v2.18 compatibility.
  151.         Maximum size of screen is (640,400) on KISS/GS2.
  152.         (-> 7 KISS/GS Ranks)
  153.  
  154.         Example:
  155.         |
  156.         |(640,400)
  157.         |
  158.  
  159.  
  160.     * '%'    Palette file
  161.  
  162.         Description: %<Palette filename>
  163.  
  164.         Describes a palette file.
  165.         Palette files are numbered as 0,1,2... in the order of appearance.
  166.         All colors in the palette file #0 are used.
  167.         But the first (transparent) color in the other palette files is ignored.
  168.         Total number of colors must be less than or equal to 256.
  169.  
  170.         All palette files must be described
  171.         before description about cel files.
  172.  
  173.         Example:
  174.         |
  175.         |%COL.KCF
  176.         |%COL2.KCF
  177.         |
  178.  
  179.  
  180.     * '['    Border color
  181.  
  182.         Description: [<Border color's pixel code>
  183.  
  184.         Outside of the screen is filled with this pixel code.
  185.  
  186.         Example:
  187.         |
  188.         |[12
  189.         |
  190.  
  191.  
  192.     * '#'    Cel file
  193.  
  194.         Description: #<Mark>[.<Fix>] <Cel filename>
  195.                 [*<Palette number>] [:<Set number>...]
  196.  
  197.         <Mark> :    Identification number to specify object.
  198.                 Cels of the same Mark are unified
  199.                 and make an object.
  200.                 Object number is from 0 to 255 on KISS/GS2.
  201.                 (-> 7 KISS/GS Ranks)
  202.  
  203.         <Fix> :        Fixed value. Specify this for fixed objects
  204.                 such as the doll's body.
  205.                 An object with a big value is hard to move.
  206.                 Value is a number from 0 to 32767.
  207.                 If omitted, treated as 0 (not fixed).
  208.  
  209.         <Cel filename> : Describes the filename with suffix.
  210.  
  211.         <Palette number> :
  212.                 Indicates which palette file this cel uses.
  213.                 If omitted, treated as 0.
  214.  
  215.         <Set number> :    The cel is drawn only in the sets specified here.
  216.                 0 - 9 is available.
  217.                 If omitted, this cel is drawn in all sets.
  218.  
  219.         The order of cel file descriptions determines
  220.         the priority in drawing cels.
  221.         The number of cels is max 256.
  222.         (-> 7 KISS/GS Ranks)
  223.  
  224.  
  225.         Example:
  226.         |
  227.         |#2    data1.cel            ; forward (near)
  228.         |#3    data2.cel    :2 3 4        ;
  229.         |#4.255    data3.cel            ; fixed
  230.         |#5    data4.cel  *1   :5        ;
  231.         |#2    data1_.cel            ; backward (far)
  232.         |
  233.  
  234.         data1.cel and data1_.cel make one object.
  235.  
  236.  
  237.     * '$'    Set information
  238.  
  239.         Description: $<Palette group> [<xpos,ypos> ...]
  240.  
  241.         Palette group and positions of object for each set.
  242.         There are max 10 sets.
  243.         This section can be overwritten by KISS save function.
  244.  
  245.         A long description is folded, and the following lines start with a ' ' (blank) character
  246.         to indicate that the lines are continued from the previous line.
  247.  
  248.         <Palette group>    : Palette group number. 0 ... 9.
  249.         <xpos,ypos>    : Position of object (from object mark 0).
  250.                   Max 256 positions are described on KISS/GS2.
  251.                   (-> 7 KISS/GS Ranks)
  252.                   '*' means a non-existent object.
  253.  
  254.         Example:
  255.         |
  256.         |$2 192,11 * 56,176 55,21 259,62 15,24 375,63
  257.         |$3 43,115 154,62 372,108 253,156 * * * 165,207
  258.         | * 162,198 * 119,56 152,44 * * * 
  259.         | 16,355 394,362 108,355 * * * 125,261
  260.         |$0 192,11 * 56,176 55,21 259,62 15,24 375,63
  261.         |
  262.  
  263.  
  264.     * ';'    Comment
  265.  
  266.         Description: ;<Comment>
  267.  
  268.         This line is ignored.
  269.  
  270.         Future extension may determine how to include various 
  271.         information of the data (title, author etc.) as comments.
  272.  
  273.     * Others
  274.  
  275.         Reserved for extention.
  276.  
  277.  
  278.  
  279. 5.    Details of cel files
  280.  
  281.     Cel files have a 32-byte header.
  282.  
  283.     offset    size    contents
  284.     +0    4B    Identifier 'KiSS' ( 4Bh 69h 53h 53h )
  285.     +4    B    Cel file mark ( 20h )
  286.     +5    B    bits per pixel ( 4 or 8 )
  287.     +6    W    Reserved
  288.     +8    W(L,H)    Width ( 1 ... XMAX )
  289.     +10    W(L,H)    Height ( 1 ... YMAX )
  290.     +12    W(L,H)    x-offset ( 0 ... XMAX-1 )
  291.     +14    W(L,H)    y-offset ( 0 ... YMAX-1 )
  292.     +16    16B    Reserved
  293.  
  294.         Caution: the reserved field must be filled with 0.
  295.  
  296.     Cels of the same object are aligned at the top left corner.
  297.     X,y-offsets are the offsets from this alignment point.
  298.  
  299.     +32...    Pixel data
  300.  
  301.  
  302.     * Pixel data order (4 bits/pixel)
  303.  
  304.     One raster:
  305.  
  306.     |<-  byte   ->|  |<-  byte   ->|  |<-  byte   ->| 
  307.     MSB         LSB  MSB         LSB  MSB         LSB
  308.  
  309.     | pix0 | pix1 |  | pix2 | pix3 |  | pix4 | pix5 |  ......... | pixN |
  310.  
  311.     If the width is odd, add a padding pixel of color 0.
  312.  
  313.     The number of rasters is indicated in the height field.
  314.  
  315.  
  316.  
  317.     * Pixel data order (8 bits/pixel)
  318.  
  319.     One raster:
  320.  
  321.     |<-  byte   ->|  |<-  byte   ->|  |<-  byte   ->| 
  322.     MSB         LSB  MSB         LSB  MSB         LSB
  323.  
  324.     |     pix0    |  |     pix1    |  |     pix2    | ...  |     pixN    |
  325.  
  326.     The number of rasters is indicated in the height field.
  327.  
  328.  
  329.     If the top 4-byte identifier is not 'KiSS', the file format is as follows:
  330.  
  331.     +0    W(L,H)    Width
  332.     +2    W(L,H)    Height
  333.  
  334.     +4...    Pixel data
  335.  
  336.     4 bits/pixel.
  337.     X and y-offset are 0.
  338.     This is the conventional format.
  339.  
  340.  
  341.  
  342.  
  343. 6.    Palette file detail
  344.  
  345.     Palette files have a 32-byte header.
  346.  
  347.     offset    size    contents
  348.     +0    4B    Identifier 'KiSS' ( 4Bh 69h 53h 53h )
  349.     +4    B    Palette file mark ( 10h )
  350.     +5    B    bits per color ( 12 or 24 )
  351.     +6    W    Reserved
  352.     +8    W(L,H)    number of colors in one palette group ( 1 ... 256 )
  353.     +10    W(L,H)    number of palette groups ( 1 ... 10 )
  354.     +12    W    Reserved
  355.     +14    W    Reserved
  356.     +16    16B    Reserved
  357.  
  358.         Caution: the reserved fields must be filled with 0.
  359.  
  360.     +32...    Palette data
  361.  
  362.  
  363.     * Palette data order (12 bits = 4096 colors)
  364.  
  365.     A color consists of 2 bytes. 4 bits each for red, green, blue.
  366.  
  367.     |<-  byte   ->|  |<-  byte   ->|
  368.     MSB         LSB  MSB         LSB
  369.  
  370.     | rrrr | bbbb |  | 0000 | gggg | ....
  371.  
  372.  
  373.  
  374.     * Palette data order (24 bit = 16,777,216 colors)
  375.  
  376.  
  377.     A color consists of 3 bytes. 8 bits each for red, green, blue.
  378.  
  379.     |<-  byte   ->|  |<-  byte   ->|  |<-  byte   ->| 
  380.     MSB         LSB  MSB         LSB  MSB         LSB
  381.  
  382.     |  rrrrrrrr   |  |  gggggggg   |  |  bbbbbbbb   | ...
  383.  
  384.  
  385.  
  386.     If the number of palette groups is less than 10,
  387.     colors of the remaining palette groups will be copied from Group 0.
  388.  
  389.     If the top 4-byte identifier is not 'KiSS', the file format is as follows:
  390.  
  391.     +0...    palette data
  392.  
  393.     12 bits/color, 16 colors in a palette group, 10 groups.
  394.     This is the conventional format.
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402. 7.    KISS/GS Ranks
  403.  
  404.     Rank        size      colors max cels
  405.     --------------- ---------- ---- ----------
  406.       KISS/GS1    640 x 400   16     128        ;      KISS v2.24c
  407.       KISS/GS2    640 x 400   256    256        ;      KISS v2.37
  408.       KISS/GS3    768 x 480   256    256        ; draft
  409.       KISS/GS4    768 x 480   256    512        ; draft
  410.     --------------- ---------- ---- ----------
  411.  
  412.  
  413.  
  414.     These are just standards. When you implement a KISS program on your system,
  415.     you should support the maximum ability of the hardware.
  416.     When you create KISS data you are encouraged to consider these ranks.
  417.     The lower rank the data conforms to, the more users can play with it.
  418.     However, you don't have to conform it to unnecessarily low ranks.
  419.  
  420.  
  421.  
  422.  
  423. *    Appendix
  424.  
  425.     This document is in public domain.
  426.     Send bug reports, questions, comments and problems to
  427.  
  428.         UHD98984@pcvan.or.jp
  429.                 yav
  430.  
  431.     Thank you.
  432.  
  433.  
  434.             ITO Takayuki <yuki@is.s.u-tokyo.ac.jp>
  435.             Graduate student, Department of Information Science,
  436.             Faculty of Science, University of Tokyo, Japan.
  437.