To use CAMgraphicsProcess classes one must create both a CAMgraphicsProcess instance,and an instance of a class derived from CAMgraphicsDriver. The "high level" plotting routines in CAMgraphicsProcess call upon the "low level" routines provided by the device driver to create graphics output. One associates the device driver with a particular CAMgraphicsProcess by invoking the attachDriver(…) member function.
The general structure of a code using the CAMgraphicsProcess class and the CAMpostscriptDriver class has the form:
CAMgraphicsProcss Gprocess; // create instance CAMpostScriptDriver Pdriver("graph.ps");// Postscript driver // with output to graph.ps GProcess.attachDriver(Pdriver); ... style/format commands for first picture ... ... plotting commands for first picture ... Gprocess.frame(); // close first picture ... style/format commands for second picture ... ... plotting commands for second picture ... GProcess.frame(); // close second picture
As the pseudo code illustrates, the plotting and style routines are sandwiched between graphic system control routines. The style routines are called before the plotting routines. The plotting routines are calls to the CAMgraphicsProcess plotting functions that accept C++ standard data types and arrays of standard data types.
In many of the plotting routines, enumerated constants associated with the CAMgraphicsProcess class are used as input arguments. The enumerated constants are listed below the tables that contain the routines that require them. All of the enumerated constants have the form CAMgraphicsProcess::CONSTANT_NAME.
For example, to change the default line color to red, one uses the statement
CAMgraphicsProcess::setPlotLineColor(CAMgraphicsProcess::RED);
Alternately, one can pass the routines the integer equivalent of an enumerated constant. CAMgraphicsProcess::RED corresponds to a value of 9, so one could set the line color to red using the statement
CAMgraphicsProcess::setPlotLineColor(9);
A CAMgraphicsProcess "remembers" it's state, so that a format option (e.g. invoking setPlotLineColor(…), or setPlotLineWidth(…)) once set, remains in effect until reset. For line plots, the command restorePlotDefaults() will reset all the line plot formats to their defaults.