To draw directly to the screen, use the following:
{
// Drawing geometries directly to the screen in different colors
// This GrafPort contains a device cache and default values for
// all graphic state
IRootGrafPort rootPort (&screenDevice);
rootPort.draw (myRect, redBundle);
rootPort.draw (myCurve, greenBundle, curveMatrix);
rootPort.draw (myArea);
}
To draw directly to the screen using nested clip areas and a specified coordinate systems, use the following:
{
// Drawing geometries to the screen using a different
// coordinate system and clip area
// This GrafPort contains a device cache and default values
// for all graphic state
IRootGrafPort rootPort (&screenDevice);
// This GrafPort overrides the clip area; rootPort is its parent
ILinkedClipPort clippedPort (&rootPort, myClipArea);
// clipped to the area; bundle overridden
clippedPort.draw (myRect, yellowBundle);
// unclipped; bundle & matrix overridden
rootPort.draw (myLoop, weirdBundle, someMatrix);
// clipped; using rootPort's bundle & matrix
clippedPort.draw (myEllipse);
// You can draw IMDrawables, too!
myGraphic.draw (rootPort); // unclipped
myOtherGraphic.draw (clippedPort); // clipped
}