Contents of /src/canvas.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (show annotations)
Tue Dec 9 20:06:06 2008 UTC (15 years, 6 months ago) by harbaum
File MIME type: text/plain
File size: 3844 byte(s)
Initial import
1 /*
2 * Copyright (C) 2008 Till Harbaum <till@harbaum.org>.
3 *
4 * This file is part of OSM2Go.
5 *
6 * OSM2Go is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * OSM2Go is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with OSM2Go. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #ifndef CANVAS_H
21 #define CANVAS_H
22
23 typedef enum { CANVAS_GROUP_BG=0, CANVAS_GROUP_POLYGONS,
24 CANVAS_GROUP_TRACK, CANVAS_GROUP_GPS,
25 CANVAS_GROUP_WAYS_HL, CANVAS_GROUP_WAYS_OL,
26 CANVAS_GROUP_WAYS, CANVAS_GROUP_NODES_HL, CANVAS_GROUP_NODES,
27 CANVAS_GROUP_DRAW, CANVAS_GROUPS } canvas_group_t;
28
29 #if defined(USE_GNOMECANVAS)
30
31 #include <libgnomecanvas/libgnomecanvas.h>
32
33 typedef GnomeCanvasItem canvas_item_t;
34 typedef GnomeCanvasPoints canvas_points_t;
35 typedef GtkWidget canvas_t;
36
37 typedef gulong canvas_color_t;
38 #define CANVAS_COLOR(r,g,b,a) GNOME_CANVAS_COLOR_A(r,g,b,a)
39
40
41 #elif defined(USE_GOOCANVAS)
42
43 #include <goocanvas.h>
44
45 typedef GooCanvasItem canvas_item_t;
46 typedef GooCanvasPoints canvas_points_t;
47 typedef GtkWidget canvas_t;
48
49 typedef gulong canvas_color_t;
50
51 #define CANVAS_COLOR(r,g,b,a) ((((guint) (r) & 0xff) << 24) \
52 | (((guint) (g) & 0xff) << 16) \
53 | (((guint) (b) & 0xff) << 8) \
54 | ((guint) (a) & 0xff))
55
56
57
58 #else
59 #error "No canvas type defined!"
60 #endif
61
62
63
64 struct map_s;
65 canvas_item_t *canvas_circle_new(struct map_s *map, canvas_group_t group,
66 gint x, gint y, gint radius, gint border,
67 canvas_color_t fill_col, canvas_color_t border_col);
68
69 void canvas_item_set_pos(canvas_item_t *item, lpos_t *lpos, gint radius);
70
71 canvas_points_t *canvas_points_new(gint points);
72 void canvas_point_set_pos(canvas_points_t *points, gint index, lpos_t *lpos);
73 void canvas_points_free(canvas_points_t *points);
74 void canvas_item_set_points(canvas_item_t *item, canvas_points_t *points);
75
76 canvas_item_t *canvas_polyline_new(struct map_s *map, canvas_group_t group,
77 canvas_points_t *points, gint width, canvas_color_t color);
78
79 canvas_item_t *canvas_polygon_new(struct map_s *map, canvas_group_t group,
80 canvas_points_t *points, gint width, canvas_color_t color,
81 canvas_color_t fill);
82
83 void canvas_window2world(canvas_t *canvas, gint x, gint y, gint *wx, gint *wy);
84 canvas_item_t *canvas_get_item_at(canvas_t *canvas, gint x, gint y);
85
86 void canvas_item_set_zoom_max(canvas_item_t *item, float zoom_max);
87
88 void canvas_item_to_bottom(canvas_item_t *item);
89
90 void canvas_item_destroy(canvas_item_t *item);
91
92 void canvas_item_set_user_data(canvas_item_t *item, void *data);
93 void *canvas_item_get_user_data(canvas_item_t *item);
94
95 void canvas_item_destroy_connect(canvas_item_t *item,
96 GCallback c_handler, gpointer data);
97
98 void canvas_set_zoom(canvas_t *canvas, double zoom);
99
100 void canvas_get_scroll_offsets(canvas_t *canvas, gint *sx, gint *sy);
101
102 void canvas_scroll_to(canvas_t *canvas, gint sx, gint sy);
103
104 void canvas_set_bounds(canvas_t *canvas, gint minx, gint miny,
105 gint maxx, gint maxy);
106
107 canvas_item_t *canvas_image_new(struct map_s *map, canvas_group_t group,
108 GdkPixbuf *pix, gint x, gint y,
109 float hscale, float vscale);
110
111 void canvas_image_move(canvas_item_t *item, gint x, gint y,
112 float hscale, float vscale);
113
114 gint canvas_item_get_segment(canvas_item_t *item, gint x, gint y);
115 void canvas_item_get_segment_pos(canvas_item_t *item, gint seg,
116 gint *x0, gint *y0, gint *x1, gint *y1);
117
118 #endif // CANVAS_H