Line data Source code
1 : /* Copyright 1989-2020 Free Software Foundation, Inc.
2 : Written by James Clark (jjc@jclark.com)
3 :
4 : This file is part of groff, the GNU roff typesetting system.
5 :
6 : groff is free software; you can redistribute it and/or modify it under
7 : the terms of the GNU General Public License as published by the Free
8 : Software Foundation, either version 3 of the License, or
9 : (at your option) any later version.
10 :
11 : groff is distributed in the hope that it will be useful, but WITHOUT ANY
12 : WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 : FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 : for more details.
15 :
16 : You should have received a copy of the GNU General Public License
17 : along with this program. If not, see <http://www.gnu.org/licenses/>. */
18 :
19 : struct line_type {
20 : enum { invisible, solid, dotted, dashed } type;
21 : double dash_width;
22 : double thickness; // the thickness is in points
23 :
24 : line_type();
25 : };
26 :
27 :
28 : class output {
29 : protected:
30 : char *args;
31 : double desired_height; // zero if no height specified
32 : double desired_width; // zero if no depth specified
33 : double compute_scale(double, const position &, const position &);
34 : public:
35 : output();
36 : virtual ~output();
37 : void set_desired_width_height(double wid, double ht);
38 : void set_args(const char *);
39 : virtual void start_picture(double sc, const position &ll, const position &ur) = 0;
40 : virtual void finish_picture() = 0;
41 : virtual void circle(const position &, double rad,
42 : const line_type &, double) = 0;
43 : virtual void text(const position &, text_piece *, int, double) = 0;
44 : virtual void line(const position &, const position *, int n,
45 : const line_type &) = 0;
46 : virtual void polygon(const position *, int n,
47 : const line_type &, double) = 0;
48 : virtual void spline(const position &, const position *, int n,
49 : const line_type &) = 0;
50 : virtual void arc(const position &, const position &, const position &,
51 : const line_type &) = 0;
52 : virtual void ellipse(const position &, const distance &,
53 : const line_type &, double) = 0;
54 : virtual void rounded_box(const position &, const distance &, double,
55 : const line_type &, double, char *) = 0;
56 : virtual void command(const char *, const char *, int) = 0;
57 0 : virtual void set_location(const char *, int) {}
58 : virtual void set_color(char *, char *) = 0;
59 : virtual void reset_color() = 0;
60 : virtual char *get_last_filled() = 0;
61 : virtual char *get_outline_color() = 0;
62 : virtual int supports_filled_polygons();
63 : virtual void begin_block(const position &ll, const position &ur);
64 : virtual void end_block();
65 : };
66 :
67 : extern output *out;
68 :
69 : /* #define FIG_SUPPORT 1 */
70 : #define TEX_SUPPORT 1
71 :
72 : output *make_troff_output();
73 :
74 : #ifdef TEX_SUPPORT
75 : output *make_tex_output();
76 : output *make_tpic_output();
77 : #endif /* TEX_SUPPORT */
78 :
79 : #ifdef FIG_SUPPORT
80 : output *make_fig_output();
81 : #endif /* FIG_SUPPORT */
82 :
83 : // Local Variables:
84 : // fill-column: 72
85 : // mode: C++
86 : // End:
87 : // vim: set cindent noexpandtab shiftwidth=2 textwidth=72:
|