目录
二、源BMP文件信息的读取
三、实际位图数据的旋转、缩放操作
四、生成转换过后的新位图文件
#include <stdlib.h>
#ifndef PHOTODEAL_H
#define PHOTODEAL_H
#pragma pack(1)
typedef struct tagBmpFileHeader{
unsigned short bfType;
unsigned long bfSize;
unsigned short bfReserved1;
unsigned short bfReserved2;
unsigned long bfOffBits;
}BMPFILEHEADER;
typedef struct tagBmpInfoHeader{
unsigned long biSize;
long biWidth;
long biHeight;
unsigned short biPlanes;
unsigned short biBitCount;
unsigned long biCompression;
unsigned long biSizeImage;
long biXPelsPerMeter;
long biYPelsPerMeter;
unsigned long biClrUsed;
unsigned long biClrImportant;
}BMPINFOHEADER;
typedef struct tagPalEn{
unsigned char rgbRed;
unsigned char rgbGreen;
unsigned char rgbBlue;
unsigned char rgbFlags;
}PALEN;
typedef struct tagPalette{
unsigned short palVersion;
unsigned short palNumEntries;
PALEN palPalEN[1];
}PALETTE;
#pragma pack()
void OnLoad(char* path, BMPFILEHEADER* srcBmpFileHeader, BMPINFOHEADER* srcBmpInfoHeader, unsigned char** srcBmpData);
void WriteData(char* path, BMPFILEHEADER* desBmpFileHeader, BMPINFOHEADER* desBmpInfoHeader, unsigned char* desBmpData);
void RotateBmp(BMPFILEHEADER* srcBmpFileHeader, BMPINFOHEADER* srcBmpInfoHeader, BMPFILEHEADER* desBmpFileHeader, BMPINFOHEADER* desBmpInfoHeader, unsigned char** srcBmpData, /*double dAngle,*/ unsigned char* desBmpData);
void ZoomBmp(BMPFILEHEADER* srcBmpFileHeader, BMPINFOHEADER* srcBmpInfoHeader, BMPFILEHEADER* desBmpFileHeader, BMPINFOHEADER* desBmpInfoHeader,
unsigned char* srcBmpData, unsigned char** desBmpData /*, int zmHeight, int zmWidth, , double dxRate, double dyRate*/);
void start();
//void suofang();
#endif
#define _CRT_SECURE_NO_WARNINGS
#include "PHOTODEAL.h"
#include <stdio.h>
//#include <stdlib.h>
#include <string.h>
#include <math.h>
BMPFILEHEADER srcBmpFileHeader, desBmpFileHeader;
BMPINFOHEADER srcBmpInfoHeader, desBmpInfoHeader;
unsigned char* srcBmpData = NULL;
unsigned char* desBmpData = NULL;
void OnLoad(char* path, BMPFILEHEADER* srcBmpFileHeader, BMPINFOHEADER* srcBmpInfoHeader, unsigned char** srcBmpData){
FILE* pFile;
unsigned char* tempData