-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
31 lines (24 loc) · 866 Bytes
/
main.cpp
File metadata and controls
31 lines (24 loc) · 866 Bytes
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
#include <iostream>
//#include "bmpLibGlobal.h"
using namespace std;
int saveBMP(const unsigned char *data,int width,int height,int channel, const char* path);
unsigned char* loadBMP( int *width, int *height, int *channel, const char * path);
int saveBMP_RGB(const unsigned char *data,int width,int height,int channel, const char* path);
unsigned char* loadBMP_RGB(int *width, int *height, int *channel, const char * path);
int main()
{
uint8_t *image=new uint8_t[401*400*3];
int width=400;
// 填充 QImage 实例
for (int y = 0; y < 400; ++y) {
for (int x = 0; x < width; ++x) {
int index=(x*width+y)*3;
image[index]=x;
image[index+1]=y;
image[index+2]=0;
}
}
saveBMP_RGB(image,width,400,3,"./bmpLibExample.bmp");
cout << "Hello World!" << endl;
return 0;
}