GKS for MS Windows 95/98/XP

NEW (24.JULY 2007 )

 

Here  you can download zipped precompiled 64-bit  GKS library build with IVF 10 em64t compiler in VS 2005. Test project is also included.

 

 

 (27.MAY 2007 bug removed, 14.OCT.2006)

 

Here you can download precompiled GKS library which were build with Intel Fortran 9.1 compiler. For use it extract files and copy the three bdf files (error message file, font file and workstation description table file) to the windows directory (c:/windows) or to your project directory.

 

(17.9.2005)

 

Here you can download precompiled GKS library which were build with Intel Fortran 9.0 compiler. For use it just extract files to root folder C:\

 

This site describes the installation and usage of the GKS graphics library. The GKS library is essentially the  STARLINK GKS graphics library ported with minor modifications onto MS Windows environment by using Digital Visual Fortran 5.x or Compaq Visual Fortran 6.x compilers.

 

This GKS port is a level 2B implementation of GKS. This means that full output capabilities, including workstation-independent segment storage (level 2), and full synchronous input capabilities (level B) are implemented.

 

 

IMPORTANT NOTICES

 

·   I contacted Martin Bly from Starlink who gave me permission to put GKS on this site

 

·   The use and distribution of this software is limited by STARLINK Licence conditions

 

·   This port of GKS is not supported by STARLINK

 

 

Contains

 

Hardware requirements

Software requirements

Documentation

Difference from RAL-GKS

Porting GKS Application

Installation

Pre-compiled GKS library

 User build GKS library

Usage

Implementation details

GKS description table

Workstations

Output

Attributes

Input

Utilities

Utility routines (alphabetic order)

Reporting Bugs

 

Hardware requirements

 

This port of the GKS library was tested on:

 

·   PC Pentium II 450 MHz 128 MB RAM running MS Windows 98

·   Notebook PC Pentium II 233 MHz 64 MB RAM running MS Windows 95

 

Software requirements

 

The use of this port of the GKS library is restricted to QuickWin application programs built by  Digital VF 5.x or Digital VF 6.x in MS Windows95/98 environment.

 

Documentation

 

The following documentation  is available from STARLINK:

 

·   Guide

·   GKS reference

 

Beside these documents various GKS guides, descriptions etc. are available on Internet. Just search for GKS …

 

Difference from RAL-GKS

 

There are some differences between this port and the original STARLINK GKS library:

 

·   Maximum normalization number is set to 25 while the original is 10.

·   GKS metafile output workstation type number is set to 4 while the original is 10. In this way application can use GMO parameter as workstation type.

·   GKS metafile input workstation type number is set to 5 while the original is 50. In this way application can use GMI parameter as workstation type.

·   Initial aspect source flags for all attributes are set to INDIVIDUAL while the original is set to BUNDLE.

·   No generalizied drawing primitive (GDP) is included in this port while the original has 6 GDP’s. Since GDP’s are not standard they are replaced by utility functions in this port.

·   Number of fonts is raised to 15 while the original has 11 fonts. Also font numbers are changed to those used by NCAR implementation of GKS.

 

Porting GKS Applications

 

There is a lot of free academic and commercial  FORTRAN code that uses GKS as a graphics base over Internet. For example:

 

·   GRSOFT  2D and 3D graphics presentation software

·   MODULEF finite element library

·   NCAR graphics software. You cand download MS Window version of this software from here

 

When porting such a code with the use of the present GKS library the following minimal changes must be made:

 

·   The workstation type numbers must be changed to those of the present GKS library (see Workstations ).

·   If the code uses  INCLUDE statement with GKS enumeration type parameters replace this statement with include ‘/usr/include/gks.inc’ statement.

·   If the software use input functions then check the device numbers and prompt/echo types (see  Input).

·   If the software use asynchronous input (SAMPLE or EVENT mode) the code must be changed to operate on REQUEST mode. A minimal simulation of event mode can be done by GRQLC subroutine with device number 2 which uses keyboard keys as a trigger. While this function returns point coordinates, a key pressed can be read via GUGTKY subroutine.

 

 

