50b84e06fe
Using Unicode quarter blocks the effective resolution is (40x2)x(24x2). Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
38 lines
776 B
C++
38 lines
776 B
C++
#pragma once
|
|
|
|
#include <unordered_map>
|
|
#include <vector>
|
|
|
|
class ASCIIArt
|
|
{
|
|
public:
|
|
ASCIIArt();
|
|
|
|
struct Character
|
|
{
|
|
const char * c;
|
|
double foreground;
|
|
double background;
|
|
double error;
|
|
};
|
|
|
|
const Character & getCharacter(const unsigned char * address);
|
|
const Character & getCharacter(const std::vector<int> & values);
|
|
|
|
private:
|
|
std::unordered_map<int, Character> myAsciiPixels;
|
|
|
|
struct Unicode
|
|
{
|
|
Unicode(const char * aC, std::vector<int> aValues);
|
|
|
|
const char * c;
|
|
std::vector<int> values; // foreground: top left - top right - bottom left - bottom right
|
|
};
|
|
|
|
std::vector<Unicode> myGlyphs;
|
|
|
|
static void fit(const std::vector<int> & art, const Unicode & glyph,
|
|
double & foreground, double & background, double & error);
|
|
|
|
};
|