Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

TDrawBuffer Class Reference

Implements a video buffer. More...

#include <drawbuf.h>

List of all members.

Public Methods

void moveChar (ushort indent, char c, ushort attr, ushort count)
void moveStr (ushort indent, const char *str, ushort attrs)
void moveCStr (ushort indent, const char *str, ushort attrs)
void moveBuf (ushort indent, const void *source, ushort attr, ushort count)
void putAttribute (ushort indent, ushort attr)
void putChar (ushort indent, ushort c)

Protected Attributes

ushort data [maxViewWidth]


Detailed Description

This class implements a video buffer.

TDrawBuffer implements a simple, non-view buffer class with member functions for moving characters, attributes, and strings to and from a draw buffer.

Every view uses at least one istance of this class in its draw() method. The view draws itself using a TDrawBuffer object. Just before returning from draw(), a call to one of the writeXXXX methods will write the video buffer on the screen.

See also:
TView::draw

Each member of the buffer is an attribute & character pair. The attribute is a byte which stores information about foreground and background colors.

The contents of a draw buffer are typically used with TView::writeBuf() or TView::writeLine() to display text.

See also:
TView::writeChar , TView::writeStr

Note: pay attention to the size of the buffer! It usually stores only a line of the picture. Its default size is maxViewWidth = 132 pairs.

Definition at line 44 of file drawbuf.h.


Member Function Documentation

void TDrawBuffer::moveBuf ( ushort indent,
const void * source,
ushort attr,
ushort count )
 

Writes a text buffer in this video buffer.

`indent' is the character position within the buffer where the data is to go. `source' is a pointer to an array of characters. `attr' is the attribute to be used for all characters (0 to retain the old attribute). `count' is the number of characters to move.

void TDrawBuffer::moveCStr ( ushort indent,
const char * str,
ushort attrs )
 

Writes a string in the buffer.

`indent' is the character position within the buffer where the data is to go. `str' is a pointer to a 0-terminated string of characters to be moved into the buffer. `attrs' is a pair of text attributes to be put into the buffer with each character in the string. Initially the low byte is used, and a `~' in the string toggles between the low byte and the high byte.

void TDrawBuffer::moveChar ( ushort indent,
char c,
ushort attr,
ushort count )
 

Fills the buffer or part of the buffer with an uniform pattern.

`indent' is the character position within the buffer where the data is to go. `c' is the character to be put into the buffer. If `c' is 0 the character is not written and the old character is preserved. `attr' is the attribute to be put into the buffer. If `attr' is 0 the attribute is not written and the old attribute is preserved. `count' is the number of character/attribute pairs to put into the buffer.

void TDrawBuffer::moveStr ( ushort indent,
const char * str,
ushort attrs )
 

Writes a string in the buffer.

`indent' is the character position within the buffer where the data is to go. `str' is a pointer to a 0-terminated string of characters to be moved into the buffer. `attr' is the text attribute to be put into the buffer with each character in the string. If `attr' is 0 the attribute is not written and the old attribute is preserved. The characters in `str' are set in the low bytes of each buffer word.

void TDrawBuffer::putAttribute ( ushort indent,
ushort attr ) [inline]
 

Writes an attribute.

`ident' is the character position within the buffer where the attribute is to go. `attr' is the attribute to write.

Definition at line 125 of file drawbuf.h.

void TDrawBuffer::putChar ( ushort indent,
ushort c ) [inline]
 

Writes a character.

`ident' is the character position within the buffer where the character is to go. `c' is the character to write. This call inserts `c' into the lower byte of the calling buffer.

Definition at line 130 of file drawbuf.h.


Member Data Documentation

ushort TDrawBuffer::data [protected]
 

Defines the array for this draw buffer.

Definition at line 110 of file drawbuf.h.


The documentation for this class was generated from the following file:
Generated at Sat Sep 22 20:19:23 2001 for TVision by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001