Folder structure overview

 

The following UNIX-like folder-tree  is  used for GKS instalation:

 

                ROOT --- usr --- etc                         { gksemf.bdf, gksdbs.bdf, gkswdt.bdf }

                                       --- include                 { gks.inc }

                                       --- lib                        { gksqw.lib }

                                       --- src  ------ gks---   

 

where ROOT is C, D or E drive. Note that the only essential part of this tree is ROOT/usr/etc path because this path is use by GKS application during initialisation. No environment variables are required.

 

Installation

 

Pre-compiled GKS library

 

1.     Download gkslib.zip file. This file contains the following library and binary data files which were build with Compaq VF 6.1

 

        gksqw.lib    -  GKS Quick Window Static Library

        gksemf.bdf  - Error message file

        gksdbs.bdf  -  Font file

        gkswdt.bdf  - Workstation description file

        gks.inc        - include file for GKS enumeration types

 

2.     Extract files from gkslib.zip into root folder i.e. C:\, D:\ or E:\ folder. 

 

 

User build GKS library

 

1.     Download gksmake.zip file. This file contains the following files in \usr\src\gks\wingks folder:

 

install.bat  - GKS installation batch file. It create an appropriate folder structure and a copy of modified source files from wingks/src to source folder. At the end it execute build.bat file.

build.bat – Call gks.mak

clean.bat – Call gks.mak with clean option

data_emf.mak – Build GKS error message file

data_wdt.mak  - Build GKS workstation description table

data_dbs.mak  - Build GKS font file

font.inp – Input file needed by data_dbs.mak

gks.mak – GKS installation driver

 

and two folders src and project/libgks. The files from the src folder are copied to the appropriate original STARLINK source code folder. At project/libgks folder there is the libgks.mak file which build GKS library and libgks.dsw file which allowe it to build GKS library from Visual Fortran.

 

2.     Download  GKS source code. Alternatively you can download it from here

 

3.     Extract gksmake.zip to root folder  i.e. C:\, D:\ or E:\ folder. This will create the appropriate folder tree structure.

 

4.     Extract GKS source to /usr/src/gks folder.

 

5.     Run usr/src/gks/wingks/install.bat. You must have access to a line compiler and nmake tool to successfully run this file. If you haven’t add the following lines at the end of your autoexec.bat file:

 

SET PATH=C:\PROGRA~1\MICROS~4\DF98\BIN;C:\PROGRA~1\MICROS~4\VC98\BIN;%PATH%;

SET PATH=C:\PROGRA~1\MICROS~4\COMMON\MSDEV98\BIN;%PATH%

SET INCLUDE=C:\PROGRA~1\MICROS~4\DF98\INCLUDE;C:\PROGRA~1\MICROS~4\VC98\INCLUDE;

SET LIB=C:\PROGRA~1\MICROS~4\DF98\LIB;C:\PROGRA~1\MICROS~4\VC98\LIB;

 

Usage

 

To build a program that use GKS library in the Developer Studio:

 

1.     select File, New,Projects, enter a new name, select Fortran QuickWin  Application and click on OK;

 

2.     select Project, Settings, and Settings for All Configurations and then select the Link tab. Add user32.lib gdi32.lib to the end of the Object/Library Modules if they are not already there;

 

3.     Insert the GKS library into the Workspace by clicking on Project, Add, Files and selecting /usr/lib/gksqw.lib;

 

4.     Insert a file into the Workspace by clicking on Project, Add, Files and build an application.

 

IMPORTANT NOTE: If you use Digital FORTRAN  VC5.x the initial phase when calling GOPKS can be up to 20 sec long due to color table initialization (QuickWin function RemapPaletteRGB is very slow !!!)

 

Examples

 

You can try to run examples from  GKS source code which are described in Guide. They are located in ../source/ugprogs folder. Do not forget that this port of GKS differ from that of STARLINK so you must make minor changes in the code (see Difference from RAL-GKS ).

 

Implementation details

 

GKS description table

 

