/[zanavi_public1]/navit/navit/graphics/null/graphics_null.c
ZANavi

Contents of /navit/navit/graphics/null/graphics_null.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2 - (show annotations) (download)
Fri Oct 28 21:19:04 2011 UTC (12 years, 5 months ago) by zoff99
File MIME type: text/plain
File size: 6993 byte(s)
import files
1 /**
2 * Navit, a modular navigation system.
3 * Copyright (C) 2005-2008 Navit Team
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * version 2 as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 */
19
20 #include <glib.h>
21 #include "config.h"
22 #ifdef HAVE_UNISTD_H
23 #include <unistd.h>
24 #endif
25 #include "point.h"
26 #include "graphics.h"
27 #include "color.h"
28 #include "plugin.h"
29 #include "event.h"
30 #include "debug.h"
31 #if defined(WINDOWS) || defined(WIN32) || defined (HAVE_API_WIN32_CE)
32 #include <windows.h>
33 # define sleep(i) Sleep(i * 1000)
34 #endif
35
36 static int dummy;
37 static struct graphics_priv {
38 int dummy;
39 } graphics_priv;
40
41 static struct graphics_font_priv {
42 int dummy;
43 } graphics_font_priv;
44
45 static struct graphics_gc_priv {
46 int dummy;
47 } graphics_gc_priv;
48
49 static struct graphics_image_priv {
50 int dummy;
51 } graphics_image_priv;
52
53 static void
54 graphics_destroy(struct graphics_priv *gr)
55 {
56 }
57
58 static void font_destroy(struct graphics_font_priv *font)
59 {
60
61 }
62
63 static struct graphics_font_methods font_methods = {
64 font_destroy
65 };
66
67 static struct graphics_font_priv *font_new(struct graphics_priv *gr, struct graphics_font_methods *meth, char *font, int size, int flags)
68 {
69 *meth=font_methods;
70 return &graphics_font_priv;
71 }
72
73 static void
74 gc_destroy(struct graphics_gc_priv *gc)
75 {
76 }
77
78 static void
79 gc_set_linewidth(struct graphics_gc_priv *gc, int w)
80 {
81 }
82
83 static void
84 gc_set_dashes(struct graphics_gc_priv *gc, int w, int offset, unsigned char *dash_list, int n)
85 {
86 }
87
88 static void
89 gc_set_foreground(struct graphics_gc_priv *gc, struct color *c)
90 {
91 }
92
93 static void
94 gc_set_background(struct graphics_gc_priv *gc, struct color *c)
95 {
96 }
97
98 static struct graphics_gc_methods gc_methods = {
99 gc_destroy,
100 gc_set_linewidth,
101 gc_set_dashes,
102 gc_set_foreground,
103 gc_set_background
104 };
105
106 static struct graphics_gc_priv *gc_new(struct graphics_priv *gr, struct graphics_gc_methods *meth)
107 {
108 *meth=gc_methods;
109 return &graphics_gc_priv;
110 }
111
112 static struct graphics_image_priv *
113 image_new(struct graphics_priv *gr, struct graphics_image_methods *meth, char *path, int *w, int *h, struct point *hot, int rotation)
114 {
115 return &graphics_image_priv;
116 }
117
118 static void
119 draw_lines(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count)
120 {
121 }
122
123 static void
124 draw_polygon(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count)
125 {
126 }
127
128 static void
129 draw_rectangle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int w, int h)
130 {
131 }
132
133 static void
134 draw_circle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int r)
135 {
136 }
137
138
139 static void
140 draw_text(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct graphics_gc_priv *bg, struct graphics_font_priv *font, char *text, struct point *p, int dx, int dy)
141 {
142 }
143
144 static void
145 draw_image(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, struct graphics_image_priv *img)
146 {
147 }
148
149 static void
150 draw_image_warp(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, int count, char *data)
151 {
152 }
153
154 static void
155 draw_restore(struct graphics_priv *gr, struct point *p, int w, int h)
156 {
157 }
158
159 static void draw_drag(struct graphics_priv *gr, struct point *p)
160 {
161 }
162
163 static void
164 background_gc(struct graphics_priv *gr, struct graphics_gc_priv *gc)
165 {
166 }
167
168 static void
169 draw_mode(struct graphics_priv *gr, enum draw_mode_num mode)
170 {
171 }
172
173 static struct graphics_priv * overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, int w, int h, int alpha, int wraparound);
174
175 static void *
176 get_data(struct graphics_priv *this, char const *type)
177 {
178 return &dummy;
179 }
180
181 static void image_free(struct graphics_priv *gr, struct graphics_image_priv *priv)
182 {
183 }
184
185 static void get_text_bbox(struct graphics_priv *gr, struct graphics_font_priv *font, char *text, int dx, int dy, struct point *ret, int estimate)
186 {
187 }
188
189 static void overlay_disable(struct graphics_priv *gr, int disable)
190 {
191 }
192
193 static void overlay_resize(struct graphics_priv *gr, struct point *p, int w, int h, int alpha, int wraparound)
194 {
195 }
196
197 static struct graphics_methods graphics_methods = {
198 graphics_destroy,
199 draw_mode,
200 draw_lines,
201 draw_polygon,
202 draw_rectangle,
203 draw_circle,
204 draw_text,
205 draw_image,
206 draw_image_warp,
207 draw_restore,
208 draw_drag,
209 font_new,
210 gc_new,
211 background_gc,
212 overlay_new,
213 image_new,
214 get_data,
215 image_free,
216 get_text_bbox,
217 overlay_disable,
218 overlay_resize,
219 };
220
221 static struct graphics_priv *
222 overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, int w, int h, int alpha, int wraparound)
223 {
224 *meth=graphics_methods;
225 return &graphics_priv;
226 }
227
228
229 static struct graphics_priv *
230 graphics_null_new(struct navit *nav, struct graphics_methods *meth, struct attr **attrs, struct callback_list *cbl)
231 {
232 *meth=graphics_methods;
233 if (!event_request_system("null","graphics_null"))
234 return NULL;
235 return &graphics_priv;
236 }
237
238 static void
239 event_null_main_loop_run(void)
240 {
241
242 dbg(0,"enter\n");
243 for (;;)
244 sleep(1);
245
246 }
247
248 static void event_null_main_loop_quit(void)
249 {
250 dbg(0,"enter\n");
251 }
252
253 static struct event_watch *
254 event_null_add_watch(void *h, enum event_watch_cond cond, struct callback *cb)
255 {
256 dbg(0,"enter\n");
257 return NULL;
258 }
259
260 static void
261 event_null_remove_watch(struct event_watch *ev)
262 {
263 dbg(0,"enter\n");
264 }
265
266
267 static struct event_timeout *
268 event_null_add_timeout(int timeout, int multi, struct callback *cb)
269 {
270 dbg(0,"enter\n");
271 return NULL;
272 }
273
274 static void
275 event_null_remove_timeout(struct event_timeout *to)
276 {
277 dbg(0,"enter\n");
278 }
279
280
281 static struct event_idle *
282 event_null_add_idle(int priority, struct callback *cb)
283 {
284 dbg(0,"enter\n");
285 return NULL;
286 }
287
288 static void
289 event_null_remove_idle(struct event_idle *ev)
290 {
291 dbg(0,"enter\n");
292 }
293
294 static void
295 event_null_call_callback(struct callback_list *cb)
296 {
297 dbg(0,"enter\n");
298 }
299
300 static struct event_methods event_null_methods = {
301 event_null_main_loop_run,
302 event_null_main_loop_quit,
303 event_null_add_watch,
304 event_null_remove_watch,
305 event_null_add_timeout,
306 event_null_remove_timeout,
307 event_null_add_idle,
308 event_null_remove_idle,
309 event_null_call_callback,
310 };
311
312 static struct event_priv *
313 event_null_new(struct event_methods *meth)
314 {
315 *meth=event_null_methods;
316 return NULL;
317 }
318
319
320 void
321 plugin_init(void)
322 {
323 plugin_register_graphics_type("null", graphics_null_new);
324 plugin_register_event_type("null", event_null_new);
325 }

   
Visit the ZANavi Wiki