💻 TermColor User Manual
Classes | Public Member Functions | Static Public Attributes | Package Functions | Static Package Functions | Static Package Attributes | Properties | List of all members
TermColor.Win32TermBuffer Class Reference
Inheritance diagram for TermColor.Win32TermBuffer:
Inheritance graph
[legend]
Collaboration diagram for TermColor.Win32TermBuffer:
Collaboration graph
[legend]

Classes

struct  CharAttributes
 
struct  CharInfo
 
struct  CharUnion
 
struct  Coord
 
struct  SmallRect
 

Public Member Functions

 Win32TermBuffer (int width, int height)
 
void Clear ()
 
void Clear< TColorValue > (char c, in TColorValue foreground, in TColorValue background)
 
void SetChar (int x, int y, char ch)
 
void SetForeground< TColorValue > (int x, int y, in TColorValue color)
 
void SetBackground< TColorValue > (int x, int y, in TColorValue color)
 
void Flush (TextWriter output)
 
void Flush (TextWriter output, int offsetX, int offsetY)
 
- Public Member Functions inherited from TermColor.ITerminalBuffer
void SetPoint< TColorValue > (int x, int y, char ch, in TColorValue foreground, in TColorValue background)
 

Static Public Attributes

const int STD_OUTPUT_HANDLE = -11
 
const uint ENABLE_VIRTUAL_TERMINAL_PROCESSING = 4
 

Package Functions

static IntPtr GetStdHandle (int nStdHandle)
 
static SafeFileHandle CreateFile (string fileName, [MarshalAs(UnmanagedType.U4)] uint fileAccess, [MarshalAs(UnmanagedType.U4)] uint fileShare, IntPtr securityAttributes, [MarshalAs(UnmanagedType.U4)] FileMode creationDisposition, [MarshalAs(UnmanagedType.U4)] int flags, IntPtr template)
 
static bool WriteConsoleOutput (SafeFileHandle hConsoleOutput, CharInfo[] lpBuffer, Coord dwBufferSize, Coord dwBufferCoord, ref SmallRect lpWriteRegion)
 
static bool SetConsoleMode (IntPtr hConsoleHandle, uint dwMode)
 
static bool GetConsoleMode (IntPtr hConsoleHandle, out uint lpMode)
 

Static Package Functions

static void EnableVTProcessing ()
 

Static Package Attributes

static bool EnableVTProcessingThrows = true
 

Properties

int Length [get]
 
int Width [get]
 
int Height [get]
 
- Properties inherited from TermColor.ITerminalBuffer
int Width [get]
 
int Height [get]
 

Detailed Description

Text buffer capable of storing color data. Supports only 16 color mode. Data internally represented as a binary structure ready to be passed to Windows Console API. Outputs colored text via Windows Console API.

Constructor & Destructor Documentation

◆ Win32TermBuffer()

TermColor.Win32TermBuffer.Win32TermBuffer ( int  width,
int  height 
)
inline

Creates new ConsoleBuffer with given size.

Member Function Documentation

◆ Clear()

void TermColor.Win32TermBuffer.Clear ( )

Fill the buffer with empty characters and default colors.

Implements TermColor.ITerminalBuffer.

◆ Clear< TColorValue >()

void TermColor.Win32TermBuffer.Clear< TColorValue > ( char  c,
in TColorValue  foreground,
in TColorValue  background 
)
inline

Fill the buffer with given (char, IColor, IColor) tuple.

Template Parameters
TColorValueType of the color.
Parameters
cThe character to clear with.
foregroundForeground color.
backgroundBackground color.

Implements TermColor.ITerminalBuffer.

Type Constraints
TColorValue :IColor 

◆ Flush() [1/2]

void TermColor.Win32TermBuffer.Flush ( TextWriter  output)
inline

Forward the contents of the buffer to an output device. Win32TermBuffer can output only to Windows Console, therefore the device must be Console.Out.

Parameters
outputForward the contents of the buffer to an output device. Must be Console.Out, otherwise exception is thrown.
Exceptions
ArgumentException

Implements TermColor.ITerminalBuffer.

◆ Flush() [2/2]

void TermColor.Win32TermBuffer.Flush ( TextWriter  output,
int  offsetX,
int  offsetY 
)
inline

Forward the contents of the buffer to an output device at a specific offset. Win32TermBuffer can output only to Windows Console, therefore the device must be Console.Out.

Parameters
outputForward the contents of the buffer to an output device at a specific offset. Must be Console.Out, otherwise exception is thrown.
Exceptions
ArgumentException

Implements TermColor.ITerminalBuffer.

◆ SetBackground< TColorValue >()

void TermColor.Win32TermBuffer.SetBackground< TColorValue > ( int  x,
int  y,
in TColorValue  color 
)
inline

Write background color to one point in the buffer. Rows and columns are numbered from the top left starting at zero.

Parameters
xColumn number.
yRow number.
backgroundBackground color of the character.

Implements TermColor.ITerminalBuffer.

Type Constraints
TColorValue :IColor 

◆ SetChar()

void TermColor.Win32TermBuffer.SetChar ( int  x,
int  y,
char  ch 
)
inline

Write a character to one point in the buffer. Rows and columns are numbered from the top left starting at zero.

Parameters
xColumn number.
yRow number.
chThe character to write.

Implements TermColor.ITerminalBuffer.

◆ SetForeground< TColorValue >()

void TermColor.Win32TermBuffer.SetForeground< TColorValue > ( int  x,
int  y,
in TColorValue  color 
)
inline

Write foreground color to one point in the buffer. Rows and columns are numbered from the top left starting at zero.

Parameters
xColumn number.
yRow number.
foregroundForeground color of the character.

Implements TermColor.ITerminalBuffer.

Type Constraints
TColorValue :IColor 

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