Common MGraphic behavior

MGraphic is an abstract base class that derives from MDrawable. MDrawable provides the protocol for drawing a 2D or 3D graphic, and MGraphic provides the protocol common to all 2D graphics -- obtaining attribute information, transforming the graphic, finding the bounds of the graphic, and detecting whether the graphic has been selected by the user (hit detection).

Figure 22 shows the class relationships for MGraphic and MDrawable and lists the MGraphic member functions described in this chapter. MDrawable has a pure virtual Draw function that is implemented in the MGraphic derived classes. You typically call the Draw function from the TView::DrawContents function to draw into a view and the View system passes the correct TGrafPort to the DrawContents function. Chapter 2 has several DrawContents implementations.


The MGraphic constructors are protected and used only when you derive from MGraphic to create a custom 2-D graphic. See Chapter 11 for information on creating customized 2-D graphics.

Using attribute bundles
Transforming a 2D graphic
Detecting hits

[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker