X-Git-Url: https://hackdaworld.org/gitweb/?a=blobdiff_plain;f=bmp%2Fbmp.h;h=40e6df45f27390deda2ca0f30867d7bbea8083a4;hb=0e23b0ff9632e31c6abc581b42b0efdff798af4c;hp=f25007d813b96b35891303f581d1a49f1091ce65;hpb=a54cc5ef402ca4ba6202f13ee65e5f2fdcfd10c1;p=my-code%2Fapi.git diff --git a/bmp/bmp.h b/bmp/bmp.h index f25007d..40e6df4 100644 --- a/bmp/bmp.h +++ b/bmp/bmp.h @@ -8,6 +8,10 @@ #include #include #include +#include +#include +#include +#include /* defines */ #define B_SUCCESS 1 @@ -20,6 +24,7 @@ #define B_E_MEM -7 #define B_E_READ_DATA -8 #define B_E_WRITE_DATA -9 +#define B_E_GEOMETRY -10 #define MAX_CHARS_FILE 32 #define BMP_H_SIZE 14 #define BMP_I_SIZE 40 @@ -31,7 +36,7 @@ typedef struct s_bmp_hdr { unsigned short int reserved1; unsigned short int reserved2; unsigned int offset; /* <- 14 + 40 bytes = 0x36 */ -} t_bmp_hdr; /* 14 bytes */ +} __attribute__ ((packed)) t_bmp_hdr; /* 14 bytes */ typedef struct s_bmp_info { unsigned int size; /* 40 bytes = 0x28 */ @@ -45,13 +50,13 @@ typedef struct s_bmp_info { unsigned int yres; unsigned int noc; unsigned int ic; -} t_bmp_info; /* 40 bytes */ +} __attribute__ ((packed)) t_bmp_info; /* 40 bytes */ typedef struct s_pixel { unsigned char r; unsigned char g; unsigned char b; -} t_pixel; +} __attribute__ ((packed)) t_pixel; typedef struct s_bmp { int outfd; @@ -68,7 +73,12 @@ typedef struct s_bmp { } t_bmp; /* function prototypes */ -int bmp_init(t_bmp *bmp); +int bmp_init(t_bmp *bmp,int outfd); int bmp_shutdown(t_bmp *bmp); +int bmp_check_header_and_info(t_bmp *bmp); +int bmp_alloc_map(t_bmp *bmp); +int bmp_write_file(t_bmp *bmp); +int bmp_cut_bottom(t_bmp *dst,t_bmp *src,int dz); +int bmp_read_file(t_bmp *bmp); #endif