23#define KTECH_DEFINITION
24#include "../ktech.hpp"
25#undef KTECH_DEFINITION
26#include "../basic/point.hpp"
27#include "../basic/upoint.hpp"
28#include "../basic/rgba.hpp"
29#include "../basic/cella.hpp"
55 std::vector<CellA>
m_t;
61 auto File(
const std::filesystem::path& filePath) ->
Texture&;
62 auto File(
const std::filesystem::path& filePath,
Point relativePosition) ->
Texture&;
63 auto Write(
const std::vector<std::string>& stringVector,
RGBA foreground,
RGBA background) ->
Texture&;
64 auto Write(
const std::vector<std::string>& stringVector,
RGBA foreground,
RGBA background,
Point relativePosition) ->
Texture&;
75 void ExportToFile(
const std::filesystem::path& filePath)
const;
Like Cell, but with RGBA foreground and background colors, instead of RGB.
Definition cella.hpp:32
2D vector, mostly used to store positions and directions.
Definition point.hpp:30
Like RGB, but also has an alpha channel representing transparency.
Definition rgba.hpp:30
A CellA-based sprite.
Definition texture.hpp:48
Point m_rPos
Position relative to the parent Object or Widget.
Definition texture.hpp:53
void Print() const
Print the Texture to the terminal (complex Textures only).
Definition texture.cpp:406
auto Write(const std::vector< std::string > &stringVector, RGBA foreground, RGBA background) -> Texture &
Write a complex Texture from a vector of strings.
Definition texture.cpp:172
auto operator()(size_t x, size_t y) -> CellA &
Get a value from the 2D bitmap by-reference (complex Textures only).
Definition texture.cpp:268
UPoint m_size
Rectangle size (used in both simple and complex Textures).
Definition texture.hpp:54
auto Null() -> Texture &
Create a complex Texture that represents a missing Texture.
Definition texture.cpp:232
std::vector< CellA > m_t
1D vector of the 2D bitmap (used only in complex Textures).
Definition texture.hpp:55
CellA m_value
Uniform value (applies only to simple Textures).
Definition texture.hpp:52
void ExportToFile(const std::filesystem::path &filePath) const
Export Texture to a file (complex Textures only).
Definition texture.cpp:386
auto Transform(const std::function< void(CellA &)> &operation, UPoint from=UPoint(0, 0), UPoint to=UPoint(0, 0)) -> Texture &
Transform the Texture using a operation callback function (whether simple or complex).
Definition texture.cpp:341
auto Resize(UPoint size, CellA newValue=CellA(' ', RGBA(0, 0, 0, 0), RGBA(0, 0, 0, 0))) -> Texture &
Resize the Texture (whether simple or complex).
Definition texture.cpp:299
auto File(const std::filesystem::path &filePath) -> Texture &
Import a complex Texture from file.
Definition texture.cpp:111
bool m_simple
true means simple, false means complex.
Definition texture.hpp:51
bool m_active
Activation status: true means enabled. false means disabled, and will be skipped in rendering.
Definition texture.hpp:49
auto Simple(UPoint size, CellA value) -> Texture &
Create a simple Texture (uniform rectangle).
Definition texture.cpp:38
auto Rectangle(UPoint size, CellA value) -> Texture &
Create a complex Texture that is a uniform rectangle.
Definition texture.cpp:70
Unsigned 2D vector, mostly used to store sizes and 2D indexes.
Definition upoint.hpp:29