-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
43 lines (43 loc) · 1.24 KB
/
Copy pathmain.cpp
File metadata and controls
43 lines (43 loc) · 1.24 KB
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
#include "bmp.h"
#include <iostream>
using namespace std;
int main()
{
try
{
{
BMP bmp("2.1.bmp");
cout << "水平像素数:" << bmp.getWidth() << '\n';
cout << "垂直像素数:" << bmp.getHeight() << '\n';
Color c;
c = bmp.getPixel(0, 0);
cout << "左下:\nR:" << static_cast<int>(c.R) << "\nG:" << static_cast<int>(c.G) << "\nB:" << static_cast<int>(c.B) << '\n';
c = bmp.getPixel(bmp.getHeight() - 1, bmp.getWidth() - 1);
cout << "右下:\nR:" << static_cast<int>(c.R) << "\nG:" << static_cast<int>(c.G) << "\nB:" << static_cast<int>(c.B) << '\n';
bmp.conv2Gray();
bmp.save("2.1.2.bmp");
}
{
BMP bmp("2.2.bmp");
bmp.reverseImageColor();
bmp.save("2.2.2.bmp");
}
{
BMP bmp("2.3.bmp");
Color c;
bmp.equalizeRedBlue();
bmp.save("2.3.2.bmp");
}
{
BMP bmp("3.3.bmp");
bmp.pixelize(32, 32, 128, 128, 8);
bmp.save("3.3.1.bmp");
}
return 0;
}
catch (const char *msg)
{
cerr << msg;
return -1;
}
}