home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 3 / PDCD_3.iso / utilities / utilss / sprtools / h / sprite < prev    next >
Text File  |  1994-07-18  |  4KB  |  97 lines

  1. /************************************************************************
  2.  *                                                                      *
  3.  * sprite.h                                                             *
  4.  * ========                                                             *
  5.  *                                                                      *
  6.  * Archimedes Screendump Sprite header                                  *
  7.  * plus sprite working info structure                                   *
  8.  *                                                                      *
  9.  * Version 4.02 (13-Jan-1994)                                           *
  10.  *                                                                      *
  11.  * (C) 1993 DEEJ Technology PLC                                         *
  12.  *                                                                      *
  13.  ************************************************************************/
  14.  
  15. #ifndef __sprite_h
  16. #define __sprite_h
  17.  
  18. #include "io.h"
  19.  
  20. /* sprite file load/save structure */
  21.  
  22. typedef struct {
  23.         /* sprite areas header */
  24.         int number;             /* number of sprites (should be 1)        */
  25.         int offset;             /* offset to first sprite - taken as +16  */
  26.         int free;               /* offset to first free word              */
  27.         /* sprite header */
  28.         int next;               /* offset to next sprite                  */
  29.         char name[12];          /* name null terminated if < 12           */
  30.         int width;              /* width in words -1                      */
  31.         int height;             /* height in words -1                     */
  32.         int left;               /* first pixel used in left most word     */
  33.         int right;              /* last pixel used in right most word     */
  34.         int sprite;             /* offset to sprite data                  */
  35.         int mask;               /* offset to mask or sprite if none       */
  36.         int mode;               /* RISCOS mode number                     */
  37.                                 /* palette data follows depending on mode */
  38. } spritefile;
  39.  
  40. extern int spritefile_descr[];
  41.  
  42.  
  43. typedef struct                  /* structure for FSI pixel calculations     */
  44. {                               /* signed fields for error diffussion       */
  45.         int red;
  46.         int green;
  47.         int blue;
  48.         int value;
  49. } pix_str;
  50.  
  51. typedef struct spr_info__str spr_info_str;
  52.  
  53. /* spr_info_str function types */
  54.  
  55. typedef uint (*spr_read_func)(spr_info_str*, int,int);
  56. typedef void (*spr_write_func)(spr_info_str*, int,int, uint);
  57. typedef pix_str* (*spr_closest_func)(spr_info_str*, pix_str*);
  58.  
  59. /* sprite working structure */
  60.  
  61. typedef struct spr_info__str
  62. {
  63.         int     mode;                   /* RISCOS mode number                */
  64.         int     X,Y;                    /* X & Y resoutions in pixels        */
  65.         int     Xasp,Yasp;              /* x:y pixel aspect rations          */
  66.         int     line_size;              /* number of bytes per raster line   */
  67.         int     pix;                    /* pixel spacing in bits (act. bpp)  */
  68.         int     bpp;                    /* used bits per pixel               */
  69.         int     cols;                   /* number of cols (1<<bpp)           */
  70.         int     has_palette;            /* sprite has palette, 0 or #pal ents*/
  71.         uint    palette[256];           /* #cols entries, 0xBBGGRR00         */ 
  72.         uchar   *spr_data;              /* line_size*Y bytes of sprite data  */
  73.     spr_read_func    read_pixel_val;
  74.     spr_read_func    read_pixel_rgb;
  75.     spr_write_func   write_pixel_val;
  76.     spr_write_func   write_pixel_rgb;
  77.     spr_closest_func closest_rgb;
  78. } spr_info_t;
  79.  
  80. extern void alloc_spr_data(spr_info_str*);
  81. extern void alloc_spr_line(spr_info_str*);
  82. extern void mode_info(spr_info_str*, spritefile*);
  83. extern void fill_info(spr_info_str*);
  84. extern void palette256(uint*);
  85. extern void default_palette(spr_info_str*);
  86. extern void read_palette(spr_info_str*, int, FILE*);
  87. extern void read_sprite_header(spr_info_str*, FILE*);
  88. extern void read_sprite(spr_info_str*, FILE*);
  89. extern void write_sprite_header(spr_info_str*, FILE*);
  90. extern void write_sprite(spr_info_str*, FILE*);
  91. extern uint read_pixel_RGB(spr_info_str*, int x, int y);
  92. extern uint read_pixel_val(spr_info_str*, int x, int y);
  93. extern void write_pixel_val(spr_info_str*, int x, int y, uint value);
  94. extern void spr_init_funcs(spr_info_str*);
  95.  
  96. #endif
  97.