.\"## .\" $XConsortium: p389,v 5.2 94/04/17 20:59:00 rws Exp $ .\"## .\"## $XMCOPY .\"## Copyright (c) 1990, 1991 by Sun Microsystems, Inc. .\"## .\"## All Rights Reserved .\"## .\"## Permission to use, copy, modify, and distribute this software and its .\"## documentation for any purpose and without fee is hereby granted, .\"## provided that the above copyright notice appear in all copies and that .\"## both that copyright notice and this permission notice appear in .\"## supporting documentation, and that the name of Sun Microsystems, .\"## not be used in advertising or publicity .\"## pertaining to distribution of the software without specific, written .\"## prior permission. .\"## .\"## SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, .\"## INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO .\"## EVENT SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR .\"## CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF .\"## USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR .\"## OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR .\"## PERFORMANCE OF THIS SOFTWARE. .TH "SET WORKSTATION VIEWPORT" 3P "29 February 1991" .SH NAME SET WORKSTATION VIEWPORT \- set 2D viewport limits for a specified workstation .IX "Workstation Transformation" "SET WORKSTATION VIEWPORT" .SH SYNOPSIS .SS C Syntax .ft B .ta 1.5i 3.25i .nf void pset_ws_vp ( ws, viewport ) Pint ws; \fIworkstation id\fP Plimit *viewport; \fIworkstation viewport limits\fP .fi .ft R .SS Required PHIGS Operating States (PHOP, WSOP, *, *) .SH DESCRIPTION .SS Purpose \s-2SET WORKSTATION VIEWPORT\s+2 defines a 2D area in Device Coordinate (\s-2DC\s+2) space, at a constant \fIz\fP value. The abstract image within the workstation window, defined in Normalized Projection Coordinate (\s-2NPC\s+2) space, is mapped to this viewport. .LP Together, the workstation window and the workstation viewport define the \fIworkstation transformation\fP that converts the image from \s-2NPC\s+2 to \s-2DC\s+2 of workstation's physical display surface. The workstation window defines what within \s-2NPC\s+2 space is displayed; the workstation viewport defines where the image is displayed in \s-2DC\s+2 space. .LP Control of the workstation transformation allows you to choose a portion of the abstract image composed in \s-2NPC\s+2 space for display on the workstation, without changing the definition of the image in \s-2NPC\s+2 space. .SS C Input Parameters .IP \fIws\fP The identifier of the workstation for which the viewport is to be set. .IP \fIviewport\fP A pointer to a structure containing the \s-2DC\s+2 limits for the \s-2\&2D\s+2 workstation viewport, defined as follows: .nf .ta .5i +\w'Pfloat 'u +\w'x_max; 'u .sp .4 typedef struct { .sp .2 Pfloat x_min; /* x minimum */ Pfloat x_max; /* x maximum */ Pfloat y_min; /* y minimum */ Pfloat y_max; /* y maximum */ .sp .2 } Plimit; .fi .SS Execution .LP The current workstation viewport defines the area in Device Coordinates in which the abstract image within the current workstation window is displayed. The workstation window is defined in Normalized Projection Coordinates. Together, the workstation window and the workstation viewport define the \fIworkstation transformation\fP that converts the image from \s-2NPC\s+2 to \s-2DC\s+2 of workstation's physical display surface. .LP The \fIx\fP minimum must be non-negative and less than \fIx\fP maximum and \fIy\fP minimum must be non-negative and less than \fIy\fP maximum. In addition, all values must be within the workstation's \s-2DC\s+2 range. The default \s-2PEX-SI\s0 workstation \s-2DC\s+2 maximum is 1, but it is selectable by using \s-2WORKSTATION TYPE SET (3P)\s+2. .LP \s-2SET WORKSTATION VIEWPORT\s+2 sets the \fIx\fP and \fIy\fP components of the requested workstation viewport in the specified workstation's state list to the values specified. The \fIz\fP component of the requested workstation viewport and current workstation viewport are not changed. The effect of calling \s-2SET WORKSTATION VIEWPORT\s+2 is visible only after the requested workstation viewport replaces the current workstation viewport. The time at which this occurs depends on the workstation's display update state. This action is performed immediately, and the workstation transformation update state is set to \s-2NOTPENDING\s+2, if any one of the following is true: .sp .5v .in +0.5i .ta +0.2i .ti -0.2i \(bu The workstation's display update state allows update. .sp .5v .ti -0.2i \(bu The workstation's modification mode is any value other than No Immediate Visual Effect, and the dynamic modification accepted for workstation transformation entry in the workstation description table is set to Immediate. .sp .5v .ti -0.2i \(bu The display space empty status in the workstation state list is \s-2EMPTY\s+2. .LP Otherwise, the workstation transformation update state is set to \s-2PENDING\s+2, and the requested workstation viewport will not replace the current workstation viewport until the next time the workstation is updated. The workstation transformation update state will be set to \s-2NOTPENDING\s+2 at that time. .LP If the current workstation window and viewport do not have the same aspect ratios, the workstation transformation preserves the proportions of the image by mapping the workstation window to the largest possible area of the workstation viewport so that: .sp .5v .in +0.5i .ta +0.2i .ti -0.2i \(bu The aspect ratio of the window in \fIx\fP and \fIy\fP is maintained. .sp .5v .ti -0.2i \(bu The lower left hand corner of the window is mapped to the lower left hand corner of the viewport. .LP If the aspect ratios of the workstation window and viewport are different, there will be unused space along the upper or right-hand edges of the viewport, but not both. .LP The default workstation transformation maps the entire \s-2NPC\s+2 view plane, [0,1] \(mu [0,1] \(mu [0,1], onto the largest square area in the workstation display space including the display's lower left corner. .\"different: The workstation transformation can be changed at any time after .\"different: the workstation is opened. However, changing the transformation .\"different: may cause an implicit regeneration of the picture regardless of .\"different: the explicit setting of the workstation's display update state. .LP .SH ERRORS .IP 003 Ignoring function, function requires state (\s-2PHOP\s+2, \s-2WSOP\s+2, \s-2*\s+2, \s-2*\s+2) .IP 054 Ignoring function, the specified workstation is not open .IP 057 Ignoring function, specified workstation is of category \s-2MI\s+2 .IP 152 Ignoring function, invalid viewport; \s-2XMIN \(>= XMAX\s+2 or \s-2YMIN \(>= YMAX\s+2. .IP 157 Ignoring function, the workstation viewport is not within display space .SH SEE ALSO .nf .IP .ta 0.5i .SM "SET WORKSTATION WINDOW (3P)" .SM "SET WORKSTATION VIEWPORT 3 (3P)" .fi