VT100 Terminal App
Circle VT100 module documentation
Loading...
Searching...
No Matches
CTRenderer Class Reference

Combines Circle framebuffer access with a VT100-aware state machine. More...

#include <TRenderer.h>

Inheritance diagram for CTRenderer:

Classes

struct  TRendererState
 

Public Member Functions

 CTRenderer (void)
 
 ~CTRenderer (void)
 Release renderer resources and buffers.
 
boolean Initialize (void)
 Initialize framebuffer access and Circle device registration.
 
boolean SetFont (const TFont &rFont, CCharGenerator::TFontFlags FontFlags=CCharGenerator::FontFlagsNone)
 Set the font to be used.
 
boolean SetFont (EFontSelection selection, CCharGenerator::TFontFlags FontFlags=CCharGenerator::FontFlagsNone)
 Set the font by selection identifier.
 
TRendererColor MapColor (EColorSelection color)
 Translate a configured color selection into the renderer palette.
 
unsigned GetWidth (void) const
 Query the screen width in pixels.
 
unsigned GetHeight (void) const
 Query the screen height in pixels.
 
unsigned GetColumns (void) const
 Query the screen width in characters.
 
unsigned GetRows (void) const
 Query the screen height in characters.
 
unsigned GetCursorColumn (void) const
 Query the current cursor column (0-based).
 
unsigned GetCursorRow (void) const
 Query the current cursor row (0-based).
 
CBcmFrameBuffer * GetDisplay (void)
 Access the underlying framebuffer device.
 
void ClearDisplay (void)
 Clear entire display area and home the cursor.
 
int Write (const void *pBuffer, size_t nCount) override
 Write characters to screen.
 
void ResetParserState (void)
 Reset ANSI parser state (used by VT tests).
 
void Goto (unsigned nRow, unsigned nColumn)
 Move the cursor to a specific position.
 
void SetPixel (unsigned nPosX, unsigned nPosY, TRendererColor Color)
 Set a pixel to a specific logical color.
 
void SetPixel (unsigned nPosX, unsigned nPosY, CDisplay::TRawColor nColor)
 Set a pixel to a specific raw color.
 
TRendererColor GetPixel (unsigned nPosX, unsigned nPosY)
 Get the color value of a pixel.
 
boolean SetColors (EColorSelection Foreground, EColorSelection Background)
 Set the text colors using logical selections.
 
void SetColors (TRendererColor Foreground=kColorWhite, TRendererColor Background=kColorBlack)
 Set the text colors using explicit renderer colors.
 
void SetCursorBlock (boolean bCursorBlock)
 Enable a block cursor instead of the default underline.
 
void SetBlinkingCursor (boolean bBlinkingCursor, unsigned nPeriodMilliSeconds=500)
 Enable or disable cursor blinking.
 
void Update (void)
 Periodic display maintenance invoked from the task loop.
 
void SetCursorMode (boolean bVisible)
 Enable or disable cursor visibility.
 
void SetVT52Mode (boolean bEnable)
 Enable or disable VT52 emulation mode.
 
void SetAutoPageMode (boolean bEnable)
 Enable or disable automatic page mode (cursor wrap to top).
 
void SetSmoothScrollEnabled (boolean bEnable)
 Enable or disable smooth-scroll animation.
 
boolean GetSmoothScrollEnabled (void) const
 Query whether smooth-scroll animation is enabled.
 
void ForceHideCursor (void)
 Force-hide the cursor and restore underlying pixels.
 
void Run (void) override
 Entry point of the rendering task.
 
void SetRawPixel (unsigned nPosX, unsigned nPosY, CDisplay::TRawColor nColor)
 Set a pixel to a specific raw color.
 
CDisplay::TRawColor GetRawPixel (unsigned nPosX, unsigned nPosY)
 Get the raw color value of a pixel.
 
CDisplay::TColor AdjustBrightness (CDisplay::TColor color, float factor)
 Adjust brightness of a logical color.
 
CDisplay::TRawColor AdjustBrightness565 (CDisplay::TRawColor color, float factor)
 Adjust brightness of a raw RGB565 color.
 
void SetBrightnessScaling (float boldFactor=1.6f, float reverseBackgroundFactor=0.7f, float reverseForegroundFactor=1.25f)
 Set scaling factors for bold and reverse video attributes.
 
void doRenderTest (void)
 Conduct a rendering self-test using various attributes.
 
void SaveState (TRendererState &state)
 Save the current renderer state for later restore.
 
void RestoreState (const TRendererState &state)
 Restore a previously saved renderer state.
 
size_t GetBufferSize (void) const
 Query the size of the internal pixel buffer.
 
