File: p_erase.c

package info (click to toggle)
plotutils 2.0-2
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 5,964 kB
  • ctags: 2,522
  • sloc: ansic: 38,416; sh: 1,853; yacc: 856; makefile: 181; lex: 144
file content (37 lines) | stat: -rw-r--r-- 837 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/* This file contains the erase method, which is a standard part of
   libplot.  It erases all objects on the graphics device display.

   A PSPlotter simply resets the output buffer, discarding all objects
   written to it, resets the bounding box, and marks all Postscript fonts
   as unused. */

#include "sys-defines.h"
#include "plot.h"
#include "extern.h"

int
#ifdef _HAVE_PROTOS
_p_erase (void)
#else
_p_erase ()
#endif
{
  int i;

  if (!_plotter->open)
    {
      _plotter->error ("erase: invalid operation");
      return -1;
    }

  _plotter->endpath (); /* flush polyline if any */

  _reset_buffer (&_plotter->outbuf); /* discard all objects */
  _reset_range ();		/* reset bounding box */

  /* reinitialize `font used' array */
  for (i = 0; i < NUM_PS_FONTS; i++)
    _plotter->ps_font_used[i] = false;

  return 0;
}