Skip to main content

Appendix A: GKSM Metafile (Part 1)

APPENDIX A​

Excerpt from "Draft Proposal: Graphical Kernel System" [14]

E.2 Metafile Based on ISO DIS7942​

This metafile may be categorized as one which aims to provide a means of recording the exact sequence of function calls made to GKS. Its functional capability covers the entire range of GKS output functions, from level m to level 2. It is, therefore, suitable for applications where the individual graphics actions need to be 'played back', perhaps with selective graphical editing being done by the interpreter.

Two encodings have been specified for this metafile. One encoding is inefficient for many applications. The second allows an unspecified binary format. The remainder of this IGCF appendix gives full details of these metafile structures and encodings.

E.2.1 File Format and Data Format​

The GKS metafile is built up as a sequence of logical data items. The file starts with a file header in fixed format which describes the origin of the metafile (author, installation), the format of the following items, and the number representation. The file ends with an end item indicating the logical end of the file. In between these two items, the following information is recorded in the sense of an audit trail:

  • a) workstation control items and message items;
  • b) output primitive items, describing elementary graphics objects;
  • c) attribute information, including output primitive attributes; segment attributes, and workstation attributes;
  • d) segment items, describing the segment structure and dynamic segment manipulations;
  • e) user items.

The overall structure of the GKS metafile is as follows:

FILE:     |file  |item|---|item|---|end |
|header| 1 | | i | |item|

ITEM: |item |item data record|
|header | |

ITEM |'GKSM' |identification|length of item data|

HEADER: |optional| number | in bytes |

All data items except the file header have an item header containing:

  • a) the character string 'GKSM' (optional) which is present to improve legibility of the file and to provide an error control facility;
  • b) the item type identification number which indicates the kind of information that is contained in the item;
  • c) the length of the item data record.

The lengths of these fields of the item header are implementation dependent and are specified in the file header. The content of the item data record is fully described below for each item type.

The metafile contains characters, integer numbers, and real numbers marked (c), (i), (r) in the item description. Characters in the metafile are represented according to ISO 646 and ISO 2022. Numbers will be represented according to ISO 6093 using format F1 for integers and format F2 for reals. (Remark: Formats F1 and F2 can be written and read via FORTRAN formats I and F respectively.)

Real numbers describing coordinates and length units are stored as normalized device coordinates. The workstation transformation, if specified in the application program for a workstation writing a metafile of this format, is not performed but WORKSTATION WINDOW and WORKSTATION VIEWPORT are stored in data items for later usage. Real numbers may be stored as integers. In this case transformation parameters are specified in the file header to allow proper transformation of integers into normalized device coordinates.

For reasons of economy, numbers can be stored using an internal binary format. As no standard exists for binary number representation, this format limits the portability of the metafile. The specification of such a binary number representation is outside the scope of this document.

When exchanging metafiles between different installations, the physical structure of data sets on specific storage media should be standardized. Such a definition is outside the scope of this standard.

E.3 Generation of Metafiles​

Table E1 contains a list, by class, of all GKS functions which apply to workstations of category MO, and their effects on this GKSM. In the table, GKSM-OUT is a workstation identifier indicating a workstation writing a metafile of this format.

The concepts of clipping rectangle and clipping indicator are encapsulated in one metafile item which specifies a clipping rectangle. This item is written to the metafile on activate workstation with the values (0, 1, 0, 1), if the clipping indicator is OFF, or the viewport of the current normalization transformation, if the clipping indicator is ON. If the viewport of the current normalization transformation is redefined or a different normalization transformation is selected when the clipping indicator is ON, a further clipping rectangle item is written. If the clipping indicator is changed to OFF, a clipping rectangle item (0, 1, 0, 1) is written. If the clipping indicator is changed to ON, an item containing the viewport of the current normalization transformation is written. This is analogous to the handling of clipping in segments (see 4.7.6 [14]).

GKS functions which apply to workstations        GKSM item created
of category MO                                   or effect
========================================================================

Control functions

OPEN WORKSTATION (GKSM-OUT,...)                  - (file header)
                                                 1 (CONDITIONAL)
CLOSE WORKSTATION (GKSM-OUT)                     0 (end item)
ACTIVATE WORKSTATION (GKSM-OUT)                  (61, 21-44)
                                                 ensure attributes
                                                 current;
                                                 enable output

