Graphic state classes

Figure 229 shows the graphic state class architecture. The graphic state describes graphic and scene attributes, model and view matrices for 2D and 3D, and a 2D clipping region. Graphic attributes are represented by the attribute bundle of the graphic, and scene attributes are represented by the 3D scene bundle.


TRootGrafState: This class provides access to the default graphic state, which consists of an identity matrix, an infinite clip area, and default attributes.

TLinkedGrafState: This abstract base class provides the functionality for linking graphic states into a hierarchy.

TGrafStateAccessor: This class instantiates the graphic state so that you access the various parts of the graphic state as described under the heading "Graphic state" on page 360. You should scope the instantiation of this class because it holds the drawing semaphore, which should be released as soon as possible.

The following code fragment shows instantiating TGrafStateAccessor and copying the clip state so that when TGrafStateAccessor destructs, the clip state is obtained, but the global semaphore is released. Be aware that the graphic state could become out of date as soon as the semaphore is released.

      TGArea area;
      {
          TGrafStateAccessor grafState( &port );
          area = *grafStrate.GetClipState() -> GetClipArea();
      }
      .
      .
      .

[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