Functions

RestScreen

Display a saved screen region to a specified location

Syntax

Signature
void RestScreen( int top, int left, int bottom, int right, const char *screen );

Arguments

top, left, bottom, right Inclusive, zero-based bounds. Use NIL for any edge to select the corresponding screen boundary.

screen Buffer returned by SaveScreen(), or NULL for no restore.

Return value

No return value.

Description

Draw the saved cells at the given screen location. You can restore them to the original location or move them to another rectangle with the same dimensions as the saved region. The dimensions must still match after the bounds are adjusted to the current screen.

The caller keeps ownership of the buffer and can restore it more than once. Release it with `free()` after the last restore. A `NULL` buffer leaves the screen unchanged.

Example

restscreen.c
#include "xdev-wtui.h"
#include "xdev-wtui-box.h"

#include <stdlib.h>

int main( void )
{
   SetPos( 2, 2 );
   DispOut( "Original screen", NULL );
   char *screen = SaveScreen( 1, 1, 5, 30 );

   DispBox( 1, 1, 5, 30, B_DOUBLE, "BG+/B" );
   SetPos( 2, 2 );
   DispOut( "Press a key to restore", NULL );
   Inkey( 0, NIL );

   RestScreen( 1, 1, 5, 30, screen );
   free( screen );

   Inkey( 0, NIL );

   return 0;
}