FTXUI
5.0.0
C++ functional terminal UI.
|
Public Types | |
using | Stylizer = std::function< void(Pixel &)> |
Public Member Functions | |
Canvas ()=default | |
Canvas (int width, int height) | |
Constructor. More... | |
int | width () const |
int | height () const |
Pixel | GetPixel (int x, int y) const |
Get the content of a cell. More... | |
void | DrawPointOn (int x, int y) |
Draw a braille dot. More... | |
void | DrawPointOff (int x, int y) |
Erase a braille dot. More... | |
void | DrawPointToggle (int x, int y) |
Toggle a braille dot. A filled one will be erased, and the other will be drawn. More... | |
void | DrawPoint (int x, int y, bool value) |
Draw a braille dot. More... | |
void | DrawPoint (int x, int y, bool value, const Stylizer &s) |
Draw a braille dot. More... | |
void | DrawPoint (int x, int y, bool value, const Color &color) |
Draw a braille dot. More... | |
void | DrawPointLine (int x1, int y1, int x2, int y2) |
Draw a line made of braille dots. More... | |
void | DrawPointLine (int x1, int y1, int x2, int y2, const Stylizer &s) |
Draw a line made of braille dots. More... | |
void | DrawPointLine (int x1, int y1, int x2, int y2, const Color &color) |
Draw a line made of braille dots. More... | |
void | DrawPointCircle (int x, int y, int radius) |
Draw a circle made of braille dots. More... | |
void | DrawPointCircle (int x, int y, int radius, const Stylizer &s) |
Draw a circle made of braille dots. More... | |
void | DrawPointCircle (int x, int y, int radius, const Color &color) |
Draw a circle made of braille dots. More... | |
void | DrawPointCircleFilled (int x, int y, int radius) |
Draw a filled circle made of braille dots. More... | |
void | DrawPointCircleFilled (int x, int y, int radius, const Stylizer &s) |
Draw a filled circle made of braille dots. More... | |
void | DrawPointCircleFilled (int x, int y, int radius, const Color &color) |
Draw a filled circle made of braille dots. More... | |
void | DrawPointEllipse (int x, int y, int r1, int r2) |
Draw an ellipse made of braille dots. More... | |
void | DrawPointEllipse (int x, int y, int r1, int r2, const Color &color) |
Draw an ellipse made of braille dots. More... | |
void | DrawPointEllipse (int x, int y, int r1, int r2, const Stylizer &s) |
Draw an ellipse made of braille dots. More... | |
void | DrawPointEllipseFilled (int x, int y, int r1, int r2) |
Draw a filled ellipse made of braille dots. More... | |
void | DrawPointEllipseFilled (int x, int y, int r1, int r2, const Color &color) |
Draw a filled ellipse made of braille dots. More... | |
void | DrawPointEllipseFilled (int x, int y, int r1, int r2, const Stylizer &s) |
Draw a filled ellipse made of braille dots. More... | |
void | DrawBlockOn (int x, int y) |
Draw a block. More... | |
void | DrawBlockOff (int x, int y) |
Erase a block. More... | |
void | DrawBlockToggle (int x, int y) |
Toggle a block. If it is filled, it will be erased. If it is empty, it will be filled. More... | |
void | DrawBlock (int x, int y, bool value) |
Draw a block. More... | |
void | DrawBlock (int x, int y, bool value, const Stylizer &s) |
Draw a block. More... | |
void | DrawBlock (int x, int y, bool value, const Color &color) |
Draw a block. More... | |
void | DrawBlockLine (int x1, int y1, int x2, int y2) |
Draw a line made of block characters. More... | |
void | DrawBlockLine (int x1, int y1, int x2, int y2, const Stylizer &s) |
Draw a line made of block characters. More... | |
void | DrawBlockLine (int x1, int y1, int x2, int y2, const Color &color) |
Draw a line made of block characters. More... | |
void | DrawBlockCircle (int x1, int y1, int radius) |
Draw a circle made of block characters. More... | |
void | DrawBlockCircle (int x1, int y1, int radius, const Stylizer &s) |
Draw a circle made of block characters. More... | |
void | DrawBlockCircle (int x1, int y1, int radius, const Color &color) |
Draw a circle made of block characters. More... | |
void | DrawBlockCircleFilled (int x1, int y1, int radius) |
Draw a filled circle made of block characters. More... | |
void | DrawBlockCircleFilled (int x1, int y1, int radius, const Stylizer &s) |
Draw a filled circle made of block characters. More... | |
void | DrawBlockCircleFilled (int x1, int y1, int radius, const Color &color) |
Draw a filled circle made of block characters. More... | |
void | DrawBlockEllipse (int x1, int y1, int r1, int r2) |
Draw an ellipse made of block characters. More... | |
void | DrawBlockEllipse (int x1, int y1, int r1, int r2, const Stylizer &s) |
Draw an ellipse made of block characters. More... | |
void | DrawBlockEllipse (int x1, int y1, int r1, int r2, const Color &color) |
Draw an ellipse made of block characters. More... | |
void | DrawBlockEllipseFilled (int x1, int y1, int r1, int r2) |
Draw a filled ellipse made of block characters. More... | |
void | DrawBlockEllipseFilled (int x1, int y1, int r1, int r2, const Stylizer &s) |
Draw a filled ellipse made of block characters. More... | |
void | DrawBlockEllipseFilled (int x1, int y1, int r1, int r2, const Color &color) |
Draw a filled ellipse made of block characters. More... | |
void | DrawText (int x, int y, const std::string &value) |
Draw a piece of text. More... | |
void | DrawText (int x, int y, const std::string &value, const Color &color) |
Draw a piece of text. More... | |
void | DrawText (int x, int y, const std::string &value, const Stylizer &style) |
Draw a piece of text. More... | |
void | Style (int x, int y, const Stylizer &style) |
Modify a pixel at a given location. More... | |
Definition at line 23 of file canvas.hpp.
Definition at line 33 of file canvas.hpp.
|
default |
Canvas | ( | int | width, |
int | height | ||
) |
Constructor.
width | the width of the canvas. A cell is a 2x4 braille dot. |
height | the height of the canvas. A cell is a 2x4 braille dot. |
Definition at line 87 of file canvas.cpp.
|
inline |
Definition at line 29 of file canvas.hpp.
|
inline |
Definition at line 30 of file canvas.hpp.
Pixel GetPixel | ( | int | x, |
int | y | ||
) | const |
Get the content of a cell.
x | the x coordinate of the cell. |
y | the y coordinate of the cell. |
Definition at line 95 of file canvas.cpp.
void DrawPointOn | ( | int | x, |
int | y | ||
) |
Draw a braille dot.
x | the x coordinate of the dot. |
y | the y coordinate of the dot. |
Definition at line 134 of file canvas.cpp.
void DrawPointOff | ( | int | x, |
int | y | ||
) |
Erase a braille dot.
x | the x coordinate of the dot. |
y | the y coordinate of the dot. |
Definition at line 151 of file canvas.cpp.
void DrawPointToggle | ( | int | x, |
int | y | ||
) |
Toggle a braille dot. A filled one will be erased, and the other will be drawn.
x | the x coordinate of the dot. |
y | the y coordinate of the dot. |
Definition at line 169 of file canvas.cpp.
void DrawPoint | ( | int | x, |
int | y, | ||
bool | value | ||
) |
Draw a braille dot.
x | the x coordinate of the dot. |
y | the y coordinate of the dot. |
value | whether the dot is filled or not. |
Definition at line 104 of file canvas.cpp.
void DrawPoint | ( | int | x, |
int | y, | ||
bool | value, | ||
const Stylizer & | style | ||
) |
Draw a braille dot.
x | the x coordinate of the dot. |
y | the y coordinate of the dot. |
value | whether the dot is filled or not. |
style | the style of the cell. |
Definition at line 122 of file canvas.cpp.
void DrawPoint | ( | int | x, |
int | y, | ||
bool | value, | ||
const Color & | color | ||
) |
Draw a braille dot.
x | the x coordinate of the dot. |
y | the y coordinate of the dot. |
value | whether the dot is filled or not. |
color | the color of the dot. |
Definition at line 113 of file canvas.cpp.
void DrawPointLine | ( | int | x1, |
int | y1, | ||
int | x2, | ||
int | y2 | ||
) |
Draw a line made of braille dots.
x1 | the x coordinate of the first dot. |
y1 | the y coordinate of the first dot. |
x2 | the x coordinate of the second dot. |
y2 | the y coordinate of the second dot. |
Definition at line 188 of file canvas.cpp.
void DrawPointLine | ( | int | x1, |
int | y1, | ||
int | x2, | ||
int | y2, | ||
const Stylizer & | style | ||
) |
Draw a line made of braille dots.
x1 | the x coordinate of the first dot. |
y1 | the y coordinate of the first dot.o |
x2 | the x coordinate of the second dot. |
y2 | the y coordinate of the second dot. |
style | the style of the line. |
Definition at line 209 of file canvas.cpp.
void DrawPointLine | ( | int | x1, |
int | y1, | ||
int | x2, | ||
int | y2, | ||
const Color & | color | ||
) |
Draw a line made of braille dots.
x1 | the x coordinate of the first dot. |
y1 | the y coordinate of the first dot. |
x2 | the x coordinate of the second dot. |
y2 | the y coordinate of the second dot. |
color | the color of the line. |
Definition at line 198 of file canvas.cpp.
void DrawPointCircle | ( | int | x, |
int | y, | ||
int | radius | ||
) |
Draw a circle made of braille dots.
x | the x coordinate of the center of the circle. |
y | the y coordinate of the center of the circle. |
radius | the radius of the circle. |
Definition at line 246 of file canvas.cpp.
void DrawPointCircle | ( | int | x, |
int | y, | ||
int | radius, | ||
const Stylizer & | style | ||
) |
Draw a circle made of braille dots.
x | the x coordinate of the center of the circle. |
y | the y coordinate of the center of the circle. |
radius | the radius of the circle. |
style | the style of the circle. |
Definition at line 265 of file canvas.cpp.
void DrawPointCircle | ( | int | x, |
int | y, | ||
int | radius, | ||
const Color & | color | ||
) |
Draw a circle made of braille dots.
x | the x coordinate of the center of the circle. |
y | the y coordinate of the center of the circle. |
radius | the radius of the circle. |
color | the color of the circle. |
Definition at line 255 of file canvas.cpp.
void DrawPointCircleFilled | ( | int | x, |
int | y, | ||
int | radius | ||
) |
Draw a filled circle made of braille dots.
x | the x coordinate of the center of the circle. |
y | the y coordinate of the center of the circle. |
radius | the radius of the circle. |
Definition at line 273 of file canvas.cpp.
void DrawPointCircleFilled | ( | int | x, |
int | y, | ||
int | radius, | ||
const Stylizer & | style | ||
) |
Draw a filled circle made of braille dots.
x | the x coordinate of the center of the circle. |
y | the y coordinate of the center of the circle. |
radius | the radius of the circle. |
style | the style of the circle. |
Definition at line 295 of file canvas.cpp.
void DrawPointCircleFilled | ( | int | x, |
int | y, | ||
int | radius, | ||
const Color & | color | ||
) |
Draw a filled circle made of braille dots.
x | the x coordinate of the center of the circle. |
y | the y coordinate of the center of the circle. |
radius | the radius of the circle. |
color | the color of the circle. |
Definition at line 282 of file canvas.cpp.
void DrawPointEllipse | ( | int | x, |
int | y, | ||
int | r1, | ||
int | r2 | ||
) |
Draw an ellipse made of braille dots.
x | the x coordinate of the center of the ellipse. |
y | the y coordinate of the center of the ellipse. |
r1 | the radius of the ellipse along the x axis. |
r2 | the radius of the ellipse along the y axis. |
Definition at line 307 of file canvas.cpp.
void DrawPointEllipse | ( | int | x, |
int | y, | ||
int | r1, | ||
int | r2, | ||
const Color & | color | ||
) |
Draw an ellipse made of braille dots.
x | the x coordinate of the center of the ellipse. |
y | the y coordinate of the center of the ellipse. |
r1 | the radius of the ellipse along the x axis. |
r2 | the radius of the ellipse along the y axis. |
color | the color of the ellipse. |
Definition at line 317 of file canvas.cpp.
void DrawPointEllipse | ( | int | x1, |
int | y1, | ||
int | r1, | ||
int | r2, | ||
const Stylizer & | s | ||
) |
Draw an ellipse made of braille dots.
x1 | the x coordinate of the center of the ellipse. |
y1 | the y coordinate of the center of the ellipse. |
r1 | the radius of the ellipse along the x axis. |
r2 | the radius of the ellipse along the y axis. |
s | the style of the ellipse. |
Definition at line 332 of file canvas.cpp.
void DrawPointEllipseFilled | ( | int | x1, |
int | y1, | ||
int | r1, | ||
int | r2 | ||
) |
Draw a filled ellipse made of braille dots.
x1 | the x coordinate of the center of the ellipse. |
y1 | the y coordinate of the center of the ellipse. |
r1 | the radius of the ellipse along the x axis. |
r2 | the radius of the ellipse along the y axis. |
Definition at line 371 of file canvas.cpp.
void DrawPointEllipseFilled | ( | int | x1, |
int | y1, | ||
int | r1, | ||
int | r2, | ||
const Color & | color | ||
) |
Draw a filled ellipse made of braille dots.
x1 | the x coordinate of the center of the ellipse. |
y1 | the y coordinate of the center of the ellipse. |
r1 | the radius of the ellipse along the x axis. |
r2 | the radius of the ellipse along the y axis. |
color | the color of the ellipse. |
Definition at line 381 of file canvas.cpp.
void DrawPointEllipseFilled | ( | int | x1, |
int | y1, | ||
int | r1, | ||
int | r2, | ||
const Stylizer & | s | ||
) |
Draw a filled ellipse made of braille dots.
x1 | the x coordinate of the center of the ellipse. |
y1 | the y coordinate of the center of the ellipse. |
r1 | the radius of the ellipse along the x axis. |
r2 | the radius of the ellipse along the y axis. |
s | the style of the ellipse. |
Definition at line 396 of file canvas.cpp.
void DrawBlockOn | ( | int | x, |
int | y | ||
) |
Draw a block.
x | the x coordinate of the block. |
y | the y coordinate of the block. |
Definition at line 465 of file canvas.cpp.
void DrawBlockOff | ( | int | x, |
int | y | ||
) |
Erase a block.
x | the x coordinate of the block. |
y | the y coordinate of the block. |
Definition at line 485 of file canvas.cpp.
void DrawBlockToggle | ( | int | x, |
int | y | ||
) |
Toggle a block. If it is filled, it will be erased. If it is empty, it will be filled.
x | the x coordinate of the block. |
y | the y coordinate of the block. |
Definition at line 506 of file canvas.cpp.
void DrawBlock | ( | int | x, |
int | y, | ||
bool | value | ||
) |
Draw a block.
x | the x coordinate of the block. |
y | the y coordinate of the block. |
value | whether the block is filled or not. |
Definition at line 435 of file canvas.cpp.
void DrawBlock | ( | int | x, |
int | y, | ||
bool | value, | ||
const Stylizer & | style | ||
) |
Draw a block.
x | the x coordinate of the block. |
y | the y coordinate of the block. |
value | whether the block is filled or not. |
style | the style of the block. |
Definition at line 453 of file canvas.cpp.
void DrawBlock | ( | int | x, |
int | y, | ||
bool | value, | ||
const Color & | color | ||
) |
Draw a block.
x | the x coordinate of the block. |
y | the y coordinate of the block. |
value | whether the block is filled or not. |
color | the color of the block. |
Definition at line 444 of file canvas.cpp.
void DrawBlockLine | ( | int | x1, |
int | y1, | ||
int | x2, | ||
int | y2 | ||
) |
Draw a line made of block characters.
x1 | the x coordinate of the first point of the line. |
y1 | the y coordinate of the first point of the line. |
x2 | the x coordinate of the second point of the line. |
y2 | the y coordinate of the second point of the line. |
Definition at line 528 of file canvas.cpp.
void DrawBlockLine | ( | int | x1, |
int | y1, | ||
int | x2, | ||
int | y2, | ||
const Stylizer & | style | ||
) |
Draw a line made of block characters.
x1 | the x coordinate of the first point of the line. |
y1 | the y coordinate of the first point of the line. |
x2 | the x coordinate of the second point of the line. |
y2 | the y coordinate of the second point of the line. |
style | the style of the line. |
Definition at line 549 of file canvas.cpp.
void DrawBlockLine | ( | int | x1, |
int | y1, | ||
int | x2, | ||
int | y2, | ||
const Color & | color | ||
) |
Draw a line made of block characters.
x1 | the x coordinate of the first point of the line. |
y1 | the y coordinate of the first point of the line. |
x2 | the x coordinate of the second point of the line. |
y2 | the y coordinate of the second point of the line. |
color | the color of the line. |
Definition at line 538 of file canvas.cpp.
void DrawBlockCircle | ( | int | x, |
int | y, | ||
int | radius | ||
) |
Draw a circle made of block characters.
x | the x coordinate of the center of the circle. |
y | the y coordinate of the center of the circle. |
radius | the radius of the circle. |
Definition at line 589 of file canvas.cpp.
void DrawBlockCircle | ( | int | x, |
int | y, | ||
int | radius, | ||
const Stylizer & | style | ||
) |
Draw a circle made of block characters.
x | the x coordinate of the center of the circle. |
y | the y coordinate of the center of the circle. |
radius | the radius of the circle. |
style | the style of the circle. |
Definition at line 608 of file canvas.cpp.
void DrawBlockCircle | ( | int | x, |
int | y, | ||
int | radius, | ||
const Color & | color | ||
) |
Draw a circle made of block characters.
x | the x coordinate of the center of the circle. |
y | the y coordinate of the center of the circle. |
radius | the radius of the circle. |
color | the color of the circle. |
Definition at line 598 of file canvas.cpp.
void DrawBlockCircleFilled | ( | int | x, |
int | y, | ||
int | radius | ||
) |
Draw a filled circle made of block characters.
x | the x coordinate of the center of the circle. |
y | the y coordinate of the center of the circle. |
radius | the radius of the circle. |
Definition at line 616 of file canvas.cpp.
void DrawBlockCircleFilled | ( | int | x, |
int | y, | ||
int | radius, | ||
const Stylizer & | s | ||
) |
Draw a filled circle made of block characters.
x | the x coordinate of the center of the circle. |
y | the y coordinate of the center of the circle. |
radius | the radius of the circle. |
s | the style of the circle. |
Definition at line 638 of file canvas.cpp.
void DrawBlockCircleFilled | ( | int | x, |
int | y, | ||
int | radius, | ||
const Color & | color | ||
) |
Draw a filled circle made of block characters.
x | the x coordinate of the center of the circle. |
y | the y coordinate of the center of the circle. |
radius | the radius of the circle. |
color | the color of the circle. |
Definition at line 625 of file canvas.cpp.
void DrawBlockEllipse | ( | int | x, |
int | y, | ||
int | r1, | ||
int | r2 | ||
) |
Draw an ellipse made of block characters.
x | the x coordinate of the center of the ellipse. |
y | the y coordinate of the center of the ellipse. |
r1 | the radius of the ellipse along the x axis. |
r2 | the radius of the ellipse along the y axis. |
Definition at line 650 of file canvas.cpp.
void DrawBlockEllipse | ( | int | x1, |
int | y1, | ||
int | r1, | ||
int | r2, | ||
const Stylizer & | s | ||
) |
Draw an ellipse made of block characters.
x1 | the x coordinate of the center of the ellipse. |
y1 | the y coordinate of the center of the ellipse. |
r1 | the radius of the ellipse along the x axis. |
r2 | the radius of the ellipse along the y axis. |
s | the style of the ellipse. |
Definition at line 675 of file canvas.cpp.
void DrawBlockEllipse | ( | int | x, |
int | y, | ||
int | r1, | ||
int | r2, | ||
const Color & | color | ||
) |
Draw an ellipse made of block characters.
x | the x coordinate of the center of the ellipse. |
y | the y coordinate of the center of the ellipse. |
r1 | the radius of the ellipse along the x axis. |
r2 | the radius of the ellipse along the y axis. |
color | the color of the ellipse. |
Definition at line 660 of file canvas.cpp.
void DrawBlockEllipseFilled | ( | int | x, |
int | y, | ||
int | r1, | ||
int | r2 | ||
) |
Draw a filled ellipse made of block characters.
x | the x coordinate of the center of the ellipse. |
y | the y coordinate of the center of the ellipse. |
r1 | the radius of the ellipse along the x axis. |
r2 | the radius of the ellipse along the y axis. |
Definition at line 716 of file canvas.cpp.
void DrawBlockEllipseFilled | ( | int | x1, |
int | y1, | ||
int | r1, | ||
int | r2, | ||
const Stylizer & | s | ||
) |
Draw a filled ellipse made of block characters.
x1 | the x coordinate of the center of the ellipse. |
y1 | the y coordinate of the center of the ellipse. |
r1 | the radius of the ellipse along the x axis. |
r2 | the radius of the ellipse along the y axis. |
s | the style of the ellipse. |
Definition at line 741 of file canvas.cpp.
void DrawBlockEllipseFilled | ( | int | x, |
int | y, | ||
int | r1, | ||
int | r2, | ||
const Color & | color | ||
) |
Draw a filled ellipse made of block characters.
x | the x coordinate of the center of the ellipse. |
y | the y coordinate of the center of the ellipse. |
r1 | the radius of the ellipse along the x axis. |
r2 | the radius of the ellipse along the y axis. |
color | the color of the ellipse. |
Definition at line 726 of file canvas.cpp.
void DrawText | ( | int | x, |
int | y, | ||
const std::string & | value | ||
) |
Draw a piece of text.
x | the x coordinate of the text. |
y | the y coordinate of the text. |
value | the text to draw. |
Definition at line 782 of file canvas.cpp.
void DrawText | ( | int | x, |
int | y, | ||
const std::string & | value, | ||
const Color & | color | ||
) |
Draw a piece of text.
x | the x coordinate of the text. |
y | the y coordinate of the text. |
value | the text to draw. |
color | the color of the text. |
Definition at line 791 of file canvas.cpp.
void DrawText | ( | int | x, |
int | y, | ||
const std::string & | value, | ||
const Stylizer & | style | ||
) |
Draw a piece of text.
x | the x coordinate of the text. |
y | the y coordinate of the text. |
value | the text to draw. |
style | the style of the text. |
Definition at line 803 of file canvas.cpp.
void Style | ( | int | x, |
int | y, | ||
const Stylizer & | style | ||
) |
Modify a pixel at a given location.
style | a function that modifies the pixel. |
Definition at line 822 of file canvas.cpp.