Loading...
Searching...
No Matches
image.hpp
Go to the documentation of this file.
// Copyright 2024 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#ifndef FTXUI_SCREEN_IMAGE_HPP
#define FTXUI_SCREEN_IMAGE_HPP
#include <string> // for string, basic_string, allocator
#include <vector> // for vector
#include "ftxui/screen/box.hpp" // for Box
#include "ftxui/screen/pixel.hpp" // for Pixel
namespace ftxui {
/// @brief A rectangular grid of Pixel.
/// @ingroup screen
class Image {
public:
// Constructors:
Image() = delete;
Image(int dimx, int dimy);
// Access a character in the grid at a given position.
std::string& at(int x, int y);
const std::string& at(int x, int y) const;
// Access a cell (Pixel) in the grid at a given position.
Pixel& PixelAt(int x, int y);
const Pixel& PixelAt(int x, int y) const;
// Get screen dimensions.
int dimx() const { return dimx_; }
int dimy() const { return dimy_; }
// Fill the image with space and default style
void Clear();
Box stencil;
protected:
int dimx_;
int dimy_;
std::vector<std::vector<Pixel>> pixels_;
};
} // namespace ftxui
#endif // FTXUI_SCREEN_IMAGE_HPP
box.hpp
ftxui::Image::dimy
int dimy() const
Definition image.hpp:33
ftxui::Image::dimx_
int dimx_
Definition image.hpp:41
ftxui::Image::PixelAt
Pixel & PixelAt(int x, int y)
Access a cell (Pixel) at a given position.
Definition image.cpp:43
ftxui::Image::at
std::string & at(int x, int y)
Access a character in a cell at a given position.
Definition image.cpp:29
ftxui::Image::Image
Image()=delete
ftxui::Image::stencil
Box stencil
Definition image.hpp:38
ftxui::Image::dimy_
int dimy_
Definition image.hpp:42
ftxui::Image::Clear
void Clear()
Clear all the pixel from the screen.
Definition image.cpp:55
ftxui::Image::dimx
int dimx() const
Definition image.hpp:32
ftxui::Image::pixels_
std::vector< std::vector< Pixel > > pixels_
Definition image.hpp:43
ftxui
Definition animation.hpp:10
pixel.hpp
ftxui::Box
Definition box.hpp:9
ftxui::Pixel
A Unicode character and its associated style.
Definition pixel.hpp:15