home *** CD-ROM | disk | FTP | other *** search
/ Amiga GigaPD 3 / Amiga_GigaPD_v3_3of3.iso / fred_fish / fish_601-700_lha / fish_674.lha / IFFLIB / iff.h < prev    next >
C/C++ Source or Header  |  1993-06-02  |  8KB  |  276 lines

  1. #ifndef LIBRARIES_IFF_H
  2. #define LIBRARIES_IFF_H
  3. /*
  4. **
  5. **    $Id: iff.h,v 22.1 92/06/02 16:46:47 chris Exp $
  6. **    $Revision: 22.1 $
  7. **
  8. **    $Filename: iff.h $
  9. **    $Author: Christian A. Weber $
  10. **    $Release: 22.1 $
  11. **    $Date: 92/06/02 16:46:47 $
  12. **
  13. **    Standard header file for programs using iff.library
  14. **
  15. **    COPYRIGHT (C) 1987-1992 BY CHRISTIAN A. WEBER, BRUGGERWEG 2,
  16. **    CH-8037 ZUERICH, SWITZERLAND.
  17. **    THIS FILE MAY BE FREELY DISTRIBUTED. USE AT YOUR OWN RISK.
  18. **
  19. */
  20.  
  21. #ifndef EXEC_TYPES_H
  22. #include <exec/types.h>
  23. #endif
  24.  
  25. #define IFFNAME "iff.library"
  26. #define IFFVERSION 22L                    /* Current library version */
  27.  
  28. /****************************************************************************
  29. **    Error codes (returned by IFFL_IFFError())
  30. */
  31.  
  32. #define IFFL_ERROR_BADTASK            -1    /* IFFL_IFFError() called by wrong task */
  33. #define IFFL_ERROR_OPEN                16    /* Can't open file */
  34. #define IFFL_ERROR_READ                17    /* Error reading file */
  35. #define IFFL_ERROR_NOMEM            18    /* Not enough memory */
  36. #define IFFL_ERROR_NOTIFF            19    /* File is not an IFF file */
  37. #define IFFL_ERROR_WRITE            20    /* Error writing file */
  38. #define IFFL_ERROR_NOILBM            24    /* IFF file is not of type ILBM */
  39. #define IFFL_ERROR_NOBMHD            25    /* BMHD chunk not found */
  40. #define IFFL_ERROR_NOBODY            26    /* BODY chunk not found */
  41. #define IFFL_ERROR_BADCOMPRESSION    28    /* Unknown compression type */
  42. #define IFFL_ERROR_NOANHD            29    /* ANHD chunk not found */
  43. #define IFFL_ERROR_NODLTA            30    /* DLTA chunk not found */
  44.  
  45. #ifdef IFFLIB_PRE21NAMES
  46. #define IFF_BADTASK -1
  47. #define IFF_CANTOPENFILE 16
  48. #define IFF_READERROR 17
  49. #define IFF_NOMEM 18
  50. #define IFF_NOTIFF 19
  51. #define IFF_WRITEERROR 20
  52. #define IFF_NOILBM 24
  53. #define IFF_NOBMHD 25
  54. #define IFF_NOBODY 26
  55. #define IFF_TOOMANYPLANES 27
  56. #define IFF_UNKNOWNCOMPRESSION 28
  57. #define IFF_NOANHD 29
  58. #define IFF_NODLTA 30
  59. #endif
  60.  
  61.  
  62. /****************************************************************************
  63. **    Common IFF IDs
  64. */
  65.  
  66. #define IFFL_MAKE_ID(a,b,c,d) ((ULONG)(a)<<24L|(ULONG)(b)<<16L|(c)<<8|(d))
  67.  
  68. /*
  69. **    Generic IFF IDs
  70. */
  71. #ifndef ID_FORM        /* don't redefine these if iffparse.h is included */
  72. #define ID_FORM IFFL_MAKE_ID('F','O','R','M')
  73. #define ID_CAT  IFFL_MAKE_ID('C','A','T',' ')
  74. #define ID_LIST IFFL_MAKE_ID('L','I','S','T')
  75. #define ID_PROP IFFL_MAKE_ID('P','R','O','P')
  76. #endif
  77.  
  78. /*
  79. **    Specific IFF IDs
  80. */
  81. #define ID_ANIM IFFL_MAKE_ID('A','N','I','M')
  82. #define ID_ANHD IFFL_MAKE_ID('A','N','H','D')
  83. #define ID_ANNO IFFL_MAKE_ID('A','N','N','O')
  84. #define ID_BMHD IFFL_MAKE_ID('B','M','H','D')
  85. #define ID_BODY IFFL_MAKE_ID('B','O','D','Y')
  86. #define ID_CAMG IFFL_MAKE_ID('C','A','M','G')
  87. #define ID_CLUT IFFL_MAKE_ID('C','L','U','T')
  88. #define ID_CMAP IFFL_MAKE_ID('C','M','A','P')
  89. #define ID_CRNG IFFL_MAKE_ID('C','R','N','G')
  90. #define ID_CTBL IFFL_MAKE_ID('C','T','B','L')
  91. #define ID_DLTA IFFL_MAKE_ID('D','L','T','A')
  92. #define ID_ILBM IFFL_MAKE_ID('I','L','B','M')
  93. #define ID_SHAM IFFL_MAKE_ID('S','H','A','M')
  94.  
  95. #define ID_8SVX IFFL_MAKE_ID('8','S','V','X')
  96. #define ID_ATAK IFFL_MAKE_ID('A','T','A','K')
  97. #define ID_NAME IFFL_MAKE_ID('N','A','M','E')
  98. #define ID_RLSE IFFL_MAKE_ID('R','L','S','E')
  99. #define ID_VHDR IFFL_MAKE_ID('V','H','D','R')
  100.  
  101. #ifdef IFFLIB_PRE21NAMES
  102. #define MakeID(a,b,c,d) ((ULONG)(a)<<24L|(ULONG)(b)<<16L|(c)<<8|(d))
  103. #endif
  104.  
  105.  
  106. /****************************************************************************
  107. **    Modes for IFFL_OpenIFF()
  108. */
  109.  
  110. #define IFFL_MODE_READ    0
  111. #define IFFL_MODE_WRITE    1
  112.  
  113.  
  114. /****************************************************************************
  115. **    Modes for IFFL_CompressBlock() and IFFL_DecompressBlock()
  116. */
  117.  
  118. #define IFFL_COMPR_NONE        0x0000        /* generic */
  119. #define IFFL_COMPR_BYTERUN1    0x0001        /* ILBM */
  120. #define IFFL_COMPR_FIBDELTA    0x0101        /* 8SVX */
  121.  
  122.  
  123. /****************************************************************************
  124. **    Structure definitions
  125. */
  126.  
  127. #ifdef _IFFLIB
  128.  
  129. typedef struct
  130. {
  131.     BPTR    File;            /* DOS file handle */
  132.     LONG    FormSize;        /* Gr÷▀e des gesamten FORM */
  133.     LONG    ChunkSize;        /* Gr÷▀e des aktuellen Chunks */
  134.     LONG    ChunkFPos;        /* Position im File wo dieser Chunk beginnt */
  135. } *IFFL_HANDLE;
  136.  
  137. #else
  138.  
  139. typedef void *IFFL_HANDLE;    /* The IFF 'FileHandle' structure */
  140.  
  141. #endif
  142.  
  143. struct IFFL_Chunk            /* Generic IFF chunk structure */
  144. {
  145.     LONG  ckID;
  146.     LONG  ckSize;
  147. /*  UBYTE ckData[ckSize] (variable sized data) */
  148. };
  149.  
  150. struct IFFL_BMHD            /* BMHD chunk for ILBM files */
  151. {
  152.     UWORD w,h;
  153.     WORD  x,y;
  154.     UBYTE nPlanes;
  155.     UBYTE masking;
  156.     UBYTE compression;
  157.     UBYTE pad1;
  158.     UWORD transparentColor;
  159.     UBYTE xAspect,yAspect;
  160.     WORD  pageWidth,pageHeight;
  161. };
  162.  
  163. struct IFFL_ANHD            /* ANHD chunk for ANIM files */
  164. {
  165.     UBYTE    Operation;
  166.     UBYTE    Mask;
  167.     UWORD    W;
  168.     UWORD    H;
  169.     WORD    X;
  170.     WORD    Y;
  171.     ULONG    AbsTime;
  172.     ULONG    RelTime;
  173.     UBYTE    Interleave;
  174.     UBYTE    pad0;
  175.     ULONG    Bits;
  176.     UBYTE    pad[16];
  177. };
  178.  
  179. #ifdef IFFLIB_PRE21NAMES
  180. #define Chunk IFFL_Chunk
  181. #define BitMapHeader IFFL_BMHD
  182. #define AnimHeader IFFL_ANHD
  183. #endif
  184.  
  185. /****************************************************************************
  186. **    IFF library function prototypes (ANSI)
  187. */
  188.  
  189. void                 IFFL_CloseIFF        ( IFFL_HANDLE );
  190. ULONG                 IFFL_CompressBlock   ( APTR, APTR, ULONG, ULONG );
  191. BOOL                 IFFL_DecodePic       ( IFFL_HANDLE, struct BitMap * );
  192. ULONG                 IFFL_DecompressBlock ( APTR, APTR, ULONG, ULONG );
  193. void                *IFFL_FindChunk       ( IFFL_HANDLE, LONG );
  194. struct IFFL_BMHD    *IFFL_GetBMHD         ( IFFL_HANDLE );
  195. LONG                 IFFL_GetColorTab     ( IFFL_HANDLE, WORD * );
  196. ULONG                 IFFL_GetViewModes    ( IFFL_HANDLE );
  197. LONG                 IFFL_IFFError        ( void );
  198. BOOL                 IFFL_ModifyFrame     ( void *, struct BitMap * );
  199. APTR                 IFFL_NewOpenIFF      ( char *, LONG );
  200. IFFL_HANDLE             IFFL_OpenIFF         ( char *, ULONG );
  201. LONG                 IFFL_PopChunk        ( IFFL_HANDLE );
  202. IFFL_HANDLE             IFFL_PPOpenIFF       ( char *, char * );
  203. LONG                 IFFL_PushChunk       ( IFFL_HANDLE, ULONG, ULONG );
  204. BOOL                 IFFL_SaveBitMap      ( char *, struct BitMap *, WORD *, LONG );
  205. BOOL                 IFFL_SaveClip        ( char *, struct BitMap *, WORD *, LONG,
  206.                                                         LONG, LONG, LONG, LONG );
  207. LONG                 IFFL_WriteChunkBytes ( IFFL_HANDLE, void *, LONG );
  208.  
  209.  
  210. #ifdef IFFLIB_PRE21NAMES
  211. IFFL_HANDLE    OpenIFF(char *);
  212. void CloseIFF(IFFL_HANDLE);
  213. void *FindChunk(IFFL_HANDLE,LONG);
  214. struct BitMapHeader *GetBMHD(IFFL_HANDLE);
  215. LONG GetColorTab(IFFL_HANDLE,WORD *);
  216. BOOL DecodePic(IFFL_HANDLE,struct BitMap *);
  217. BOOL SaveBitMap(char *,struct BitMap *,WORD *,LONG);
  218. BOOL SaveClip(char *,struct BitMap *,WORD *,LONG,LONG,LONG,LONG,LONG);
  219. LONG IFFError(void);
  220. ULONG GetViewModes(IFFL_HANDLE);
  221. APTR NewOpenIFF(char *,LONG);
  222. BOOL ModifyFrame(void *,struct BitMap *);
  223. IFFL_HANDLE    PPOpenIFF(char *,char *);
  224. #endif
  225.  
  226.  
  227. /****************************************************************************
  228. **    Pragmas for Lattice C V5.x
  229. **    (generated with: 'fd2pragma iff_lib.fd iff_pragmas.h')
  230. */
  231.  
  232. extern struct Library *IFFBase;
  233.  
  234. #ifndef NO_PRAGMAS
  235. /*pragma libcall IFFBase IFFL_OldOpenIFF 1E 801*/
  236. #pragma libcall IFFBase IFFL_CloseIFF 24 901
  237. #pragma libcall IFFBase IFFL_FindChunk 2A 0902
  238. #pragma libcall IFFBase IFFL_GetBMHD 30 901
  239. #pragma libcall IFFBase IFFL_GetColorTab 36 8902
  240. #pragma libcall IFFBase IFFL_DecodePic 3C 8902
  241. #pragma libcall IFFBase IFFL_SaveBitMap 42 0A9804
  242. #pragma libcall IFFBase IFFL_SaveClip 48 43210A9808
  243. #pragma libcall IFFBase IFFL_IFFError 4E 0
  244. #pragma libcall IFFBase IFFL_GetViewModes 54 901
  245. /*pragma libcall IFFBase IFFL_OldNewOpenIFF 5A 0802*/
  246. #pragma libcall IFFBase IFFL_ModifyFrame 60 8902
  247. /*#pragma libcall IFFBase IFFL_PPOpenIFF 66 9802*/
  248. /*--- functions in V21 or higher ---*/
  249. #pragma libcall IFFBase IFFL_OpenIFF 78 0802
  250. #pragma libcall IFFBase IFFL_PushChunk 7E 10803
  251. #pragma libcall IFFBase IFFL_PopChunk 84 801
  252. #pragma libcall IFFBase IFFL_WriteChunkBytes 8A 09803
  253. #pragma libcall IFFBase IFFL_CompressBlock 90 109804
  254. #pragma libcall IFFBase IFFL_DecompressBlock 96 109804
  255.  
  256. #ifdef IFFLIB_PRE21NAMES
  257. #pragma libcall IFFBase OpenIFF 1e 801
  258. #pragma libcall IFFBase CloseIFF 24 901
  259. #pragma libcall IFFBase FindChunk 2a 0902
  260. #pragma libcall IFFBase GetBMHD 30 901
  261. #pragma libcall IFFBase GetColorTab 36 8902
  262. #pragma libcall IFFBase DecodePic 3c 8902
  263. #pragma libcall IFFBase SaveBitMap 42 0a9804
  264. #pragma libcall IFFBase SaveClip 48 43210A9808
  265. #pragma libcall IFFBase IFFError 4e 0
  266. #pragma libcall IFFBase GetViewModes 54 901
  267. #pragma libcall IFFBase NewOpenIFF 5a 0802
  268. #pragma libcall IFFBase ModifyFrame 60 8902
  269. /*#pragma libcall IFFBase PPOpenIFF 66 9802*/
  270. #endif
  271.  
  272. #endif
  273.  
  274. #endif !LIBRARIES_IFF_H
  275.  
  276.