In this section:
Sometimes, it is useful to build up graphics information in memory, rather than on the screen. For example, such information might be subsequently copied to the screen at several locations, or written to a file. A complex drawing could be built up off screen whilst displaying other information. When complete, the drawing can be displayed.
In ClearWin+ there are two approaches to this issue each with its own set of routines. The first creates an internal drawing surface using CREATE_GRAPHICS_REGION@ and is described below. The other approach uses what is called a virtual screen and is described in the ClearWin+ User's Supplement. Mixing routines from the two sets may not produce the desired result.
An internal drawing surface uses the following set of routines together with the DIB routines listed in the section in Drawing device independent bitmaps.
Copies from one designated surface to another.
Creates a drawing surface of a given size. Use NEW_GRAPHICS_REGION@ to also specify the size.
Releases the memory for a drawing surface.
Copies a surface to the clipboard.
Scrolls a drawing surface.
Selects an existing drawing surface.
Here is a short program that creates a drawing surface using CREATE_GRAPHICS_REGION@, selects the surface by using SELECT_GRAPHICS_OBJECT@ copies a bitmap and writes a message into it. The current screen area is then selected by another call to SELECT_GRAPHICS_OBJECT@ allowing subsequent graphics drawing to be directed to the screen. When a button is clicked the internal surface is copied to the screen using COPY_GRAPHICS_REGION@.
CALL draw_characters@('This was drawn off screen',
CALL draw_characters@('This was drawn to a window',
i=winio@('%bt[Show Off-Screen Block]')