canvas.hpp
cstddef
functional
string
unordered_map
ftxui/screen/color.hpp
ftxui/screen/image.hpp
include/ftxui/dom/elements.hpp
src/ftxui/dom/canvas.cpp
include/ftxui/dom/canvas.hpp
ftxui/screen/box.hpp
ftxui/screen/color.hpp
ftxui/screen/image.hpp
ftxui/screen/pixel.hpp
cstddef
cstdint
functional
string
unordered_map
vector
include/ftxui/component/component.hpp
include/ftxui/component/component_base.hpp
include/ftxui/component/component_options.hpp
include/ftxui/component/loop.hpp
include/ftxui/dom/canvas.hpp
include/ftxui/dom/elements.hpp
include/ftxui/dom/table.hpp
src/ftxui/component/button.cpp
src/ftxui/component/catch_event.cpp
src/ftxui/component/checkbox.cpp
src/ftxui/component/collapsible.cpp
src/ftxui/component/component.cpp
src/ftxui/component/component_fuzzer.cpp
src/ftxui/component/component_options.cpp
src/ftxui/component/container.cpp
src/ftxui/component/dropdown.cpp
src/ftxui/component/hoverable.cpp
src/ftxui/component/input.cpp
src/ftxui/component/loop.cpp
src/ftxui/component/maybe.cpp
src/ftxui/component/menu.cpp
src/ftxui/component/modal.cpp
src/ftxui/component/radiobox.cpp
src/ftxui/component/renderer.cpp
src/ftxui/component/resizable_split.cpp
src/ftxui/component/screen_interactive.cpp
src/ftxui/component/slider.cpp
src/ftxui/component/util.cpp
src/ftxui/component/window.cpp
src/ftxui/dom/automerge.cpp
src/ftxui/dom/blink.cpp
src/ftxui/dom/bold.cpp
src/ftxui/dom/border.cpp
src/ftxui/dom/canvas.cpp
src/ftxui/dom/clear_under.cpp
src/ftxui/dom/color.cpp
src/ftxui/dom/composite_decorator.cpp
src/ftxui/dom/dbox.cpp
src/ftxui/dom/dim.cpp
src/ftxui/dom/flex.cpp
src/ftxui/dom/flexbox.cpp
src/ftxui/dom/focus.cpp
src/ftxui/dom/frame.cpp
src/ftxui/dom/gauge.cpp
src/ftxui/dom/graph.cpp
src/ftxui/dom/gridbox.cpp
src/ftxui/dom/hbox.cpp
src/ftxui/dom/hyperlink.cpp
src/ftxui/dom/inverted.cpp
src/ftxui/dom/italic.cpp
src/ftxui/dom/linear_gradient.cpp
src/ftxui/dom/node_decorator.cpp
src/ftxui/dom/node_decorator.hpp
src/ftxui/dom/paragraph.cpp
src/ftxui/dom/reflect.cpp
src/ftxui/dom/scroll_indicator.cpp
src/ftxui/dom/selection.cpp
src/ftxui/dom/selection_style.cpp
src/ftxui/dom/separator.cpp
src/ftxui/dom/size.cpp
src/ftxui/dom/spinner.cpp
src/ftxui/dom/strikethrough.cpp
src/ftxui/dom/table.cpp
src/ftxui/dom/text.cpp
src/ftxui/dom/underlined.cpp
src/ftxui/dom/underlined_double.cpp
src/ftxui/dom/util.cpp
src/ftxui/dom/vbox.cpp
ftxui::Canvas
ftxui::Canvas::Cell
ftxui::Canvas::XY
ftxui::Canvas::XYHash
ftxui

    //Copyright2021ArthurSonzogni.Allrightsreserved.
    //UseofthissourcecodeisgovernedbytheMITlicensethatcanbefoundin
    //theLICENSEfile.
    #ifndefFTXUI_DOM_CANVAS_HPP
    #defineFTXUI_DOM_CANVAS_HPP

    #include<cstddef>//forsize_t
    #include<functional>//forfunction
    #include<string>//forstring
    #include<unordered_map>//forunordered_map

    #include"ftxui/screen/color.hpp"//forColor
    #include"ftxui/screen/image.hpp"//forPixel,Image

    #ifdefDrawText
    //WorkaroundforWinUsr.h(viaWindows.h)definingmacrosthatbreakthings.
    //https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-drawtext
    #undefDrawText
    #endif

    namespaceftxui{

    structCanvas{
    public:
    Canvas()=default;
    Canvas(intwidth,intheight);

    //Getters:
    intwidth()const{returnwidth_;}
    intheight()const{returnheight_;}
    PixelGetPixel(intx,inty)const;

    usingStylizer=std::function<void(Pixel&)>;

    //Drawsusingbraillecharacters--------------------------------------------
    voidDrawPointOn(intx,inty);
    voidDrawPointOff(intx,inty);
    voidDrawPointToggle(intx,inty);
    voidDrawPoint(intx,inty,boolvalue);
    voidDrawPoint(intx,inty,boolvalue,constStylizer&s);
    voidDrawPoint(intx,inty,boolvalue,constColor&color);
    voidDrawPointLine(intx1,inty1,intx2,inty2);
    voidDrawPointLine(intx1,inty1,intx2,inty2,constStylizer&s);
    voidDrawPointLine(intx1,inty1,intx2,inty2,constColor&color);
    voidDrawPointCircle(intx,inty,intradius);
    voidDrawPointCircle(intx,inty,intradius,constStylizer&s);
    voidDrawPointCircle(intx,inty,intradius,constColor&color);
    voidDrawPointCircleFilled(intx,inty,intradius);
    voidDrawPointCircleFilled(intx,inty,intradius,constStylizer&s);
    voidDrawPointCircleFilled(intx,inty,intradius,constColor&color);
    voidDrawPointEllipse(intx,inty,intr1,intr2);
    voidDrawPointEllipse(intx,inty,intr1,intr2,constColor&color);
    voidDrawPointEllipse(intx,inty,intr1,intr2,constStylizer&s);
    voidDrawPointEllipseFilled(intx,inty,intr1,intr2);
    voidDrawPointEllipseFilled(intx,inty,intr1,intr2,constColor&color);
    voidDrawPointEllipseFilled(intx,inty,intr1,intr2,constStylizer&s);

    //Drawusingboxcharacters-------------------------------------------------
    //Blockareofsize1x2.yisconsideredtobeamultipleof2.
    voidDrawBlockOn(intx,inty);
    voidDrawBlockOff(intx,inty);
    voidDrawBlockToggle(intx,inty);
    voidDrawBlock(intx,inty,boolvalue);
    voidDrawBlock(intx,inty,boolvalue,constStylizer&s);
    voidDrawBlock(intx,inty,boolvalue,constColor&color);
    voidDrawBlockLine(intx1,inty1,intx2,inty2);
    voidDrawBlockLine(intx1,inty1,intx2,inty2,constStylizer&s);
    voidDrawBlockLine(intx1,inty1,intx2,inty2,constColor&color);
    voidDrawBlockCircle(intx1,inty1,intradius);
    voidDrawBlockCircle(intx1,inty1,intradius,constStylizer&s);
    voidDrawBlockCircle(intx1,inty1,intradius,constColor&color);
    voidDrawBlockCircleFilled(intx1,inty1,intradius);
    voidDrawBlockCircleFilled(intx1,inty1,intradius,constStylizer&s);
    voidDrawBlockCircleFilled(intx1,inty1,intradius,constColor&color);
    voidDrawBlockEllipse(intx1,inty1,intr1,intr2);
    voidDrawBlockEllipse(intx1,inty1,intr1,intr2,constStylizer&s);
    voidDrawBlockEllipse(intx1,inty1,intr1,intr2,constColor&color);
    voidDrawBlockEllipseFilled(intx1,inty1,intr1,intr2);
    voidDrawBlockEllipseFilled(intx1,
    inty1,
    intr1,
    intr2,
    constStylizer&s);
    voidDrawBlockEllipseFilled(intx1,
    inty1,
    intr1,
    intr2,
    constColor&color);

    //Drawusingnormalcharacters----------------------------------------------
    //Drawusingcharacterofsize2x4atposition(x,y)
    //xisconsideredtobeamultipleof2.
    //yisconsideredtobeamultipleof4.
    voidDrawText(intx,inty,conststd::string&value);
    voidDrawText(intx,inty,conststd::string&value,constColor&color);
    voidDrawText(intx,inty,conststd::string&value,constStylizer&style);

    //Drawusingdirectlypixelsorimages--------------------------------------
    //xisconsideredtobeamultipleof2.
    //yisconsideredtobeamultipleof4.
    voidDrawPixel(intx,inty,constPixel&);
    voidDrawImage(intx,inty,constImage&);

    //Decorator:
    //xisconsideredtobeamultipleof2.
    //yisconsideredtobeamultipleof4.
    voidStyle(intx,inty,constStylizer&style);

    private:
    boolIsIn(intx,inty)const{
    returnx>=0&&x<width_&&y>=0&&y<height_;
    }

    enumCellType{
    kCell,//Unitsofsize2x4
    kBlock,//Unitsofsize2x2
    kBraille,//Unitsofsize1x1
    };

    structCell{
    CellTypetype=kCell;
    Pixelcontent;
    };

    structXY{
    intx;
    inty;
    booloperator==(constXY&other)const{
    returnx==other.x&&y==other.y;
    }
    };

    structXYHash{
    size_toperator()(constXY&xy)const{
    constexprsize_tshift=1024;
    returnsize_t(xy.x)*shift+size_t(xy.y);
    }
    };

    intwidth_=0;
    intheight_=0;
    std::unordered_map<XY,Cell,XYHash>storage_;
    };

    }//namespaceftxui

    #endif//FTXUI_DOM_CANVAS_HPP