RasterView class
#include <nxt/raster.hpp>
Non-owning view into raster storage. This is the primary working type for all rendering operations. Views can create sub-views (subraster) for hierarchical layout.
Constructors, destructors, conversion operators
-
RasterView(glyph_
view_ t glyphs, color_ view_ t fgs, color_ view_ t bgs, emphasis_ view_ t ems, GlyphTable& glyph_table) noexcept - Construct from mdspan views and glyph table.
Public functions
- auto bgs() const → auto
-
auto bgs_2d() const → color_
view_ t noexcept - auto ems() const → auto
-
auto ems_2d() const → emphasis_
view_ t noexcept - auto extent() const → Size noexcept
- auto fgs() const → auto
-
auto fgs_2d() const → color_
view_ t noexcept -
auto get_cell(Pos pos) const → std::
optional<Cell> noexcept - Get cell data. Returns nullopt if out of bounds.
- auto glyph_table() const → GlyphTable& noexcept
- Access glyph table.
- auto glyphs() const → auto
- Flat ranges for algorithms (row-major order)
-
auto glyphs_2d() const → glyph_
view_ t noexcept - 2D mdspan views for direct access
-
auto height() const → height_
t noexcept - void set_bg(Pos pos, Rgba8 color) const noexcept
- Set background color at position.
- void set_char(Pos pos, char c) const noexcept
- Convenience: set ASCII character.
- void set_em(Pos pos, Emphasis em) const noexcept
- Set emphasis at position.
- void set_fg(Pos pos, Rgba8 color) const noexcept
- Set foreground color at position.
-
void set_glyph(Pos pos,
GlyphTable::
GlyphId gid) const noexcept - Set glyph at position. Silently ignores out-of-bounds.
- auto subraster(Pos origin, Size size) const → RasterView noexcept
-
auto width() const → width_
t noexcept - Dimensions.
-
auto write_text(Pos pos,
std::
string_view text) const → col_ t noexcept - Write UTF-8 text. Returns ending column position.
Function documentation
RasterView nxt:: RasterView:: subraster(Pos origin,
Size size) const noexcept
Create a sub-view of a rectangular region. Coordinates are relative to this view.