image.cpp
sstream
string
vector
ftxui/screen/image.hpp
ftxui/screen/pixel.hpp
ftxui/screen/box.hpp
ftxui/screen/color.hpp
ftxui/screen/image.hpp
ftxui/screen/pixel.hpp
src/ftxui/screen/image.cpp
cstdint
sstream
string
vector
ftxui

    //Copyright2020ArthurSonzogni.Allrightsreserved.
    //UseofthissourcecodeisgovernedbytheMITlicensethatcanbefoundin
    //theLICENSEfile.
    #include<sstream>//IWYUpragma:keep
    #include<string>
    #include<vector>

    #include"ftxui/screen/image.hpp"
    #include"ftxui/screen/pixel.hpp"

    namespaceftxui{

    namespace{
    Pixel&dev_null_pixel(){
    staticPixelpixel;
    returnpixel;
    }
    }//namespace

    Image::Image(intdimx,intdimy)
    :stencil{0,dimx-1,0,dimy-1},
    dimx_(dimx),
    dimy_(dimy),
    pixels_(dimy,std::vector<Pixel>(dimx)){}

    ///@briefAccessacharacterinacellatagivenposition.
    ///@paramxThecellpositionalongthex-axis.
    ///@paramyThecellpositionalongthey-axis.
    std::string&Image::at(intx,inty){
    returnPixelAt(x,y).character;
    }

    ///@briefAccessacharacterinacellatagivenposition.
    ///@paramxThecellpositionalongthex-axis.
    ///@paramyThecellpositionalongthey-axis.
    conststd::string&Image::at(intx,inty)const{
    returnPixelAt(x,y).character;
    }

    ///@briefAccessacell(Pixel)atagivenposition.
    ///@paramxThecellpositionalongthex-axis.
    ///@paramyThecellpositionalongthey-axis.
    Pixel&Image::PixelAt(intx,inty){
    returnstencil.Contain(x,y)?pixels_[y][x]:dev_null_pixel();
    }

    ///@briefAccessacell(Pixel)atagivenposition.
    ///@paramxThecellpositionalongthex-axis.
    ///@paramyThecellpositionalongthey-axis.
    constPixel&Image::PixelAt(intx,inty)const{
    returnstencil.Contain(x,y)?pixels_[y][x]:dev_null_pixel();
    }

    ///@briefClearallthepixelfromthescreen.
    voidImage::Clear(){
    for(auto&line:pixels_){
    for(auto&cell:line){
    cell=Pixel();
    }
    }
    }

    }//namespaceftxui