Start of image to ansi converter.
This commit is contained in:
parent
b7002917c1
commit
be144e2a05
2 changed files with 40 additions and 0 deletions
|
@ -53,4 +53,13 @@ roguish = executable('roguish', [
|
||||||
],
|
],
|
||||||
dependencies: dependencies)
|
dependencies: dependencies)
|
||||||
|
|
||||||
|
roguish = executable('img2ansi', [
|
||||||
|
'dbc.cpp',
|
||||||
|
'panel.cpp',
|
||||||
|
'ansi_parser.cpp',
|
||||||
|
'render.cpp',
|
||||||
|
'scratchpad/img2ansi.cpp'
|
||||||
|
],
|
||||||
|
dependencies: dependencies)
|
||||||
|
|
||||||
test('tests', runtests)
|
test('tests', runtests)
|
||||||
|
|
31
scratchpad/img2ansi.cpp
Normal file
31
scratchpad/img2ansi.cpp
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
#include <fmt/core.h>
|
||||||
|
#include <filesystem>
|
||||||
|
#include "panel.hpp"
|
||||||
|
#include "color.hpp"
|
||||||
|
#include "render.hpp"
|
||||||
|
#include "dbc.hpp"
|
||||||
|
#include <SFML/Graphics/Image.hpp>
|
||||||
|
|
||||||
|
using namespace fmt;
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
int main(int argc, char *argv[]) {
|
||||||
|
dbc::check(argc == 2, "USAGE: img2ansi <image_file>");
|
||||||
|
|
||||||
|
string image_file(argv[1]);
|
||||||
|
|
||||||
|
println("LOADING IMAGE: {}", image_file);
|
||||||
|
|
||||||
|
// load the image from argv
|
||||||
|
sf::Image image;
|
||||||
|
image.loadFromFile(image_file);
|
||||||
|
|
||||||
|
// create a grid panel to hold the cells
|
||||||
|
// divide the image into cells
|
||||||
|
// for each cell:
|
||||||
|
// get the color
|
||||||
|
// calculate value
|
||||||
|
// find character that's closest
|
||||||
|
// write to panel/canvas with ftxui
|
||||||
|
// display in sfml window with renderer
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue