FTXUI 6.1.9
C++ functional terminal UI.
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
13namespace ftxui {
14
15/// @brief Una cuadrícula rectangular de píxeles.
16/// @ingroup screen
17class Image {
18 public:
19 // Constructors:
20 Image() = delete;
21 Image(int dimx, int dimy);
22
23 // Destructor:
24 virtual ~Image() = default;
25
26 // Accede a un carácter en la cuadrícula en una posición dada.
27 std::string& at(int x, int y);
28 const std::string& at(int x, int y) const;
29
30 // Accede a una celda (Pixel) en la cuadrícula en una posición dada.
31 Pixel& PixelAt(int x, int y);
32 const Pixel& PixelAt(int x, int y) const;
33
34 // Obtiene las dimensiones de la pantalla.
35 int dimx() const { return dimx_; }
36 int dimy() const { return dimy_; }
37
38 // Rellena la imagen con espacios y estilo predeterminado.
39 void Clear();
40
42
43 protected:
44 int dimx_;
45 int dimy_;
46 std::vector<std::vector<Pixel>> pixels_;
47};
48
49} // namespace ftxui
50
51#endif // FTXUI_SCREEN_IMAGE_HPP
int dimy() const
Definition image.hpp:36
Pixel & PixelAt(int x, int y)
Accede a una celda (Pixel) en una posición dada.
Definition image.cpp:43
std::string & at(int x, int y)
Accede a un caracter en una celda en una posición dada.
Definition image.cpp:29
Image()=delete
Box stencil
Definition image.hpp:41
void Clear()
Borra todos los píxeles de la pantalla.
Definition image.cpp:55
int dimx() const
Definition image.hpp:35
std::vector< std::vector< Pixel > > pixels_
Definition image.hpp:46
virtual ~Image()=default
Una cuadrícula rectangular de píxeles.
Definition image.hpp:17
Box es una estructura que representa un área rectangular en un espacio 2D.
Definition box.hpp:16
Un carácter Unicode y su estilo asociado.
Definition pixel.hpp:15
El espacio de nombres ftxui:: de FTXUI.
Definition animation.hpp:10