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.
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@.
INTEGER i,ictrl,width,depth,ierr,hdib< BR> INTEGER g_handle,r_handle,white<BR> PARAMETER (g_handle=7,r_handle=8)
CALL draw_characters@('This was drawn off screen',
CALL draw_characters@('This was drawn to a window',
i=winio@('%bt[Show Off-Screen Block]')