Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ push_state(3G) — HP-UX 9.10

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

sbdl(3G)

cond_execute_segment(3G)

execute_segment(3G)

push_state(3G)

NAME

push_state, pop_state − save and restore the state of the graphics device

SYNOPSIS

C Syntax:

void push_state(fildes)
int fildes;

void pop_state(fildes)
int fildes;

FORTRAN77 Syntax:

subroutine push_state(fildes)
integer*4 fildes

subroutine pop_state(fildes)
integer*4 fildes

Pascal Syntax:

procedure push_state(fildes:integer);

procedure pop_state(fildes:integer);

DESCRIPTION

Input Parameters

fildes Integer file descriptor returned by gopen when an I/O path to a graphics device is opened. 

Discussion

Push_state causes a subset of the current state of the specified graphics device to be saved for subsequent restoration with pop_state.  The graphics state stored and restored consists of modal attribute settings, such as line_color_index(3G), and device control settings, such as drawing_mode(3G). 

See sbdl(3G) for a complete list of the functions that contribute to the current state.  Modelling transforms on the matrix stack are not saved and restored by push_state and pop_state.  The state of the matrix stack can be saved and restored as appropriate by use of push_matrix(3G) and pop_matrix(3G). 

The required state is saved on a stack so that push_state and pop_state pairs can be nested.  The common usage of pushing the state at the start of a segment and popping the state at the end of a segment is provided implicitly by execute_segment(3G) and cond_execute_segment(3G). 

EXAMPLE

In the following C program segment, fildes is assumed to hold a a file descriptor returned by a call to gopen(3G).  The change to line_color_index following the push_state does not affect the color of the polyline following the pop_state. 

open_segment(fildes,1,FALSE,FALSE); /* build segment 1 */
line_color_index(fildes, 1); /* set line color to index 1 */
polyline(fd, ...); /* this polyline is drawn with color 1 */
push_state(fildes); /* save the current state */
line_color_index(fildes,3); /* set line color index to 3 */
polyline(fd, ...); /* this polyline is drawn with color 3 */
pop_state(fildes); /* restore the state */
polyline(fd, ...); /* this polyline is drawn with color 1 */
close_segment(fildes); /* segment 1 is now closed */

ERRORS

1 Graphics device is not initialized for this operation. 

SEE ALSO

sbdl(3G), cond_execute_segment(3G), execute_segment(3G). 

Hewlett-Packard Company  —  HP-UX Release 9.10: April 1995

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026