### Drawing More Complex Forms

To draw a graphic that has its own clip area, you can define your own class and its draw function as follows:

    IGraphicWithClipArea::draw (IGrafPort& parent) const
    {
         ILinkedClipPort clipPort (&parent, fClipArea);
         clipPort.draw (fPolygon);
         clipPort.draw (fEllipse);
    }

The graphic consists of a polygon and an ellipse.

To draw an IMDrawable that requires concatenation of multiple objects, for example, an IGrafBundle object and a model matrix, you can define your own class and its draw function as follows:

    IGraphicWithBundleAndMatrix::draw (IGrafPort& parent) const
    {
         ILinkedMatrixPort matrixPort (&parent, fMatrix);
         ILinkedBundlePort bundlePort (&matrixPort, &fBundle);
         bundlePort.draw (fPolygon);
         bundlePort.draw (fEllipse);
    }

To create a graphic with more than one bundle (multiple linked ports that use the same parent port), you can define your own class and its draw function as follows:

    IGraphicWithBundlesAndMatrix::draw (IGrafPort& parent) const
    {
         ILinkedMatrixPort matrixPort (&parent, fMatrix);
         ILinkedBundlePort redBundlePort (&matrixPort, fRedBundle);
         ILinkedBundlePort greenBundlePort (&matrixPort,
         fGreenBundle);
         redBundlePort.draw (fPolygon);
         greenBundlePort.draw (fEllipse);
    }