next up previous contents index
Next: GKS-3D Primer Up: Making Hardcopies Previous: Encapsulated PostScript

Use of Workstation Transformations to Change Picture Size

When using GKS from an application program it is not necessary to specify a workstation transformation to set the size of the output picture. In this case, the Normalization Viewport will automatically be made to map to the largest possible square which fits onto the output device display surface. This is often acceptable for an interactive graphics session. However, when making a hardcopy image, especially if this must fit within a document, then the actual size of the picture may well be very important. The GKS Workstation Transformation, which is described fully in on Page gif, allows the actual area required to be specified in metres. A brief summary will be given here.

The Workstation Transformation defines which part of the Normalized Device Coordinate (NDC) space 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:

\index{GKS routine!{\protect\tt GSWKWN}}
\index{GKS routine!{\protect\tt GSWKVP}}
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. 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.

As an example, suppose that the picture occupies the area (wxmin, wymin) to (wxmax, wymax) in World Coordinates. This may be mapped via the Normalization Transformation to a Viewport (vxmin, vymin) to (vxmax, vymax), and this does not have to preserve the aspect ratio. This Viewport must now be output onto an A4 sheet so as to fill the width of the page, assuming an aspect ratio with width > height. Although the width of an A4 page is 21cm, most output devices do not permit the full width to be used. Consult the Workstation Description Table for the device to find out what is the maximum size.

C  Set the Window and Viewport for Normalization Tfrm 'trn'
C  and select this Normalization Tfrm for future primitives.
C
      CALL gswn  (trn,  wxmin, wxmax, wymin, wymax)
      CALL gsvp  (trn,  vxmin, vxmax, vymin, vymax)
      CALL gselnt(trn)
C
C  Set the Workstation Window and Workstation Viewport
C  Note that 18.9 cm is the maximum width for PostScript Portrait Mode
C  (The Workstation Window to map from the Normalization Viewport)
C
      CALL gswkwn(wkid, vxmin, vxmax, vymin, vymax)
      CALL gswkvp(wkid, 0.0,   0.189,
     *                  0.0,   0.189*(vymax-vymin)/(vxmax-vxmin))


next up previous contents index
Next: GKS-3D Primer Up: Making Hardcopies Previous: Encapsulated PostScript


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