www.pudn.com > mfcopentree.rar > MyBitmap.h


// MyBitmap.h: interface for the CMyBitmap class. 
// 
////////////////////////////////////////////////////////////////////// 
 
#if !defined(AFX_MYBITMAP_H__9D95EDF2_2374_466A_8668_95F4FF7E7912__INCLUDED_) 
#define AFX_MYBITMAP_H__9D95EDF2_2374_466A_8668_95F4FF7E7912__INCLUDED_ 
 
#if _MSC_VER > 1000 
#pragma once 
#endif // _MSC_VER > 1000 
 
#include  
 
typedef struct 
    { 
    unsigned short bfType;            
    unsigned int   bfSize;            
    unsigned short bfReserved1;       
    unsigned short bfReserved2;       
    unsigned int   bfOffBits;         
    } bmpFHEAD; 
 
 
typedef struct bmpIHEAD 
    { 
    unsigned int   biSize;            
    int            biWidth;           
    int            biHeight;          
    unsigned short biPlanes;          
    unsigned short biBitCount;        
    unsigned int   biCompression;     
    unsigned int   biSizeImage;       
    int            biXPelsPerMeter;   
    int            biYPelsPerMeter;   
    unsigned int   biClrUsed;         
    unsigned int   biClrImportant;    
    } bmpIHEAD; 
 
 
typedef struct bmpPAL 
	{ 
	unsigned char r; 
	unsigned char g; 
	unsigned char b; 
	} PAL; 
 
 
 
class CMyBitmap 
{ 
public: 
	int width, height; 
	 
public: 
	unsigned char *data; 
 
	CMyBitmap(void); 
	bool create(int x, int y); 
	bool load(char *filename); 
	bool save(char *filename); 
	int getwidth(void)	{ if (data) return width; else return -1;  }; 
	int getheight(void) { if (data) return height; else return -1; }; 
	void getcolor(int x, int y, BYTE *r, BYTE *g, BYTE *b); 
	void setcolor(int x, int y, BYTE  r, BYTE  g, BYTE  b); 
	~CMyBitmap(void); 
}; 
 
#endif // !defined(AFX_MYBITMAP_H__9D95EDF2_2374_466A_8668_95F4FF7E7912__INCLUDED_)