X-Git-Url: http://git.draconx.ca/gitweb/liblbx.git/blobdiff_plain/76e363aa42e94748b34370e7f01aa587e555722c..430be3ec2f86aec28fa21558b3141a2e28efd848:/src/image.h diff --git a/src/image.h b/src/image.h index 3ef95ab..880f7de 100644 --- a/src/image.h +++ b/src/image.h @@ -3,29 +3,39 @@ #include -typedef struct lbx_image LBX_IMG; +struct lbx_file_ops; + +struct lbx_image { + unsigned short width, height; + unsigned char frames, chunk, leadin; +}; struct lbx_colour { - unsigned char red; - unsigned char green; - unsigned char blue; + unsigned red:6, green:6, blue:6, active:1; }; struct lbx_imginfo { - unsigned int width, height; - unsigned int nframes, loopstart; - int haspalette; - int looping; + unsigned char loopstart; + int palettesz, looping; }; -LBX_IMG *lbximg_fopen(FILE *f); -void lbximg_close(LBX_IMG *img); -unsigned char **lbximg_getframe(LBX_IMG *img, int frame); -unsigned char **lbximg_getmask(LBX_IMG *img); +struct lbx_image *lbx_img_open(void *f, const struct lbx_file_ops *fops, + int (*destructor)(void *)); +struct lbx_image *lbx_img_fopen(const char *file); +int lbx_img_close(struct lbx_image *img); + +int lbx_img_seek(struct lbx_image *img, unsigned frame); +long lbx_img_read_row_header(struct lbx_image *img, unsigned *x, unsigned *y); +long lbx_img_read_row_data(struct lbx_image *img, void *buf); + +unsigned char **lbx_img_getframe(struct lbx_image *img, int frame); +unsigned char **lbx_img_getmask(struct lbx_image *img); -int lbximg_loadpalette(FILE *f, struct lbx_colour palette[static 256]); -int lbximg_getpalette(LBX_IMG *img, struct lbx_colour palette[static 256]); +int lbx_img_loadpalette(void *f, const struct lbx_file_ops *fops, + struct lbx_colour palette[static 256]); +int lbx_img_getpalette(struct lbx_image *img, + struct lbx_colour palette[static 256]); -void lbximg_getinfo(LBX_IMG *img, struct lbx_imginfo *info); +void lbx_img_getinfo(struct lbx_image *img, struct lbx_imginfo *info); #endif