The overall characteristics of this port of GKS are:

 

·   Number of available workstation types                      20

·   Number of simultaneously open/active workstations 4

·   Number of workstations associated with a segment   4

·   Maximum normalization transformation number      25

 

The original RAL-GKS has a maximal normalization transformation number equal to 10.

 

Workstations

 

There are 20 workstations available. They are listed in the following table:

 

Type

Category

Device

1

OUTIN

MS Window

2

OUT

Enhanced Windows Metafile

3

WISS

Workstation independent segment storage

4

MO

GKS Metafile output

5

MI

GKS Metafile input

2700

OUT

PostScript A4 monochrome  portrait mode

2701

OUT

PostScript A4 monochrome  landscape mode

2704

OUT

PostScript A3 monochrome portrait mode

2705

OUT

PostScript A3 monochrome landscape mode

2720

OUT

PostScript A4 colour     portrait mode

2721

OUT

PostScript A4 colour     landscape mode

2724

OUT

PostScript A3 colour     portrait mode

2725

OUT

PostScript A3 colour     landscape mode

2702

OUT

Encapsulated PostScript A4 monochrome portrait  mode

2703

OUT

Encapsulated PostScript A4 monochrome landscape mode

2706

OUT

Encapsulated PostScript A3 monochrome portrait  mode

2707

OUT

Encapsulated PostScript A3 monochrome landscape mode

2722

OUT

Encapsulated PostScript A4 colour     portrait mode

2723

OUT

Encapsulated PostScript A4 colour     landscape mode

2726

OUT

Encapsulated PostScript A3 colour     portrait mode

2727

OUT

Encapsulated PostScript A3 colour     landscape mode

 

 

This GKS application is an MS QuickWindow application that means that MS Windows workstation is a QuickWin child window. The size of this window is determined in runtime and is fixed to 0.8 of maximal frame size. While the window once created can not be resized it can be iconified or moved.  Note also that device coordinates used by this workstation are essential, the pixels (raster coordinates) divided by 1000 and are not in metres.

 

All workstations from the OUT category produce files which are created in a current working directory. The names of Enhanced window Metafile are GKSnnn.EMF, and of GKS metafile GKSnnn.GKM where nnn is number between 0 and 999. By default names of  PS files are GKSnnn.PS and that of EPS GKSnnn.EPS. Currently there is no  utility available to change outputfile name during runtime.

 

An Enhanced Window Metafile workstation creates a file that contains  a picture of  16x12 cm. This picture can be imported, for example,  into MS Word document or to CorelDraw graphics.

 

The output from PS workstations is a ASCII file containing postscript  commands. These files can be viewed, for example, by GSView program  or can be imported into CorelDraw graphics file.

 

The output from EPS workstations are also  ASCII files but can be  printed directly on a Postscript printer or imported into TeX documents.

 

Output

        

All workstations have the same output capabilities (polyline, polymarker, fill area, cell array) except EMF which can't  currently produce Cell Array output primitive.

 

Unlike original RAL-GKS this port does not include any generalized drawing primitive.

 

Attributes

 

The following attribute types can be used with the GKS library:

 

·   Line types  1 to  5

·   Marker types   1 to 5

·   Fill area  hatch styles   -1 to -10

·   Fill area  pattern styles  1 to 3

·   Fonts : (see table)

 

Type

Description

RAL type

1

Default ASCII font

1

-4

Hershey simplex Roman

-101

-5

Hershey simplex Greek

-103

-6

Hershey simplex script

-108

-7

Hershey complex Roman

-104

-8

Hershey complex Greek

-110

-9

Hershey complex script

-109

-10

Hershey complex italic

-105

-11

Hershey complex Cyrillic

(-111)

-12

Hershey duplex Roman

-102

-13

Hershey triplex Roman

-106

-14

Hershey triplex italic

-107

-15

Hershey Gothic German

(-113)

-16

Hershey Gothic English

(-112)

-17

Hershey Gothic Italian

(-114)

-18

Hershey math symbols

-115

 

 

