00001
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef IMAGE_H
00026 #define IMAGE_H
00027
00028 #include "aux.h"
00029
00030 #define IMG_MONOCOL 0
00031 #define IMG_MAPPCOL 1
00032 #define IMG_TRUECOL 2
00033
00034 #define IMG_DV_W 720
00035 #define IMG_DV_H 480
00036
00037 typedef unsigned char Byte;
00038
00039 typedef struct Bcolor {
00040 Byte z, y, x;
00041 } Bcolor;
00042
00043 typedef struct CMap {
00044 Byte r[256];
00045 Byte g[256];
00046 Byte b[256];
00047 } CMap;
00048
00049 typedef struct Image {
00050 int type;
00051 int w, h;
00052 CMap *m;
00053 union {
00054 Byte *b;
00055 Bcolor *c;
00056 } u;
00057 } Image;
00058
00059 #define img_type(_) (_)->type
00060 #define img_cmap(_) (_)->m
00061
00062 Image *img_create(int type, int w, int h);
00063 void img_clear(Image *i, Color c);
00064 Image *img_read(char *fname);
00065 void img_write(Image *i, char *fname, int cflag);
00066
00067 void img_puti(Image *i, int u, int v, int c);
00068 int img_geti(Image *i, int u, int v);
00069
00070 void img_putc(Image *i, int u, int v, Color c);
00071 Color img_getc(Image *i, int u, int v);
00072
00073 void img_free(Image *i);
00074
00075 void cmap_read(CMap *m, int maplength, int fd);
00076
00077 #endif