Up to cover page | Back to Introduction | On to Intelligent Content
This chapter is informative (non-normative).
A WebCGM is a Version 1, 2, 3, or 4 CGM as defined in ISO/IEC 8632:1999, with some restrictions. The restrictions improve the interoperability of WebCGM, and simplify the production of WebCGM interpreter (viewer) tools.
A WebCGM 2.1 instance, as shown in Figure 1, consists of a single Picture.
Properties which apply to the whole metafile are defined in the Metafile Descriptor. These include descriptive information about the metafile, the precisions of numbers, as well as identifiers for fonts and such resources. Properties which apply to the elements in the body of the picture are contained in the Picture Descriptor. These include such information as picture size and scaling, specification modes for aspects such as line width, and background color. Because WebCGM 2.1 allows only a single picture per metafile, the distinction -- whole-metafile versus picture-specific -- may not seem useful. However, because a WebCGM 2.1 metafile must be a valid ISO CGM:1999 metafile, the ISO CGM:1999 metafile structure is observed.
The WebCGM picture contains CGM graphic elements, as well as (optionally) Application Structures. Application Structures define intelligent objects within the picture, which are comprised of groups of graphical primitives. These intelligent objects may contain attributes or properties. WebCGM defines several types of intelligent objects - "graphical object", "paragraph", "layer", and "sub-paragraph" - as well as a few properties which each group may have.
CGM supports both raster and vector graphics in the same picture. WebCGM permits the use of popular raster compression methods — ITU-T Group 4, JPEG, and the deflate (LZ77 derivative) method of PNG — for raster content embedded within the picture.
For information about scaling of WebCGM pictures in Web documents, see
section "WebCGM and the
object
element".
This section presents an informative description of the normative drawing model of the ISO CGM standard, as well as registered extensions that have been incorporated into the WebCGM profile.
Elements rendered first may be wholly or partially hidden by elements rendered later. In the ISO CGM standard, the writing mode of primitives is "replacement mode" — content is rendered opaquely on top of previous content. To meet per-primitive (and per-pixel) transparency requirements, WebCGM includes a registered extension for Alpha transparency, as well as registered color models RGB-alpha and sRGB-alpha.
Implementations of WebCGM are expected to behave as though they implement a drawing model corresponding to the one described below. A real implementation is not required to implement the model in this way, but the result on any device supported by the implementation shall match that described by this model.
WebCGM uses a painters model of rendering. Colors are applied in successive operations to the output device. When an area overlaps a previously colored area the new color partially or completely obscures the old. When the color is not completely opaque the result on the output device is defined by the following (mathematical) rules for compositing (all color values use premultiplied alpha):
Pr, Pg, Pb — Primitive color value
Pa — Primitive alpha value
Cr, Cg, Cb — Canvas color value (before blending)
Ca — Canvas alpha value (before blending)
Cr', Cg', Cb' — Canvas color value (after blending)
Ca' — Canvas alpha value (after blending)
Ca' = 1 - (1 - Pa) * (1 - Ca)
Cr' = (1 - Pa) * Cr + Pr
Cg' = (1 - Pa) * Cg + Pg
Cb' = (1 - Pa) * Cb + Pb
Alpha compositing is performed in the current COLOUR MODEL (see T.16.19).
Primitives in a WebCGM document have an implicit drawing order, with the first primitives in the WebCGM document getting drawn first. Subsequent primitives are drawn on top of previously drawn primitives.
Primitives which have a value for the registered Escape 45 other than fully opaque, have the effect of producing a temporary separate canvas initialized to transparent black onto which the primitive is drawn. The canvas is then composited into the background, taking into account the Escape 45 value. The presence of APS in the primitive list has no effect on the rendering. No temporary canvas is created. It is identical to the case of no APS.
In the ISO CGM:1999 standard, a picture has an implicit or explicit opaque background. Graphic elements within the picture are rendered in the order they appear in the metafile. It is a requirement of a 2D graphics format for Web documents that pictures may be overlaid on previous content. For this, it must be controllable whether the picture background is opaque or transparent (both cases are needed), or "translucent" (partially opaque).
Conceptually, a CGM picture's background is handled as follows. When a picture's canvas is first created in the compositing model of section 2.2.2, it is initialized to transparent black (0,0,0,0). Before the drawing of the first foreground primitives, the canvas is then filled per the equations in section 2.2.2 with the effective background color of the metafile.
In metafiles that use the RGB-alpha color model, the effective background color may be directly set in the Picture Descriptor to any valid (r,g,b,a), including transparent black (0,0,0,0). In RGB metafiles, the same effects may be achieved by including the registered Escape 45 (alpha transparency) element in the Picture Descriptor, which is then combined with the defined RGB background color to achieve any valid (r,g,b,a) effective background color.
Within a WebCGM picture, groups of graphical primitives can be defined which structure graphics to meet the requirements of integration into Web documents. Groups in WebCGM are realized as standard Version 4 Application Structures (APS) of ISO CGM.
To meet the requirements of intelligent graphics, four specific group types are defined and allowed in WebCGM: 'grobject', 'layer', 'para', and 'subpara'. WebCGM allows a fifth group type, 'grnode', as a convenience for authoring tools to preserve their graphical grouping functions. The detailed normative syntax and semantics of the group types, including viewer behavior, is defined in Chapter 3 and in the PPF. Below is a brief conceptual summary.
Every group has at least one explicit property, its unique identifier (a parameter of the Begin APS element). WebCGM groups other than 'grnode' may have several explicit attributes associated with them. These attributes are realized as standard Version 4 (V4) Application Structure Attribute elements (APS Attributes) of ISO CGM.
Chapter 3 normatively defines the detailed content model for version 4 elements in WebCGM using EBNF notation. See section, "WebCGM Content Model", for an informative (non-normative), all-at-once presentation of the content model using XML DTD notation.
WebCGM defines a set of allowable group (APS) types, to support the Web document operations of hyperlinking, layered pictures, and text search within graphics. See Chapter 3 for the detailed normative syntax and semantics of the allowable group types. Brief conceptual descriptions follow (each item is linked to its Chapter 3 normative definition):
WebCGM does allow one other group type for the convenience of authoring tools:
Note that 'grnode' was not present in WebCGM 1.0, but was added to WebCGM 2.0 to allow for better hierarchical structure in WebCGM documents. The 'grnode' ("graphical node") APS allows illustration authoring tools to preserve in the WebCGM metafile instance the graphical groupings that are often used by such tools.
WebCGM does not allow private group types in WebCGM instances. External private metadata can be associated, by id or by name, with all group (APS) types other than 'grnode' within a WebCGM. A standard external mechanism is defined in the XML Companion File section.
Groups of types 'para', 'subpara', and 'grobject' may be used for picking and navigation operations in hyperlinked Web documents. These three APS types are called "objects" in WebCGM.
Objects may contain an explicit 'region' APS Attribute, which provides the boundary for picking operations. This is known as the overlay model of object identification (for picking, mouseover screentip display, etc). It is useful in cases where the picking region of an object can not be defined by existing geometry, for example on line art drawings or raster content.
Objects which contain graphical content have an implicit property: the boundary or bounding extent of the enclosed graphical object. This extent is used for picking and navigation operations in hyperlinked Web documents, in the absence of a 'region' attribute. Use of this implicit boundary property for picking and navigation operations in Version 4 CGM instances is referred to as the embedded model.
Objects may also be the target of a link. Viewers will generally move the APS into view and scale them to fit into the viewer's rectangle. The exact viewer behavior is controlled by a set of object behavior keywords associated with the link, and the presence or absence of certain APS Attributes on the object ('viewcontext', 'region', etc.)
Explicit properties or attributes of WebCGM groups are encoded as APS Attribute elements. Each APS Attribute has a "type" parameter, which identifies the attribute. See Chapter 3 for the detailed normative syntax and semantics of the allowable APS Attributes. Brief conceptual descriptions follow (each item is linked to its Chapter 3 normative definition):
WebCGM does not allow private attribute types in WebCGM instances. External private metadata, including attributes as well as elements, can be associated by id or by name with all group (APS) types other than 'grnode' within a WebCGM. A standard external metadata binding mechanism is defined in the XML Companion File chapter .
The detailed normative syntax and semantics are presented later (Chapter 3) in this specification. The structure and relationships of the intelligent content are illustrated in the following diagrams. In the following, "picbody" is not a specific WebCGM object type, but rather a convenience to refer to that part of the CGM picture which is between the Begin Picture Body element and the End Picture Element, exclusive. Boxes with heavy borders indicate elements that are decomposed further, and offset boxes indicate attributes associated with an element. Similarly, gdata is not an object type, but rather a catch-all reference to zero or more CGM graphical elements which WebCGM allows, and which are valid at such a position according to the rules of CGM. The cgmprim attribute associated with gdata represents an entity that associates the graphical primitives to the model. See Figure 2.
WebCGM supports object-to-object hyperlinking within individual WebCGM instances, between WebCGM instances, from WebCGM instances to other Web media types, and from other media types to WebCGM instances.
In-line linking is supported, from WebCGM objects (APS of type 'grobject', 'para', and 'subpara') to WebCGM graphic files, objects, as well as to text and other media types. WebCGM fully supports linking from other media to WebCGM files and objects.
Links from WebCGM objects are realized as 'linkuri' APS Attribute elements contained within the definitions of the objects. The address of the link (a 'linkuri' parameter) is an Internationalized Resource Identifier (IRI) [RFC 3987], and is described in the normative 'linkuri' section and fragment syntax subsections.
Objects may contain multiple 'linkuri' APS attribute instances, for which case the associated Link Title parameter is available to help the user select the destination. WebCGM prescribes a uniform viewer requirement to offer destination choice to the user for such multi-destination cases.
The target of a link, either from within a WebCGM or from another media type (e.g., HTML text), may be a WebCGM instance. WebCGM defines an optional "fragment syntax" for addressing objects within a WebCGM metafile.
The fragment syntax, in full generality, is:
<base-IRI>#<pict-part>.<obj-part>
The <pict-part> is identified by a keyword and has two pieces, the picture locator (either the 'PictureId' string parameter of the CGM, or the picture sequence number), and viewer behavior upon navigating to the picture. With the WebCGM restriction of one picture per metafile (since WebCGM version 2.0), the <pict-part> is not useful anymore, but is maintained in the syntax for backward compatibility with WebCGM 1.0 metafiles and WebCGM 1.0 implementations.
The <obj-part> similarly is identified by a keyword and has two pieces, the Id parameter of the object (APS), and viewer behavior.
The syntax is well-defined so that in many common cases, keywords and pieces can be eliminated and defaulted. So, for example, <base-IRI>#<string> unambiguously identifies the object (APS) whose Id parameter is "<string>" in the first (only) picture of the metafile pointed to by "<base-IRI>".
See the normative specifications of Chapter 3 for complete details and examples.
Supported ISO CGM encodings. ISO CGM defines two encodings of the CGM functionality: Binary, and Clear Text. WebCGM, like other leading industry profiles of CGM, limits the encoding to Binary for the purposes of conforming interchange. It is the Binary encoding which is registered as a MIME type. Using available encoding converters, the Clear Text encoding can be used for debugging, hand authoring, demonstration, etc.
GZIP compression. WebCGM data may be compressed for transmission using gzip compression. See "7.1 Conformance definitions" for normative specifications regarding GZIP compression.
WebCGM has no rules regarding filenames or filename extensions. It is a common convention that normal (uncompressed) WebCGM instances use the filename extension ".cgm", and that gzip-compressed WebCGM files use the extension ".cgz". However, these are only conventions and care should be exercised not to break existing links when compression is introduced into existing environments.
The graphical content of WebCGM is chosen to balance the requirements of high expressive power, and simplicity to implement. It is a subset of the Model Profile (MP) of the CGM standard.
The WebCGM Profile Pro-forma (PPF), later in this document, gives the complete normative graphical content details. Following is a conceptual summary.
The most obvious aspect of a graphics format is the collection of graphical primitives - those drawing elements which define the geometric and other presentation content of the format. CGM:1999 contains a rich selection of vector graphics primitives, plus fully integrated state-of-the-art compressed tile raster content.
WebCGM includes most of the significant graphical drawing primitives of CGM:1999.
In CGM:1999 but excluded from the present version of WebCGM are:
Attribute elements and control elements determine the details of the appearance of graphical primitives.
The following attribute and control features of CGM:1999 are excluded from WebCGM.
There are some CGM Version 3 attribute and control elements for which it is desirable to override the default value in CGM:1999, when an explicit definition of the value is not present in the CGM file. This would also allow definition of the rendering behavior of CGM Version 1 and Version 2 files, where those attribute and control elements are not allowed, as well as allow definition in CGM Verson 3 files where the elements are not declared.
This is accomplished in WebCGM using a standard XML DTD to encode the allowable elements and their values in an XML instance. Examples and more details can be found in the WebCGM chapter on Application Configurable Items.
The normal behavior of CGM:1999 viewers is to render later occurring primitives completely opaquely on top of earlier primitives. Several notions of transparency are supported in WebCGM. See section 2.2.2 and 2.2.3 for discussion of the CGM drawing model and transparency options.
The full range of standard CGM:1999 color models is limited in WebCGM. The default RGB model is included, as well as the models: RGB-alpha; the colorimetric RGB space of the Web, sRGB; and sRGB-alpha. The latter three are registered in the ISO Register of Graphical Items.
Fully international text is supported in WebCGM by:
The default character encoding ("character set" in the now-archaic terminology of the original CGM:1987) is ISOLatin1. This default is mandated by the ISO CGM:1999 standard.
A core set of 13 fonts, the same as those in the ISO CGM Model Profile (MP), are required in WebCGM implementations.
In order to facilitate font interchange, WebCGM defines a format to specify the mapping of font names during the import process.
This mapping is accomplished in WebCGM using standard XML DTD. Examples and more details can be found in the WebCGM chapter on Application Configurable Items.
The XML Companion File (XCF) component of WebCGM was added in the WebCGM 2.0 release. The WebCGM XCF provides a standard way to externalize metadata from a WebCGM instance, while maintaining a tight binding of that metadata to objects (APSs) in the WebCGM instance.
The WebCGM XCF was designed with three main usage scenarios in mind. A WebCGM companion file:
Examples and more details may be found in the WebCGM XML Companion File (XCF) chapter, the complete normative definition of the WebCGM XCF.
The normative definition of XCF includes a base and generic DTD. The WebCGM XCF is designed to be extensible, by other profiles derived from WebCGM, as well as applications of WebCGM. In particular, this allows industry specific metadata to be added to the WebCGM object model. See the normative XCF definition for details.
The XCF is a mechanism to bind external metadata to objects in WebCGM instances. Accordingly, unlike hierarchical tree structured WebCGM instances, the structure of the XML Companion File is mostly flat. See the normative section, Relationship with XML companion file, for more details.
The Document Object Model (DOM) component of WebCGM was added in the WebCGM 2.0 release. An interface for programmatic access to WebCGM contents and structure, as well as facilities to manipulate a standardized WebCGM XML Companion File, were perhaps the strongest driving requirements for the WebCGM 2.0 release. Virtually all of the WebCGM viewer and user agent implementations had already defined and implemented a proprietary application programming interface (API) for such functionality.
Compared with detailed, complete DOM specifications such as W3C's XML DOM Level 3, or the DOM of the SVG 1.1 Recommendation, the WebCGM DOM has limited scope. A full DOM would support query and discovery of all objects and entities in a target content (graphic) instance, right down to the leaf nodes of the structure tree. It would also support symmetric, detailed modification and manipulation capabilities for changing the object.
The functionality available in the WebCGM DOM is somewhat more limited. The WebCGM DOM exposes the document graphic structure down to the Application Structure (APS) level — APS's are the fundamental addressable graphical objects in WebCGM, and are the building blocks of the hierarchical structure tree of a WebCGM. Other capabilites available via WebCGM DOM include:
Temporary changes to the presentation style of graphical objects may be made via DOM and XCF "Style Properties". Recognizing similar capabilities in CSS, potential relationships between WebCGM and CSS were studied in detail prior to the addition of DOM-accessible and XCF-accessible Style Properties to WebCGM. Ultimately, a lean and minimal WebCGM-specific model was chosen, that nevertheless borrowed heavily from applicable CSS concepts (such as inheritance.)
Similar temporary changes to APS Attributes — which represent non-graphical metadata associated with graphical objects — are supported by DOM and XCF access.
DOM functionality supports query and discovery of the structure of a WebCGM, enumeration of its graphical objects, extraction of associated metadata (e.g., hyperlinking data) from documents, and provides users with standard ways to add more interactivity to WebCGM documents than was previously possible. It also provides users with standard ways to add more interactivity to WebCGM documents than was previously possible.
DOM functionality also supports manipulation and application of standard WebCGM XML Companion Files, described in the previous section.
The WebCGM DOM supports a number of usage scenarios and gives access to a number of useful capabilities. Collectively, the WebCGM 2.0 Requirements and the WebCGM 2.1 Requirements documents give details about the in-scope and out-of-scope capabilities of WebCGM DOM.