File: output.h

package info (click to toggle)
plotutils 2.4.1-15
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 11,072 kB
  • ctags: 6,952
  • sloc: ansic: 76,305; cpp: 12,402; sh: 8,475; yacc: 2,604; makefile: 894; lex: 144
file content (84 lines) | stat: -rw-r--r-- 2,893 bytes parent folder | download | duplicates (4)
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
// -*- C++ -*-
// The output class: almost pure virtual (a protocol class), but
// see some definitions in object.cc.

struct line_type 
{
  enum { invisible, solid, dotted, dashed } type;
  double dash_width;		// or inter-dot spacing, for dotted lines
  double thickness;		// line thickness in points
  // ctor 
  line_type();
};

class output 
{
public:
  // ctor, dtor 
  output();
  virtual ~output();
  // interface: implemented in toto in each concrete output class 
  virtual void start_picture (double sc, const position &ll, const position &ur) = 0;
  virtual void finish_picture (void) = 0;
  virtual void arc (const position &start, const position &cent, 
		    const position &end, const line_type &lt) = 0;
  virtual void circle (const position &cent, double rad,
		       const line_type &lt, double fill) = 0;
  virtual void ellipse (const position &cent, const distance &dim,
			const line_type &lt, double fill) = 0;
  virtual void line (const position &start, const position *v, int n,
		     const line_type &lt) = 0;
  virtual void polygon (const position *v, int n,
			const line_type &lt, double fill) = 0;
  virtual void spline (const position &start, const position *v, int n,
		       const line_type &lt) = 0;
  virtual void text (const position &center, text_piece *v, int n,
		     double angle) = 0;
  virtual void rounded_box (const position &cent, const distance &dim,
			    double rad, const line_type &lt, double fill) = 0;
  // no-ops, can optionally be overridden 
  virtual void command (const char *s, const char *filename, int lineno);
  virtual void set_location (const char *filename, int lineno);
  // returns 0 (false), can optionally be overridden 
  virtual int supports_filled_polygons (void);
  // no-ops; can optionally be overridden 
  virtual void begin_block (const position &ll, const position &ur);
  virtual void end_block (void);
  // not overridable; related to scaling 
  void set_desired_width_height (double wid, double ht);
  void set_args (const char *);
protected:
  char *args;
  double desired_height;	// zero if no height specified
  double desired_width;		// zero if no depth specified
  double compute_scale (double sc, const position &ll, const position &ur);
};

// A global; we have only one of these.  Its member function are what do
// the output of objects of various kinds (they're invoked by the
// objects' `print' operations).  Defined in main.cc.
extern output *out;

#define TROFF_SUPPORT 0
#define TEX_SUPPORT 0
#define PLOT_SUPPORT 1

#ifdef TROFF_SUPPORT
output *make_troff_output (void);
#endif

#ifdef TEX_SUPPORT
output *make_tex_output (void);
output *make_tpic_output (void);
#endif

#ifdef PLOT_SUPPORT
output *make_plot_output (void);
extern char *display_type;

extern char *font_name;
extern char *pen_color_name;
extern double font_size;
extern double line_width;
extern int precision_dashing;
#endif