Font type numbers are set to those defined in NCAR Graphics and not that of original RAL-GKS.

   

Input

 

All six logical input devices are available on MS Windows workstation in the request mode. Unlike original RAL-GKS library for X-Windows this port also supports Stroke and Pick input. The input capabilities  are limited by two restrictions:

 

·   prompt/echo types are restricted to type 1 for all input devices except locator which supports all

·   required echo area is ignored on all devices.

 

On MS Windows there are two actual input devices available: mouse and keyboard. For the mouse  accept is left button click and clicking any other button means break. Mouse double-click is not supported.  On the keyboard  break is ESC key.

 

Locator

 

There are two locator devices. Essentially they are both mouse device but device 1 accepts mouse click, while device 2 accept keyboard press. For device 2 the key pressed during request can be obtained via non-standard utility subroutine GUGTKY. On both devices all six standard  prompt/echo types are available:

 

1.     MS pointer (implementation standard)

2.     Crosshair

3.     Tracking cross

4.     Rubber band

5.     Rectangle

6.     Digits.

 

Stroke

 

There is one stroke device,  device 1 is the mouse.

 

Valuator

 

There are two valuator devices, device 1 is the keyboard and device 2 is the mouse.

 

Choice

 

There is one choice device, device 1 is mouse. The choice device operate with the string menu which must be supplied via GINCH function.

 

Pick

 

There is one pick device,  device 1 the mouse. The pick apparatus is set to 20 pixels and can not be changed.

 

String

 

There is one string device, device 1 is the keyboard.

 

 

Utilities

 

Since GKS is a low-level graphics library several non-standard utility subroutines are added to the library with the intent to make use life easier.

 

Control

       

GUOPKS( IWKID)  - Initialize GKS and activate first available OUTIN workstation

GUSDSP( IWKTYP, IXSIZE, IYSIZE, PERMAX) – Set size of display for specified workstation type (work only for MS Window workstation)

 

Output

 

GUARC1( IOPT, XC, YC, RADIUS, SANG, EANG) – Circular arc, sector or segment

GUARC3( IOPT, X1, Y1, X2, Y2, X3, Y3) – Circular arc, sector or segment

GUARRO( NP, XP, YP, IFS, ARSZ, ANG, VENT) – Polyline terminated by arrow

GUAXIS( IXY, RMIN, RMAX, RLOC, RSPAC, NMAJ, RMAJSZ, RMINSZ) – X or Y axis

GUBEZ1( NP, XP, YP)  - Bezier curve         

GUBOX1( X1, Y1, X2, Y2) – Rectangle by opposite points

GUBOX2( X1, Y1, A, B, ROTANG) – Rectangle by position, size and rotation

GUBSPL( NDEG, NP, XP, YP) – Uniform B-spline of given degree

GUCIR1( XC, YC, X1, Y1) – Circle by centre and peripheral points

GUCIR2( XC, YC, R) – Circle by centre point and radius

GUCIR3( X1, Y1, X2, Y2, X3, Y3) – Circle by three points

GUCUR1( NP, XP, YP) – Cubic spline interpolation curve

GUCUR2( NP, XP, YP) – Parametric cubic spine interpolation curve

GUELL1( XC, YC, A, B, ALPHA) – Ellipse by centre point, semi axes and rotation

GUELL2( IOPT, XC, YC, A, B, SANG, EANG,  ROTANG) – Elliptic arc, sector or segment

GUFRAM – Frame around current viewport

GUGRID( XMIN, XMAX, YMIN, YMAX, XLOCY, YLOCX, XSPAC, YSPAC,

     :          NXMAJ, NYMAJ, XMINSZ, YMINSZ) - Grid

GUHYP1( IOPT, XC, YC, A, B, YLMIN, YLMAX,  ROTANG) – Hyperbolic arc, segment or sector

GULIN1( X1, Y1, X2, Y2) – Line by two points

GULIN2( X1, Y1, R, ROTANG) – Line by point, length and direction

GUNGON( N, XC, YC, R, ROTANG) – Perfect polygon with N vertices

