### Modeling Overview

The 2D Graphics framework provides two distinct ways of rendering geometries on a device:

- Draw the geometry directly to the device. The class IGrafPort supports a well-defined, fixed set of 2D geometries through a set of overloaded draw functions. This approach does not associate attributes and transformation matrices with geometry. This makes it suitable for immediate mode rendering only.

- Draw the geometry via a higher-level abstraction called IMGraphic. This is a retained-mode approach to rendering graphical primitives.

2D Modeling classes also provide a convenient way to associate geometry with attributes and transforms for rendering and storage.

IMGraphic is the abstract base class for representing the 2D primitives of the 2D Graphics framework. It is a higher-level manifestation of graphical objects which can be held in a collection, transformed, and rendered to a graphic device through an IGrafPort.

IMGraphic can be considered as a utility class for applications to hold geometry-related data that includes the geometry definition, its IGrafBundle (set of graphical attributes defining the representation of the geometry), and a set of transformation functions. You can derive from default IMGraphic objects and store other information specified.

Each IMGraphic object provides the following functionality:

- Holds a set of its own attributes and transformations.
- Provides streaming capability (with some restrictions on some of its subclasses).
- Provides inquiry functions as a mechanism for direct manipulation of IMGraphic objects such as hit detection.
- Provides extensibility through subclassing.
- Allows, through the IGraphicGroup subclass, creation of hierarchies of IMGraphic objects. IGraphicGroup creates a collection of IMGraphic objects forming a group. Each of the IMGraphic objects can be an IGraphicGroup itself, so one can create a hierarchy of objects.

Create your own IMDrawable and IMGraphic derived class to create complex graphics such as an automobile or human figure. A complex graphic is actually a combination of the geometry classes. The drawing port can render it because it knows all of the geometry classes.

2D Graphics Rendering Pipeline Overview