next up previous contents index
Next: Using CCATSL Windows Up: Plotting graphs Previous: Drawing graphs line by   Contents   Index


Printing out graphs

If you want to include your graphs in a word-processed report, the simplest way to proceed is by using Windows's builtin window-capture feature by pressing Alt+PrintScreen (this was how the screenshots for these pages were produced). This copies the contents of the active window into the clipboard, and it can then be `pasted' into your document in the normal way.

A better approach which is more complicated, but more versatile, is to save each graph to a disk file called a metafile. This can be printed out later, or incorporated in a word-processed report. To create and save a metafile containing a graph, use the routines GRecordCL and GSaveCL. Alternatively, you can do everything from the system menu: select record graphics to start recording graphics commands, wait until your program has drawn the graph, then select Record current window graphics again, to stop recording. Now select Save recording as Metafile to save the recorded graphics. You may find it helpful to call the CCATSL function PauseCL at appropriate points in your program.

Once you have all your graphs saved as metafiles, they can be viewed and printed by selecting display metafile or print/display metafile from the system menu, or by calling DisplayMetaFilesCL (below) in your program.

The example program b10print.c provides further demonstration.


GRecordCL

This routine `opens' a metafile, causing subsequent graphics commands to the current graphics window up to the next call to GSaveCL, to be recorded in the metafile. See GSaveCL for to see how to save the resulting metafile.

  
GRecordCL();                /* start recording graphics commands */
..                          /* commands to produce the graph     */
GSaveCL("mygraph.wmf");     /* stop recording and save the graph */


GSaveCL

This routine saves the the sequence of graphics commands since the last GRecordCL in a disk file in Enhanced Windows Metafile Format. The file may be subsequently displayed and/or printed using the routine DisplayMetaFilesCL.

  void GSaveCL ( char *fnam);

  fnam The filename to save the metafile under. If fnam="", the user will be prompted for a filename.


DisplayMetaFilesCL

DisplayMetaFilesCL prints out a collection of metafiles, positioning them in a grid on the page. The user will prompted for the names of the files, (the first may be specified in the call to DisplayMetaFilesCL) and for other information.

  void DisplayMetaFilesCL ( int ncols,
  int nrows,
  char *filename);

  ncols The number of columns in the grid.
  nrows The number of rows in the grid.
  filename The name of the first metafile. This may be ““ in which case the user will be prompted for a filename.


next up previous contents index
Next: Using CCATSL Windows Up: Plotting graphs Previous: Drawing graphs line by   Contents   Index
CATAM admin 2010-02-23