void SaveScreenBuffer (void *buffer, size_t bufferSize)
 Save the internal pixel buffer into a caller-provided buffer.
 
void RestoreScreenBuffer (const void *buffer, size_t bufferSize)
 Restore the internal pixel buffer from a caller-provided buffer.
 

Static Public Member Functions

static CTRendererGet (void)
 Access the singleton renderer instance.
 

Static Public Attributes

static constexpr TRendererColor kColorBlack = DISPLAY_COLOR(0, 0, 0)
 
static constexpr TRendererColor kColorWhite = DISPLAY_COLOR(235, 235, 235)
 
static constexpr TRendererColor kColorAmber = DISPLAY_COLOR(255, 176, 0)
 
static constexpr TRendererColor kColorGreen = DISPLAY_COLOR(51, 255, 51)
 

Detailed Description

Combines Circle framebuffer access with a VT100-aware state machine.

CTRenderer implements the full terminal drawing pipeline including escape sequence handling, scrolling regions, cursor updates, and attribute effects. By inheriting from CDevice it can receive bytes directly from the ANSI parser, while inheriting from CTask permits cooperative refresh and cursor blinking without busy waiting.

Constructor & Destructor Documentation

◆ CTRenderer()

CTRenderer::CTRenderer ( void  )

Creates a CTRenderer instance with default font selection VT100Font10x20 and no font flags and white on black colors.

Member Function Documentation

◆ AdjustBrightness()

CDisplay::TColor CTRenderer::AdjustBrightness ( CDisplay::TColor  color,
float  factor 
)

Adjust brightness of a logical color.

Parameters
colorThe logical color to be adjusted.
factorBrightness factor (1.0 = no change, < 1.0 = darker, > 1.0 = brighter).
Returns
The adjusted logical color.

◆ AdjustBrightness565()

CDisplay::TRawColor CTRenderer::AdjustBrightness565 ( CDisplay::TRawColor  color,
float  factor 
)

Adjust brightness of a raw RGB565 color.

Parameters
colorThe raw RGB565 color to be adjusted.
factorBrightness factor (1.0 = no change, < 1.0 = darker, > 1.0 = brighter).
Returns
The adjusted raw RGB565 color.

◆ Get()

CTRenderer * CTRenderer::Get ( void  )
static

Access the singleton renderer instance.

Returns
Pointer to the renderer singleton.

◆ GetColumns()

unsigned CTRenderer::GetColumns ( void  ) const

Query the screen width in characters.

Returns
Width in text columns.

◆ GetDisplay()

CBcmFrameBuffer * CTRenderer::GetDisplay ( void  )

Access the underlying framebuffer device.

Returns
Pointer to the framebuffer.

◆ GetHeight()

unsigned CTRenderer::GetHeight ( void  ) const

Query the screen height in pixels.

Returns
Height in pixels.

◆ GetPixel()

TRendererColor CTRenderer::GetPixel ( unsigned  nPosX,
unsigned  nPosY 
)

Get the color value of a pixel.

Parameters
nPosXX-Position of the pixel (based on 0).
nPosYY-Position of the pixel (based on 0).
Returns
The requested color value (CDisplay::Black if not matches).

◆ GetRawPixel()

CDisplay::TRawColor CTRenderer::GetRawPixel ( unsigned  nPosX,
unsigned  nPosY 
)
inline

Get the raw color value of a pixel.

Parameters
nPosXX-Position of the pixel (based on 0).
nPosYY-Position of the pixel (based on 0).
Returns
The requested raw color value.
Note
This method allows the direct access to the internal buffer.

◆ GetRows()

unsigned CTRenderer::GetRows ( void  ) const

Query the screen height in characters.

Returns
Height in text rows.

◆ GetSmoothScrollEnabled()

boolean CTRenderer::GetSmoothScrollEnabled ( void  ) const
inline

Query whether smooth-scroll animation is enabled.

Returns
TRUE when smooth-scroll animation is enabled.

◆ GetWidth()

unsigned CTRenderer::GetWidth ( void  ) const

Query the screen width in pixels.

Returns
Width in pixels.

◆ Goto()

void CTRenderer::Goto ( unsigned  nRow,
unsigned  nColumn 
)

Move the cursor to a specific position.

Parameters
nRowRow number (based on 0).
nColumnColumn number (based on 0).

◆ Initialize()

boolean CTRenderer::Initialize ( void  )

Initialize framebuffer access and Circle device registration.

Returns
TRUE on success, FALSE otherwise.

◆ MapColor()

TRendererColor CTRenderer::MapColor ( EColorSelection  color)

Translate a configured color selection into the renderer palette.

Parameters
colorLogical color selection enum value.
Returns
Render-specific color value.

◆ SetAutoPageMode()

