TMyGroup::Draw function implementation
The constructor to TLinkedModelMatrixPort takes a reference to a port and a model matrix. It establishes a link to the model matrix so that the model matrix supplied in the constructor can be concatenated to the graphic state. The destructor deletes the link. TMyGroup::Draw( TGrafPort& parentPort )
{
TLinkedBundlePort bundlePort( &parentPort, fBundle );
TLinkedModelMatrixPort matrixPort( &bundlePort, &fModelMatrixState )
TMyGroupIterator iterator;
for( MGraphic* child = iterator.First(); child != NIL; child = iterator.Next; )
child>Draw( matrixPort );
}
TLinkedModelMatrixPort matrixPort( &bundlePort, &fModelMatrixState )
for( MGraphic* child = iterator.First(); child != NIL; child = iterator.Next; ) child>Draw( matrixPort );
TMyPolygon::Draw function
The TMyPolygon::Draw function calls TGrafPort::Draw, which gets the device from the drawing port, and calls the TGrafDevice::RenderPolygon function. The RenderPolygon function in the TGrafPort::Draw function has a graphics device. TMyPolygon::Draw( TGrafPort& parent )
{
parent.Draw( *this );
}
TSomeGrafDevice::Draw function
The grafState.GetModelMatrixState function returns the model matrix stored in the TLinkedViewMatrixPort instance. TSomeGrafDevice::Draw( const TGPolygon& p,
const TGrafState& grafState,
TGrafCache& grafCache )
{
grafState.GetAttributeState()>GetAntialiasing();
grafState.GetModelMatrixState()>GetMatrix();
}
The grafState.GetModelMatrixState>GetMatrix function returns the matrix in the matrix state object.