home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format 106 / af106sub.adf / datatypes.LZX / anim_datatype / classdata.h < prev    next >
C/C++ Source or Header  |  2003-05-15  |  6KB  |  181 lines

  1.  
  2.  
  3. #ifndef CLASSDATA_H
  4. #define CLASSDATA_H 1
  5.  
  6. /*
  7. **
  8. **  $VER: classdata.h 1.11 (24.9.97)
  9. **  anim.datatype 1.11
  10. **
  11. **  anim class data
  12. **
  13. **  Written 1996/1997 by Roland 'Gizzy' Mainz
  14. **  Original example source from David N. Junod
  15. **
  16. */
  17.  
  18. /*****************************************************************************/
  19.  
  20. /* public BOOPSI class name */
  21. #define ANIMDTCLASS "anim.datatype"
  22.  
  23. /*****************************************************************************/
  24.  
  25. /* Animation compression modes  */
  26. #define acmpILBM            (0U)
  27. #define acmpXORILBM         (1U)
  28. #define acmpLongDelta       (2U)
  29. #define acmpShortDelta      (3U)
  30. #define acmpDelta           (4U)
  31. #define acmpByteDelta       (5U)
  32. #define acmpStereoByteDelta (6U)
  33. #define acmpAnim7           (7U)
  34. #define acmpAnim8           (8U)
  35. #define acmpAnimJ          (74U) /* ascii 'J', Bill Grahams compression format */
  36.  
  37. /* Animation header flags */
  38. #define ahfLongData         (1U << 0U)
  39. #define ahfXOR              (1U << 1U)
  40. #define ahfOneInfoList      (1U << 2U)
  41. #define ahfRLC              (1U << 3U)
  42. #define ahfVertical         (1U << 4U)
  43. #define ahfLongInfoOffsets  (1U << 5U)
  44.  
  45. /* Generic IFF Chunk ID's we may encounter */
  46. #ifndef ID_ANNO
  47. #define ID_ANNO         MAKE_ID('A','N','N','O')
  48. #endif /* !ID_ANNO */
  49.  
  50. #ifndef ID_AUTH
  51. #define ID_AUTH         MAKE_ID('A','U','T','H')
  52. #endif /* !ID_AUTH */
  53.  
  54. #ifndef ID_Copyright
  55. #define ID_Copyright    MAKE_ID('(','c',')',' ')
  56. #endif /* !ID_Copyright */
  57.  
  58. #ifndef ID_FVER
  59. #define ID_FVER         MAKE_ID('F','V','E','R')
  60. #endif /* !ID_FVER */
  61.  
  62. #ifndef ID_NAME
  63. #define ID_NAME         MAKE_ID('N','A','M','E')
  64. #endif /* !ID_NAME */
  65.  
  66. /* IFF ANIM related IDs */
  67. #ifndef ID_DPAN
  68. #define ID_DPAN         MAKE_ID('D','P','A','N')
  69. #endif /* !ID_DPAN */
  70.  
  71. struct DPAnimChunk
  72. {
  73.     UWORD dpan_Version;
  74.     UWORD dpan_nframes;
  75.     ULONG dpan_flags;
  76. #define dpan_FPS dpan_flags
  77. };
  78.  
  79. /*****************************************************************************/
  80.  
  81. /* anim.datatype class instance data */
  82. struct AnimInstData
  83. {
  84.     /* Misc */
  85.     struct SignalSemaphore  aid_SigSem;             /* Instance data lock                      */
  86.     UWORD                   aid_Pad0;
  87.     APTR                    aid_Pool;               /* pool for misc things */
  88.     APTR                    aid_FramePool;          /* pool for animation bitmaps */
  89.     struct BitMapHeader    *aid_BMH;                /* Short cut to animation.datatype's bitmapheader */
  90.     struct BitMap          *aid_KeyBitMap;          /* Key BitMap                              */
  91.     struct MinList          aid_FrameList;          /* List of frames                          */
  92.     struct MinList          aid_PostedFreeList;     /* List of frames which should be freed */
  93.     struct FrameNode       *aid_CurrFN;             /* Last framenode obtained using ADTM_LOADFRAME */
  94.     STRPTR                  aid_ProjectName;        /* Shortcut to DTA_Name                    */
  95.     BPTR                    aid_VerboseOutput;      /* Verbose output                          */
  96.  
  97.     /* Prefs */
  98.     ULONG                   aid_ModeID;
  99.     BOOL                    aid_NoCMAPs;            /* Don't create colormaps                  */
  100.     BOOL                    aid_LoadAll;            /* Load all frames of the animation        */
  101.     BOOL                    aid_AsyncIO;            /* sync or async IO ?                      */
  102.     BOOL                    aid_NoDynamicTiming;    /* No dynamic timing ?                     */
  103.     BOOL                    aid_NoDPaintBrushPatch; /* No forced xor mode for ANIM-5 with interleave == 1 */
  104.     BOOL                    aid_Registered;         /* Shareware payed ? */
  105.     ULONG                   aid_FPS;                /* fps of stream (maybe modified by prefs) */
  106.  
  107.     /* Sample stuff */
  108.     BYTE                   *aid_Sample;             /* global sample */
  109.     ULONG                   aid_SampleLength;       /* length of global sample */
  110.     ULONG                   aid_Period;             /* period */
  111.     ULONG                   aid_Volume;             /* volume */
  112.     ULONG                   aid_SamplesPerFrame;    /* samples per frame; Set by prefs to override own calculations */
  113.  
  114.     /* Disk-loading section */
  115. #ifdef DOASYNCIO
  116.     struct AsyncFile       *aid_FH;
  117. #else
  118.     BPTR                    aid_FH;
  119. #endif /* DOASYNCIO */
  120.     LONG                    aid_CurrFilePos;
  121. };
  122.  
  123.  
  124. /* node which holds information about a single animation frame */
  125. struct FrameNode
  126. {
  127.     struct MinNode     fn_Node;           /* Node in aid_FrameList      */
  128.     struct MinNode     fn_PostedFreeNode; /* Node in aid_PostedFreeList */
  129.  
  130. /* Get beginning of struct FrameNode from fn_PostedFreeNode */
  131. #define POSTEDFREENODE2FN( pfn ) ((struct FrameNode *)(((struct MinNode *)(pfn)) - 1))
  132.  
  133.     struct FrameNode  *fn_PrevFrame;
  134.  
  135. /* Misc */
  136.     UWORD              fn_PostedFree;
  137.     WORD               fn_UseCount;       /* In-Use counter */
  138.  
  139. /* Timing section */
  140.     ULONG              fn_TimeStamp;
  141.     ULONG              fn_Frame;
  142.     ULONG              fn_Duration;
  143.  
  144. /* Animation info */
  145.     struct AnimHeader  fn_AH;
  146.  
  147. /* Bitmap/ColorMap section */
  148.     struct BitMap     *fn_BitMap;
  149.     struct ColorMap   *fn_CMap;
  150.  
  151. /* BitMap loading section */
  152.     LONG               fn_BMOffset; /* File offset (0 is begin of file) */
  153.     ULONG              fn_BMSize;   /* Chunk size  */
  154.     ULONG              fn_LoadSize; /* temporary variable used by ADTM_LOADFRAME */
  155.  
  156. /* Sample section */
  157.     BYTE              *fn_Sample;
  158.     ULONG              fn_SampleLength;
  159.     ULONG              fn_Period;
  160. };
  161.  
  162. /*****************************************************************************/
  163.  
  164. /* encoder context data */
  165. struct AnimContext
  166. {
  167.     APTR               ac_Pool;             /* memory pool for this context */
  168.     UBYTE             *ac_WorkBuffer;
  169.     ULONG              ac_WorkBufferSize;
  170.     struct BitMap     *ac_BitMap[ 2 ];      /* two buffers...               */
  171.     WORD               ac_WhichBitMap;      /* which buffer: 0 or 1         */
  172. };
  173.  
  174.  
  175. /*****************************************************************************/
  176.  
  177.  
  178. #endif /* !CLASSDATA_H */
  179.  
  180.  
  181.