NAME

TDrawBuffer - temporary line buffer for screen output

HIERARCHY

TDrawBuffer (value type)
  used by TView drawing methods

SYNOPSIS

use TUI::Views;

my $buffer = TDrawBuffer->new;

$buffer->moveStr(
  0,
  'Financial Results for FY1991',
  $view->getColor(1)
);

$view->writeLine(1, 3, 28, 1, $buffer);

DESCRIPTION

TDrawBuffer represents a temporary buffer for rendering a single line of screen output. Each entry in the buffer stores both a character value and a display attribute.

This type is a lightweight value type and is not derived from TObject. Internally, it corresponds to an array of fixed width, where each element combines a character and its visual attributes.

TDrawBuffer is primarily used inside TView drawing routines. Text and attributes are written into the buffer using helper methods, and the buffer is then passed to TView methods such as writeLine or writeBuf to render the output on screen.

CONSTRUCTOR

new

my $buffer = TDrawBuffer->new();

Creates a new, empty draw buffer with a width equal to the maximum view width.

METHODS

moveBuf

$buffer->moveBuf($indent, \@source, $attr | undef, $count);

Copies character data from @source into the draw buffer.

Source elements may be Unicode codepoints, legacy packed screen-cell values (short), or TScreenCell objects.

If $attr is defined, it overrides any attribute information present in the source data.

Otherwise, attribute information is taken from the source element when available (either from a legacy packed screen-cell value or from a TScreenCell object).

moveChar

$buffer->moveChar($indent, $char | undef, $attr | undef, $count);

Writes a repeated character (undef to retain the already present characters) into the buffer using the given attribute (undef to retain the already present attributes).

Note: If both $char and $attr are undef, the attributes are retained but the characters are not.

moveCStr

my $num = $buffer->moveCStr($indent, $string, $attrs);

Writes a string containing Turbo Vision style tilde markers into the buffer, applying the specified attributes.

Returns the number of cells in the buffer that were actually updated.

moveStr

my $num = $buffer->moveStr($indent, $string, $attr | undef);

Writes a plain string into the buffer starting at the specified position and applies the given attributes.

Returns the number of cells in the buffer that were actually updated.

putAttribute

$buffer->putAttribute($index, $attr);

Sets the display attribute at the specified buffer position.

putChar

$buffer->putChar($index, $char);

Sets the character value at the specified buffer position.

SEE ALSO

TView, TWindow

AUTHORS

  • Borland International (original Turbo Vision design)

  • J. Schneider <brickpool@cpan.org> (Perl implementation and maintenance)

CONTRIBUTORS

  • magiblot <magiblot@hotmail.com>

COPYRIGHT AND LICENSE

Copyright (c) 1990-1994, 1997 by Borland International

Copyright (c) 2019-2026 the "AUTHORS" and "CONTRIBUTORS" as listed above.

This software is licensed under the MIT license (see the LICENSE file, which is part of the distribution).