1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
/***************************************************/
/* CImage class: Support GIF,PNG and JPEG format */
/***************************************************/
#ifndef _CIMAGEH_
#define _CIMAGEH_
#include <windows.h>
class CImage {
public:
// Default constructor
CImage();
// Load an image
// Supports GIF , JPG or PNG format
// Return 1 when image has been succesfully load , 0 otherwise.
int LoadImage(const char *FileName);
// Get error message if LoadImage fails.
char *GetErrorMessage();
// Returns image width
int Width();
// Returns image height
int Height();
// Returns data (24Bits BGR)
BYTE *GetData();
// Release memory
void Release();
// Write a PNG file (Return an error message when fail, NULL otherwise)
// Data are 24Bits BGR
static char *WritePNG(char *FileName,int width,int height,BYTE *data);
private:
char m_LastError[1024]; /* Error message */
BYTE *m_Data; /* Handle to data (24Bits BGR) */
int m_Width; /* Image width (pixels) */
int m_Height; /* Image height (pixels) */
};
#endif
|