fixed bmp api, improved dft_2d ... though still seems to be broken
[my-code/api.git] / bmp / bmp.h
index f25007d..4dd47f5 100644 (file)
--- a/bmp/bmp.h
+++ b/bmp/bmp.h
@@ -8,6 +8,10 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
 
 /* defines */
 #define B_SUCCESS 1
@@ -31,7 +35,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 +49,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 +72,11 @@ 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_read_file(t_bmp *bmp);
 
 #endif