GUPAR1( IOPT, XC, YC, A, YLMIN, YLMAX,  ROTANG) – Parabolic arc or sector

 

Note that arc is drawing by using polyline, segment and sector are drawn with fill area output function.

 

Attributes

   

GUSASF(IFLG) - Set all ASF's to value IFLG.

 

Error handling

   

GUNERR(NERR) - Report Number of Errors

GURERR(IERR) - Report Error of Lates GKS call

 

Transformations

   

GUSWNU(ITNR,XMIN,XMAX,YMIN,YMAX)  - Set window with uniform scale

 

Metafiles

 

GURDII(IWKID)  - Read and Interpret Metafile Item

   

Input

 

GUGTKY( IKEY) – Get ASCII code of key pressed during last request locator interaction

GUMENU( IWKID, IDEV, NCHO, CSTR, ICHNR, ISTAT, ICHO)

 

The following utilities accept essentially the same data as appropriate GIN** GKS functions except that echo area and data record are omitted.

 

CUINCH( IWKID, IDEV, ISTAT, ICHNR, IPET)

GUINLC( IWKID, IDEV, ITRN, XIN, YIN, IPET)

GUINPK( IWKID, IDEV, ISTAT, ISGNA, IPKID, IPET)

GUINSK( IWKID, IDEV, ITRN, NP, XIN, YIN, IPET)

GUINST( IWKID, IDEV, INLSTR, CINSTR, IPET, IBFLEN, INIPOS)

GUINVL( IWKID, IDEV, VINI, IPET, VLOW, VHIGH)

 

Utility routines (alphabetic order)

 

GUARC1 (IOPT, XC, YC, RADIUS, SANG, EANG) - Draw circular arc, segment or sector.

 

inp IOPT        0=arc, 1=segment, 2=sector

inp  XC, YC  coordinates of centre point

inp RADIUS  radius of arc

inp SANG      start angle in degrees

inp EANG     end angle   in degrees

 

GUARC3  (IOPT,  X1, Y1, X2, Y2, X3, Y3) – Draw circular arc

 

inp IOPT       0=arc, 1=segment, 2=sector

inp  X1, Y1   start point

inp  X2, Y2   mid point

inp  X3, Y3   end point

 

GUARRO ( NP, XP, YP, IFS, ARSZ, ANG, VENT) -  Draws lines terminated with an arrow

 

inp   XP(1),

inp   YP(1)     coordinates of points (WC)

inp   IFS         file style : 1 = filled; 0 = outline

inp  ARSZ     arrow size ( WC)

inp  ANG       the acute angle of the arrow point in degrees

inp  VENT     the fraction of the triangular arrow-head that is cut away from the back.

 

GUAXIS ( IXY, RMIN, RMAX, RLOC,  RSPAC, NMAJ, RMAJSZ, RMINSZ) – Draws an X- or Y- axis

 

inp IXY          axis type (0=xasis, 1=yaxis)

inp RMIN,

inp RMAX     axis limits

inp RSPACE  distance between tick marks on the axis (wc)

inp RLOC      if IXY=0 then this is the y-value of the x-axis else this is the x-value of

                       y-axis (WC)

inp NMAJ      number of tick marks to set before drawing a major tick  mark.

inp RMAJSZ  length of major tick marks (WC)

inp RMINSZ  length of minor tick marks (WC)

 

GUBEZ1 ( NP, XP, YP) – Bezier curve

 

inp NP           number of points [3..25]

inp XP(NP),

inp YP(NP)   points on Bezier polygon

 

GUBOX1 ( X1, Y1, X2, Y2) – Rectangle defined by opposite diagonal points

 

GUBOX2 ( X1, Y1, A, B, ROTANG) – Rectangle defined by lower-left corner point, dimensions and rotation angle.

 

inp X1,Y1        coordinate of lower-left point

inp A                width

inp B                height

inp ROTANG  rotation angle in degrees

 

GUBSPL ( NDEG, NP, XP, YP) – Uniform B-spline curve of given degree

 

