ftxui::Canvas
#include <ftxui/dom/canvas.hpp>Examples: component/canvas_animated, dom/canvas
Summary
| Symbol | Description |
|---|---|
Stylizer | |
Canvas | |
width | |
height | |
GetPixel | Get the content of a cell. |
DrawPointOn | Draw a braille dot. |
DrawPointOff | Erase a braille dot. |
DrawPointToggle | Toggle a braille dot. A filled one will be erased, and the other will be drawn. |
DrawPoint | Draw a braille dot. |
DrawPointLine | Draw a line made of braille dots. |
DrawPointCircle | Draw a circle made of braille dots. |
DrawPointCircleFilled | Draw a filled circle made of braille dots. |
DrawPointEllipse | Draw an ellipse made of braille dots. |
DrawPointEllipseFilled | Draw a filled ellipse made of braille dots. |
DrawBlockOn | Draw a block. |
DrawBlockOff | Erase a block. |
DrawBlockToggle | Toggle a block. If it is filled, it will be erased. If it is empty, it will be filled. |
DrawBlock | Draw a block. |
DrawBlockLine | Draw a line made of block characters. |
DrawBlockCircle | Draw a circle made of block characters. |
DrawBlockCircleFilled | Draw a filled circle made of block characters. |
DrawBlockEllipse | Draw an ellipse made of block characters. |
DrawBlockEllipseFilled | Draw a filled ellipse made of block characters. |
DrawText | Draw a piece of text. |
DrawPixel | Directly draw a predefined pixel at the given coordinate. |
DrawImage | Draw a predefined image, with top-left corner at the given coordinate You can supply negative coordinates to align the image however you like - only the 'visible' portion will be drawn. |
Style | Modify a pixel at a given location. |
Public Types
Stylizer
Public Member Functions
Canvas
Canvas();Examples: component/canvas_animated, dom/canvas
Canvas
Canvas(int width, int height);Constructor.
Parameters:
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.
Examples: component/canvas_animated, dom/canvas
width
int width() const;height
int height() const;GetPixel
Get the content of a cell.
Parameters:
x: the x coordinate of the cell.y: the y coordinate of the cell.
DrawPointOn
void DrawPointOn(int x, int y);Draw a braille dot.
Parameters:
x: the x coordinate of the dot.y: the y coordinate of the dot.
DrawPointOff
void DrawPointOff(int x, int y);Erase a braille dot.
Parameters:
x: the x coordinate of the dot.y: the y coordinate of the dot.
DrawPointToggle
void DrawPointToggle(int x, int y);Toggle a braille dot. A filled one will be erased, and the other will be drawn.
Parameters:
x: the x coordinate of the dot.y: the y coordinate of the dot.
DrawPoint
void DrawPoint(int x, int y, bool value);Draw a braille dot.
Parameters:
x: the x coordinate of the dot.y: the y coordinate of the dot.value: whether the dot is filled or not.
DrawPoint
Draw a braille dot.
Parameters:
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.
DrawPoint
Draw a braille dot.
Parameters:
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.
DrawPointLine
void DrawPointLine(int x1, int y1, int x2, int y2);Draw a line made of braille dots.
Parameters:
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.
DrawPointLine
void DrawPointLine(int x1, int y1, int x2, int y2, const Stylizer & s);Draw a line made of braille dots.
Parameters:
x1: the x coordinate of the first dot.y1: the y coordinate of the first dot.ox2: the x coordinate of the second dot.y2: the y coordinate of the second dot.style: the style of the line.
DrawPointLine
void DrawPointLine(int x1, int y1, int x2, int y2, const Color & color);Draw a line made of braille dots.
Parameters:
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.
DrawPointCircle
void DrawPointCircle(int x, int y, int radius);Draw a circle made of braille dots.
Parameters:
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.
DrawPointCircle
void DrawPointCircle(int x, int y, int radius, const Stylizer & s);Draw a circle made of braille dots.
Parameters:
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.
DrawPointCircle
void DrawPointCircle(int x, int y, int radius, const Color & color);Draw a circle made of braille dots.
Parameters:
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.
DrawPointCircleFilled
void DrawPointCircleFilled(int x, int y, int radius);Draw a filled circle made of braille dots.
Parameters:
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.
DrawPointCircleFilled
void DrawPointCircleFilled(int x, int y, int radius, const Stylizer & s);Draw a filled circle made of braille dots.
Parameters:
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.
DrawPointCircleFilled
void DrawPointCircleFilled(int x, int y, int radius, const Color & color);Draw a filled circle made of braille dots.
Parameters:
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.
DrawPointEllipse
void DrawPointEllipse(int x, int y, int r1, int r2);Draw an ellipse made of braille dots.
Parameters:
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.
DrawPointEllipse
void DrawPointEllipse(int x, int y, int r1, int r2, const Color & color);Draw an ellipse made of braille dots.
Parameters:
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.
DrawPointEllipse
void DrawPointEllipse(int x, int y, int r1, int r2, const Stylizer & s);Draw an ellipse made of braille dots.
Parameters:
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.
DrawPointEllipseFilled
void DrawPointEllipseFilled(int x, int y, int r1, int r2);Draw a filled ellipse made of braille dots.
Parameters:
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.
DrawPointEllipseFilled
void DrawPointEllipseFilled(int x, int y, int r1, int r2, const Color & color);Draw a filled ellipse made of braille dots.
Parameters:
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.
DrawPointEllipseFilled
void DrawPointEllipseFilled(int x, int y, int r1, int r2, const Stylizer & s);Draw a filled ellipse made of braille dots.
Parameters:
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.
DrawBlockOn
void DrawBlockOn(int x, int y);Draw a block.
Parameters:
x: the x coordinate of the block.y: the y coordinate of the block.
DrawBlockOff
void DrawBlockOff(int x, int y);Erase a block.
Parameters:
x: the x coordinate of the block.y: the y coordinate of the block.
DrawBlockToggle
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.
Parameters:
x: the x coordinate of the block.y: the y coordinate of the block.
DrawBlock
void DrawBlock(int x, int y, bool value);Draw a block.
Parameters:
x: the x coordinate of the block.y: the y coordinate of the block.value: whether the block is filled or not.
DrawBlock
Draw a block.
Parameters:
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.
DrawBlock
Draw a block.
Parameters:
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.
DrawBlockLine
void DrawBlockLine(int x1, int y1, int x2, int y2);Draw a line made of block characters.
Parameters:
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.
DrawBlockLine
void DrawBlockLine(int x1, int y1, int x2, int y2, const Stylizer & s);Draw a line made of block characters.
Parameters:
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.
DrawBlockLine
void DrawBlockLine(int x1, int y1, int x2, int y2, const Color & color);Draw a line made of block characters.
Parameters:
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.
DrawBlockCircle
void DrawBlockCircle(int x1, int y1, int radius);Draw a circle made of block characters.
Parameters:
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.
DrawBlockCircle
void DrawBlockCircle(int x1, int y1, int radius, const Stylizer & s);Draw a circle made of block characters.
Parameters:
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.
DrawBlockCircle
void DrawBlockCircle(int x1, int y1, int radius, const Color & color);Draw a circle made of block characters.
Parameters:
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.
DrawBlockCircleFilled
void DrawBlockCircleFilled(int x1, int y1, int radius);Draw a filled circle made of block characters.
Parameters:
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.
DrawBlockCircleFilled
void DrawBlockCircleFilled(int x1, int y1, int radius, const Stylizer & s);Draw a filled circle made of block characters.
Parameters:
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.
DrawBlockCircleFilled
void DrawBlockCircleFilled(int x1, int y1, int radius, const Color & color);Draw a filled circle made of block characters.
Parameters:
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.
DrawBlockEllipse
void DrawBlockEllipse(int x1, int y1, int r1, int r2);Draw an ellipse made of block characters.
Parameters:
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.
DrawBlockEllipse
void DrawBlockEllipse(int x1, int y1, int r1, int r2, const Stylizer & s);Draw an ellipse made of block characters.
Parameters:
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.
DrawBlockEllipse
void DrawBlockEllipse(int x1, int y1, int r1, int r2, const Color & color);Draw an ellipse made of block characters.
Parameters:
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.
DrawBlockEllipseFilled
void DrawBlockEllipseFilled(int x1, int y1, int r1, int r2);Draw a filled ellipse made of block characters.
Parameters:
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.
DrawBlockEllipseFilled
void DrawBlockEllipseFilled(int x1, int y1, int r1, int r2, const Stylizer & s);Draw a filled ellipse made of block characters.
Parameters:
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.
DrawBlockEllipseFilled
void DrawBlockEllipseFilled(int x1, int y1, int r1, int r2, const Color & color);Draw a filled ellipse made of block characters.
Parameters:
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.
DrawText
void DrawText(int x, int y, const std::string & value);Draw a piece of text.
Parameters:
x: the x coordinate of the text.y: the y coordinate of the text.value: the text to draw.
DrawText
Draw a piece of text.
Parameters:
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.
DrawText
Draw a piece of text.
Parameters:
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.
DrawPixel
Directly draw a predefined pixel at the given coordinate.
Parameters:
x: the x coordinate of the pixel.y: the y coordinate of the pixel.p: the pixel to draw.
DrawImage
Draw a predefined image, with top-left corner at the given coordinate You can supply negative coordinates to align the image however you like - only the 'visible' portion will be drawn.
Parameters:
x: the x coordinate corresponding to the top-left corner of the image.y: the y coordinate corresponding to the top-left corner of the image.image: the image to draw.
Style
Modify a pixel at a given location.
Parameters:
style: a function that modifies the pixel.