gvsu/cs677/pa3/BMP.h
josh 63fc87efdd Added BMP class, initial Makefile, skeleton edge-detect.cc
git-svn-id: svn://anubis/gvsu@201 45c1a28c-8058-47b2-ae61-ca45b979098e
2008-10-20 02:18:16 +00:00

49 lines
1.1 KiB
C++

// 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 <stdio.h>
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();
};