void CTRenderer::SetAutoPageMode ( boolean  bEnable)

Enable or disable automatic page mode (cursor wrap to top).

Parameters
bEnableTRUE to enable auto page mode, FALSE for normal scrolling.

◆ SetBlinkingCursor()

void CTRenderer::SetBlinkingCursor ( boolean  bBlinkingCursor,
unsigned  nPeriodMilliSeconds = 500 
)

Enable or disable cursor blinking.

Parameters
bBlinkingCursorTRUE to enable blinking.
nPeriodMilliSecondsBlink period in milliseconds.

◆ SetBrightnessScaling()

void CTRenderer::SetBrightnessScaling ( float  boldFactor = 1.6f,
float  reverseBackgroundFactor = 0.7f,
float  reverseForegroundFactor = 1.25f 
)

Set scaling factors for bold and reverse video attributes.

Parameters
boldFactorScaling factor for bold attribute.
reverseBackgroundFactorScaling factor for reverse video background.
reverseForegroundFactorScaling factor for reverse video foreground.

◆ SetColors() [1/2]

boolean CTRenderer::SetColors ( EColorSelection  Foreground,
EColorSelection  Background 
)

Set the text colors using logical selections.

Parameters
ForegroundForeground color selection.
BackgroundBackground color selection.
Returns
TRUE if the colors were applied.

◆ SetColors() [2/2]

void CTRenderer::SetColors ( TRendererColor  Foreground = kColorWhite,
TRendererColor  Background = kColorBlack 
)

Set the text colors using explicit renderer colors.

Parameters
ForegroundForeground color value.
BackgroundBackground color value.

◆ SetCursorBlock()

void CTRenderer::SetCursorBlock ( boolean  bCursorBlock)

Enable a block cursor instead of the default underline.

Parameters
bCursorBlockTRUE to enable block cursor mode.

◆ SetCursorMode()

void CTRenderer::SetCursorMode ( boolean  bVisible)

Enable or disable cursor visibility.

Parameters
bVisibleTRUE to show the cursor.

◆ SetFont() [1/2]

bool CTRenderer::SetFont ( const TFont &  rFont,
CCharGenerator::TFontFlags  FontFlags = CCharGenerator::FontFlagsNone 
)

Set the font to be used.

Parameters
rFontFont to be used for text rendering.
FontFlagsOptional generator font flags.
Returns
TRUE if the font was applied successfully.

◆ SetFont() [2/2]

bool CTRenderer::SetFont ( EFontSelection  selection,
CCharGenerator::TFontFlags  FontFlags = CCharGenerator::FontFlagsNone 
)

Set the font by selection identifier.

Parameters
selectionFont selection identifier.
FontFlagsOptional generator font flags.
Returns
TRUE if the font was applied successfully.

◆ SetPixel() [1/2]

void CTRenderer::SetPixel ( unsigned  nPosX,
unsigned  nPosY,
CDisplay::TRawColor  nColor 
)

Set a pixel to a specific raw color.

Parameters
nPosXX-Position of the pixel (based on 0).
nPosYY-Position of the pixel (based on 0).
nColorThe raw color to be set.

◆ SetPixel() [2/2]

void CTRenderer::SetPixel ( unsigned  nPosX,
unsigned  nPosY,
TRendererColor  Color 
)

Set a pixel to a specific logical color.

Parameters
nPosXX-Position of the pixel (based on 0).
nPosYY-Position of the pixel (based on 0).
ColorThe logical color to be set.

◆ SetRawPixel()

void CTRenderer::SetRawPixel ( unsigned  nPosX,
unsigned  nPosY,
CDisplay::TRawColor  nColor 
)
inline

Set a pixel to a specific raw color.

Parameters
nPosXX-Position of the pixel (based on 0).
nPosYY-Position of the pixel (based on 0).
nColorThe raw color to be set.
Note
This method allows the direct access to the internal buffer.

◆ SetSmoothScrollEnabled()

void CTRenderer::SetSmoothScrollEnabled ( boolean  bEnable)

Enable or disable smooth-scroll animation.

Parameters
bEnableTRUE to enable smooth-scroll animation.

◆ SetVT52Mode()

void CTRenderer::SetVT52Mode ( boolean  bEnable)

Enable or disable VT52 emulation mode.

Parameters
bEnableTRUE to enable VT52 mode, FALSE for ANSI mode.

◆ Write()

int CTRenderer::Write ( const void *  pBuffer,
size_t  nCount 
)
override

Write characters to screen.

Note
Supports several escape sequences (see: doc/screen.txt).
Parameters
pBufferPointer to the characters to be written.
nCountNumber of characters to be written.
Returns
Number of written characters.

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