FTXUI
6.1.9
C++ functional terminal UI.
Toggle main menu visibility
Loading...
Searching...
No Matches
image.hpp
Go to the documentation of this file.
1
// Copyright 2024 Arthur Sonzogni. All rights reserved.
2
// Use of this source code is governed by the MIT license that can be found in
3
// the LICENSE file.
4
#ifndef FTXUI_SCREEN_IMAGE_HPP
5
#define FTXUI_SCREEN_IMAGE_HPP
6
7
#include <string>
// for string, basic_string, allocator
8
#include <vector>
// for vector
9
10
#include "
ftxui/screen/box.hpp
"
// for Box
11
#include "
ftxui/screen/pixel.hpp
"
// for Pixel
12
13
namespace
ftxui
{
14
15
/// @brief A rectangular grid of Pixel.
16
/// @ingroup screen
17
class
Image
{
18
public
:
19
// Constructors:
20
Image
() =
delete
;
21
Image
(
int
dimx
,
int
dimy
);
22
23
// Access a character in the grid at a given position.
24
std::string&
at
(
int
x,
int
y);
25
const
std::string&
at
(
int
x,
int
y)
const
;
26
27
// Access a cell (Pixel) in the grid at a given position.
28
Pixel
&
PixelAt
(
int
x,
int
y);
29
const
Pixel
&
PixelAt
(
int
x,
int
y)
const
;
30
31
// Get screen dimensions.
32
int
dimx
()
const
{
return
dimx_
; }
33
int
dimy
()
const
{
return
dimy_
; }
34
35
// Fill the image with space and default style
36
void
Clear
();
37
38
Box
stencil
;
39
40
protected
:
41
int
dimx_
;
42
int
dimy_
;
43
std::vector<std::vector<Pixel>>
pixels_
;
44
};
45
46
}
// namespace ftxui
47
48
#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