- Split bearch.h correctly into bearch.h and bearch_t.h
[libfirm] / ir / be / bechordal_draw.h
1
2 /**
3  * @file   bechordal_draw.h
4  * @date   13.05.2005
5  * @author Sebastian Hack
6  *
7  * Drawing chordal graphs.
8  *
9  * Copyright (C) 2005 Universitaet Karlsruhe
10  * Released under the GPL
11  */
12
13 #ifndef _BECHORDAL_DRAW_H
14 #define _BECHORDAL_DRAW_H
15
16 #include "bearch_t.h"
17
18 typedef struct _plotter_t plotter_t;
19 typedef struct _plotter_if_t plotter_if_t;
20 typedef struct _rect_t rect_t;
21 typedef struct _draw_chordal_opts_t draw_chordal_opts_t;
22 typedef struct _color_t color_t;
23
24 struct _color_t {
25   double r, g, b;
26 };
27
28 struct _rect_t {
29   int x, y, w, h;
30 };
31
32 struct _plotter_if_t {
33   void (*begin)(plotter_t *self, const rect_t *visible_area);
34
35   void (*set_color)(plotter_t *self, const color_t * color);
36   const color_t * (*get_color)(const plotter_t *self);
37   void (*set_width)(plotter_t *self, int width);
38   int (*get_width)(const plotter_t *self);
39   void (*line)(plotter_t *self, int x1, int y1, int x2, int y2);
40   void (*box)(plotter_t *self, const rect_t *rect);
41   void (*text)(plotter_t *self, int x, int y, const char *str);
42
43   void (*finish)(plotter_t *self);
44   void (*free)(plotter_t *self);
45 };
46
47 extern void plotter_free(plotter_t *self);
48
49 struct _plotter_t {
50   const plotter_if_t *vtab;
51 };
52
53 struct _draw_chordal_opts_t {
54   int h_gap;
55   int h_inter_gap;
56   int v_gap;
57   int v_inter_gap;
58   int x_margin;
59   int y_margin;
60 };
61
62 extern const draw_chordal_opts_t draw_chordal_def_opts;
63
64 extern plotter_t *new_plotter_ps(const char *filename);
65
66 extern void draw_interval_tree(
67     const draw_chordal_opts_t *opts,
68     const be_chordal_env_t *chordal_env,
69     plotter_t *plotter);
70
71 #endif /* _BECHORDAL_DRAW_H */