Professional Documents
Culture Documents
(GKS)
D A Duce and F R A Hopgood
Since its publication in 1985, the Graphical Kernel System embody, and this provides a framework within which
(GKS) has become established as an important standard GKS is described. GKS is a 2D graphics system that pro-
for computer graphics. Both its output and input models vides graphical output and input. The major features of
are superior to earlier 2D systems, and its coordinate sys- GKS are described in the section on principles. One ques-
tems are flexible and device-independent. GK5 uses dif- tion that inevitably arises is what is the impact of GKS on
ferent concepts to previous graphics packages, and existing applications programs and programmer practice.
includes a number of innovative features, including how Some of the difficulties that are likely to be encountered
the values of aspects are determined and the model of in moving existing programs and indeed programmers to
input. The impact of GK5 on existing applications prog- GKS are described in the section on changing to GKS.
rams and programmer practice is addressed, and prob- There are now a large number of GKS implementations
lems with reprogramming existing applications to run appearing on the market, and the section on implementa-
using GK5 are also described. Implementation of GK5 is tions gives some hints about what to look for when pur-
reviewed from the viewpoint of purchasing a GK5 chasing a GKS implementation. The implementations on
implementation and the different implementation the market and reported in the literature by no means use
philosophies. The issues of conformffy testing and regis- a common implementation philosophy. Some of the
tration of graphical items are discussed. approaches that have been published are discussed in
the section on implementation philosophies. The impor-
computer graphics, graphics standards, GKS, primitives, coordinates, tant issue of conformity testing is addressed, as is the topic
aspects, implementations of registration of graphical items, a process for standardiz-
ing the meanings of graphical items that it is not manda-
This paper gives an overview of the International Organi- tory for implementations to provide.
zation for Standardization (ISO) standard for computer
graphics, the Graphical Kernel System (GKS), and some
related topics. Before entering this discussion, it is PRINCIPLES OF COMPUTER GRAPHICS
appropriate to consider briefly the origins of GKS. There are a number of fundamental topics that must be
The most impressive CAD systems have been turnkey addressed by any computer graphics system. The most
systems built using customized hardware and large important of these are listed below.
software systems whose construction has taken many
man-years. Such systems are by nature expensive to pro-
duce and maintain, and are difficult to transport to Output primitives
another hardware environment. The graphics subsystems
in such products tend to be tailored to the capabilities of The primary purpose of generative computer graphics is
the device hardware being supported. A number of pack- to generate a picture on the display surface of some
ages have existed for a number of years that attempt to graphics device. Graphical output is defined in terms of
provide device independence across a range of devices basic building blocks, which are called output primitives.
(the twentieth anniversary of the release of the first ver- Points, lines and areas are examples of output primitives,
sion of the Ghost package falls in 1987), but there has which may or may not be included in a particular
been little agreement about how this should be achieved. graphics system. The questions facing a graphics standard
The existence of numerous graphics packages and are what is the fundamental set of output primitives and at
their importance to CAD led IFIP Working Group 5.2 in what level of abstraction are they defined. Clearly, such a
1974 to invite Richard Guedj (of France) to start an active set must be rich enough to cover all possible graphical
programme directed towards establishing standards for pictures in the field of application of the standard.
computer graphics. The first step in this programme was
the Seillac I Workshop on Methodology in Computer Primitive aspects
Graphics 1. This led to international activity to develop a
standard for a 2D kernel graphics system under the When an output primitive is displayed on a graphics
auspices of ISO. The history of the development of GKS device it will have a particular appearance, for example,
has been told elsewhere 2-s; suffice it to say here that after lines may be displayed with a particular colour, and solid
an extremely thorough review by an international team of or dotted. Those facets of a primitive that determine its
experts between 1980 and t 984, GKS was published as appearance when displayed are termed the aspects of the
ISO 7942 on 15 August 1985. primitive. In the example given, colour and linestyle
The next section discusses the major concepts that any would be aspects. A standard needs to decide what the
device-independent, interactive graphics system has to aspects should be for each type of output primitive. The
number of aspects recognised governs the flexibility
lnformaticsDivision, RutherfordAppletonLaboratory,Chilton, Didcot, given to the programmer to control the appearance of
Oxon OX11 0QX, UK pictures.
396 0010--4485187/080396-- 14 $03.00 (~) 1987 Butterworth & Co (Publishers) Ltd computer-aided design
Coordinates
It is accepted that the user of a graphics system should be /
able to define graphics in a coordinate system relevant to
the application. It is also accepted that this coordinate
system is unlikely to be the one specified for the device by +
+
the manufacturer. As a result, there is a need to transform
user coordinates to device coordinates. The problem that Polymorker +
+
+ +
arises is what kinds of user coordinate system should be
supported (for example, Cartesian, polar, spherical
polar), and how should the mapping to device coordi-
nates be specified.
Text characters
Input primitives
Interactive programs need to be able to accept graphical
and nongraphical input. These data correspond to a F i l l area
number of different types, for example, coordinate posi-
tions, character strings for labelling and values for iden-
tifying groups of primitives. The different types of input
data are termed input primitives. Questions facing a
graphics standard include: what kinds of input primitive
should be provided? Should all input be handled by the Cell o r r o y
graphics system or just graphical input? Should graphical
and nongraphical input be differentiated?
Figure 1. The five main output primitives in GKS
Input model
An input model describes how input primitives are Output primitives
related to physical input devices, the degree of control The output primitives in GKS are abstractions from the
provided to the application (for example, selection of the output primitives typically provided by graphical output
way in which input values are echoed to the device's devices. GKS defines six output primitives.
.operator), and the styles of interaction available to an
application program (for example, can the operator gen- • Polyline, which draws a sequence of connected line
erate input values asynchronously from the execution of segments.
the program?) What kind of input model should a • Polymarker, which marks a sequence of points with
graphics standard support? the same symbol.
• Fill area, which displays a specified area.
• Text, which draws a string of characters.
Device independence • Cell array, which displays an image composed of cells
Most high level standards are defined so that the user can with specified colours or grey scales.
be isolated from specific characteristics of the graphics • Generalized drawing primitive (GDP), a controlled
output and input devices being used and can concentrate method of adding more exotic primitives, for exam-
on defining graphical output and input in a device-inde- ple, conic arcs and splines.
pendent way. It might be deemed desirable to be able to
move an application from one device environment to The five main output primitives are illustrated in Figure I.
another without having to make major changes to the This choice of primitives calls for some comment.
program structure. Issues that arise in connection with Many existing graphics packages use the concept of
device independence include: how is the user to be in- current position. GKS does not. There are several prob-
sulated from the details of device hardware while having lems with current position, for example, should there be
some degree of control over the appearance of pictures one current position or should each type of primitive
on devices with differing capabilities (for example, colour have its own associated current position, and what hap-
and monochrome)? How is the transformation from user pens to current position when transformations are
to device coordinates to be specified so that different changed. There are several answers to these questions,
device coordinate systems can be accommodated? How each of which has its merits for particular applications.
can the user retain some degree of control over the map- Therefore GKS did not incorporate this concept, though
ping from abstract input and output to physical input and it is interesting to note that at least one project has built
output so that the devices can be used in an optimal way? current position on top of GKS in a controlled way (see
later).
Another notable feature of the GKS output primitives is
PRINCIPLES OF GKS the absence of relative coordinates. All coordinate data
This section examines how the principles of computer are absolute. Relative coordinates were omitted on the
graphics are realised in the Graphical Kernel System. grounds that they could be implemented on top of GKS.
Other graphics standards under development embody The line drawing primitive in GKS draws a sequence of.
these principles in similar ways. A full description of GKS lines rather than a single line. This choice stems from the
is given elsewhere 3,s,~.GKS is a 2D graphics system that observation that many applications deal in sequences of
provides graphical output and input that is defined in a lines rather than single lines and the decomposition to
language-independent manner. single lines is rather unnatural, and also the observation
I L ~ . . / / ~ Workstation
, 'J/ 1 .,e..o,, 2
Coordinate systems and device independence |
I ..
// 11
I , //
/
i I
The GKS concept of a workstation is the key to device
independence in GKS. A workstation consists of zero or
,¢~/" //// i1111'1
one display surfaces and zero or more input devices plus
associated software. The GKS idea of a workstation is an
Viewport I ondl l / // ~.~Worksiotion
I / w,ndo.2
abstraction from physical hardware.
A major difference from many earlier graphics systems
w,. ow, _ I!
is that GKS allows more than one workstation to be in use ,'1/-" ,'; ,'
simultaneously. For example, an operator may be Normolizotion/n," JE _I/ ,II 'iJtv,ew
/ ..... <
interacting with a design through an interactive display, transform- / / ~ '
OllOn | / • i I . . I t
while taking copies of completed parts of the design on a
plotter. ,' ," /I ,'i /,
Output primitives are specified in a Cartesian world ,,,,; ,I/
. I /
1i #
I'
I I Normalization
coordinate system. Applications that require other user
level coordinate systems, for example, polar or
Ib-._-ql ,.o°s,or o,oo2
logarithmic coordinates, must first transform these user i.,c.._ )ll I,'.__.-,
coordinates to world coordinates. [i¢---'-zi
Transformation to the coordinate system of the display Window I ~'--"------..~ f
device is accomplished in two stages. First, world coordi- Window 2
nates are transformed to an intermediate coordinate sys-
tem called normalized device coordinates (NDC) by a Figure 2. Two objects defined in two world coordinate
window to viewport mapping termed a normalization systems, mapped onto specific areas of the normalized
transformation. Then a second window to viewport map- device coordinates
Workstation-dependent Global
Polyline Linetype
Areo used Linewidth scalefactor None
Window Polyline colour index
Viewport Polymarker Markertype
Marker size scalefactor None
Polymarker colour index
Fill area Fill area interiorstyle Pattern reference point
Fill area style index Patternsize
Fill areacolour index
Areo used Text Text font and precision Character height
Character expansion factor Character up vector
Figure 3. Workstation transformation maps the work- Character spacing Text path
Text colour index Text alignment
station window to the largest possibte region of the work- Cell array None None
station viewport with the same aspect ratio.
The idea that different parts of the picture can be defined Levels
in different world coordinate systems and input can sub-
Rather than insist that all facilities in GKS are supported by
sequently be returned to the application program in the
every implementation, GKS is defined as a set of levels on
right world coordinate system is a very powerful feature
two orthogonal axes:
of GKS.
Logical input devices may operate in one of three
• 0: simple output
modes:
• 1 : output including segments
• request rather like Fortran READ. A request is made by • 2: full output including all the facilities for inserting
the application program for a measure to be returned segments from WlSS into the current segment
from a specified device. GKS waits until the operator • a: no input
has set the measure to the desired value and has acti- • b: request input only
vated the trigger. • c: all forms of input
• sample: the current measure value is returned
whenever requested by the application program. The There are, therefore, nine levels in total, with 0a the
trigger is not used by sample input. simplest and 2c the most comprehensive. The American
• event: a number of input devices may be active National Standards Institute GKS standard defines an
together. Each time the trigger for a particular device is additional level, m, which mandates very minimal
activated, the current measure value and data that capabilities. There is no likelihood of this being added to
identify the device are added to a single queue of the ISO standard and many American suppliers are ignor-
input events for all the devices used in event mode. ing it.
The application program can interrogate the queue to
retrieve the input events. It is possible to couple more C H A N G I N G TO G K S
than one input device to the same trigger so that mul- Current s y s t e m
tiple events can be generated from a single trigger
event. The problems encountered in reprogramming an existing
application to run using GKS will clearly differ depending
Some degree of control over logical input devices is pro- on the graphics software used in the original implementa-
vided to the application program through device initiali- tion. Consequently, this section has to be a generalization
zation functions. These enable the program to define the from the experience encountered in the UK. The major
Capability 0a 0b 0c 1a 1b 1c 2a 2b 2c