[Contents] [index] [Help] [Retrace] [browse <] [Browse >]

User preferences for screen attributes are generally reflected in the
Workbench screen or in the default public screen.  in some cases it may be
useful to create a new screen with the same attributes.

Under V34, information on a screen was available through the
getscreendata() call.  due to extensions in v36 screen and graphics
capabilities, this call is no longer sufficient to completely describe the
display.  Applications should now use a variety of calls; the specific
call depends on the information required.

lockpubscreen() returns a pointer to the screen structure of a specific
screen.  getscreendrawinfo() returns rendering information on the screen,
such as the pen array and font used.  queryoverscan() returns the overscan
information of a specific display mode (for more information, see the
section on "overscan and the display clip").

The example below shows how to use getscreendrawinfo() to examine the
attributes of the Workbench screen so that a new screen with the same
attributes can be created.

    struct DrawInfo *GetScreenDrawInfo( struct Screen * )

The attributes required to clone an existing screen are its width, height,
depth, pens and mode.  The pens and screen depth are available through the
drawinfo structure.  the width and height may be obtained from the screen
structure.  (The width and height may be larger than the overscan area if
the screen is scrollable, and autoscroll may always be enabled as it does
not effect displays smaller than or equal to the overscan area.)

The screen's display mode can be obtained using the graphics library call
getvpmodeid().  this call returns the display id of an existing screen
which can then be used as the data for the sa_displayid tag in
openscreentaglist().  note that the example assumes the screen should be
open to the user's text overscan preference.  If an exact copy of the
display clip of the existing screen is required, use the videocontrol()
command of the graphics library to access the viewportextra structure.

The colors of the screen may be copied using the graphics library calls
getrgb4(), setrgb4(), setrgb4cm() and loadrgb4().  the example code does
not copy the colors.

The example copies the font from the cloned screen.  A reasonable
alternative would be to use the user's preference font, which may be
accessed through the sa_sysfont tag.

     clonescreen.c