next up previous contents index
Next: Clipping Up: Coordinates and Transformations Previous: Normalization Transformation

Workstation Transformation

The method of defining which portion of NDC space is to appear on a specific workstation is similar to the way a viewport is positioned in NDC space (the Normalization Transformation). The Workstation Transformation defines that part of NDC space which will be visible, and where it will appear on the display surface. It is set by calling the functions Set WorKstation WiNdow and Set WorKstation ViewPort:

CALL GSWKWN(WKID, WXMIN, WXMAX, WYMIN, WYMAX)
 
CALL GSWKVP(WKID, VXMIN, VXMAX, VYMIN, VYMAX)
Set Workstation Window specifies in NDC coordinates the area of the NDC space to be output to the device. Set Workstation Viewport specifies in Display Coordinates (DC) where on the device the window will appear. These functions may be called at any time. However, whether or not the effect is immediately visible is workstation-dependent. For example, if changing the workstation transformation requires an implicit image regeneration, then the timing of when it will take place is affected by the current deferral mode (see section on Page gif).

The aspect ratio for the workstation window and the workstation viewport must always be the same. If they are not, then the specified transformation is ignored, and the complete workstation window is displayed on the device in the correct aspect ratio. A rectangle is used with the bottom left corner set to the bottom left corner of the specified viewport, and which is as large as possible.

The default setting for the workstation transformation is to map the whole unit square of NDC onto the largest square possible for the workstation. For rectangular displays, this means that not all of the display surface is used. Conversely, if the workstation transformation is set so that all of a rectangular display is used, then either: (1) the normalization transformation can not preserve the aspect ratio, or: (2) not all of NDC space can be used.

To inquire the range of device coordinates corresponding to a particular workstation type, it is possible to call the function GQDSP (inQuire Display SPace). (Note: The 3D version is called GQDVOL.)

CALL GQDSP (WTYPE, ERRIND, DCUNIT, RX, RY, LX, LY)
The routine returns the units in which the display surface is measured (DCUNIT), and also the maximum x and y values in each direction. Some devices, for example hardcopy plotters, are measured in metres (DCUNIT='GMETRE'), so the routine will return the actual size of the device. Other devices, for example graphics terminals, will be defined in raster or some other units (DCUNIT='GOTHU'). RX, RY are real device coordinates, and LX, LY are in integer raster units.

As an example of how to use this routine, below is a fragment of code which allows an application to draw on the whole of a rectangular display surface with a 'Landscape' aspect ratio (width > height). See also the example in Appendix on Page gif.

C  Inquire the Workstation Display Surface Size
      CALL gqdsp (wtype, errind, dcunit, rx, ry, lx, ly)
C
C  Set the Workstation Window and Viewport (assume x > y)
      CALL gswkwn(wkid, 0.0, 1.0, 0.0, ry/rx)
      CALL gswkvp(wkid, 0.0, rx,  0.0, ry)
C
C  Make sure Workstation Transformation is used
      CALL guwk  (wkid, gperfo)
C
C  Set Window and Viewport for Normalization Tfrm 'trn'
      CALL gswn  (trn,  xmn, xmx, ymn, ymx)
      CALL gsvp  (trn,  0.0, 1.0, 0.0, ry/rx)
C
C  Select this Normalization Tfrm for future primitives
      CALL gselnt(trn)

 

 


Figure: Normalization and Workstation Transformations



next up previous contents index
Next: Clipping Up: Coordinates and Transformations Previous: Normalization Transformation


Janne Saarela
Mon Apr 3 17:00:12 METDST 1995