Terminal Graphics
Single-file, header-only C++20 functionality for producing graphics on the terminal using the sixel protocol
Loading...
Searching...
No Matches
TG::Image< ValueType > Class Template Reference

A simple class to hold a 2D image using datatype specified as ValueType template parameter. More...

Public Member Functions

 Image (int x_dim, int y_dim)
 Instantiate an Image with the specified dimensions.
 
int width () const
 query image dimensions
 
int height () const
 
ValueType & operator() (int x, int y)
 query or set intensity at coordinates (x,y)
 
const ValueType & operator() (int x, int y) const
 query intensity at coordinates (x,y)
 
void clear ()
 clear image, setting all intensities to 0
 

Detailed Description

template<typename ValueType>
class TG::Image< ValueType >

A simple class to hold a 2D image using datatype specified as ValueType template parameter.

Constructor & Destructor Documentation

◆ Image()

template<typename ValueType>
TG::Image< ValueType >::Image ( int x_dim,
int y_dim )
inline

Instantiate an Image with the specified dimensions.

Member Function Documentation

◆ width()

template<typename ValueType>
int TG::Image< ValueType >::width ( ) const
inline

query image dimensions

◆ height()

template<typename ValueType>
int TG::Image< ValueType >::height ( ) const
inline

◆ operator()() [1/2]

template<typename ValueType>
ValueType & TG::Image< ValueType >::operator() ( int x,
int y )
inline

query or set intensity at coordinates (x,y)

◆ operator()() [2/2]

template<typename ValueType>
const ValueType & TG::Image< ValueType >::operator() ( int x,
int y ) const
inline

query intensity at coordinates (x,y)

◆ clear()

template<typename ValueType>
void TG::Image< ValueType >::clear ( )
inline

clear image, setting all intensities to 0