navit
0.5.3-trunk
|
#include <unistd.h>
#include <glib.h>
#include <poll.h>
#include "config.h"
#include "window.h"
#include "point.h"
#include "graphics.h"
#include "color.h"
#include "item.h"
#include "xmlconfig.h"
#include "plugin.h"
#include "event.h"
#include "debug.h"
#include "callback.h"
#include "android.h"
#include "command.h"
Data Structures | |
struct | graphics_priv |
struct | graphics_font_priv |
struct | graphics_gc_priv |
struct | graphics_image_priv |
struct | event_timeout |
Functions | |
static int | find_class_global (char *name, jclass *ret) |
static int | find_method (jclass class, char *name, char *args, jmethodID *ret) |
static int | find_static_method (jclass class, char *name, char *args, jmethodID *ret) |
static void | graphics_destroy (struct graphics_priv *gr) |
static void | font_destroy (struct graphics_font_priv *font) |
static struct graphics_font_priv * | font_new (struct graphics_priv *gr, struct graphics_font_methods *meth, char *font, int size, int flags) |
static void | gc_destroy (struct graphics_gc_priv *gc) |
static void | gc_set_linewidth (struct graphics_gc_priv *gc, int w) |
static void | gc_set_dashes (struct graphics_gc_priv *gc, int w, int offset, unsigned char *dash_list, int n) |
static void | gc_set_foreground (struct graphics_gc_priv *gc, struct color *c) |
static void | gc_set_background (struct graphics_gc_priv *gc, struct color *c) |
static struct graphics_gc_priv * | gc_new (struct graphics_priv *gr, struct graphics_gc_methods *meth) |
static void | image_destroy (struct graphics_image_priv *img) |
static struct graphics_image_priv * | image_new (struct graphics_priv *gra, struct graphics_image_methods *meth, char *path, int *w, int *h, struct point *hot, int rotation) |
static void | initPaint (struct graphics_priv *gra, struct graphics_gc_priv *gc) |
static void | draw_lines (struct graphics_priv *gra, struct graphics_gc_priv *gc, struct point *p, int count) |
static int | polygon_area (struct point *p, int count) |
static int | is_clockwise (struct point *p, int count) |
static int | add_vertex_to_java_array (struct point *p, int count, jint *j_p, int reverse) |
static void | draw_polygon_with_holes (struct graphics_priv *gra, struct graphics_gc_priv *gc, struct point *p, int count, int hole_count, int *ccount, struct point **holes) |
static void | draw_polygon (struct graphics_priv *gra, struct graphics_gc_priv *gc, struct point *p, int count) |
static void | draw_rectangle (struct graphics_priv *gra, struct graphics_gc_priv *gc, struct point *p, int w, int h) |
static void | draw_circle (struct graphics_priv *gra, struct graphics_gc_priv *gc, struct point *p, int r) |
static void | draw_text (struct graphics_priv *gra, struct graphics_gc_priv *fg, struct graphics_gc_priv *bg, struct graphics_font_priv *font, char *text, struct point *p, int dx, int dy) |
static void | draw_image (struct graphics_priv *gra, struct graphics_gc_priv *fg, struct point *p, struct graphics_image_priv *img) |
static void | draw_image_warp (struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, int count, struct graphics_image_priv *img) |
static void | draw_drag (struct graphics_priv *gra, struct point *p) |
static void | background_gc (struct graphics_priv *gr, struct graphics_gc_priv *gc) |
static void | draw_mode (struct graphics_priv *gra, enum draw_mode_num mode) |
static struct graphics_priv * | overlay_new (struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, int w, int h, int wraparound) |
Creates a new overlay. More... | |
static void * | get_data (struct graphics_priv *this, const char *type) |
static void | image_free (struct graphics_priv *gr, struct graphics_image_priv *priv) |
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) |
static void | overlay_disable (struct graphics_priv *gra, int disable) |
static void | overlay_resize (struct graphics_priv *gra, struct point *pnt, int w, int h, int wraparound) |
static int | set_attr (struct graphics_priv *gra, struct attr *attr) |
int | show_native_keyboard (struct graphics_keyboard *kbd) |
Displays the native input method. More... | |
void | hide_native_keyboard (struct graphics_keyboard *kbd) |
Hides the native input method and frees associated private data. More... | |
static void | resize_callback (struct graphics_priv *gra, int w, int h) |
static void | padding_changed_callback (struct graphics_priv *gra, int left, int top, int right, int bottom) |
static void | motion_callback (struct graphics_priv *gra, int x, int y) |
static void | keypress_callback (struct graphics_priv *gra, char *s) |
static void | button_callback (struct graphics_priv *gra, int pressed, int button, int x, int y) |
static int | set_activity (jobject graphics) |
static int | graphics_android_init (struct graphics_priv *ret, struct graphics_priv *parent, struct point *pnt, int w, int h, int wraparound, int use_camera) |
Initializes a new Android graphics instance. More... | |
static int | graphics_android_fullscreen (struct window *win, int on) |
static void | graphics_android_disable_suspend (struct window *win) |
static void | graphics_android_cmd_runMenuItem (struct graphics_priv *this, char *function, struct attr **in, struct attr ***out, int *valid) |
Runs an item from the Android menu. More... | |
static void | graphics_android_cmd_menu (struct graphics_priv *this, char *function, struct attr **in, struct attr ***out, int *valid) |
Shows the Android menu. More... | |
static struct graphics_priv * | graphics_android_new (struct navit *nav, struct graphics_methods *meth, struct attr **attrs, struct callback_list *cbl) |
Creates a new Android graphics instance. More... | |
static void | event_android_main_loop_run (void) |
static void | event_android_main_loop_quit (void) |
static void | do_poll (JNIEnv *env, int fd, int cond) |
static struct event_watch * | event_android_add_watch (int h, enum event_watch_cond cond, struct callback *cb) |
static void | event_android_remove_watch (struct event_watch *ev) |
static void | event_android_remove_timeout (struct event_timeout *priv) |
static void | event_android_handle_timeout (struct event_timeout *priv) |
static struct event_timeout * | event_android_add_timeout (int timeout, int multi, struct callback *cb) |
static struct event_idle * | event_android_add_idle (int priority, struct callback *cb) |
static void | event_android_remove_idle (struct event_idle *ev) |
static void | event_android_call_callback (struct callback_list *cb) |
static struct event_priv * | event_android_new (struct event_methods *meth) |
void | plugin_init (void) |
Variables | |
static GHashTable * | image_cache_hash = NULL |
static struct graphics_font_methods | font_methods |
static struct graphics_gc_methods | gc_methods |
static struct graphics_image_methods | image_methods |
static struct graphics_methods | graphics_methods |
static jclass | NavitClass |
static jmethodID | Navit_disableSuspend |
static jmethodID | Navit_exit |
static jmethodID | Navit_fullscreen |
static jmethodID | Navit_runOptionsItem |
static jmethodID | Navit_showMenu |
static jmethodID | Navit_showNativeKeyboard |
static jmethodID | Navit_hideNativeKeyboard |
static struct command_table | commands [] |
static jclass | NavitTimeoutClass |
static jmethodID | NavitTimeout_init |
static jmethodID | NavitTimeout_remove |
static jclass | NavitIdleClass |
static jmethodID | NavitIdle_init |
static jmethodID | NavitIdle_remove |
static jclass | NavitWatchClass |
static jmethodID | NavitWatch_init |
static jmethodID | NavitWatch_remove |
static struct event_methods | event_android_methods |
|
static |
References p.
Referenced by draw_polygon_with_holes().
|
static |
|
static |
References callback_list_call_attr_3, graphics_priv::cbl, p, point::x, and point::y.
Referenced by graphics_android_init().
|
static |
References dbg, event_watch_cond_except, event_watch_cond_read, event_watch_cond_write, and lvl_debug.
Referenced by event_android_add_watch().
|
static |
|
static |
References jnienv, graphics_priv::NavitGraphics, graphics_priv::NavitGraphics_draw_drag, and p.
|
static |
|
static |
|
static |
References graphics_gc_priv::a, graphics_gc_priv::b, graphics_gc_priv::dashes, graphics_gc_priv::g, graphics_gc_priv::gra, jnienv, graphics_gc_priv::linewidth, graphics_priv::NavitGraphics, graphics_priv::NavitGraphics_draw_polyline, graphics_gc_priv::ndashes, p, graphics_priv::Paint, and graphics_gc_priv::r.
|
static |
References jnienv, graphics_priv::NavitGraphics, and graphics_priv::NavitGraphics_draw_mode.
|
static |
|
static |
References graphics_gc_priv::a, add_vertex_to_java_array(), graphics_gc_priv::b, graphics_gc_priv::g, graphics_gc_priv::gra, is_clockwise(), jnienv, graphics_gc_priv::linewidth, graphics_priv::NavitGraphics, graphics_priv::NavitGraphics_draw_polygon_with_holes, p, graphics_priv::Paint, and graphics_gc_priv::r.
|
static |
|
static |
|
static |
References event_idle::cb, dbg, event_android_add_timeout(), jnienv, lvl_debug, NavitIdle_init, and NavitIdleClass.
|
static |
References event_timeout::cb, dbg, event_android_handle_timeout(), event_timeout::handle_timeout, event_timeout::jni_timeout, jnienv, lvl_debug, event_timeout::multi, NavitTimeout_init, and NavitTimeoutClass.
Referenced by event_android_add_idle().
|
static |
References event_watch::cb, dbg, do_poll(), jnienv, lvl_debug, NavitWatch_init, and NavitWatchClass.
|
static |
|
static |
References callback_call_0, event_timeout::cb, event_android_remove_timeout(), and event_timeout::multi.
Referenced by event_android_add_timeout().
|
static |
References android_activity, dbg, jnienv, lvl_debug, and Navit_exit.
|
static |
References dbg, event_android_methods, find_class_global(), jnienv, lvl_debug, Navit_disableSuspend, Navit_exit, Navit_fullscreen, Navit_hideNativeKeyboard, Navit_runOptionsItem, Navit_showMenu, Navit_showNativeKeyboard, NavitClass, NavitIdle_init, NavitIdle_remove, NavitIdleClass, NavitTimeout_init, NavitTimeout_remove, NavitTimeoutClass, NavitWatch_init, NavitWatch_remove, and NavitWatchClass.
Referenced by plugin_init().
|
static |
References dbg, event_android_remove_timeout(), jnienv, lvl_debug, and NavitIdle_remove.
|
static |
References event_timeout::jni_timeout, jnienv, and NavitTimeout_remove.
Referenced by event_android_handle_timeout(), and event_android_remove_idle().
|
static |
References dbg, jnienv, lvl_debug, and NavitWatch_remove.
|
static |
References dbg, jnienv, lvl_error, and name.
Referenced by event_android_new(), and graphics_android_init().
|
static |
References dbg, jnienv, lvl_error, and name.
Referenced by graphics_android_init().
|
static |
References dbg, jnienv, lvl_error, and name.
Referenced by graphics_android_init().
|
static |
|
static |
References font_methods, graphics_font_priv::size, and size.
|
static |
References graphics_gc_priv::dashes.
|
static |
|
static |
|
static |
References graphics_gc_priv::dashes, and graphics_gc_priv::ndashes.
|
static |
References graphics_gc_priv::a, graphics_gc_priv::b, c, graphics_gc_priv::g, and graphics_gc_priv::r.
|
static |
References graphics_gc_priv::linewidth.
|
static |
References graphics_priv::padding, type, and graphics_priv::win.
|
static |
References graphics_font_priv::size, point::x, and point::y.
|
static |
Shows the Android menu.
This is the callback function associated with the
API function.
this | The graohics_prov
|
function | The API function which was called |
in | Parameters to pass to the API function |
out | Points to a buffer which will receive a pointer to the output of the command |
valid |
|
static |
Runs an item from the Android menu.
This is a callback function which implements multiple API functions.
this | The graohics_prov
|
function | The API function which was called |
in | Parameters to pass to the API function |
out | Points to a buffer which will receive a pointer to the output of the command |
valid |
References android_activity, dbg, jnienv, lvl_debug, and Navit_runOptionsItem.
|
static |
References android_activity, dbg, jnienv, lvl_debug, and Navit_disableSuspend.
Referenced by graphics_android_new().
|
static |
References android_activity, jnienv, and Navit_fullscreen.
Referenced by graphics_android_new().
|
static |
Initializes a new Android graphics instance.
This initializes a new Android graphics instance, which can either be the main view or an overlay.
ret | The new graphics instance |
parent | The graphics instance that contains the new instance ( NULL
|
p | The position of the overlay in its parent ( NULL
|
w | The width of the overlay (0 for the main view) |
h | The height of the overlay (0 for the main view) |
wraparound | (0 for the main view) |
use_camera | Whether to use the camera (0 for overlays) |
References android_activity, graphics_priv::Bitmap_createScaledBitmap, graphics_priv::Bitmap_getHeight, graphics_priv::Bitmap_getWidth, graphics_priv::BitmapClass, graphics_priv::BitmapFactory_decodeFile, graphics_priv::BitmapFactory_decodeResource, graphics_priv::BitmapFactoryClass, button_callback(), callback_cast, callback_new_1, graphics_priv::Context_getResources, graphics_priv::ContextClass, dbg, find_class_global(), find_method(), find_static_method(), jnienv, keypress_callback(), lvl_debug, lvl_error, motion_callback(), graphics_priv::NavitGraphics, graphics_priv::NavitGraphics_draw_circle, graphics_priv::NavitGraphics_draw_drag, graphics_priv::NavitGraphics_draw_image, graphics_priv::NavitGraphics_draw_image_warp, graphics_priv::NavitGraphics_draw_mode, graphics_priv::NavitGraphics_draw_polygon, graphics_priv::NavitGraphics_draw_polygon_with_holes, graphics_priv::NavitGraphics_draw_polyline, graphics_priv::NavitGraphics_draw_rectangle, graphics_priv::NavitGraphics_draw_text, graphics_priv::NavitGraphics_overlay_disable, graphics_priv::NavitGraphics_overlay_resize, graphics_priv::NavitGraphics_SetCamera, graphics_priv::NavitGraphicsClass, graphics_priv::packageName, graphics_priv::padding, padding_changed_callback(), graphics_priv::Paint, graphics_priv::Paint_init, graphics_priv::Paint_setARGB, graphics_priv::Paint_setStrokeWidth, graphics_priv::PaintClass, resize_callback(), graphics_priv::Resources, graphics_priv::Resources_getIdentifier, graphics_priv::ResourcesClass, set_activity(), point::x, and point::y.
Referenced by graphics_android_new(), and overlay_new().
|
static |
Creates a new Android graphics instance.
This method is called when the graphics plugin is initialized. It creates the main view, i.e. the map view. Unless overlay mode is enabled, it also holds any OSD items.
nav | The navit instance. |
meth | The methods for the new graphics instance |
attrs | The attributes for the new graphics instance |
cbl | The callback list for the new graphics instance |
References color::a, attr_search(), attr::attrs, color::b, graphics_priv::bgcolor, padding::bottom, attr::callback_list, graphics_priv::cbl, cbl, attr::color, command_add_table(), commands, dbg, window::disable_suspend, event_request_system(), window::fullscreen, color::g, graphics_android_disable_suspend(), graphics_android_fullscreen(), graphics_android_init(), graphics_methods, image_cache_hash, jnienv, padding::left, lvl_debug, navit_object_set_attr(), graphics_priv::NavitGraphics, graphics_priv::NavitGraphics_setBackgroundColor, graphics_priv::NavitGraphicsClass, attr::num, graphics_priv::padding, window::priv, color::r, padding::right, padding::top, attr::type, attr::u, and graphics_priv::win.
Referenced by plugin_init().
|
static |
void hide_native_keyboard | ( | struct graphics_keyboard * | kbd | ) |
Hides the native input method and frees associated private data.
kbd | The struct graphics_keyboard
Definition: graphics.h:62 |
References android_activity, dbg, graphics_keyboard::gra_priv, jnienv, lvl_error, and Navit_hideNativeKeyboard.
|
static |
|
static |
|
static |
References graphics_image_priv::Bitmap, graphics_priv::Bitmap_createScaledBitmap, graphics_priv::Bitmap_getHeight, graphics_priv::Bitmap_getWidth, graphics_priv::BitmapClass, graphics_priv::BitmapFactory_decodeFile, graphics_priv::BitmapFactory_decodeResource, graphics_priv::BitmapFactoryClass, dbg, graphics_image_priv::h, graphics_image_priv::height, graphics_image_priv::hot, jnienv, lvl_debug, lvl_error, lvl_warning, graphics_priv::packageName, graphics_image_priv::path, startup::pos, graphics_priv::Resources, graphics_priv::Resources_getIdentifier, graphics_image_priv::w, graphics_image_priv::width, point::x, and point::y.
|
static |
References graphics_gc_priv::a, graphics_gc_priv::b, graphics_gc_priv::g, graphics_gc_priv::gra, jnienv, graphics_gc_priv::linewidth, graphics_priv::Paint, graphics_priv::Paint_setARGB, graphics_priv::Paint_setStrokeWidth, and graphics_gc_priv::r.
Referenced by draw_circle(), draw_image(), draw_image_warp(), draw_rectangle(), and draw_text().
|
inlinestatic |
References p, and polygon_area().
Referenced by draw_polygon_with_holes().
|
static |
References callback_list_call_attr_1, graphics_priv::cbl, dbg, and lvl_debug.
Referenced by graphics_android_init().
|
static |
References callback_list_call_attr_1, graphics_priv::cbl, p, point::x, and point::y.
Referenced by graphics_android_init().
|
static |
|
static |
Creates a new overlay.
This method creates a graphics instance for a new overlay. If overlay mode is enabled, a separate overlay is created for each OSD item.
gr | The parent graphics instance, i.e. the one which will contain the overlay. |
meth | The methods for the new graphics instance |
p | The position of the overlay in its parent |
w | The width of the overlay |
h | The height of the overlay |
wraparound |
References dbg, graphics_android_init(), graphics_methods, graphics_priv::h, lvl_debug, p, graphics_priv::w, and graphics_priv::wraparound.
|
static |
|
static |
References padding::bottom, dbg, padding::left, lvl_debug, graphics_priv::padding, padding::right, and padding::top.
Referenced by graphics_android_init().
void plugin_init | ( | void | ) |
References dbg, event_android_new(), graphics_android_new(), and lvl_debug.
|
static |
Referenced by is_clockwise().
|
static |
References callback_list_call_attr_2, graphics_priv::cbl, dbg, and lvl_debug.
Referenced by QNavitQuick::geometryChanged(), graphics_android_init(), and QNavitWidget::resizeEvent().
|
static |
References android_activity, dbg, jnienv, lvl_debug, and lvl_error.
Referenced by graphics_android_init().
|
static |
int show_native_keyboard | ( | struct graphics_keyboard * | kbd | ) |
Displays the native input method.
This method decides whether a native on-screen input method, such as a virtual keyboard, needs to be displayed. A typical case in which there is no need for an on-screen input method is if a hardware keyboard is present.
Note that the Android platform lacks reliable means of determining whether an on-screen input method is going to be displayed or how much screen space it is going to occupy. Therefore this method tries to guess these values. They have been tested and found to work correctly with the AOSP keyboard, and are thus expected to be compatible with most on-screen keyboards found on the market, but results may be unexpected with other input methods.
kbd | A struct graphics_keyboard
|
References android_activity, dbg, graphics_keyboard::h, jnienv, lvl_error, and Navit_showNativeKeyboard.
|
static |
The command table. Each entry consists of an API function name and the callback function which implements this command.
Referenced by graphics_android_new().
|
static |
Referenced by event_android_new().
|
static |
Referenced by font_new().
|
static |
Referenced by gc_new().
|
static |
Referenced by graphics_android_new(), and overlay_new().
|
static |
Referenced by graphics_android_new(), and overlay_new().
|
static |
|
static |
Referenced by event_android_new(), and graphics_android_disable_suspend().
|
static |
Referenced by event_android_main_loop_quit(), and event_android_new().
|
static |
Referenced by event_android_new(), and graphics_android_fullscreen().
|
static |
Referenced by event_android_new(), and hide_native_keyboard().
|
static |
Referenced by event_android_new(), and graphics_android_cmd_runMenuItem().
|
static |
Referenced by event_android_new().
|
static |
Referenced by event_android_new(), and show_native_keyboard().
|
static |
Referenced by event_android_new().
|
static |
Referenced by event_android_add_idle(), and event_android_new().
|
static |
Referenced by event_android_new(), and event_android_remove_idle().
|
static |
Referenced by event_android_add_idle(), and event_android_new().
|
static |
Referenced by event_android_add_timeout(), and event_android_new().
|
static |
Referenced by event_android_new(), and event_android_remove_timeout().
|
static |
Referenced by event_android_add_timeout(), and event_android_new().
|
static |
Referenced by event_android_add_watch(), and event_android_new().
|
static |
Referenced by event_android_new(), and event_android_remove_watch().
|
static |
Referenced by event_android_add_watch(), and event_android_new().