### 2D Graphics Geometry Overview

The 2D Graphics framework provides geometry classes and corresponding IMGraphic-derived graphics classes. The classes described here are the basic geometric forms that the 2D Graphics framework knows how to render based on the underlying geometry classes, the "atoms" for building more sophisticated graphics.

### Geometry Classes

The 2D Graphics framework geometry classes fall into the following general categories:

- Computational geometry - basic definitions for doing geometric computations. Computational geometry is used for calculations. It is not rendered directly except IGRect2D, which is filled and framed like other area-enclosing geometry). Use these classes for constructing other types of geometry.
- Path geometry - primitives that divide space. Path geometry includes lines, polylines and curves. They may be framed, but not filled.
- Area geometry - primitives enclosing space. They may be framed and filled.
- Special area geometry - classes for making area geometry by concatenating different geometric shapes, used mostly for clipping.
- Image geometry - classes for image handling and manipulation.
- Path geometry classes describe open shapes that need not be filled. Area geometry classes however describe shapes of enclosed path that can be filled. Some geometric shapes such as point, line and non-enclosing polyline and non-enclosing curves are of path geometry while enclosing geometric shapes such as rectangle, circle, ellipse, polygon and enclosing curves (loops) can be both path and area geometry.

### Graphic Classes

The table summarizes the graphic classes, derived from IMGraphic, and their corresponding geometry classes:

### Graphic Class | ### Geometry Class
--- | ---
ILine | IGLine2D: A line segment formed by 2 points.
ICurve | IGCurve2D: A general purpose approximating spline curves used for arc and other quadratic curves.
IPolyline | IGPolyline2D: A set of connected line segments.
ILoop | IGLoop2D: A closed curve.
IEllipse | IGEllipse2D: Circles and ellipses.
IPolygon | IGPolygon2D: A polygon with an arbitrary number of 2D vertices.
IArea | IGArea: A set of geometries enclosing areas combined by boolean operations.
IImage | IGImage: A pixel-based image.

### Graphics Class Architecture

The 2D graphics classes whose names specify a geometry (ILine, ICurve, IEllipse, and so on) are derived from IMGraphic. As shown in the figure, a 2D graphics class has a geometry class that provides the shape for the graphic.

The IMGraphic-derived graphics classes are wrappers for their referenced geometry classes. The graphics classes have functions that let you manipulate the geometry from within the graphic without accessing the geometry functions directly. The advantage of the wrapper architecture is that the 2D graphics classes bring together the functionality of the geometry classes and the high-level functionality of the IMGraphic class.

All IMGraphic-derived classes use a drawing port (IGrafPort) to render the graphic; they own an attribute bundle (IGrafBundle); and they know the transformation matrix.

Geometry Class Summary