/*************************************************************************** * draw.h * * Thu Jul 19 19:00:10 2007 * Copyright 2007 Steffen Pohle * steffen@gulpe.de ****************************************************************************/ /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef _DRAW_H_ #define _DRAW_H_ #include "osmroute.h" #include "map.h" #include "gps.h" #ifdef HAVE_GTK #include "gtk_port.h" #endif #ifdef HAVE_WINAPI #include "wince_port.h" #endif #ifdef HAVE_SDL #include "sdl_port.h" #endif #ifdef ANDROID #include "android_port.h" #endif #define DRAW_GPS 0x0001 #define DRAW_GPSFOLLOW 0x0002 #define DRAW_DEBUG 0x0004 #define POLYGON_MAX_POINTS 2048 enum { DRAW_BTN_NONE = 0, DRAW_BTN_SCALEINC, DRAW_BTN_SCALEDEC, DRAW_BTN_GPS, DRAW_BTN_DEBUG }; #define DRAW_BTN_WIDTH 32 #define DRAW_BTN_MAX 4 struct line_style { struct color borderc; struct color c; float width; }; enum { COLOR_white, COLOR_red, COLOR_blue, COLOR_green, COLOR_brown, COLOR_pink, COLOR_yellow, COLOR_greengray, COLOR_redgray, COLOR_bluegray, COLOR_MAX }; #define COLOR_steps 4 /* * variables definitions.. */ extern float view_lon; extern float view_lat; extern float view_scale; extern int view_flags; extern struct image *img_map; extern struct map_pos img_map_pos; extern float img_map_scale; extern struct map_pos select_pos; extern int select_enabled; extern struct line_style draw_linestyle[MWAY_MAX]; extern struct color color_polygon[MAREA_MAX]; extern struct color color_bg; extern struct color color_fg; extern int draw_type[MAREA_MAX+MWAY_MAX]; extern struct color color[COLOR_MAX][COLOR_steps]; /* * functions definitions, called from outside the drawing routines */ extern void draw_setscale (int newscale); extern void draw_setscalef (float newscale); extern void draw_set_pointerpos (float lon, float lat, int mode); extern void draw_set_flag (int flag); extern void draw_del_flag (int flag); extern iPoint draw_geo2screen (float center_lon, float center_lat, float lon, float lat); extern void draw_screen2geo (int x, int y, float *lon, float *lat); extern void draw_init (); extern void draw_init_color (); extern void draw (); /* * the drawing prozess */ // extern void draw (); // it is defined inside osmroute.h extern void draw_redrawmap (); extern void draw_line (struct image *img, int x1, int y1, int x2, int y2, struct line_style style); extern void draw_lineway (struct image *img, int x1, int y1, int x2, int y2, struct line_style style); extern void draw_rectangle (struct image *img, int x1, int y1, int x2, int y2, struct line_style style); extern void draw_polygonstart (); extern void draw_polygonadd (int x, int y); extern void draw_polygonfinish (struct image *img, struct line_style ls, struct color c, int border); /* * functions which we need inside the *_gfx.c files... needed for drawing */ extern iPoint gfx_screensize; extern void gfx_resize (int width, int height); extern void gfx_init (int width, int height); extern void gfx_flip (); extern int gfx_color_alloc (struct color *c, unsigned short int r, unsigned short int g, unsigned short int b); extern void gfx_draw_img (struct image *dimg, int dx, int dy, int dw, int dh, struct image *simg, int sx, int sy); extern void gfx_draw_line (struct image *dimg, int x1, int y1, int x2, int y2, struct line_style style); extern void gfx_draw_text (struct image *dimg, int x, int y, char *text, struct color *c); extern void gfx_draw_polygon (struct image *dimg, iPoint *p, int pcnt, struct line_style style, struct color c); extern void gfx_draw_rect (struct image *dimg, int x1, int y1, int x2, int y2, struct color *c); extern void gfx_clear (struct image *dimg, struct color *c); extern struct image *gfx_img_alloc (int w, int h); extern void gfx_img_free (struct image *img); extern struct image* gfx_img_load (char *name); /* * draw_gps.c */ extern struct gps_data drawgps_data; extern unsigned long long int drawgps_on_way_id; extern unsigned short int drawgps_on_way_sid; extern char drawgps_on_way_name[MAP_W_NAMELEN]; extern void drawgps_set_pos (struct gps_data *gpsdata); extern void draw_gui_gps (); /* * draw_route.c */ extern void draw_gui_route (); /* * draw_favorites.c */ extern void draw_gui_favorites (); /* * draw_gui.c */ extern unsigned long long int mouse_over_way_id; extern unsigned short int mouse_over_way_sid; extern char mouse_over_way_name[MAP_W_NAMELEN]; extern iPoint mousepos; extern int mousebtn; extern time_t mousebtnpresstime; extern iPoint mousebtnpresspos; extern int mousebtnpresslongtime; extern unsigned long long int mouse_over_way_id; extern unsigned short int mouse_over_way_sid; extern char mouse_over_way_name[MAP_W_NAMELEN]; extern void draw_mousemove (int x, int y, int btn); extern void draw_mousebtndown (int x, int y, int btn); extern void draw_mousebtnup (int x, int y, int btn); extern void draw_mouseloop (); extern void draw_gui (); #endif