mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-09-19 10:08:10 +08:00
add pixelate func and example
This commit is contained in:
@@ -12,6 +12,8 @@
|
||||
#include "ftxui/screen/color.hpp" // for Color
|
||||
#include "ftxui/screen/image.hpp" // for Pixel, Image
|
||||
|
||||
#include <opencv2/opencv.hpp> //for OpenCV
|
||||
|
||||
#ifdef DrawText
|
||||
// Workaround for WinUsr.h (via Windows.h) defining macros that break things.
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-drawtext
|
||||
@@ -106,6 +108,10 @@ struct Canvas {
|
||||
// y is considered to be a multiple of 4.
|
||||
void Style(int x, int y, const Stylizer& style);
|
||||
|
||||
static void DrawImageOnTerminal(const std::string& image_path, int width = 80, int height = 24);
|
||||
|
||||
|
||||
|
||||
private:
|
||||
bool IsIn(int x, int y) const {
|
||||
return x >= 0 && x < width_ && y >= 0 && y < height_;
|
||||
|
Reference in New Issue
Block a user