home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Datafile PD-CD 3
/
PDCD_3.iso
/
utilities
/
utilss
/
sprtools
/
h
/
sprite
< prev
next >
Wrap
Text File
|
1994-07-18
|
4KB
|
97 lines
/************************************************************************
* *
* sprite.h *
* ======== *
* *
* Archimedes Screendump Sprite header *
* plus sprite working info structure *
* *
* Version 4.02 (13-Jan-1994) *
* *
* (C) 1993 DEEJ Technology PLC *
* *
************************************************************************/
#ifndef __sprite_h
#define __sprite_h
#include "io.h"
/* sprite file load/save structure */
typedef struct {
/* sprite areas header */
int number; /* number of sprites (should be 1) */
int offset; /* offset to first sprite - taken as +16 */
int free; /* offset to first free word */
/* sprite header */
int next; /* offset to next sprite */
char name[12]; /* name null terminated if < 12 */
int width; /* width in words -1 */
int height; /* height in words -1 */
int left; /* first pixel used in left most word */
int right; /* last pixel used in right most word */
int sprite; /* offset to sprite data */
int mask; /* offset to mask or sprite if none */
int mode; /* RISCOS mode number */
/* palette data follows depending on mode */
} spritefile;
extern int spritefile_descr[];
typedef struct /* structure for FSI pixel calculations */
{ /* signed fields for error diffussion */
int red;
int green;
int blue;
int value;
} pix_str;
typedef struct spr_info__str spr_info_str;
/* spr_info_str function types */
typedef uint (*spr_read_func)(spr_info_str*, int,int);
typedef void (*spr_write_func)(spr_info_str*, int,int, uint);
typedef pix_str* (*spr_closest_func)(spr_info_str*, pix_str*);
/* sprite working structure */
typedef struct spr_info__str
{
int mode; /* RISCOS mode number */
int X,Y; /* X & Y resoutions in pixels */
int Xasp,Yasp; /* x:y pixel aspect rations */
int line_size; /* number of bytes per raster line */
int pix; /* pixel spacing in bits (act. bpp) */
int bpp; /* used bits per pixel */
int cols; /* number of cols (1<<bpp) */
int has_palette; /* sprite has palette, 0 or #pal ents*/
uint palette[256]; /* #cols entries, 0xBBGGRR00 */
uchar *spr_data; /* line_size*Y bytes of sprite data */
spr_read_func read_pixel_val;
spr_read_func read_pixel_rgb;
spr_write_func write_pixel_val;
spr_write_func write_pixel_rgb;
spr_closest_func closest_rgb;
} spr_info_t;
extern void alloc_spr_data(spr_info_str*);
extern void alloc_spr_line(spr_info_str*);
extern void mode_info(spr_info_str*, spritefile*);
extern void fill_info(spr_info_str*);
extern void palette256(uint*);
extern void default_palette(spr_info_str*);
extern void read_palette(spr_info_str*, int, FILE*);
extern void read_sprite_header(spr_info_str*, FILE*);
extern void read_sprite(spr_info_str*, FILE*);
extern void write_sprite_header(spr_info_str*, FILE*);
extern void write_sprite(spr_info_str*, FILE*);
extern uint read_pixel_RGB(spr_info_str*, int x, int y);
extern uint read_pixel_val(spr_info_str*, int x, int y);
extern void write_pixel_val(spr_info_str*, int x, int y, uint value);
extern void spr_init_funcs(spr_info_str*);
#endif