Sie sind auf Seite 1von 3

MCA 402: Graphics & Multimedia

Prof. Boudhayan Bhattacharya Prof. Subhajyoti Mahata

GKS (the Graphical Kernel System) is an ANSI and ISO standard. GKS standardizes twodimensional graphics functionality at a relatively low level. The primary purposes of the standard are: To provide for portability of graphics application programs. To aid in the understanding of graphics methods by application programmers. To provide guidelines for manufacturers in describing useful graphics capabilities. The Graphical Kernel System (GKS) is a document produced by the International Standards Organization (ISO) which defines a common interface to interactive computer graphics for application programs. GKS has been designed by a group of experts representing the national standards institutions of most major industrialized countries. The full standard provides functional specifications for some 200 subroutines which perform graphics input and output in a device independent way. Application programs can thus move freely between different graphics devices and different host computers. For the first time graphics programs have become genuinely portable. In order to allow particular applications to choose a graphics package with the appropriate capability, GKS has been defined to have different levels. The level structure has two dimensions, one for output (0, 1, or 2) and one for input (a, b, or c). Higher levels include the capabilities of lower levels. In the United States, ANSI has defined also a level 'm', for very simple applications, which sits below output level '0'. Most implementations provide all output (level '2') and intermediate input (level 'b'). The reason input level 'c' is not usually supported is that it requires asynchronous input facilities not found in all operating systems. The GKS functions have been defined independently from a specific programming language, and bindings to individual languages are subject to separate standards efforts which have been undertaken for all the major languages. The GKS functions are separated into those which pass values to GKS for control, setting or output, and those which inquire about status information. There are 8 distinct classes: 1. Control Functions 2. Output Attributes 3. Output Primitives 4. Segment Functions 5. Transformations 6. Input Functions 7. Metafile Functions 8. Inquiry Functions The Graphical Kernel System (GKS) provides a set of functions for the purpose of generating 2D pictures on vector graphics and/or raster devices. It also supports operator input and interaction by supplying basic functions for graphical input, picture segmentation and subsequent storage, retrieval and dynamic modification of graphical information. GKS provides a functional interface between an application program and a configuration of graphical input and output devices. The functional interface contains all basic functions for interactive and non-interactive graphics on a wide variety of graphical equipment. 1

MCA 402: Graphics & Multimedia

Prof. Boudhayan Bhattacharya Prof. Subhajyoti Mahata The interface is at such a level of abstraction that hardware peculiarities are shielded from the application program. As a result, a simplified interface presenting uniform output primitives (POLYLINE, POLYMARKER, TEXT, FILL AREA, CELL ARRAY, GENERALIZED DRAWING PRIMITIVES) and uniform input classes (LOCATOR, STROKE, VALUATOR, CHOICE, PICK, STRING) is obtained. A central concept, both for structuring GKS and for realizing device independence, is the workstation concept. Each workstation available at a particular installation is grouped into one of six categories (OUTPUT, INPUT, OUTIN, WISS, MD, MI) depending on the actions it can perform. The notion of multiple workstations allows simultaneous output to workstations of type OUTPUT and OUTIN and input from workstations of type INPUT and OUTIN. Facilities for internal and external storage of graphical information are provided by a special set of workstations of type WISS, MD and MI that use metafiles. Not all of the GKS implementations support the full set of functions. Nine levels of implementation are defined to meet the different requirements of graphical systems and each GKS implementation, classified into one of these levels, provides the functions of that level only. The levels themselves are upward compatible. GKS defines only a language independent nucleus of a graphics system. For integration into a language, GKS is embedded in a language dependent layer containing the language conventions. The graphical output that is generated by GKS is built up from two groups of basic elements called output primitives and primitive attributes. The output primitives are abstractions of basic actions a device can perform, such as draWing lines, markers or printing character strings. The attributes control the aspects of output primitives on a device, such as line types, marker types, text characteristics (eg. height, spacing, expansion factor) and colour. Non-g~ometric aspects such as colour can be controlled for each workstation individually to make best use of its capabilities.

Output Primitives
A basic graphic element that can be used to construct a picture. There are four basic output primitives: Polyline Polymarker Fill Area Text

1. Polyline
The GKS function for drawing line segments is called polyline. The polyline function takes an array of X-Y coordinates and draws line segments connecting them. The attributes that control the appearance of a polyline are: Linetype: which controls whether the polyline is drawn as a solid, dashed, dotted, or dashdotted line Linewidth scale factor: which controls how thick the line is. 2

MCA 402: Graphics & Multimedia

Prof. Boudhayan Bhattacharya Prof. Subhajyoti Mahata Polyline color index: which controls what color the line is.

2. Polymarkers
The GKS polymarker function allows you to draw marker symbols centered at coordinate points that you specify. The attributes that control the appearance of polymarkers are: Marker: which specifies one of five standardized symmetric characters to be used for the marker. The five characters are dot, plus, asterisk, circle, and cross. Marker size scale factor: which controls how large each marker is (except for the dot marker). Polymarker color index: which specifies what color the marker is.

3. Fill Area
The GKS fill area function allows you to specify a polygonal shape of an area to be filled with various interior styles. The attributes that control the appearance of fill areas are: Fill area interior style: which specifies how the polygonal area should be filled: with solid colors or various hatch patterns, or with nothing, that is, a line is drawn to connect the points of the polygon, so you get only a border. Fill area style index: If the fill area style is hatch, this index specifies which hatch pattern is to be used: horizontal lines; vertical lines; left slant lines; right slant lines; horizontal and vertical lines; or left slant and right slant lines. Fill area colour index, which specifies the color of the fill patterns or solid areas.

4. Text
The GKS text function allows you to draw a text string at a specified coordinate position. The attributes that control the appearance of text are: Text font and precision: which specifies what text font should be used for the characters and how precisely their representation should adhere to the settings of the other text attributes. Character expansion factor: which controls the height-to-width ratio of each plotted character. Character spacing: which specifies how much additional white space should be inserted between characters in a string. Text color index: which specifies what color the text string should be.

Segment is a collection of output primitives that can be manipulated as a unit. In GKS, segment attributes are visibility, highlighting, detectability, segment priority and segment transformation.