added new licence header
[libfirm] / ir / be / bechordal_draw.h
1 /*
2  * Copyright (C) 1995-2007 University of Karlsruhe.  All right reserved.
3  *
4  * This file is part of libFirm.
5  *
6  * This file may be distributed and/or modified under the terms of the
7  * GNU General Public License version 2 as published by the Free Software
8  * Foundation and appearing in the file LICENSE.GPL included in the
9  * packaging of this file.
10  *
11  * Licensees holding valid libFirm Professional Edition licenses may use
12  * this file in accordance with the libFirm Commercial License.
13  * Agreement provided with the Software.
14  *
15  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17  * PURPOSE.
18  */
19
20
21 /**
22  * @file   bechordal_draw.h
23  * @date   13.05.2005
24  * @author Sebastian Hack
25  *
26  * Drawing chordal graphs.
27  *
28  * Copyright (C) 2005 Universitaet Karlsruhe
29  * Released under the GPL
30  */
31
32 #ifndef _BECHORDAL_DRAW_H
33 #define _BECHORDAL_DRAW_H
34
35 #include "bearch_t.h"
36
37 typedef struct _plotter_t plotter_t;
38 typedef struct _plotter_if_t plotter_if_t;
39 typedef struct _rect_t rect_t;
40 typedef struct _draw_chordal_opts_t draw_chordal_opts_t;
41 typedef struct _color_t color_t;
42
43 struct _color_t {
44   double r, g, b;
45 };
46
47 struct _rect_t {
48   int x, y, w, h;
49 };
50
51 struct _plotter_if_t {
52   void (*begin)(plotter_t *self, const rect_t *visible_area);
53
54   void (*set_color)(plotter_t *self, const color_t * color);
55   const color_t * (*get_color)(const plotter_t *self);
56   void (*set_width)(plotter_t *self, int width);
57   int (*get_width)(const plotter_t *self);
58   void (*line)(plotter_t *self, int x1, int y1, int x2, int y2);
59   void (*box)(plotter_t *self, const rect_t *rect);
60   void (*text)(plotter_t *self, int x, int y, const char *str);
61
62   void (*finish)(plotter_t *self);
63   void (*free)(plotter_t *self);
64 };
65
66 extern void plotter_free(plotter_t *self);
67
68 struct _plotter_t {
69   const plotter_if_t *vtab;
70 };
71
72 struct _draw_chordal_opts_t {
73   int h_gap;
74   int h_inter_gap;
75   int v_gap;
76   int v_inter_gap;
77   int x_margin;
78   int y_margin;
79 };
80
81 extern const draw_chordal_opts_t draw_chordal_def_opts;
82
83 extern plotter_t *new_plotter_ps(const char *filename);
84
85 extern void draw_interval_tree(
86     const draw_chordal_opts_t *opts,
87     const be_chordal_env_t *chordal_env,
88     plotter_t *plotter);
89
90 #endif /* _BECHORDAL_DRAW_H */