home *** CD-ROM | disk | FTP | other *** search
/ Encyclopedia of Graphics File Formats Companion / GFF_CD.ISO / formats / grasp / spec / dff.txt
Text File  |  1994-06-01  |  3KB  |  71 lines

  1. Paul Mace Software Inc.
  2. 400 Willaimson Way
  3. Ashland OR 97520
  4.  
  5. DFF File Format
  6.  
  7. I don't do vertical run length encoding, because I always thought the
  8. overhead was not worth it, particularly for DFF playback.
  9.  
  10. DFF has 8 bytes per frame for a window of thwere the changes take place.
  11. The actual difference data is 80 to FF is count of number of bytes to move,
  12. 0 to 3F is skip count, and 40 to 7F is RLE count. If a count is zero
  13. (80, 40, and 0) the following word is the count (mostly for big skips).
  14. This is definitely not how I'd do it now, but I threw it together 4 or
  15. 5 years ago and never wanted to change it and make all my users convert 
  16. their files.
  17.  
  18. unsigned int dffcnt;       // number of frames in DFF file
  19. unsigned char numbits;     // number of bits per pixel
  20. unsigned char numpl;       // number of bit planes
  21.  
  22. struct 
  23.    {
  24.    unsigned long dffpos;   // position of frame in file
  25.    unsigned long dfflen;   // width and height of frame
  26.    int xsize;              // width and height of frame
  27.    int ysize;
  28.    int xoff;               // offset relative to 0,0 of frame data
  29.    int yoff;
  30.  
  31. } list[dffcnt];
  32.  
  33. The dffpos offsets are relative to the end of the header, so the offset
  34. for th first frame is usually zero and the data is right after the last 
  35. structure in list[]. The actual DFF data is stored one scanline at a
  36. time (no skips or fills across scanlines). The rectangles defined for 
  37. each frame can be different (and virtually always are different).
  38.  
  39. Something to keep in mind is that the DFF format does not include
  40. palette information, so there may be a first frame which has palette 
  41. information usually stored as a GIF, PIC, or PCX. The first frame can
  42. be stored in the DFF (effectively a difference with nothing). But if
  43. one stores the first frame in the DFF, there is no way to currently include
  44. a palette. Do people often use PCX, PIC, or GIF file for the first frame
  45. and name it the same as the DFF.
  46.  
  47. In some unusual cases, the DFF is intended to start playing on a generated
  48. screen, so the first frame may not exist in file form. But that's very
  49. unusual. Also DFF's can be generated for two pages, so the actual DFF
  50. file is the difference sequence:
  51.  
  52. 1 dif 2  (difference between frames 1 and 2)
  53. 1 dif 3
  54. 2 dif 4
  55. 3 dif 5
  56. 4 dif 6
  57. 5 dif 7
  58.  
  59. this is really only for 16 color modes.
  60.  
  61. Plus I support XOR'D DFFs where all the difference information is XOR for
  62. playing the DFF forwards or backwards. Sadly I didn't put in any kind of
  63. flag or bit field for this information, so there is no way to know that a
  64. DFF is XOR or 2-page without asking the user. But the vast majority of 
  65. DFF's are neither 2-page nor XOR.
  66.  
  67.  
  68. Steven Belsky
  69. Paul Mace Software
  70.  
  71.