用c语言读取并显示bmp图像
如何在WIN-TC中或TC++3.0中把一张BMP格式的图片显示出来?
下面的是<>随书光盘上的代码,我在TC2.0下编译通过.
它是利用了抖动技术显示了8bit和24bit的位图(也就是256色和16M色位图),应该能满足你的需要. 不过,我想问下,你老师教过抖动显示吗?
#include
#include
#include
#include
#define NoError 0
#define ErrorFileOpen 1
#define ErrorFileType 2
#define ErrorImageColor 3
typedef struct tagBITMAPFILEHEADER
{
unsigned int bfType;
unsigned long bfSize;
unsigned int bfReserved1;
unsigned int bfReserved2;
unsigned long bfoffBits;
}BITMAPFILEHEADER;
typedef struct tagBITMAPINFOHEADER
{
unsigned long biSize;
unsigned long biWidth;
unsigned long biHeight;
unsigned int biPlanes;
unsigned int biBitCount;
unsigned long biCompression;
unsigned long biSizeImage;
unsigned long biXPelsPerMeter;
unsigned long biYPelsPerMeter;
unsigned long biClrUsed;
unsigned long biClrImportant;
} BITMAPINFOHEADER;
typedef struct tagRGBQUAD
{