xref: /netbsd-src/external/gpl2/groff/dist/src/preproc/pic/output.h (revision 89a07cf815a29524268025a1139fac4c5190f765)
1 /*	$NetBSD: output.h,v 1.1.1.1 2016/01/13 18:41:48 christos Exp $	*/
2 
3 // -*- C++ -*-
4 /* Copyright (C) 1989, 1990, 1991, 1992, 2001 Free Software Foundation, Inc.
5      Written by James Clark (jjc@jclark.com)
6 
7 This file is part of groff.
8 
9 groff is free software; you can redistribute it and/or modify it under
10 the terms of the GNU General Public License as published by the Free
11 Software Foundation; either version 2, or (at your option) any later
12 version.
13 
14 groff is distributed in the hope that it will be useful, but WITHOUT ANY
15 WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
17 for more details.
18 
19 You should have received a copy of the GNU General Public License along
20 with groff; see the file COPYING.  If not, write to the Free Software
21 Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */
22 
23 struct line_type {
24   enum { invisible, solid, dotted, dashed } type;
25   double dash_width;
26   double thickness;		// the thickness is in points
27 
28   line_type();
29 };
30 
31 
32 class output {
33 protected:
34   char *args;
35   double desired_height;	// zero if no height specified
36   double desired_width;		// zero if no depth specified
37   double compute_scale(double, const position &, const position &);
38 public:
39   output();
40   virtual ~output();
41   void set_desired_width_height(double wid, double ht);
42   void set_args(const char *);
43   virtual void start_picture(double sc, const position &ll, const position &ur) = 0;
44   virtual void finish_picture() = 0;
45   virtual void circle(const position &, double rad,
46 		      const line_type &, double) = 0;
47   virtual void text(const position &, text_piece *, int, double) = 0;
48   virtual void line(const position &, const position *, int n,
49 		    const line_type &) = 0;
50   virtual void polygon(const position *, int n,
51 		       const line_type &, double) = 0;
52   virtual void spline(const position &, const position *, int n,
53 		      const line_type &) = 0;
54   virtual void arc(const position &, const position &, const position &,
55 		   const line_type &) = 0;
56   virtual void ellipse(const position &, const distance &,
57 		       const line_type &, double) = 0;
58   virtual void rounded_box(const position &, const distance &, double,
59 			   const line_type &, double) = 0;
60   virtual void command(const char *, const char *, int) = 0;
set_location(const char *,int)61   virtual void set_location(const char *, int) {}
62   virtual void set_color(char *, char *) = 0;
63   virtual void reset_color() = 0;
64   virtual char *get_last_filled() = 0;
65   virtual char *get_outline_color() = 0;
66   virtual int supports_filled_polygons();
67   virtual void begin_block(const position &ll, const position &ur);
68   virtual void end_block();
69 };
70 
71 extern output *out;
72 
73 /* #define FIG_SUPPORT 1 */
74 #define TEX_SUPPORT 1
75 
76 output *make_troff_output();
77 
78 #ifdef TEX_SUPPORT
79 output *make_tex_output();
80 output *make_tpic_output();
81 #endif /* TEX_SUPPORT */
82 
83 #ifdef FIG_SUPPORT
84 output *make_fig_output();
85 #endif /* FIG_SUPPORT */
86