Expand/Shrink

save_text_image

Platform: WINDOWS ONLY
Definition: sequence res = save_text_image(sequence top_left, bottom_right)
Description: Save a rectangular region of text from a console screen.

The result is a sequence of sequences containing ASCII characters and attributes from the screen. You can redisplay this text using display_text_image(). The parmeters top_left and bottom_right are 2-element sequences {line, column}, ie {y,x}.
pwa/p2js: Not supported
Comments: Because the character attributes are also saved, the correct foreground color, background color and other properties for each character are restored by a later display_text_image(res).

An attribute byte is made up of two 4-bit fields that encode the foreground and background color of a character.
The high-order 4 bits determine the background color, while the low-order 4 bits determine the foreground color.

You might use this function in a text-mode (console) interface to save a portion of the screen before displaying a drop-down menu, dialog box, alert box etc.

On DOS32, if you are flipping video pages, note that this function reads from the current active page.
Example: If the top 2 lines of the screen have:

     Hello
     World
 

And you execute:

s = save_text_image({1,1}, {2,5})

Then s is something like:

    {"H-e-l-l-o-",
     "W-o-r-l-d-"}

where '-' indicates the attribute bytes
Implementation: See builtins\pscreen.e (an autoinclude) for details of the actual implementation.
See Also: display_text_image, get_screen_char