<img src="https://img-blog.csdn.net/20150919152225406?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" />// "bmp.h"
#ifndef BMP_H_
#define BMP_H_
typedef unsigned char BYTE; //1个字节
typedef unsigned short WORD; //2个字节
typedef unsigned int DWORD; //4个字节(无符号)
typedef long LONG; //4个字节
#pragma pack(2) //设定为2字节对齐方式
typedef struct
{
WORD bfType;
DWORD bfSize;
WORD bfReserved1;
WORD bfReserved2;
DWORD bfOffBits;
}BITMAPFILEHEADER; //文件头
#pragma pack(pop)
typedef struct
{
DWORD biSize;
LONG biWidth;
LONG biHeight;
WORD biPlanes;
WORD biBitCount;
DWORD biCompression;
DWORD biSizeImage;
LONG biXPelsPerMeter;
LONG biYPelsPerMeter;
DWORD biClrUsed;
DWORD biClrImportant;
}BITMAPINFOHEADER; //文件信息头
typedef struct
{
BYTE rgbBlue;
BYTE rgbGreen;
BYTE rgbRed;
BYTE rgbReserved;
}RGBQUAD; //调色板结构
typedef struct
{
unsigned char* buf;
int width_x;
int height_y;
RGBQUAD* palette;
int deepth;
}Bmpbase;
bool saveBmp(char*, unsigned char*, int, int, int, RGBQUAD*);
Bmpbase readbmp(char*);
Bmpbase imrotate(unsigned char*, int, int, int, RGBQUAD*,double);
#endif
</pre><pre name="code" class="cpp">
// "readbmp.cpp"
#include"bmp.h"
#include<iostream>
using namespace std;
//unsigned char* pBmpBuf; //读入图像数据的指针
//int bmpWidth;