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
32 /* bmp specific variables */
33 typedef struct s_bmp_hdr {
34 unsigned short int identifier;
36 unsigned short int reserved1;
37 unsigned short int reserved2;
38 unsigned int offset; /* <- 14 + 40 bytes = 0x36 */
39 } __attribute__ ((packed)) t_bmp_hdr; /* 14 bytes */
41 typedef struct s_bmp_info {
42 unsigned int size; /* 40 bytes = 0x28 */
45 unsigned short int planes;
46 unsigned short int bpp;
47 unsigned int compression;
48 unsigned int imagesize;
53 } __attribute__ ((packed)) t_bmp_info; /* 40 bytes */
55 typedef struct s_pixel {
59 } __attribute__ ((packed)) t_pixel;
61 typedef struct s_bmp {
68 char file[MAX_CHARS_FILE];
75 /* function prototypes */
76 int bmp_init(t_bmp *bmp,int outfd);
77 int bmp_shutdown(t_bmp *bmp);
78 int bmp_check_header_and_info(t_bmp *bmp);
79 int bmp_alloc_map(t_bmp *bmp);
80 int bmp_write_file(t_bmp *bmp);
81 int bmp_cut_bottom(t_bmp *dst,t_bmp *src,int dz);
82 int bmp_read_file(t_bmp *bmp);