home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 177.lha / IffLib_v15.3 / iff.h < prev    next >
C/C++ Source or Header  |  1988-04-28  |  3KB  |  140 lines

  1. /* C include file for the iff.library       Last update: 12-Jul-88
  2.    The C-Asm interface for Aztec C is also in this file, you can
  3.    convert it to a library if you want. I think this does not run
  4.    under Lattice C (I didn't try).
  5.  */
  6.  
  7. #ifndef LIBRARIES_IFF_H
  8. #define LIBRARIES_IFF_H
  9. #ifndef EXEC_TYPES_H
  10. #include "exec/types.h"
  11. #endif
  12.  
  13. #define IFFNAME "iff.library"
  14. #define IFFVERSION 15L              /* Current library version */
  15.  
  16.  
  17. /************** E R R O R - C O D E S ***********************************/
  18.  
  19. #define IFF_BADTASK -1              /* IffError() called by wrong task */
  20.  
  21. #define IFF_CANTOPENFILE 16         /* File not found */
  22. #define IFF_READERROR 17            /* Error reading file */
  23. #define IFF_NOMEM 18                /* Not enough memory */
  24. #define IFF_NOTIFF 19               /* File is not an IFF file */
  25. #define IFF_WRITEERROR 20           /* Error writing file */
  26.  
  27. #define IFF_NOILBM 24               /* IFF file is not of type ILBM */
  28. #define IFF_NOBMHD 25               /* BMHD chunk not found */
  29. #define IFF_NOBODY 26               /* BODY chunk not found */
  30. #define IFF_TOOMANYPLANES 27        /* BODY has more planes than BitMap */
  31. #define IFF_UNKNOWNCOMPRESSION 28   /* Unknown compression type */
  32.  
  33.  
  34. /************** S T R U C T U R E S *************************************/
  35.  
  36. struct Chunk
  37. {
  38.    LONG  ckID;
  39.    LONG  ckSize;
  40.    UBYTE ckData[1];    /* should be UBYTE ckData[ckSize] */
  41. };
  42.  
  43.  
  44. struct BitMapHeader
  45. {
  46.    UWORD w,h;
  47.    WORD  x,y;
  48.    UBYTE nPlanes;
  49.    UBYTE masking;
  50.    UBYTE compression;
  51.    UBYTE pad1;
  52.    UWORD transparentColor;
  53.    UBYTE xAspect,yAspect;
  54.    WORD  pageWidth,pageHeight;
  55. };
  56.  
  57.  
  58. /************** F U N C T I O N   D E C L A R A T I O N S ***************/
  59.  
  60. APTR OpenIFF();
  61. void CloseIFF();
  62. struct Chunk *FindChunk();
  63. LONG GetColorTab();
  64. struct BitMapHeader *GetBMHD();
  65. BOOL DecodePic();
  66. BOOL SaveBitMap();
  67. BOOL SaveClip();
  68. LONG IffError();
  69. UWORD GetViewModes();
  70.  
  71.  
  72. /************** C - A S S E M B L E R   I N T E R F A C E ***************/
  73.  
  74. #asm
  75. ; :ts=8
  76.         public    _IFFBase
  77.  
  78.         public    _OpenIFF
  79. _OpenIFF:    move.l    4(sp),a0
  80.         move.l    _IFFBase,a6
  81.         jmp    -30(a6)
  82.  
  83.         public    _CloseIFF
  84. _CloseIFF:    move.l    4(sp),a1
  85.         move.l    _IFFBase,a6
  86.         jmp    -36(a6)
  87.  
  88.         public    _FindChunk
  89. _FindChunk:    move.l    4(sp),a1
  90.         move.l    8(sp),d0
  91.         move.l    _IFFBase,a6
  92.         jmp    -42(a6)
  93.  
  94.         public    _GetBMHD
  95. _GetBMHD:    move.l    4(sp),a1
  96.         move.l    _IFFBase,a6
  97.         jmp    -48(a6)
  98.  
  99.         public    _GetColorTab
  100. _GetColorTab:    move.l    4(sp),a1
  101.         move.l    8(sp),a0
  102.         move.l    _IFFBase,a6
  103.         jmp    -54(a6)
  104.  
  105.         public    _DecodePic
  106. _DecodePic:    move.l    4(sp),a1
  107.         move.l    8(sp),a0
  108.         move.l    _IFFBase,a6
  109.         jmp    -60(a6)
  110.  
  111.         public    _SaveBitMap
  112. _SaveBitMap:    move.l    a2,-(sp)
  113.         movem.l    8(sp),a0/a1/a2
  114.         move.l    20(sp),d0
  115.         move.l    _IFFBase,a6
  116.         jsr    -66(a6)
  117.         move.l    (sp)+,a2
  118.         rts
  119.  
  120.         public    _SaveClip
  121. _SaveClip:    movem.l    d4/a2,-(sp)
  122.         movem.l    24(sp),d0-d4
  123.         movem.l    12(sp),a0-a2
  124.         move.l    _IFFBase,a6
  125.         jsr    -72(a6)
  126.         movem.l    (sp)+,d4/a2
  127.         rts
  128.  
  129.         public    _IffError
  130. _IffError:    move.l    _IFFBase,a6
  131.         jmp    -78(a6)
  132.  
  133.         public    _GetViewModes
  134. _GetViewModes:    move.l    4(sp),a1
  135.         move.l    _IFFBase,a6
  136.         jmp    -84(a6)
  137. #endasm
  138.  
  139. #endif !LIBRARIES_IFF_H
  140.