nngn
Loading...
Searching...
No Matches
nngn::term::FrameBuffer Class Reference

#include <frame_buffer.h>

Collaboration diagram for nngn::term::FrameBuffer:

Classes

struct  ColoredPixel
 

Public Types

using Flag = nngn::Graphics::TerminalFlag
 
using Mode = nngn::Graphics::TerminalMode
 
using texel4 = Texture::texel4
 

Public Member Functions

 FrameBuffer (Flag f, Mode m)
 
uvec2 size (void) const
 Size of the frame buffer in pixels.
 
std::span< char > span (void)
 Pointer to the content.
 
std::span< char > prefix (void)
 
std::span< char > pixels (void)
 
std::span< char > suffix (void)
 
void resize_and_clear (uvec2 s)
 Changes the size and clears the content according to the mode.
 
void write_ascii (std::size_t x, std::size_t y, Texture::texel4 color)
 Write pixel at {x, y} with color, ASCII output.
 
void write_colored (std::size_t x, std::size_t y, Texture::texel4 color)
 Write pixel at {x, y} with color, colored output.
 
void flip (void)
 Inverts the Y coord.
 
std::size_t dedup (void)
 Eliminates redundant information, possibly reducing the size.
 

Private Member Functions

std::size_t pixel_size (void) const
 

Static Private Member Functions

static constexpr std::size_t prefix_size_from_flags (Flag f)
 

Private Attributes

Flags< Flagflags
 
Mode mode
 
std::vector< char > v = {}
 
std::vector< char > flip_tmp = {}
 
std::size_t prefix_size
 
std::size_t suffix_size
 
uvec2 m_size = {}
 

Member Typedef Documentation

◆ Flag

◆ Mode

◆ texel4

Constructor & Destructor Documentation

◆ FrameBuffer()

nngn::term::FrameBuffer::FrameBuffer ( Flag f,
Mode m )
inline
Here is the call graph for this function:

Member Function Documentation

◆ dedup()

std::size_t nngn::term::FrameBuffer::dedup ( void )

Eliminates redundant information, possibly reducing the size.

Unique elements and the prefix/suffix will be in span(0, dedup()).

Here is the call graph for this function:
Here is the caller graph for this function:

◆ flip()

void nngn::term::FrameBuffer::flip ( void )

Inverts the Y coord.

of all pixels, must be called before dedup.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pixel_size()

std::size_t nngn::term::FrameBuffer::pixel_size ( void ) const
inlineprivate
Here is the caller graph for this function:

◆ pixels()

std::span< char > nngn::term::FrameBuffer::pixels ( void )
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ prefix()

std::span< char > nngn::term::FrameBuffer::prefix ( void )
inline
Here is the caller graph for this function:

◆ prefix_size_from_flags()

std::size_t nngn::term::FrameBuffer::prefix_size_from_flags ( Flag f)
inlinestaticconstexprprivate
Here is the call graph for this function:

◆ resize_and_clear()

void nngn::term::FrameBuffer::resize_and_clear ( uvec2 s)

Changes the size and clears the content according to the mode.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ size()

uvec2 nngn::term::FrameBuffer::size ( void ) const
inline

Size of the frame buffer in pixels.

Here is the caller graph for this function:

◆ span()

std::span< char > nngn::term::FrameBuffer::span ( void )
inline

Pointer to the content.

Here is the caller graph for this function:

◆ suffix()

std::span< char > nngn::term::FrameBuffer::suffix ( void )
inline
Here is the caller graph for this function:

◆ write_ascii()

void nngn::term::FrameBuffer::write_ascii ( std::size_t x,
std::size_t y,
Texture::texel4 color )
inline

Write pixel at {x, y} with color, ASCII output.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_colored()

void nngn::term::FrameBuffer::write_colored ( std::size_t x,
std::size_t y,
Texture::texel4 color )
inline

Write pixel at {x, y} with color, colored output.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ flags

Flags<Flag> nngn::term::FrameBuffer::flags
private

◆ flip_tmp

std::vector<char> nngn::term::FrameBuffer::flip_tmp = {}
private

◆ m_size

uvec2 nngn::term::FrameBuffer::m_size = {}
private

◆ mode

Mode nngn::term::FrameBuffer::mode
private

◆ prefix_size

std::size_t nngn::term::FrameBuffer::prefix_size
private

◆ suffix_size

std::size_t nngn::term::FrameBuffer::suffix_size
private

◆ v

std::vector<char> nngn::term::FrameBuffer::v = {}
private

The documentation for this class was generated from the following files: