Graphic state

The graphic state describes the attributes of the graphic and the scene, the model and view transformations, and the clipping region. When the MDrawable::Draw function is called, the graphic concatenates its graphic state with the TGrafState instance. When the TGrafPort::Draw function is called, if a TGrafBundle and TGrafMatrix are supplied in the call, their data is concatenated with the TGrafState instance. Because the graphic state is separate from the drawing port and has no knowledge of the graphics device, the graphic state is available in the system outside the context of drawing a graphic.

A default graphic state is provided by the 2D and 3D attribute classes in the event the Draw call does not have all of the necessary information. The default graph state consists of identity matrices, an infinite clipping region, and attributes defined by the root graphic state classes described under the headings "TAttributeState" on page 361 and "TAttribute3DState" on page 362.

TGrafState knows the classes shown in Figure 230. These classes provide access to the complete graphic state, and are described under the headings that follow.

The state classes have virtual functions that get and set a time stamp to determine whether the graphic state needs to be updated. The first time a graphic is drawn, concatenation occurs, the time stamps are set, and the graphic is drawn. For subsequent drawing operations, the time stamps are checked to determine whether or not the graphic state has changed. If the time stamps are equal, the instances are equal and the graphic state has not changed. The graphic is drawn with the previous graphic state. If the time stamps are not equal, the instances are not equal and the graphic state has changed, and the graphic state is updated.



[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