Also Known As: Computer Graphics Metafile
Type | Metafile |
Colors | Unlimited |
Compression | RLE, CCITT Group3 and Group4 |
Maximum Image Size | Unlimited |
Multiple Images Per File | Yes |
Numerical Format | NA |
Originator | ANSI, ISO |
Platform | All |
Supporting Applications | Too many to list |
See Also | None |
Usage
Standardized platform-independent format used for the interchange of bitmap and vector data.
Comments
CGM is a very feature-rich format which attempts to support the graphic needs of many general fields (graphic arts, technical illustration, cartography, visualization, electronic publishing, and so on). While the CGM format is rich in features (many graphical primitives and attributes), it is less complex than PostScript, produces much smaller (more compact) files, and allows the interchange of very sophisticated and artistic images. In fact, so many features are available to the software developer that a full implementation of CGM is considered by some to be quite difficult. Nevertheless, CGM use is spreading quickly.
Sample images are available for this format.
CGM (Computer Graphics Metafile) was developed by experts working on committees under the auspices of the International Standards Organization (ISO) and the American Standards National Institute (ANSI). It was specifically designed as a common format for the platform-independent interchange of bitmap and vector data, and for use in conjunction with a variety of input and output devices. Although CGM incorporates extensions designed to support bitmap (called raster in the CGM specification) data storage, files in CGM format are used primarily to store vector information. CGM files typically contain either bitmap or vector data, but rarely both.
Contents:
File Organization and Details
For Further Information
The newest revision of CGM is the CGM:1992 standard, which defines three upwardly compatible levels of increasing capability and functionality. Version 1 is the original CGM:1987 standard, a collection of simple metafile primitives. Version 2 metafiles may contain Closed Figures (a filled primitive comprised of other primitives). Version 3 is for advanced applications, and its metafiles may contain Beziers, NURBS, parabolic and hyperbolic arcs, and the Tile Array compressed tiled raster primitive.
CGM uses three types of syntactical encoding formats. All CGM files contain data encoded using one of these three methods:
CGM is intended for the storage of graphics data only. It is sometimes (erroneously) thought to be a data transfer standard for CAD/CAM data, like IGES, or a 3D graphic object model data storage standard. However, CGM is quite suited for the interchange of renderings from CAD/CAM systems, but not for the storage of the engineering model data itself.
CGM supports and is used by the Graphical Kernel System (GKS) standard, but is something completely different. GKS, which is in fact an API graphics library specification, is often mistaken for a graphics file format. CGM has found a role on most platforms as a method for the transfer of graphics data between applications. Programs that support CGM include most business graphics and visualization packages and many word processing and CAD applications.
Vector primitives supported by Version 1 CGM metafiles include lines, polylines, arcs, circles, rectangles, ellipses, polygons, and text. Each primitive may have one or more attributes, including fill style (hatch pattern), line or edge color, size, type, and orientation. CGM supports bitmaps in the form of cell arrays and tile arrays. The logical raster primitives of CGM are device-independent.
A minor point, but one worth noting, is that the three flavors of encoding supported by CGM may not all be readable by all software applications that import CGM files. Despite the existence of a solid body of rules and encoding schemes, CGM files are not universally interchangeable.
Many CGM file-writing applications support different subsets of standard features, often leaving some features out that may be required by other CGM readers. Also, because CGM allows vendor-specific extensions, many (such as custom fills) have been added, making full CGM support by an application difficult.
The CGM:1987 standard included a "Minimum Recommended Capabilities" list to aid developers in implementing a CGM application capable of reading and writing CGM metafiles correctly. Unfortunately, some of the big manufacturers chose to ignore even these modest requirements. Therefore, because it is impossible to police everyone who implements CGM in an application, many incompatibilities do exist.
In an effort to improve compatibility, the CGM:1992 standard removed the "Minimum Recommended Capabilities" list in anticipation of the publication of the CGM Amendment 1, which defines more stringent conformance requirements and a "Model Profile," which could be considered a minimal useful implementation level. Amendment 1 is entitled "Conformance, Rules for Profiles, and the Model Profille." Amendment 2, "Application Structuring," in the publication process as we go to press, provides the ability to "tag," reference, and index collections of elements with application significance. Modeled after SGML, the new features provide a way to "object structure" a metafile. (A 3D metafile project is also underway.)
All CGM files start with the same identifier, the BEGIN METAFILE statement, but its actual appearance in the file depends on how the file is encoded. In clear-text encoding, the element is simply the ASCII string BEGMF. If the file is binary encoded, you must read in the first two bytes as a word; the most significant byte (MSB) is followed in the file by the least significant byte (LSB). Bits in this word provide the following information:
15-12: | Element class |
11-05: | Element ID |
04-00: | Parameter list length |
BEGIN METAFILE is a "Delimiter Element," making it class 0. The element ID within that class is 1. The parameter list length is variable, so it must be ANDed out when comparing. The bit pattern is then:
0 0 0 0 0 0 0 0 0 0 1 X X X X X
To check it, simply AND the word with 0XFFE0 and compare it with 0X0020. In reading the standard, we get the impression that it is actually legal to add padding characters (nulls) to the beginning of the file. We rather doubt that anyone would actually do this, but it may be appropriate to read in words until a non-zero word is read and compare this word. You can read in full words because all elements are constrained to start on a word boundary.
CGM is both an ANSI and an ISO standard and has been adopted by many countries, such as Australia, France, Germany, Japan, Korea, and the United Kingdom. The full ANSI designation of the current version of CGM is:
Information Processing Systems--Computer Graphics Metafile for the Storage and Transfer of Picture Description Information, ANSI/ISO 8632-1992 (commonly called CGM: 1992).
Note that CGM:1992 is the current standard. Be careful not to obtain the earlier ANSI X3.122-1986 if you need the latest standard. This earlier document, CGM:1986, defining the Version 1 metafile, was superseded by ISO/IEC 8632:1992. ANSI adopted CGM:1992 without modification and replaced ANSI X3.122-1986 with it. The CGM standard is contained in four ISO standards documents:
ISO 8632-1 Part 1: Functional Specification |
ISO 8632-2 Part 2: Character Encoding |
ISO 8632-3 Part 3: Binary Encoding |
ISO 8632-4 Part 4: Clear Text Encoding |
These may be purchased from any of the following organizations:
International Standards Organization (ISO)
1 rue de Varembe
Case Postal 56
CH-1211 Geneva 20 Switzerland
Voice: +41 22 749 01 11
FAX: +41 22 733 34 30
American National Standards Institute (ANSI)
Sales Department
1430 Broadway
New York, NY, 10018
Voice: 212-642-4900
Canadian Standards Association (CSA)
Sales Group
178 Rexdale Blvd.
Rexdale, Ontario, M9W 1R3
Voice: 416-747-4044
Other countries also make the CGM specification available through their standards organizations; these include DIN (Germany), BSI (United Kingdom), AFNOR (France), and JIS (Japan).
The National Institute of Standards and Technology (NIST) has set up a Web page for CGM at:
http://speckle.ncsl.nist.gov/~lsr/cgm_std.htm
NIST has also set up a CGM Testing Service for testing CGM metafiles, generators, and interpreters. The Testing Service examines binary-encoded CGM files for conformance to Version 1 CGM, as defined in the application profiles of FIPS 128-1 and the DoD CALS CGM AP military specification MIL-D-28003A. You can purchase the testing tool used by NIST so you can do internal testing on various PC and UNIX systems.
For more information about the CGM Testing Service, contact:
National Institute of Standards and Technology (NIST)
Computer Systems Laboratory
Information Systems Engineering Division
Gaithersburg, MD 20899
Voice: 301-975-3265
You can also obtain information about CGM from the following references:
Arnold, D.B. and P.R. Bono, CGM and CGI: Metafile and Interface Standards for Computer Graphics, Springer-Verlag, New York, NY, 1988.
Arnold, D.B. and P.R. Bono, CGM et CGI: normes de metafichier et d'interfaces pour l'infographie, French translation and updating of the above reference, Masson, 1992.
Henderson, L.R., and Gebhardt, "CGM: SGML for Graphics," The Gilbane Report, Fall 1994.
Henderson, L.R., and A.M. Mumford, The CGM Handbook, Academic Press, San Diego, CA, 1993.
Bono, P.R. , J.L. Encarnacao, L.M. Encarnacao, and W.R. Herzner, PC Graphics With GKS, Prentice-Hall, Englewood Cliffs, NJ, 1990.
There are also two amendments to theis specification:
For additional information online, see:
http://www.agocg.ac.uk:80/agocg/cgm.html
[Previous]
[Next]
[Up]
[Index]
Contents |
Glossary |
Main |
Formats |
Software |
Internet |
Book
Copyright © 1996, 1994 O'Reilly & Associates, Inc. All Rights Reserved.