Figure 4 shows the class relationships for MGraphic. The relationships are similar for MGraphic3D. All MGraphic and MGraphic3D derived classes use a drawing port (TGrafPort) to render the graphic; own an attribute bundle (TGrafBundle or TGrafBundle3D); and know the transformation matrix for a graphic (TGrafMatrix or TGrafMatrix3D).
All MGraphic and MGraphic3D derived classes know how to draw themselves. The graphics provide the geometry, attribute, and transformation information to the drawing port when the Draw function of the graphic is called.
The 2D and 3D graphics classes whose names specify a geometry (TLine, TCurve, TEllipse, and so on) are derived from MGraphic and MGraphic3D. As shown in Figure 5, a 2-D graphics class has a geometry class that provides the shape for the graphic. A graphics class has public functions specific to that graphic that allow interaction with its referenced geometry.
You can create your own MDrawable, MGraphic, or MGraphic3D derived class to create complex graphics such as an automobile or human figure. Because 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.