DEACTIVATE WORKSTATION (GKSM-OUT)                disable output
CLEAR WORKSTATION (GKSM-OUT,...)                 1
                                                 2
REDRAW ALL SEGMENTS ON WORKSTATION (GKSM-OUT)
UPDATE WORKSTATION (GKSM-OUT,...)                3
SET DEFERRAL STATE (GKSM-OUT,...)                4
MESSAGE (GKSM-OUT,...)                           5 (message)
ESCAPE                                           6
________________________________________________________________________

Output Primitives

POLYLINE                                         11
POLYMARKER                                       12
TEXT                                             13
FILL AREA                                        14
CELL ARRAY                                       15
GENERALIZED DRAWING PRIMITIVE                    16
________________________________________________________________________

Output Attributes

SET POLYLINE INDEX                               21
SET LINETYPE                                     22
SET LINEWIDTH SCALE FACTOR                       23
SET POLYLINE COLOUR INDEX                        24
SET POLYMARKER INDEX                             25
SET MARKER TYPE                                  26
SET MARKER SIZE SCALE FACTOR                     27
SET POLYMARKER COLOUR INDEX                      28
SET TEXT INDEX                                   29
SET TEXT FONT AND PRECISION                      30
SET CHARACTER EXPANSION FACTOR                   31
SET CHARACTER SPACING                            32
SET TEXT COLOUR INDEX                            33
SET CHARACTER HEIGHT                             34
SET CHARACTER UP VECTOR                          34
SET TEXT PATH                                    35
SET TEXT ALIGNMENT                               36
SET FILL AREA INDEX                              37
SET FILL AREA INTERIOR STYLE                     38
SET FILL AREA STYLE INDEX                        39
SET FILL AREA COLOUR INDEX                       40

SET PATTERN SIZE                                 41
SET PATTERN REFERENCE POINT                      42

SET ASPECT SOURCE FLAGS                          43
SET PICK IDENTIFIER                              44
________________________________________________________________________

Workstation Attributes

SET POLYLINE REPRESENTATION (GKSM-OUT,...)       51
SET POLYMARKER REPRESENTATION (GKSM-OUT,...)     52
SET TEXT REPRESENTATION (GKSM-OUT,...)           53
SET FILL AREA REPRESENTATION (GKSM-OUT,...)      54
SET PATTERN REPRESENTATION (GKSM-OUT,...)        55
SET COLOUR REPRESENTATION (GKSM-OUT,...)         56
________________________________________________________________________

Transformation Functions

SET WINDOW of current normalization              34, 41, 42
transformation
SET VIEWPOINT of current normalization           61, 34, 41, 42
transformation
SELECT NORMALIZATION TRANSFORMATION              61, 34, 41, 42
SET CLIPPING INDICATOR                           61
SET WORKSTATION WINDOW (GKSM-OUT,...)            71
SET WORKSTATION WINDOW VIEWPORT (GKSM-OUT,...)   72

Note:  item 61 (CLIPPING RECTANGLE) is described more fully in E.2.2.

Note: When the current normalization transformation is altered, items
corresponding to attributes containing coordinate information are sent
(items 34, 41, and 42).
________________________________________________________________________

Segment Functions

CREATE SEGMENT                                   81
CLOSE SEGMENT                                    82
RENAME SEGMENT                                   83
DELETE SEGMENT                                   84

DELETE SEGMENT FROM WORKSTATION (GKSM-OUT,...)   84
ASSOCIATE SEGMENT WITH WORKSTATION               81, (21-44), (11-16),
(GKSM-OUT,...)                                   (61), 82
COPY SEGMENT TO WORKSTATION (GKSM-OUT,...)       (21-44), (11-16), (61)

INSERT SEGMENT                                   (21-44), (11-16), (61)
________________________________________________________________________

Segment Attributes

SET SEGMENT TRANSFORMATION                       91

SET VISIBILITY                                   92
SET HIGHLIGHTING                                 93
SET SEGMENT PRIORITY                             94
SET DETECTABILITY                                95
________________________________________________________________________

Metafile Functions

WRITE ITEM TO GKSM                               > 100
________________________________________________________________________