// BMP.h // extracts/inserts data from/into .bmp file // Adapted by Josh Holtrop from the original access_bmp.c by gw // Supports reading and creating 24-bit color BMP images #include class BMP { public: typedef struct { char id[2]; int file_size; int reserved; int offset; } __attribute__ ((packed)) header_t; typedef struct { int header_size; int width; int height; unsigned short int color_planes; unsigned short int color_depth; unsigned int compression; int image_size; int xresolution; int yresolution; int num_colors; int num_important_colors; } __attribute__ ((packed)) info_t; BMP(char * fileName); BMP(char * fileName, int width, int height, unsigned char * data); ~BMP(); int getWidth(); int getHeight(); private: FILE * m_fp; header_t m_header; info_t m_info; bool open(char * fileName); bool create(char * fileName, int width, int height, unsigned char * data); void close(); };