IFF.H 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. /*
  2. THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
  3. SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
  4. END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
  5. ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
  6. IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
  7. SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
  8. FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
  9. CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
  10. AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
  11. COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
  12. */
  13. /*
  14. * $Source: f:/miner/source/iff/rcs/iff.h $
  15. * $Revision: 1.12 $
  16. * $Author: matt $
  17. * $Date: 1994/11/07 21:26:53 $
  18. *
  19. * Header for IFF routines
  20. *
  21. * $Log: iff.h $
  22. * Revision 1.12 1994/11/07 21:26:53 matt
  23. * Added new function iff_read_into_bitmap()
  24. *
  25. * Revision 1.11 1994/05/06 19:37:38 matt
  26. * Improved error handling and checking
  27. *
  28. * Revision 1.10 1994/04/16 20:12:54 matt
  29. * Made masked (stenciled) bitmaps work
  30. *
  31. * Revision 1.9 1994/04/13 23:46:00 matt
  32. * Added function, iff_errormsg(), which returns ptr to error message.
  33. *
  34. * Revision 1.8 1994/04/13 23:27:10 matt
  35. * Put in support for anim brushes (.abm files)
  36. *
  37. * Revision 1.7 1994/04/06 23:08:02 matt
  38. * Cleaned up code; added prototype (but no new code) for anim brush read
  39. *
  40. * Revision 1.6 1994/01/22 14:40:59 john
  41. * Fixed bug with declareations.
  42. *
  43. * Revision 1.5 1994/01/22 14:23:13 john
  44. * Added global vars to check transparency
  45. *
  46. * Revision 1.4 1993/10/27 12:47:42 john
  47. * Extended the comments
  48. *
  49. * Revision 1.3 1993/09/22 19:17:20 matt
  50. * Fixed handling of pad byte in ILBM/PPB body - was writing pad byte to
  51. * destination buffer.
  52. *
  53. * Revision 1.2 1993/09/08 19:23:25 matt
  54. * Added additional return code, IFF_BAD_BM_TYPE
  55. *
  56. * Revision 1.1 1993/09/08 14:24:21 matt
  57. * Initial revision
  58. *
  59. *
  60. */
  61. #ifndef _IFF_H
  62. #define _IFF_H
  63. #include "types.h"
  64. #include "gr.h"
  65. //Prototypes for IFF library functions
  66. int iff_read_bitmap(char *ifilename,grs_bitmap *bm,int bitmap_type,ubyte *palette);
  67. //reads an IFF file into a grs_bitmap structure. fills in palette if not null
  68. //returns error codes - see IFF.H. see GR.H for bitmap_type
  69. //MEM DETAILS: This routines assumes that you already have the grs_bitmap
  70. //structure allocated, but that you don't have the data for this bitmap
  71. //allocated. In other words, do this:
  72. // grs_bitmap * MyPicture;
  73. // MALLOC( MyPicture, grs_bitmap, 1);
  74. // iff_read_bitmap( filename, MyPicture, BM_LINEAR, NULL );
  75. // ...do whatever with your bitmap ...
  76. // gr_free_bitmap( MyPicture );
  77. // exit(0)
  78. //like iff_read_bitmap(), but reads into a bitmap that already exists,
  79. //without allocating memory for the bitmap.
  80. int iff_read_into_bitmap(char *ifilename,grs_bitmap *bm,byte *palette);
  81. //read in animator brush (.abm) file
  82. //fills in array of pointers, and n_bitmaps.
  83. //returns iff error codes. max_bitmaps is size of array.
  84. int iff_read_animbrush(char *ifilename,grs_bitmap **bm,int max_bitmaps,int *n_bitmaps,ubyte *palette);
  85. // After a read
  86. extern ubyte iff_transparent_color;
  87. extern ubyte iff_has_transparency; // 0=no transparency, 1=iff_transparent_color is valid
  88. int iff_write_bitmap(char *ofilename,grs_bitmap *bm,ubyte *palette);
  89. //writes an IFF file from a grs_bitmap structure. writes palette if not null
  90. //returns error codes - see IFF.H.
  91. //function to return pointer to error message
  92. char *iff_errormsg(int error_number);
  93. //Error codes for read & write routines
  94. #define IFF_NO_ERROR 0 //everything is fine, have a nice day
  95. #define IFF_NO_MEM 1 //not enough mem for loading or processing
  96. #define IFF_UNKNOWN_FORM 2 //IFF file, but not a bitmap
  97. #define IFF_NOT_IFF 3 //this isn't even an IFF file
  98. #define IFF_NO_FILE 4 //cannot find or open file
  99. #define IFF_BAD_BM_TYPE 5 //tried to save invalid type, like BM_RGB15
  100. #define IFF_CORRUPT 6 //bad data in file
  101. #define IFF_FORM_ANIM 7 //this is an anim, with non-anim load rtn
  102. #define IFF_FORM_BITMAP 8 //this is not an anim, with anim load rtn
  103. #define IFF_TOO_MANY_BMS 9 //anim read had more bitmaps than room for
  104. #define IFF_UNKNOWN_MASK 10 //unknown masking type
  105. #define IFF_READ_ERROR 11 //error reading from file
  106. #define IFF_BM_MISMATCH 12 //bm being loaded doesn't match bm loaded into
  107. #endif