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.

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):

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):

grobject —
(graphical object) the basic grouping APS for identification of objects,
principally used to identify sources and destinations of hyperlinks.

layer — an APS type
that allows the division of a picture into a set of graphical layers, for
use by viewers in selective presentation and "2-1/2 D" effects.

subpara — may be
used to identify smaller fragments of text within APS of type 'para',
enabling, for example, the marking of the larger text block (the
"paragraph") for searching purposes, and the tagging of smaller fragments
as hotspots.

WebCGM does allow one other group type for the convenience of authoring
tools:

grnode — may be used
for simple grouping of graphical primitives, to preserve authoring tools'
grouping functions; none of the facilities (properties & attributes)
for attaching intelligence may be used with 'grnode'.

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):

region — defines a
spatial region that can be associated with an APS for picking and
navigation purposes.

viewcontext —
defines a rectangle that can be associated with an APS for establishing
the initial view upon execution of a link to that APS.

linkuri — defines a
link, whose target is specified by an IRI, for hyperlinking to text
content, pictures in other metafiles, or objects within the same or other
metafiles. "#" fragment syntax is defined for a full addressing model
down to the object level within the picture, and specifying viewer
behavior upon link traversal.

layername — the
name (required) to be assigned within an APS of type 'layer'.

layerdesc —
specifies a "layer description" string within an APS of type 'layer'.

screentip — a
string to be associated with an object, to be shown in the typical Web
browser "screen tip" style when cursor passes over the object.

name — a "common
name" attribute to be associated with an object, that gives a useful
search handle or way of defining searchable subtypes of the object type;
also allows a group of same-name objects to be a link target.

content — an
attribute of the 'para' and 'subpara' APS, that can provide a basis for
applications to build text search in cases that might otherwise prove
difficult (e.g., displayed text that is stroked, rasterized, fragmented,
or non-natural presentation order).

visibility — the
'visibility' attribute indicates if an object is visible (drawn) or not,
and also disables its eligibility to be picked (invisible objects are
ineligible for picking).

interactivity
— the 'interactivity' attribute indicates whether or not an object
is eligible to be picked (i.e., may receive mouse events), and also
affects a handful of other interaction-related behaviors.

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>".

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.
HTTP/1.1 allows for compressed data to be passed
from server to client, which can result in significant file size reduction.
WebCGM data may be compressed for transmission using gzip compression. It is
recommended that gzip-compressed
WebCGM files have the extension ".cgz" (all
lowercase) on all platforms. (See "7.1 Conformance definitions" for normative specification.)

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.

A number of specialized objects, for convenience and efficiency -
rectangles, circles and ellipses, circular and elliptical arcs and pie
slices. These come in both unfilled (line) and filled flavors.

Graphical Text primitives:

WebCGM allows the simple Restricted Text primitive of CGM:1999
(which carries its extent box with it), as well as the Append Text
element (continuation of a text string, after change of attributes
such as font, color, ...)

WebCGM also supports text-on-path: paths other than simple straight
lines can be defined (similar to Compound Line), and the text is laid
out along that path.

Closed Figure and Compound Line - these primitives allow the
construction of complex paths as a concatenation of any of the other line
and fill primitives. The path may either be drawn according to CGM line
attributes, or filled according to any of the permissible fill
attributes.

Smooth curves, available in two flavors:

the basic and popular piece-wise cubic Bezier capability of the
CGM:1999 Polybezier element;

and the compressed, tiled Tile Array capability of CGM version 3.
The popular Web compression formats of ITU-T Group 4, PNG, and JPEG
are among the supported compression types.

In CGM:1999 but excluded from the present version of WebCGM are:

The unrestricted TEXT element is prohibited (the results are
unpredictable, so the more reliable RESTRICTED TEXT is required).

The Hyperbolic Arc and Parabolic Arc elements of CGM:1999 are
prohibited (these are seen in some advanced engineering formats, but not
yet in Web practice).

Polysymbol - the Polysymbol element allows the sizing and placement
into CGM pictures of "symbols". Symbols are defined in an external Symbol
Library, which itself is a CGM. (Polysymbol was in WebCGM 1.0, but
removed due to non-use.)

Attribute elements and control elements determine the details of the
appearance of graphical primitives.

Line attributes of WebCGM include line dash styles, line width, line
color, and the controls over appearance of line cap and line join. Dash
styles can either be predefined, or can be defined precisely by the
generator of the metafile.

Fill attributes control the appearance of the interior of filled
primitives. One attribute controls the overall style of the filled-area
interior - solid color, hatch, bitmap-style pattern, empty, and hollow.
In the case of hatch interior, the style can either be one of a handful
of predefined, or can be precisely defined in the metafile. The pattern
can be defined as a small "raster tile" of two or more colors.

The related Edge attributes control the appearance of edges of filled
areas, and are for the most part identical to Line attributes.

The appearance of graphical text can be controlled by the CGM
attributes of font and character set (which corresponds to character
encoding in the proper terminology of Character Model for the World Wide
Web 1.0: Fundamentals [CHARMOD], see later), text size,
orientation, inter-character spacing, expansion-compression of nominal
character aspect ratios - the important aspects needed for precise
control in modern graphical text presentation. The orientation attribute
actually gives control not just of rotation, but skewness and aspect
distortion, i.e., it is equivalent to a local transformation on text
elements.

The following attribute and control features of CGM:1999 are excluded from
WebCGM.

The use of the bundled attributes model of CGM Version 1 is prohibited,
which eliminates all of the Version 1 bundle index elements, the ASF
elements, and the bundle-table setting elements of Version 2.

The use of the CGM Version 2 Segment functionality is prohibited, and
its dozen or so associated elements may not occur in valid WebCGM
metafiles.

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.

Allowing the Unicode UTF-8 or UTF-16 character encodings
to be selected in the CGM's character encoding designation and selection
mechanisms (CHARACTER SET LIST, CHARACTER SET INDEX, etc).

Requiring the use of the CGM:1999 Font Properties element, in the case
of fonts outside of a required core set of 13. The Font Properties
element carries a handful of parameters which are descriptive of a set of
font attributes which are most commonly used to classify and call out
fonts.

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:

can be used to bind application specific metadata (such as a part
number) to a particular Application Structure in a WebCGM
illustration.

could be used as a partial inventory of a WebCGM illustration by
enumerating the Application Structures IDs, types and (most) attributes.
(Note that it is out-of-scope of this version of WebCGM XCF to fully
mirror the hierarchical structure of a CGM graphic (see "Structure overview" in the XCF
chapter.)

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.

2.7.1 Motivation

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.

2.7.2 Scope of WebCGM DOM

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.

The WebCGM DOM supports transient manipulation of the APS attributes --
which represent non-graphical metadata associated with the objects -- and
transient changes to presentation style of graphical objects. The WebCGM DOM
provides functionality to support 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 finally provides users
with standard ways to add more interactivity to WebCGM documents
than was previously possible.

The WebCGM DOM also provides functionality for 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.