forked from cpp-for-yourself/lectures-and-homeworks
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpixelate.cpp
More file actions
29 lines (24 loc) 路 689 Bytes
/
Copy pathpixelate.cpp
File metadata and controls
29 lines (24 loc) 路 689 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
#include "pixelator/drawer.hpp"
#include "pixelator/pixelate_image.hpp"
#include "pixelator/stb_image_data_view.hpp"
#include <cstddef>
#include <filesystem>
#include <iostream>
#include <utility>
namespace {
using pixelator::Drawer;
using pixelator::PixelateImage;
using pixelator::StbImageDataView;
} // namespace
int main(int argc, char **argv) {
if (argc < 2) { std::cerr << "No image provided." << std::endl; }
const StbImageDataView image{argv[1]};
if (image.empty()) {
std::cerr << "Image could not be loaded" << std::endl;
exit(1);
}
Drawer drawer{ftxui::Dimension::Full()};
drawer.Set(PixelateImage(image, drawer.size()));
drawer.Draw();
return 0;
}