A C Library for Computer Graphics Metafile (CGM) Interpretation

MDL/I is a library that defines an Application Programming Interface (API) for the interpretation of elements in Computer Graphics Metafiles (CGMs). The library is implemented in the C programming language. The API conforms to C language conventions, but could be used from any other language. MDL/I interprets CGM versions 1, 2, and 3 as well as the leading industry profiles ATA, PIP, and CALS.

Use of this product in application development reduces programming time and resources required to support the import or editing of CGMs from the application. In the absence of this product, independent development of code to read in CGM elements and parse the incoming stream for data contents will require expert knowledge of CGM encodings and element usage, as well as the various CGM profiles relevant in a given operating environment.

The CGM Standard

Computer Graphics Metafile (CGM) is an American (ANSI X3.122-1986, FIPS Publication 128) and international (ISO/IEC 8632-1987) standard for storage, transmission and archival of graphics information. The standard defines a rich set of graphical elements and attributes; specifying encodings as well as element representation and storage formats.

CGM Encodings

There are three metafile encodings: binary, character and clear text. Binary CGMs are compact and intended for fast generation and interpretation. Element data in binary CGMs is independent of the CPU architecture - a binary CGM may be transported between computer systems, as long as the CGM contents are not altered. Character encoding is intended for situations where binary transmission is not available. Clear Text CGMs are verbose and human-readable. They may be edited with normal text editing tools.

MDL/I is capable of interpreting CGMs in any of the three encodings. Further, the encoding is detected automatically when the CGM is first opened.


CGM has been adopted as a part of the U.S. Department of Defense CALS standard (MIL-D-28003A), in the form of a CALS CGM Profile. A profile is a narrower definition of the basic standard, with additional restrictions on conformance and limitations on use of certain elements and attributes. Similarly, CGM/PIP is a profile adopted by the geophysical exploration industry. ATA is yet another profile adopted by the aerospace manufacturers.

MDL/I supports the interpretation of CGMs conforming to any of these profiles. Further, a CGM of each profile is detected automatically and all extensions defined in each profile are recognized.

Programming Model

MDL/I is organized in three distinct modules: a user interface layer (UIL), a metafile translator layer (MTL) and a graphical support layer (GSL). The UIL handles dialog with the user application. The MTL handles all metafile operations - reading, parsing, data translation, coordinate transformations and simulations. The GSL is an interface to the rendering system of choice, which is capable of controlling display or hardcopy devices and rendering a reasonable variety of graphics output primitives.

Implementation and Integration

MDL/I is targeted towards programmers and a certain amount of code is expected to be implemented and integrated into the target application requiring CGM input. The user interface layer is the responsibility of the integrator. A simple Unix-style command line interface to the translator is included as a sample implementation.

Much of the effort for an integrator lies in developing the interface to the rendering system. Based on the facilities available in the rendering system, rendering of a particular primitive or attribute may be assigned to the target system, or simulated within MDL/I.

A Flexible System

MDL/I is designed to combine simplicity for applications with simple requirements and sophistication for those with more demanding requirements. An integrator may quickly produce a CGM translator with MDL/I, utilizing the simulation capabilities of the product. On the other hand, every CGM element may be mapped to a facility in the target rendering system at its highest level, with emphasis on performance and quality.

A wide variety of graphics systems may be supported with MDL/I. The product has been used to build CGM viewing programs, CGM print and plot filters, CGM import filters in CAD and desktop publishing systems, as well as graphics file format converters.

Complete CGM Solutions

ATC is fully committed to the CGM standard and offers a complete family of CGM products. Generate CGMs from your application using GRAFPAK-CGM, a CGM generator library. Use Metacheck to verify conformance of your CGMs to the standard, or to the CALS, ATA, or PIP profiles. Use CGM-Spooler to view the CGMs and generate hardcopy.

For more information on MDL/I or any of our other products, contact an ATC account representative today.

Copyright © 1995 Advanced Technology Center /