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