1 /* bmp.h -- bmp headers */
11 #include <sys/types.h>
19 #define B_WRONG_MODE -2
22 #define B_NO_SUPPORT -5
25 #define B_E_READ_DATA -8
26 #define B_E_WRITE_DATA -9
27 #define B_E_GEOMETRY -10
28 #define MAX_CHARS_FILE 32
33 /* bmp specific variables */
34 typedef struct s_bmp_hdr {
35 unsigned short int identifier;
37 unsigned short int reserved1;
38 unsigned short int reserved2;
39 unsigned int offset; /* <- 14 + 40 bytes = 0x36 */
40 } __attribute__ ((packed)) t_bmp_hdr; /* 14 bytes */
42 typedef struct s_bmp_info {
43 unsigned int size; /* 40 bytes = 0x28 */
46 unsigned short int planes;
47 unsigned short int bpp;
48 unsigned int compression;
49 unsigned int imagesize;
54 } __attribute__ ((packed)) t_bmp_info; /* 40 bytes */
56 typedef struct s_pixel {
60 } __attribute__ ((packed)) t_pixel;
62 typedef struct s_bmp {
69 char file[MAX_CHARS_FILE];
76 /* function prototypes */
77 int bmp_init(t_bmp *bmp,int outfd);
78 int bmp_shutdown(t_bmp *bmp);
79 int bmp_check_header_and_info(t_bmp *bmp);
80 int bmp_alloc_map(t_bmp *bmp);
81 int bmp_write_file(t_bmp *bmp);
82 int bmp_cut_grab_bottom(t_bmp *dst,t_bmp *src,int dz,unsigned char m);
83 int bmp_read_file(t_bmp *bmp);