### 2D Graphics Rendering Pipeline Overview

The rendering pipeline model for the 2D Graphics framework is the IGrafPort class. Through this class, you can associate graphics attribute states, transformation matrix, and clipping areas as the state for a given port. You can render geometry by using IGrafPort with the state applied along the rendering pipeline and the states will remain stored in the port.

At the root IGrafPort pipeline or chain, an IGrafDevice deals with all the aspects of rendering geometry with respect to the state set.

The IGrafPort is the component for constructing a hierarchy of graphics states. The IGrafPort can be constructed by specifying a link to the parent IGrafPort and some state information. The state information does not have to be the complete information required to render the geometry, because the chain of IGrafPorts eventually provides enough information to render the geometry. In the event of missing state information, the mechanism inherits the values from its parent. IRootGrafPort has the default values for all attributes.

The figure provides an overview of the rendering pipeline:

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 through a higher-level abstraction called IMGraphic. This is a retained-mode approach to rendering graphical primitives.

Immediate and retained mode: In pure immediate mode rendering, the application objects are rendered without keeping any record of the information (geometry, attributes, hierarchies) used to render them, while in retained mode, the record of all objects, their hierarchies, and other related information is stored for rendering.