inp  NDEG     spline degree 1=line, 2=parabolic, 3=cubic, ….

inp  NP           number of control points

inp  XP(NP)

inp YP(NP)    control points coordinates    

 

GUCIR1 ( XC, YC, XP, YP) – Circle by centre point and peripheral point

 

inp XC, YC   centre point

inp  XP, YP   point on circle

 

GUCIR2 ( XC, YC, RADIUS) – Circle by center and radius

 

inp XC, YC    centre point

inp RADIUS  peripheral point

 

GUCIR3 (  X1, Y1, X2, Y2, X3, Y3) – Circle by three peripheral points

 

imp  X1, Y1   start point

inp  X2, Y2   mid point

inp  X3, Y3   end point

 

GUCUR1 ( NP, XP, YP)  - Cubic spline interpolation curve i.e. y=f(x) curve

 

inp  NP           number of interpolation points [3..)

inp  XP(NP)

inp YP(NP)    interpolation point coordinates    

 

GUCUR2 ( NP, XP, YP) )  - Parametric cubic spline interpolation curve

 

inp  NP           number of interpolation points [3..)

inp  XP(NP)

inp YP(NP)    interpolation point coordinates

    

 

GUELL1 ( XC, YC, A, B, ROTANG) – Ellipse by centre point, semi axis and rotation angle

 

inp  XC, YC    center point coordinates

inp  A, B         semi axes of ellipse

inp  ROTANG angle of anti-CCW rotation in degrees

 

 

GUELL2 ( IOPT, XC, YC, A, B, SANG, EANG,  ROTANG) – Ellipse arc, sector or segment

 

inp  IOPT        0=arc, 1=segment, 2=sector

inp  XC, YC    centre point coordinates

inp  A, B         semi axes of ellipse

inp  SANG      start angle in degrees

inp  EANG      end angle   in degrees

inp  ROTANG angle of anti-CCW rotation in degrees

 

GUFRAM  - Frame around the current viewport

 

GUGRID ( XMIN, XMAX, YMIN, YMAX, XLOCY, YLOCX, XSPAC, YSPAC, NXMAJ, NYMAJ,  XMINSZ, YMINSZ)  - Grid

 

inp   XMIN,

inp   XMAX     grid x-limits

inp   YMIN,

inp   YMAX     grid y -limits

inp   XSPAC,

inp   YSPAC     distance between tick marks on the axis (WC)

inp   XLOCY    y-value of x-axis

inp   YLOCX     x-value of y-axis

inp   NXMAJ,

inp   NYMAJ    number of tick marks to set before drawing a major tick mark.

inp   XMINSZ  

inp   YMINSZ   length of minor tick marks (WC)

 

GUGTKY ( IKEY) -  Return the key pressed during last request locator action

 

out IKEY          ASCII code of key pressed

 

GUHYP1 ( IOPT, XC, YC, A, B, YLMIN, YLMAX, ROTANG) – Draw hyperbolic arc, segment or sector.

 

inp  IOPT        0=arc, 1=segment, 2=sector

inp  XC, YC    center point coordinates

inp  A, B         semi axes of hyperbola

inp  YLMIN    local lower y limit

inp  YLMAX   local upper y limit

inp  ROTANG angle of anti-CCW rotation in degrees

 

GUPAR1 ( IOPT, XC, YC, A, YLMIN, YLMAX,  ROTANG) – Draw parabolic arc or segment

 

inp  IOPT        0=arc, 1=segment

inp  XC, YC    centre point coordinates

inp  A              focus point distance

inp  YLMIN    local lower y limit

inp  YLMAX   local upper y limit

inp  ROTANG angle of anti-CCW rotation in degrees

 

Reporting Bugs

 

Please send email to Milan.Batista@fpp.edu to report bugs or problems with GKS. I will try to fix bugs but I make no promises to do that quickly or even at all because most of the code is written by STARLINK.

 

 

Wednesday, 20 September 2000

 

Milan Batista

 

University of Ljubljana

Faculty of Maritime Studies and Transport

Slovenia