CGM(7P) — SUNPHIGS LIBRARY
NAME
CGM − contains information describing mapping of SunPHIGS functions to CGM elements.
DESCRIPTION
Overview
The Computer Graphics Metafile (CGM) standard defines a metafile for the capture of static picture definitions. Since use of the CGM was not intended to be restricted to PHIGS environments, a one-to-one mapping between the two standards is not possible in all cases. This document describes the generation of CGM in SunPHIGS environment.
Application Profiles
Application profile (AP) defines a subset of permissible values for parameters of elements to ease interoperability of implementations of a standard. There are several application profiles defined for CGM, among them are:
• TOP
• TOP-BASIC
The Technical Office Protocol (TOP) CGM AP defines the use of binary encoding, long-format command headers, and restricts the use of private ESCAPEs and GDPs. In addition, TOP-BASIC further restricts the range of primitive attributes to standardized values. For example, only line types of 1 through 5 may appear in the metafile. SunPHIGS , by default, generates TOP conforming metafiles. See WORKSTATION TYPE SET (3P).
Encodings
There are three standard encodings defined in CGM:
• Character Encoding
• Binary Encoding
• Clear Text Encoding
The Character Encoding is intended to provide an encoding of minimum size. It is particularly suitable for transfer through networks that cannot support binary transfers. The Binary Encoding provides an encoding that requires least effort to generate and interpret on many systems. The Clear Text Encoding provides an encoding that can be created, viewed, and edited with standard text editors. It is therefore also suitable for transfer through networks that support only transfer of text files. SunPHIGS is capable of generating any of the above three encodings. See WORKSTATION TYPE SET (3P).
Picture Generation
CGM is generated by the a workstation of type MO. See OPEN WORKSTATION (3P). At appropriate times, the PHIGS structures posted on an MO/CGM workstation are traversed and CGM elements are created. During PHIGS traversal, PHIGS primitives, which are in three dimensional space, are clipped to the view volume and then projected onto the view plane. Clipped PHIGS primitives may result in the generation of one or multiple CGM elements. Workstation transformation is applied to the clipped-and-projected primitives and appropriate CGM elements are generated.
CGM Construct
CGM created through SunPHIGS are typically in the following construct:
• BEGIN METAFILE
• Metafile Descriptor Elements
• BEGIN PICTURE
• Attribute Elements
• Graphical Primitive Elements
• END PICTURE
• END METAFILE
Metafile Descriptor Elements
Metafile Descriptor elements serves a similar purpose as the Workstation Description Table in PHIGS. By default, the following Metafile Descriptor elements appears at the beginning of every CGM metafile generated by SunPHIGS:
| Metafile Elements | Default Value |
| METAFILE VERSION | 1 |
| METAFILE DESCRIPTION | "Sun Microsystems CGM, TOP/FULL conformance" |
| METAFILE ELEMENT LIST | list of metafile elements used in the metafile |
| VDC TYPE | INTEGER |
| INTEGER PRECISION | -32767 32767 |
| REAL PRECISION | -32767.0 32767.0 4 |
| INDEX PRECISION | 0 127 |
| COLOUR PRECISION | 255 |
| COLOUR INDEX PRECISION | 255 |
| COLOUR VALUE EXTENT | 0 0 0 255 255 255 |
| MAXIMUM COLOUR INDEX | 255 |
| METAFILE DEFAULTS REPLACEMENT | list of metafile defaults |
Attribute Elements
Setting of the POLYLINE, POLYMARKER, TEXT, INTERIOR and EDGE representations on the MO/CGM workstations are recorded in the MO workstation state list. Because these representations cannot be encoded in a CGM metafile, PHIGS output primitives using bundled values are encoded in the metafile using individual attribute control. The following table shows the mapping of the SunPHIGS attribute control functions to CGM attribute elements:
| SunPHIGS Attribute Functions | CGM Elements |
| SET LINETYPE | LINE TYPE |
| SET LINE WIDTH SCALE FACTOR | LINE WIDTH |
| SET POLYLINE COLOUR INDEX | LINE COLOUR |
| SET MARKER TYPE | MARKER TYPE |
| SET MARKER SIZE SCALE FACTOR | MARKER SIZE |
| SET POLYMARKER COLOUR INDEX | MARKER COLOUR |
| SET INTERIOR STYLE | INTERIOR STYLE |
| SET INTERIOR STYLE INDEX | PATTERN INDEX or HATCH INDEX |
| SET INTERIOR COLOUR INDEX | FILL COLOUR |
Graphical Primitive Elements
The following table shows mapping of the SunPHIGS output primitives to CGM Graphical Primitive elements:
| SunPHIGS primitives | CGM elements |
| POLYLINE, POLYLINE3, POLYMARKER, | One or multiple POLYLINE elements |
| POLYMARKER 3, TEXT, TEXT 3, | |
| ANNOTATION TEXT RELATIVE, | |
| ANNOTATION TEXT RELATIVE 3 | |
| FILL AREA, FILL AREA 3 | POLYGON |
| FILL AREA SET, FILL AREA SET 3 | POLYGON SET, and POLYLINE if edge flag is ON |
| CELL ARRAY, CELL ARRAY 3, | One or multiple POLYLINE elements |
| GDP - POLYLINE SET, GDP - POLYLINE SET 3 | |
| GDP - CIRCLE, GDP - CIRCLE 3 | POLYGON SET, and POLYLINE if edge flag is ON |
| GDP - ANNOTATION CIRCLE, | CIRCLE, and POLYLINE if edge flag is ON |
| GDP - ANNOTATION CIRCLE 3 | |
| GDP - CIRCULAR ARC, GDP - CIRCULAR ARC 3 | One or multiple POLYLINE elements |
| GDP - ANNOTATION CIRCULAR ARC, | CIRCULAR ARC CENTRE |
| GDP - ANNOTATION CIRCULAR ARC 3 | |
| GDP - CIRCULAR ARC CLOSE, | POLYGON SET, and POLYLINE if edge flag is ON |
| GDP - CIRCULAR ARC CLOSE 3 | |
| GDP - ANNOTATION CIRCULAR ARC CLOSE, | CIRCULAR ARC CENTRE CLOSE |
| GDP - ANNOTATION CIRCULAR ARC CLOSE 3 | |
| GDP - ELLIPSE, GDP - ELLIPSE 3 | POLYGON SET, and POLYLINE if edge flag is ON |
| GDP - ANNOTATION ELLIPSE, | ELLIPSE, and POLYLINE if edge flag is ON |
| GDP - ANNOTATION ELLIPSE 3 | |
| GDP - ELLIPTICAL ARC, | One or multiple POLYLINE elements |
| GDP - ELLIPTICAL ARC 3 | |
| GDP - ANNOTATION ELLIPTICAL ARC, | ELLIPTICAL ARC |
| GDP - ANNOTATION ELLIPTICAL ARC 3 | |
| GDP - ELLIPTICAL ARC CLOSE, | POLYGON SET, and POLYLINE if edge flag is ON |
| GDP - ELLIPTICAL ARC CLOSE 3 | |
| GDP - ANNOTATION ELLIPTICAL ARC CLOSE, | ELLIPTICAL ARC CLOSE, and POLYLINE if edge |
| GDP - ANNOTATION ELLIPTICAL ARC CLOSE 3 | flag is ON |
Graphical Primitive Elements (continued)
| SunPHIGS primitives | CGM elements |
| POLYLINE SET 3 WITH DATA† | One or multiple POLYLINE elements |
| NON-UNIFORM B-SPLINE CURVE† | POLYMARKER or POLYLINE |
| FILL AREA 3 WITH DATA† | POLYGON |
| FILL AREA SET 3 WITH DATA,† | POLYGON SET, and POLYLINE if |
| TRIANGLE STRIP 3 WITH DATA,† | edge flag is ON. Vertex colours, vertex |
| QUADRILATERAL MESH 3 WITH DATA,† | normals, facet colours, facet normals, |
| POLYHEDRON 3 WITH DATA,† | and PHIGS+ rendering attributes (such as |
| NON-UNIFORM B-SPLINE SURFACE† | lighting, shading, and depth cueing) |
| are ignored. |
† These are SunPHIGS Extensions based on PHIGS+ and are not part of the PHIGS standard.
Line Types mapping
There are 6 line types defined in SunPHIGS 1.0 but only 5 are defined in CGM. Line types that are not defined in CGM, are mapped to the line types that resemble them most closely. The following table shows mapping of SunPHIGS line types to CGM line types:
| SunPHIGS Line Types | CGM Line Types | ||
| Value | Meaning | Value | Meaning |
| 1 | Solid | 1 | Solid |
| 2 | Dashed | 2 | Dashed |
| 3 | Dotted | 3 | Dotted |
| 4 | Dash-dotted | 4 | Dash-dotted |
| 0 | Long-dashed | 2 | Dashed |
| -1 | Dot-dash-dotted | 5 | Dash-dot-dotted |
| -2 | Center | 5 | Dash-dot-dotted |
| -3 | Phantom | 5 | Dash-dot-dotted |
Hatch Styles Mapping
There are 24 hatch styles defined in SunPHIGS 1.0, but only 6 are defined in CGM. Hatch styles that are not defined in CGM, are mapped to the hatch styles that resemble them most closely. The following table shows mapping of SunPHIGS hatch styles to CGM hatch styles:
| SunPHIGS Hatch Styles | CGM Hatch Styles | ||
| Value | Meaning | Value | Meaning |
| -1 | Horizontal | 1 | Horizontal |
| -2 | Vertical | 2 | Vertical |
| -3 | 45 Degree-angled | 3 | 45 Degree-angled |
| -4 | 135 Degree-angled | 4 | 135 Degree-angled |
| -5 | Rectangular Grid | 5 | Rectangular Grid |
| -6 | Diagonal Grid | 6 | Diagonal Grid |
| -51 | Double-spaced Horizontal | 1 | Horizontal |
| -52 | Double-spaced vertical | 2 | Vertical |
| -53 | Double-spaced 45 Degree-angled | 3 | 45 Degree-angled |
| -54 | Double-spaced 135 Degree-angled | 4 | 135 Degree-angled |
| -55 | Double-spaced Rectangular Grid | 5 | Rectangular Grid |
| -106 | Double-spaced Diagonal Grid | 6 | Diagonal Grid |
| -101 | Double-spaced Transparent Horizontal | 1 | Horizontal |
| -102 | Double-spaced Transparent Vertical | 2 | Vertical |
| -103 | Double-spaced Transp. 45 Degree-angled | 3 | 45 Degree-angled |
| -104 | Double-spaced Transp. 135 Degree-angled | 4 | 135 Degree-angled |
| -105 | Double-spaced Transp. Rectangular Grid | 5 | Rectangular Grid |
| -106 | Double-spaced Transp. Diagonal Grid | 6 | Diagonal Grid |
LIMITATIONS
CGM does not have facilities to define the placement of the image on a physical display surface. Hence the workstation viewport is discarded. Hidden line and hidden surface removal (HLHSR) are not supported in MO/CGM workstation.
SEE ALSO
OPEN WORKSTATION (3P)
WORKSTATION TYPE SET (3P)
GET ITEM TYPE FROM METAFILE (3P)
READ ITEM FROM METAFILE (3P)
INTERPRET ITEM (3P)
SunPHIGS Release 1.1 — Last change: 12 July 1989