-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
99 lines (76 loc) · 2.11 KB
/
main.cpp
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/**
* @file main.cpp
* A simple C++ program that manipulates an image.
*
* @author CS 221: Basic Algorithms and Data Structures
**/
#include "chain.h"
#include "block.h"
#include <iostream>
#include "cs221util/PNG.h"
#include "sketchify.h"
using namespace cs221util;
using namespace std;
#include "lab_intro.h"
string img_input = "img-input/coco.png";
void Rotate(string img_path) {
PNG img;
img.readFromFile(img_path);
int cols = 5;
int rows = 1;
Chain c(img, cols,rows);
c.rotate(2);
PNG res = c.render(cols,rows);
res.writeToFile("soln-img/out-rotate.png");
cout << "Exported Rotate" << endl;
}
void OddReverse(string img_path) {
PNG img;
img.readFromFile(img_path);
int cols = 10;
int rows = 5;
Chain c(img, cols,rows);
c.reverse();
PNG res = c.render(cols,rows);
res.writeToFile("soln-img/out-reverse.png");
cout << "Exported Reverse" << endl;
}
void Encoded(string img_path) {
PNG img, png2;
img.readFromFile(img_path);
png2.readFromFile("img-input/locked_icon.png");
int cols = 40;
int rows = 20;
Chain c(img, cols,rows);
c.reverse();
c.rotate(2);
PNG res = c.render(cols,rows);
res = grayscale(res);
res = watermark(res, png2);
res.writeToFile("soln-img/out-encoded.png");
cout << "Exported Encoded" << endl;
}
int main()
{
Rotate(img_input);
OddReverse(img_input);
Encoded(img_input);
cs221util::PNG png, png2, result;
png.readFromFile(img_input);
result = grayscale(png);
result.writeToFile("soln-img/out-grayscale.png");
cout << "Exported GrayScale" << endl;
result = createSpotlight(png, 250, 50);
result.writeToFile("soln-img/out-spotlight.png");
cout << "Exported SpotLight" << endl;
result = ubcify(png);
result.writeToFile("soln-img/out-ubcify.png");
cout << "Exported UBCify" << endl;
png2.readFromFile("img-input/coco_watermark.png");
result = watermark(png, png2);
result.writeToFile("soln-img/out-watermark.png");
cout << "Exported WaterMark" << endl;
sketchify(img_input, "soln-img/out-sketchify.png");
cout << "Exported Sketchify" << endl;
return 0;
}