[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