navit  0.5.3-trunk
graphics.c File Reference
#include <stdlib.h>
#include <glib.h>
#include <stdio.h>
#include <math.h>
#include "config.h"
#include "debug.h"
#include "string.h"
#include "draw_info.h"
#include "point.h"
#include "graphics.h"
#include "projection.h"
#include "item.h"
#include "xmlconfig.h"
#include "map.h"
#include "coord.h"
#include "transform.h"
#include "plugin.h"
#include "profile.h"
#include "mapset.h"
#include "layout.h"
#include "route.h"
#include "util.h"
#include "callback.h"
#include "file.h"
#include "event.h"
#include "navit.h"

Data Structures

struct  graphics
 graphics object A graphics object serves as the target for drawing operations. It encapsulates various settings, and a drawing target, such as an image buffer or a window. Currently, in Navit, there is always one main graphics object, which is used to draw the map, and optionally additional graphics objects for overlays. More...
 
struct  display_context
 
struct  hash_entry
 
struct  displaylist
 
struct  displaylist_icon_cache
 
struct  displayitem_poly_holes
 
struct  displayitem
 graphics display item structure More...
 
struct  circle
 
struct  draw_polyline_shape
 
struct  draw_polyline_context
 
struct  wpoint
 
struct  displaylist_handle
 

Macros

#define ALLOCA_COORD_LIMIT   16384
 maximum amount of coordinates to allocate on stack using g_alloca More...
 
#define HASH_SIZE   1024
 

Enumerations

enum  relative_pos {
  INSIDE = 0 , LEFT_OF = 1 , RIGHT_OF = 2 , ABOVE = 4 ,
  BELOW = 8
}
 
enum  clip_result { CLIPRES_INVISIBLE = 0 , CLIPRES_VISIBLE = 1 , CLIPRES_START_CLIPPED = 2 , CLIPRES_END_CLIPPED = 4 }
 

Functions

static void circle_to_points (const struct point *center, int diameter, int scale, int start, int len, struct point *res, int *pos, int dir)
 Create a set of points on a circle or on a circular arc. More...
 
static void graphics_process_selection (struct graphics *gra, struct displaylist *dl)
 
static void graphics_gc_init (struct graphics *this_)
 
static int graphics_dpi_scale (struct graphics *gra, int p)
 
static struct point graphics_dpi_scale_point (struct graphics *gra, struct point *p)
 
static int graphics_dpi_unscale (struct graphics *gra, int p)
 
static struct point graphics_dpi_unscale_point (struct graphics *gra, struct point *p)
 
static void clear_hash (struct displaylist *dl)
 
static struct hash_entryget_hash_entry (struct displaylist *dl, enum item_type type)
 
static struct hash_entryset_hash_entry (struct displaylist *dl, enum item_type type)
 
static int graphics_set_attr_do (struct graphics *gra, struct attr *attr)
 Sets a generic attribute of the graphics instance. More...
 
int graphics_set_attr (struct graphics *gra, struct attr *attr)
 Sets an attribute of the graphics instance. More...
 
void graphics_set_rect (struct graphics *gra, struct point_rect *pr)
 
static void graphics_dpi_patch (struct callback_list *l, enum attr_type type, int pcount, void **p, void *context)
 unscale coordinates coming from the graphics backend via callback. More...
 
struct graphicsgraphics_new (struct attr *parent, struct attr **attrs)
 
int graphics_get_attr (struct graphics *this_, enum attr_type type, struct attr *attr, struct attr_iter *iter)
 Gets an attribute of the graphics instance. More...
 
struct graphicsgraphics_overlay_new (struct graphics *parent, struct point *p, int w, int h, int wraparound)
 Create a new graphics overlay. An overlay is a graphics object that is independent of the main graphics object. When drawing everything to a window, the overlay will be shown on top of the main graphics object. Navit uses overlays for OSD elements and for the vehicle on the map. This allows updating OSD elements and the vehicle without redrawing the map. More...
 
void graphics_overlay_resize (struct graphics *this_, struct point *p, int w, int h, int wraparound)
 Alters the size, position and wraparound for an overlay. More...
 
void graphics_init (struct graphics *this_)
 
void * graphics_get_data (struct graphics *this_, const char *type)
 
void graphics_add_callback (struct graphics *this_, struct callback *cb)
 
void graphics_remove_callback (struct graphics *this_, struct callback *cb)
 
struct graphics_fontgraphics_font_new (struct graphics *gra, int size, int flags)
 
struct graphics_fontgraphics_named_font_new (struct graphics *gra, char *font, int size, int flags)
 
void graphics_font_destroy (struct graphics_font *gra_font)
 
void graphics_free (struct graphics *gra)
 
void graphics_font_destroy_all (struct graphics *gra)
 
struct graphics_gcgraphics_gc_new (struct graphics *gra)
 
void graphics_gc_destroy (struct graphics_gc *gc)
 
static void graphics_convert_color (struct graphics *gra, struct color *in, struct color *out)
 
void graphics_gc_set_foreground (struct graphics_gc *gc, struct color *c)
 
void graphics_gc_set_background (struct graphics_gc *gc, struct color *c)
 
void graphics_gc_set_texture (struct graphics_gc *gc, struct graphics_image *img)
 
gboolean graphics_gc_has_texture (struct graphics_gc *gc)
 
void graphics_gc_set_linewidth (struct graphics_gc *gc, int width)
 
void graphics_gc_set_dashes (struct graphics_gc *gc, int width, int offset, unsigned char dash_list[], int n)
 
struct graphics_imagegraphics_image_new_scaled (struct graphics *gra, char *path, int w, int h)
 Create a new image from file path, optionally scaled to w and h pixels. More...
 
static void image_new_helper (struct graphics *gra, struct graphics_image *this_, char *path, char *name, int width, int height, int rotate)
 
struct graphics_imagegraphics_image_new_scaled_rotated (struct graphics *gra, char *path, int w, int h, int rotate)
 Create a new image from file path, optionally scaled to w and h pixels and rotated. More...
 
struct graphics_imagegraphics_image_new (struct graphics *gra, char *path)
 
void graphics_image_free (struct graphics *gra, struct graphics_image *img)
 
void graphics_draw_mode (struct graphics *this_, enum draw_mode_num mode)
 Start or finish a set of drawing operations. More...
 
void graphics_draw_lines (struct graphics *this_, struct graphics_gc *gc, struct point *p, int count)
 
void graphics_draw_circle (struct graphics *this_, struct graphics_gc *gc, struct point *p, int r)
 Draw a circle. More...
 
void graphics_draw_rectangle (struct graphics *this_, struct graphics_gc *gc, struct point *p, int w, int h)
 
static void graphics_draw_polygon (struct graphics *gra, struct graphics_gc *gc, struct point *pin, int count_in)
 Draw a plain polygon on the display. More...
 
static void graphics_draw_polygon_with_holes (struct graphics *gra, struct graphics_gc *gc, struct point *pin, int count_in, int hole_count, int *ccount, struct point **holes)
 Draw a plain polygon with holes on the display. More...
 
void graphics_draw_rectangle_rounded (struct graphics *this_, struct graphics_gc *gc, struct point *plu, int w, int h, int r, int fill)
 
void graphics_draw_text (struct graphics *this_, struct graphics_gc *gc1, struct graphics_gc *gc2, struct graphics_font *font, char *text, struct point *p, int dx, int dy)
 
void graphics_get_text_bbox (struct graphics *this_, struct graphics_font *font, char *text, int dx, int dy, struct point *ret, int estimate)
 
void graphics_overlay_disable (struct graphics *this_, int disable)
 
int graphics_is_disabled (struct graphics *this_)
 
void graphics_draw_image (struct graphics *this_, struct graphics_gc *gc, struct point *p, struct graphics_image *img)
 
static void graphics_draw_image_warp (struct graphics *this_, struct graphics_gc *gc, struct point *p, int count, struct graphics_image *img)
 
int graphics_draw_drag (struct graphics *this_, struct point *p)
 
void graphics_background_gc (struct graphics *this_, struct graphics_gc *gc)
 
int graphics_show_native_keyboard (struct graphics *this_, struct graphics_keyboard *kbd)
 Shows the native on-screen keyboard or other input method. More...
 
int graphics_hide_native_keyboard (struct graphics *this_, struct graphics_keyboard *kbd)
 Hides the native on-screen keyboard or other input method. More...
 
static void xdisplay_free (struct displaylist *dl)
 
static struct displayitem_poly_holesdisplay_add_holes (struct item *item, int hole_count, char **p)
 add the holes structure into preallocated area after displayitem More...
 
static void display_add (struct hash_entry *entry, struct item *item, int count, struct coord *c, char **label, int label_count)
 
static void label_line (struct graphics *gra, struct graphics_gc *fg, struct graphics_gc *bg, struct graphics_font *font, struct point *p, int count, char *label)
 
static void display_draw_arrow (struct point *p, navit_float dx, navit_float dy, navit_float width, struct display_context *dc, struct graphics *gra, int filled)
 
static void display_draw_arrows (struct graphics *gra, struct display_context *dc, struct point *pnt, int count, int *width, int filled)
 draw arrows along a multi polygon line More...
 
static void display_draw_spike (struct point *p, navit_float dx, navit_float dy, navit_float width, struct display_context *dc, struct graphics *gra)
 
static void display_draw_spikes (struct graphics *gra, struct display_context *dc, struct point *pnt, int count, int *width, int distance)
 draw spikes along a multi polygon line More...
 
static int intersection (struct point *a1, int adx, int ady, struct point *b1, int bdx, int bdy, struct point *res)
 
static int fowler (int dy, int dx)
 
static void draw_shape_update (struct draw_polyline_shape *shape)
 
static void draw_shape (struct draw_polyline_context *ctx, struct point *pnt, int wi)
 
static void draw_point (struct draw_polyline_shape *shape, struct point *src, struct point *dst, int pos)
 
static void draw_begin (struct draw_polyline_context *ctx, struct point *p)
 
static int draw_middle (struct draw_polyline_context *ctx, struct point *p)
 
static void draw_end (struct draw_polyline_context *ctx, struct point *p)
 
static void draw_init_ctx (struct draw_polyline_context *ctx, int maxpoints)
 
static void graphics_draw_polyline_as_polygon (struct graphics *gra, struct graphics_gc *gc, struct point *pnt, int count, int *width)
 
static int relative_pos (struct wpoint *p, struct point_rect *r)
 
static void clip_line_endoint_to_rect_edge (struct wpoint *p, int rel_pos, int dx, int dy, int dw, struct point_rect *clip_rect)
 
static int clip_line (struct wpoint *p1, struct wpoint *p2, struct point_rect *clip_rect)
 
void graphics_draw_polyline_clipped (struct graphics *gra, struct graphics_gc *gc, struct point *pa, int count, int *width, int poly)
 Draw polyline on the display. More...
 
static int is_inside (struct point *p, struct point_rect *r, int edge)
 
static void poly_intersection (struct point *p1, struct point *p2, struct point_rect *r, int edge, struct point *ret)
 
static void graphics_clip_polygon (struct point_rect *r, struct point *in, int count_in, struct point *out, int *count_out)
 clip a polygon inside a rectangle More...
 
void graphics_draw_polygon_clipped (struct graphics *gra, struct graphics_gc *gc, struct point *pin, int count_in)
 Draw a plain polygon on the display. More...
 
static void graphics_draw_polygon_with_holes_clipped (struct graphics *gra, struct graphics_gc *gc, struct point *pin, int count_in, int hole_count, int *ccount, struct point **holes)
 Draw a plain polygon with holes on the display. More...
 
static void display_context_free (struct display_context *dc)
 
static struct graphics_fontget_font (struct graphics *gra, int size)
 
void graphics_draw_text_std (struct graphics *this_, int text_size, char *text, struct point *p)
 
char * graphics_icon_path (const char *icon)
 
char * graphics_texture_path (const char *texture)
 
static int limit_count (struct coord *c, int count)
 
static void multiline_label_draw (struct graphics *gra, struct graphics_gc *fg, struct graphics_gc *bg, struct graphics_font *font, struct point pref, const char *label, int line_spacing)
 Draw a multi-line text next to a specified point pref. More...
 
static void displayitem_transform_holes (struct transformation *trans, enum projection pro, struct displayitem_poly_holes *in, struct displayitem_poly_holes *out, int mindist)
 coordnate transfor hole coordinates More...
 
static void displayitem_free_holes (struct displayitem_poly_holes *holes)
 free hole structure allocated by displayitem_transform_holes More...
 
static void displayitem_draw_polygon (struct display_context *dc, struct graphics *gra, struct point *pa, int count, struct displayitem_poly_holes *holes)
 
static void displayitem_draw_polyline (struct display_context *dc, struct element *e, struct graphics *gra, struct point *pa, int count, int *width)
 
static void displayitem_draw_circle (struct displayitem *di, struct display_context *dc, struct element *e, struct graphics *gra, struct point *pa, int count)
 
static void displayitem_draw_text (struct displayitem *di, struct display_context *dc, struct element *e, struct graphics *gra, struct point *pa, int count, struct displayitem_poly_holes *holes)
 
static void displayitem_draw_icon (struct displayitem *di, struct display_context *dc, struct element *e, struct graphics *gra, struct point *pa, int count, struct layout *l)
 
static void displayitem_draw_image (struct displayitem *di, struct display_context *dc, struct graphics *gra, struct point *pa, int count)
 
static void displayitem_draw (struct displayitem *di, struct layout *l, struct display_context *dc)
 Draw a displayitem element. More...
 
static void xdisplay_draw_elements (struct graphics *gra, struct displaylist *display_list, struct itemgra *itm, struct layout *l)
 
void graphics_draw_itemgra (struct graphics *gra, struct itemgra *itm, struct transformation *t, char *label)
 
static void xdisplay_draw_layer (struct displaylist *display_list, struct graphics *gra, struct layer *lay, int order, struct layout *l)
 
static void xdisplay_draw (struct displaylist *display_list, struct graphics *gra, struct layout *l, int order)
 
static void displaylist_update_layers (struct displaylist *displaylist, GList *layers, int order)
 
static void displaylist_update_hash (struct displaylist *displaylist)
 
struct map_selectiondisplaylist_get_selection (struct displaylist *displaylist)
 Returns selection structure based on displaylist transform, projection and order. Use this function to get map selection if you are going to fetch complete item data from the map based on displayitem reference. More...
 
static int displaylist_cmp_zorder (const struct displayitem *a, const struct displayitem *b)
 Compare displayitems based on their zorder values. Use with g_list_insert_sorted to sort less shaded items to be before more shaded ones in the result list. More...
 
GListdisplaylist_get_clicked_list (struct displaylist *displaylist, struct point *p, int radius)
 Returns list of displayitems clicked at given coordinates. The deeper item is in current layout, the deeper it will be in the list. More...
 
static void do_draw (struct displaylist *displaylist, int cancel, int flags)
 
void graphics_displaylist_draw (struct graphics *gra, struct displaylist *displaylist, struct transformation *trans, struct layout *l, int flags)
 
static void graphics_load_mapset (struct graphics *gra, struct displaylist *displaylist, struct mapset *mapset, struct transformation *trans, struct layout *l, int async, struct callback *cb, int flags)
 
void graphics_draw (struct graphics *gra, struct displaylist *displaylist, struct mapset *mapset, struct transformation *trans, struct layout *l, int async, struct callback *cb, int flags)
 
int graphics_draw_cancel (struct graphics *gra, struct displaylist *displaylist)
 
struct displaylist_handlegraphics_displaylist_open (struct displaylist *displaylist)
 
struct displayitemgraphics_displaylist_next (struct displaylist_handle *dlh)
 
void graphics_displaylist_close (struct displaylist_handle *dlh)
 
struct displaylistgraphics_displaylist_new (void)
 
void graphics_displaylist_destroy (struct displaylist *displaylist)
 
struct itemgraphics_displayitem_get_item (struct displayitem *di)
 
int graphics_displayitem_get_z_order (struct displayitem *di)
 
int graphics_displayitem_get_coord_count (struct displayitem *di)
 
char * graphics_displayitem_get_label (struct displayitem *di)
 
int graphics_displayitem_get_displayed (struct displayitem *di)
 
static int within_dist_point (struct point *p0, struct point *p1, int dist)
 
static int within_dist_line (struct point *p, struct point *line_p0, struct point *line_p1, int dist)
 
static int within_dist_polyline (struct point *p, struct point *line_pnt, int count, int dist, int close)
 
static int within_dist_polygon (struct point *p, struct point *poly_pnt, int count, int dist)
 
int graphics_displayitem_within_dist (struct displaylist *displaylist, struct displayitem *di, struct point *p, int dist)
 
static void graphics_process_selection_item (struct displaylist *dl, struct item *item)
 
void graphics_add_selection (struct graphics *gra, struct item *item, enum item_type type, struct displaylist *dl)
 
void graphics_remove_selection (struct graphics *gra, struct item *item, enum item_type type, struct displaylist *dl)
 
void graphics_clear_selection (struct graphics *gra, struct displaylist *dl)
 
navit_float graphics_get_dpi (struct graphics *gra)
 get display resolution in DPI This method returns the native display density in DPI More...
 

Variables

struct circle circle64 []
 
void * route_selection
 

Macro Definition Documentation

◆ ALLOCA_COORD_LIMIT

#define ALLOCA_COORD_LIMIT   16384

maximum amount of coordinates to allocate on stack using g_alloca

Navit, a modular navigation system. Copyright (C) 2005-2008 Navit Team

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation.

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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

◆ HASH_SIZE

#define HASH_SIZE   1024

Enumeration Type Documentation

◆ clip_result

Enumerator
CLIPRES_INVISIBLE 
CLIPRES_VISIBLE 
CLIPRES_START_CLIPPED 
CLIPRES_END_CLIPPED 

◆ relative_pos

Enumerator
INSIDE 
LEFT_OF 
RIGHT_OF 
ABOVE 
BELOW 

Function Documentation

◆ circle_to_points()

static void circle_to_points ( const struct point center,
int  diameter,
int  scale,
int  start,
int  len,
struct point res,
int *  pos,
int  dir 
)
static

Create a set of points on a circle or on a circular arc.

Parameters
centerCenter point of the circle
diameterDiameter of the circle
scaleUnused
startPosition of the first point on the circle (in 1/1024th of the circle), -1 being the bottom of the circle, 511 being the top of the circle
lenLength of the arc on the circle, relative to start (in 1/1024th of the circle), 514 is half a circle, 1028 is a full circle (or 1027 if first and last points are connected with a line)
[out]resReturned an array of points that will form the resulting circle
[out]posIndex of the last point filled inside array res
dirDirection of the circle (valid values are 1 (counter-clockwise) or -1 (clockwise), other values may lead to unknown result)

References c, center, circle64, fowler(), startup::pos, pcoord::x, point::x, pcoord::y, and point::y.

Referenced by graphics_draw_circle(), and graphics_draw_rectangle_rounded().

◆ clear_hash()

static void clear_hash ( struct displaylist dl)
static

◆ clip_line()

static int clip_line ( struct wpoint p1,
struct wpoint p2,
struct point_rect clip_rect 
)
static

◆ clip_line_endoint_to_rect_edge()

static void clip_line_endoint_to_rect_edge ( struct wpoint p,
int  rel_pos,
int  dx,
int  dy,
int  dw,
struct point_rect clip_rect 
)
static

◆ display_add()

static void display_add ( struct hash_entry entry,
struct item item,
int  count,
struct coord c,
char **  label,
int  label_count 
)
static

◆ display_add_holes()

static struct displayitem_poly_holes* display_add_holes ( struct item item,
int  hole_count,
char **  p 
)
inlinestatic

add the holes structure into preallocated area after displayitem

Parameters
itemto extract holes from
hole_countprecounted number of holes
pchangeable pointer to buffer. Advanced by the size used
Returns
pointer to newly created holes structure

References displayitem_poly_holes::ccount, poly_hole::coord, poly_hole::coord_count, displayitem_poly_holes::coords, displayitem_poly_holes::count, item_attr_get(), item_attr_rewind(), p, attr::poly_hole, and attr::u.

Referenced by display_add().

◆ display_context_free()

◆ display_draw_arrow()

static void display_draw_arrow ( struct point p,
navit_float  dx,
navit_float  dy,
navit_float  width,
struct display_context dc,
struct graphics gra,
int  filled 
)
static

◆ display_draw_arrows()

static void display_draw_arrows ( struct graphics gra,
struct display_context dc,
struct point pnt,
int  count,
int *  width,
int  filled 
)
static

draw arrows along a multi polygon line

This function draws arrows along a multi polygon line, and scales the arrows according to current view settings by interpolating sizes at given arrow position,

Parameters
gracurrent graphics instance handle
dccurrent drawing context
pntarray of points for this polyline
countnumber of points in pnt
widtharrray of integers giving the expexted line width at the corresponding point
filled.True to draw filled arrows, false to draw only line arrows.

References display_draw_arrow(), navit_sqrt, p, width, point::x, and point::y.

Referenced by displayitem_draw().

◆ display_draw_spike()

static void display_draw_spike ( struct point p,
navit_float  dx,
navit_float  dy,
navit_float  width,
struct display_context dc,
struct graphics gra 
)
static

◆ display_draw_spikes()

static void display_draw_spikes ( struct graphics gra,
struct display_context dc,
struct point pnt,
int  count,
int *  width,
int  distance 
)
static

draw spikes along a multi polygon line

This function draws spikes along a multi polygon line, and scales the spikes according to current view settings by interpolating sizes at given spike position,

Parameters
gracurrent graphics instance handle
dccurrent drawing context
pntarray of points for this polyline
countnumber of points in pnt
widtharray of integers giving the expected line width at the corresponding point
distancegiving the distance between spikes

References display_draw_spike(), navit_sqrt, p, width, point::x, and point::y.

Referenced by displayitem_draw().

◆ displayitem_draw()

◆ displayitem_draw_circle()

◆ displayitem_draw_icon()

◆ displayitem_draw_image()

static void displayitem_draw_image ( struct displayitem di,
struct display_context dc,
struct graphics gra,
struct point pa,
int  count 
)
inlinestatic

◆ displayitem_draw_polygon()

◆ displayitem_draw_polyline()

static void displayitem_draw_polyline ( struct display_context dc,
struct element e,
struct graphics gra,
struct point pa,
int  count,
int *  width 
)
inlinestatic

◆ displayitem_draw_text()

◆ displayitem_free_holes()

static void displayitem_free_holes ( struct displayitem_poly_holes holes)
static

free hole structure allocated by displayitem_transform_holes

Parameters
holesstructure to deallocate

References displayitem_poly_holes::ccount, displayitem_poly_holes::coords, and displayitem_poly_holes::count.

Referenced by displayitem_draw().

◆ displayitem_transform_holes()

static void displayitem_transform_holes ( struct transformation trans,
enum projection  pro,
struct displayitem_poly_holes in,
struct displayitem_poly_holes out,
int  mindist 
)
inlinestatic

coordnate transfor hole coordinates

This function transform a whole set of polygon holes. It therefore allocates memory attached to a displayitem_poly_holes structure and call transform

Parameters
transtransformation to be used
proprojection to be used
infilled holes structure to transform
outstructure to place result in. Remember to deallocate!
mindistminimal distance between points

References displayitem_poly_holes::ccount, displayitem_poly_holes::coords, displayitem_poly_holes::count, limit_count(), TRANSFORM_ERR_BUF_SPACE, and transform_point_buf().

Referenced by displayitem_draw().

◆ displaylist_cmp_zorder()

static int displaylist_cmp_zorder ( const struct displayitem a,
const struct displayitem b 
)
static

Compare displayitems based on their zorder values. Use with g_list_insert_sorted to sort less shaded items to be before more shaded ones in the result list.

References displayitem::z_order.

Referenced by displaylist_get_clicked_list().

◆ displaylist_get_clicked_list()

GList* displaylist_get_clicked_list ( struct displaylist displaylist,
struct point p,
int  radius 
)

Returns list of displayitems clicked at given coordinates. The deeper item is in current layout, the deeper it will be in the list.

Parameters
displaylist
pclicked point
radiusradius of clicked area
Returns
GList of displayitems

References displaylist_handle::di, displaylist_cmp_zorder(), graphics_displayitem_within_dist(), graphics_displaylist_close(), graphics_displaylist_next(), graphics_displaylist_open(), p, and displayitem::z_order.

Referenced by gui_internal_cmd_position_do().

◆ displaylist_get_selection()

struct map_selection* displaylist_get_selection ( struct displaylist displaylist)

Returns selection structure based on displaylist transform, projection and order. Use this function to get map selection if you are going to fetch complete item data from the map based on displayitem reference.

Parameters
displaylist
Returns
Pointer to selection structure

References displaylist::dc, displaylist::order, display_context::pro, display_context::trans, and transform_get_selection().

Referenced by do_draw(), and gui_internal_cmd_position_do().

◆ displaylist_update_hash()

static void displaylist_update_hash ( struct displaylist displaylist)
static

◆ displaylist_update_layers()

static void displaylist_update_layers ( struct displaylist displaylist,
GList layers,
int  order 
)
static

◆ do_draw()

static void do_draw ( struct displaylist displaylist,
int  cancel,
int  flags 
)
static

◆ draw_begin()

◆ draw_end()

◆ draw_init_ctx()

static void draw_init_ctx ( struct draw_polyline_context ctx,
int  maxpoints 
)
static

◆ draw_middle()

◆ draw_point()

static void draw_point ( struct draw_polyline_shape shape,
struct point src,
struct point dst,
int  pos 
)
static

◆ draw_shape()

◆ draw_shape_update()

◆ fowler()

static int fowler ( int  dy,
int  dx 
)
static

Referenced by circle_to_points(), and draw_shape().

◆ get_font()

static struct graphics_font* get_font ( struct graphics gra,
int  size 
)
static

◆ get_hash_entry()

static struct hash_entry* get_hash_entry ( struct displaylist dl,
enum item_type  type 
)
static

◆ graphics_add_callback()

◆ graphics_add_selection()

void graphics_add_selection ( struct graphics gra,
struct item item,
enum item_type  type,
struct displaylist dl 
)

◆ graphics_background_gc()

void graphics_background_gc ( struct graphics this_,
struct graphics_gc gc 
)

◆ graphics_clear_selection()

void graphics_clear_selection ( struct graphics gra,
struct displaylist dl 
)

◆ graphics_clip_polygon()

static void graphics_clip_polygon ( struct point_rect r,
struct point in,
int  count_in,
struct point out,
int *  count_out 
)
static

clip a polygon inside a rectangle

This function clippes a given polygon inside a rectangle. It writes the result into provided buffer.

Parameters
[in]rrectangle to clip into
[in]pinpoint array of input polygon
[in]count_innumber of points in pin
[out]outpreallocated buffer of at least count_in *8 +1 points size
[out]count_outsize of out number of points, number of points used in out at return

References ALLOCA_COORD_LIMIT, is_inside(), p, and poly_intersection().

Referenced by graphics_draw_polygon_clipped(), and graphics_draw_polygon_with_holes_clipped().

◆ graphics_convert_color()

static void graphics_convert_color ( struct graphics gra,
struct color in,
struct color out 
)
static

◆ graphics_displayitem_get_coord_count()

int graphics_displayitem_get_coord_count ( struct displayitem di)

References displayitem::count.

Referenced by popup_show_item().

◆ graphics_displayitem_get_displayed()

int graphics_displayitem_get_displayed ( struct displayitem di)

◆ graphics_displayitem_get_item()

struct item* graphics_displayitem_get_item ( struct displayitem di)

Get the map item which given displayitem is based on. NOTE: returned structure doesn't contain any attributes or coordinates. type, map, idhi and idlow seem to be the only useable members.

Parameters
dipointer to displayitem structure
Returns
Pointer to struct item
Author
Martin Schaller (04/2008)

References displayitem::item.

Referenced by gui_internal_cmd_position_do(), gui_internal_dbus_signal(), gui_qml_dbus_signal(), and popup_show_item().

◆ graphics_displayitem_get_label()

char* graphics_displayitem_get_label ( struct displayitem di)

FIXME

Parameters
<>
Returns
<>
Author
Martin Schaller (04/2008)

References displayitem::label.

Referenced by popup_show_item().

◆ graphics_displayitem_get_z_order()

int graphics_displayitem_get_z_order ( struct displayitem di)

Get the number of this item as it was last displayed on the screen, dependent of current layout. Items with lower numbers are shaded by items with higher ones when they overlap. Zero means item was not displayed at all. If the item is displayed twice, its topmost occurence is used.

Parameters
dipointer to displayitem structure
Returns
z-order of current item.

References displayitem::z_order.

◆ graphics_displayitem_within_dist()

int graphics_displayitem_within_dist ( struct displaylist displaylist,
struct displayitem di,
struct point p,
int  dist 
)

◆ graphics_displaylist_close()

void graphics_displaylist_close ( struct displaylist_handle dlh)

FIXME

Parameters
<>
Returns
<>
Author
Martin Schaller (04/2008)

Referenced by displaylist_get_clicked_list(), gui_internal_cmd_position_do(), gui_internal_dbus_signal(), and gui_qml_dbus_signal().

◆ graphics_displaylist_destroy()

void graphics_displaylist_destroy ( struct displaylist displaylist)

◆ graphics_displaylist_draw()

◆ graphics_displaylist_new()

struct displaylist* graphics_displaylist_new ( void  )

FIXME

Parameters
<>
Returns
<>
Author
Martin Schaller (04/2008)

References ALLOCA_COORD_LIMIT, displaylist::dc, and display_context::maxlen.

Referenced by navit_new().

◆ graphics_displaylist_next()

struct displayitem* graphics_displaylist_next ( struct displaylist_handle dlh)

◆ graphics_displaylist_open()

struct displaylist_handle* graphics_displaylist_open ( struct displaylist displaylist)

FIXME

Parameters
<>
Returns
<>
Author
Martin Schaller (04/2008)

References displaylist_handle::dl.

Referenced by displaylist_get_clicked_list(), gui_internal_cmd_position_do(), gui_internal_dbus_signal(), and gui_qml_dbus_signal().

◆ graphics_dpi_patch()

static void graphics_dpi_patch ( struct callback_list l,
enum attr_type  type,
int  pcount,
void **  p,
void *  context 
)
static

unscale coordinates coming from the graphics backend via callback.

Parameters
lpointer to callback list
pcountnumber of parameters attached to this callback
plist of parameters
contextcontext handed over by callback_list_add_patch_function, gra in this case.
Returns
nothing

References dbg, graphics_dpi_unscale(), graphics_dpi_unscale_point(), lvl_debug, p, type, point::x, and point::y.

Referenced by graphics_new().

◆ graphics_dpi_scale()

◆ graphics_dpi_scale_point()

◆ graphics_dpi_unscale()

static int graphics_dpi_unscale ( struct graphics gra,
int  p 
)
static

References graphics::dpi_factor, and p.

Referenced by graphics_dpi_patch(), and image_new_helper().

◆ graphics_dpi_unscale_point()

static struct point graphics_dpi_unscale_point ( struct graphics gra,
struct point p 
)
static

◆ graphics_draw()

void graphics_draw ( struct graphics gra,
struct displaylist displaylist,
struct mapset mapset,
struct transformation trans,
struct layout l,
int  async,
struct callback cb,
int  flags 
)

FIXME

Parameters
<>
Returns
<>
Author
Martin Schaller (04/2008)

References graphics_load_mapset().

Referenced by navit_draw_async(), and osd_auxmap_draw().

◆ graphics_draw_cancel()

int graphics_draw_cancel ( struct graphics gra,
struct displaylist displaylist 
)

◆ graphics_draw_circle()

void graphics_draw_circle ( struct graphics this_,
struct graphics_gc gc,
struct point p,
int  r 
)

Draw a circle.

Parameters
this_The graphics instance on which to draw
gcThe graphics context
pThe coordinates of the center of the circle
rThe radius of the circle
Author
Martin Schaller (04/2008)

References ALLOCA_COORD_LIMIT, circle_to_points(), graphics_methods::draw_circle, graphics_dpi_scale(), graphics_dpi_scale_point(), graphics_draw_lines(), graphics::meth, p, graphics::priv, and graphics_gc::priv.

Referenced by displayitem_draw_circle(), gui_internal_cmd2_route_height_profile(), osd_auxmap_draw(), osd_compass_draw(), and osd_speed_warner_draw().

◆ graphics_draw_drag()

int graphics_draw_drag ( struct graphics this_,
struct point p 
)

◆ graphics_draw_image()

◆ graphics_draw_image_warp()

static void graphics_draw_image_warp ( struct graphics this_,
struct graphics_gc gc,
struct point p,
int  count,
struct graphics_image img 
)
static

◆ graphics_draw_itemgra()

◆ graphics_draw_lines()

◆ graphics_draw_mode()

void graphics_draw_mode ( struct graphics this_,
enum draw_mode_num  mode 
)

Start or finish a set of drawing operations.

graphics_draw_mode(draw_mode_begin) must be invoked before performing any drawing operations; this allows the graphics driver to perform any necessary setup. graphics_draw_mode(draw_mode_end) must be invoked to finish a set of drawing operations; this will typically clean up drawing resources and display the drawing result.

Parameters
this_graphics object that is being drawn to
modespecify beginning or end of drawing
Author
Martin Schaller (04/2008)

References graphics_methods::draw_mode, graphics::meth, and graphics::priv.

Referenced by draw_aligned_osd_text(), graphics_displaylist_draw(), gui_internal_button(), gui_internal_cmd2_about(), gui_internal_cmd2_back(), gui_internal_cmd2_locale(), gui_internal_cmd2_network_info(), gui_internal_highlight_do(), gui_internal_highlight_possible_keys(), gui_internal_html_menu(), gui_internal_html_submit(), gui_internal_keypress(), gui_internal_leave(), gui_internal_motion_cb(), gui_internal_route_update(), gui_internal_search_idle(), gui_internal_set_attr(), navit_map_progress(), navit_motion_timeout(), navit_set_attr_do(), osd_auxmap_draw(), osd_button_init(), osd_cmd_interface_draw(), osd_compass_draw(), osd_fill_with_bgcolor(), osd_gps_status_draw(), osd_image_init(), osd_j1850_draw(), osd_nav_next_turn_draw(), osd_nav_toggle_announcer_draw(), osd_navigation_status_draw_do(), osd_odometer_draw(), osd_route_guard_draw(), osd_scale_draw(), osd_speed_cam_draw(), osd_speed_warner_draw(), osd_stopwatch_draw(), osd_text_draw(), osd_volume_draw(), and vehicle_draw_do().

◆ graphics_draw_polygon()

static void graphics_draw_polygon ( struct graphics gra,
struct graphics_gc gc,
struct point pin,
int  count_in 
)
static

Draw a plain polygon on the display.

Parameters
graThe graphics instance on which to draw
gcThe graphics context
[in]pinAn array of points forming the polygon
count_inThe number of elements inside pin

References ALLOCA_COORD_LIMIT, graphics_methods::draw_polygon, graphics_dpi_scale_point(), graphics::meth, graphics::priv, and graphics_gc::priv.

Referenced by display_draw_arrow(), graphics_draw_polygon_clipped(), graphics_draw_polygon_with_holes(), graphics_draw_polyline_as_polygon(), and graphics_draw_rectangle_rounded().

◆ graphics_draw_polygon_clipped()

void graphics_draw_polygon_clipped ( struct graphics gra,
struct graphics_gc gc,
struct point pin,
int  count_in 
)

Draw a plain polygon on the display.

Parameters
graThe graphics instance on which to draw
gcThe graphics context
[in]pinAn array of points forming the polygon
count_inThe number of elements inside pin

References ALLOCA_COORD_LIMIT, graphics_clip_polygon(), graphics_draw_polygon(), and graphics::r.

Referenced by displayitem_draw_polygon(), and draw_compass().

◆ graphics_draw_polygon_with_holes()

static void graphics_draw_polygon_with_holes ( struct graphics gra,
struct graphics_gc gc,
struct point pin,
int  count_in,
int  hole_count,
int *  ccount,
struct point **  holes 
)
static

Draw a plain polygon with holes on the display.

Parameters
graThe graphics instance on which to draw
gcThe graphics context
[in]pinAn array of points forming the polygon
count_inThe number of elements inside pin
hole_countThe number of hole polygons to cut out
pcountarray of [hole_count] integers giving the number of points per hole
holesarray of point arrays for the hole polygons

References ALLOCA_COORD_LIMIT, graphics_methods::draw_polygon_with_holes, graphics_dpi_scale_point(), graphics_draw_polygon(), graphics::meth, graphics::priv, and graphics_gc::priv.

Referenced by graphics_draw_polygon_with_holes_clipped().

◆ graphics_draw_polygon_with_holes_clipped()

static void graphics_draw_polygon_with_holes_clipped ( struct graphics gra,
struct graphics_gc gc,
struct point pin,
int  count_in,
int  hole_count,
int *  ccount,
struct point **  holes 
)
static

Draw a plain polygon with holes on the display.

Parameters
graThe graphics instance on which to draw
gcThe graphics context
[in]pinAn array of points forming the polygon
count_inThe number of elements inside pin
hole_countThe number of hole polygons to cut out
pcountarray of [hole_count] integers giving the number of points per hole
holesarray of point arrays for the hole polygons

References ALLOCA_COORD_LIMIT, graphics_clip_polygon(), graphics_draw_polygon_with_holes(), and graphics::r.

Referenced by displayitem_draw_polygon().

◆ graphics_draw_polyline_as_polygon()

◆ graphics_draw_polyline_clipped()

void graphics_draw_polyline_clipped ( struct graphics gra,
struct graphics_gc gc,
struct point pa,
int  count,
int *  width,
int  poly 
)

Draw polyline on the display.

Polylines are a serie of lines connected to each other.

Parameters
graThe graphics instance on which to draw
gcThe graphics context
[in]pinAn array of points forming the polygon
count_inThe number of elements inside pin
[in]widthAn array of width matching the line starting from the corresponding pa (if all equal, all lines will have the same width)
polyA boolean indicating whether the polyline should be closed to form a polygon (only the contour of this polygon will be drawn)

References ALLOCA_COORD_LIMIT, clip_line(), CLIPRES_END_CLIPPED, CLIPRES_INVISIBLE, CLIPRES_START_CLIPPED, dbg, graphics_draw_lines(), graphics_draw_polyline_as_polygon(), point_rect::lu, lvl_debug, graphics::r, point_rect::rl, wpoint::w, width, wpoint::x, point::x, wpoint::y, and point::y.

Referenced by displayitem_draw_polyline(), and draw_compass().

◆ graphics_draw_rectangle()

◆ graphics_draw_rectangle_rounded()

void graphics_draw_rectangle_rounded ( struct graphics this_,
struct graphics_gc gc,
struct point plu,
int  w,
int  h,
int  r,
int  fill 
)

◆ graphics_draw_text()

void graphics_draw_text ( struct graphics this_,
struct graphics_gc gc1,
struct graphics_gc gc2,
struct graphics_font font,
char *  text,
struct point p,
int  dx,
int  dy 
)

◆ graphics_draw_text_std()

void graphics_draw_text_std ( struct graphics this_,
int  text_size,
char *  text,
struct point p 
)

◆ graphics_font_destroy()

void graphics_font_destroy ( struct graphics_font gra_font)

◆ graphics_font_destroy_all()

void graphics_font_destroy_all ( struct graphics gra)

Free all loaded fonts. Used when switching layouts.

Parameters
graThe graphics instance
Returns
nothing
Author
Sarah Nordstrom (05/2008)

References graphics::font, graphics_font_methods::font_destroy, graphics::font_len, graphics_font::meth, and graphics_font::priv.

Referenced by graphics_free(), and navit_set_attr_do().

◆ graphics_font_new()

struct graphics_font* graphics_font_new ( struct graphics gra,
int  size,
int  flags 
)

FIXME

Parameters
<>
Returns
<>
Author
Martin Schaller (04/2008)

References graphics::default_font, graphics_named_font_new(), and size.

Referenced by get_font(), and gui_internal_apply_config().

◆ graphics_free()

void graphics_free ( struct graphics gra)

◆ graphics_gc_destroy()

void graphics_gc_destroy ( struct graphics_gc gc)

Destroy a graphics context, freeing associated resources.

Parameters
gccontext to destroy
Author
Martin Schaller (04/2008)

References graphics_gc_methods::gc_destroy, graphics_gc::meth, and graphics_gc::priv.

Referenced by display_context_free(), graphics_free(), pedestrian_draw_arrow(), pedestrian_graphics_postdraw(), and vehicle_destroy().

◆ graphics_gc_has_texture()

gboolean graphics_gc_has_texture ( struct graphics_gc gc)

Check if graphic context supports textured backgrounds

Parameters
gcGraphics context handle
Returns
true if supported otherwise false.
Author
metalstrolch (04/2020)

References graphics_gc_methods::gc_set_texture, and graphics_gc::meth.

Referenced by displayitem_draw_polygon(), and graphics_gc_set_texture().

◆ graphics_gc_init()

static void graphics_gc_init ( struct graphics this_)
static

◆ graphics_gc_new()

◆ graphics_gc_set_background()

void graphics_gc_set_background ( struct graphics_gc gc,
struct color c 
)

◆ graphics_gc_set_dashes()

void graphics_gc_set_dashes ( struct graphics_gc gc,
int  width,
int  offset,
unsigned char  dash_list[],
int  n 
)

FIXME

Parameters
<>
Returns
<>
Author
Martin Schaller (04/2008)

References color::a, graphics_gc_methods::gc_set_dashes, graphics_gc::gra, graphics_dpi_scale(), graphics_gc::meth, offset, graphics_gc::priv, and width.

Referenced by displayitem_draw_polyline().

◆ graphics_gc_set_foreground()

◆ graphics_gc_set_linewidth()

◆ graphics_gc_set_texture()

void graphics_gc_set_texture ( struct graphics_gc gc,
struct graphics_image img 
)

Set textured background to current graphics context.

Parameters
gcGraphics context handle
imgAllocated image
Returns
void
Author
metalstrolch (04/2020)

References graphics_gc_methods::gc_set_texture, graphics_gc_has_texture(), graphics_gc::meth, graphics_gc::priv, and graphics_image::priv.

Referenced by displayitem_draw_polygon().

◆ graphics_get_attr()

int graphics_get_attr ( struct graphics this_,
enum attr_type  type,
struct attr attr,
struct attr_iter iter 
)

Gets an attribute of the graphics instance.

This function searches the attribute list of the graphics object for an attribute of a given type and stores it in the attr parameter.

Searching for attr_any or attr_any_xml is supported.

An iterator can be specified to get multiple attributes of the same type: The first call will return the first match from attr; each subsequent call with the same iterator will return the next match. If no more matching attributes are found in either of them, false is returned.

Note that currently this will only return the generic attributes which can be set with graphics_set_attr_do(struct graphics *, struct attr *). Attributes implemented by a graphics plugin cannot be retrieved with this method.

Parameters
thisThe graphics instance
typeThe attribute type to search for
attrPoints to a
struct attr
Definition: attr.h:157
which will receive the attribute
iterAn iterator. This parameter may be NULL.
Returns
True if a matching attribute was found, false if not.
Author
Martin Schaller (04/2008)

References attr_generic_get_attr(), graphics::attrs, and type.

Referenced by navit_init().

◆ graphics_get_data()

◆ graphics_get_dpi()

navit_float graphics_get_dpi ( struct graphics gra)

get display resolution in DPI This method returns the native display density in DPI

Parameters
gragraphics handle
Returns
dpi value. May be fraction therefore double.

References graphics_methods::get_dpi, graphics::meth, and graphics::priv.

Referenced by graphics_new().

◆ graphics_get_text_bbox()

◆ graphics_hide_native_keyboard()

int graphics_hide_native_keyboard ( struct graphics this_,
struct graphics_keyboard kbd 
)

Hides the native on-screen keyboard or other input method.

This method is a wrapper around the respective method of the graphics plugin.

A call to this function indicates that Navit no longer needs the input method and is about to reclaim any screen real estate it may have previously reserved for the input method.

On platforms that don't support overlapping windows this means that the on-screen input method should be hidden, as it may otherwise obstruct parts of Navit's UI.

On windowed platforms, where on-screen input methods can be displayed alongside Navit or moved around as needed, the graphics driver should instead notify the on-screen method that it is no longer expecting user input, allowing the input method to take the appropriate action.

The graphics plugin must free any data it has stored in

kbd->gra_priv

and reset the pointer to

NULL

to indicate it has done so.

The caller may free

kbd

after this function returns.

Parameters
thisThe graphics instance
kbdThe keyboard instance
Returns
True if the call was successfully passed to the plugin, false if the method is not supported by the plugin

References graphics_methods::hide_native_keyboard, and graphics::meth.

Referenced by gui_internal_keyboard_hide_native().

◆ graphics_icon_path()

◆ graphics_image_free()

◆ graphics_image_new()

struct graphics_image* graphics_image_new ( struct graphics gra,
char *  path 
)

Create a new image from file path

Parameters
grathe graphics instance
pathpath of the image to load
Returns
<>
Author
Martin Schaller (04/2008)

References graphics_image_new_scaled_rotated().

Referenced by osd_cmd_interface_set_attr(), osd_image_init(), and pedestrian_draw_arrow().

◆ graphics_image_new_scaled()

struct graphics_image* graphics_image_new_scaled ( struct graphics gra,
char *  path,
int  w,
int  h 
)

Create a new image from file path, optionally scaled to w and h pixels.

Parameters
grathe graphics instance
pathpath of the image to load
wwidth to rescale to, or IMAGE_W_H_UNSET for original width
hheight to rescale to, or IMAGE_W_H_UNSET for original height
Returns
<>
Author
Martin Schaller (04/2008)

References graphics_image_new_scaled_rotated().

Referenced by image_new_scaled(), osd_button_draw(), osd_button_init(), osd_button_set_attr(), osd_gps_status_draw(), osd_nav_next_turn_draw(), osd_nav_toggle_announcer_draw(), osd_navigation_status_draw_do(), and osd_volume_draw().

◆ graphics_image_new_scaled_rotated()

struct graphics_image* graphics_image_new_scaled_rotated ( struct graphics gra,
char *  path,
int  w,
int  h,
int  rotate 
)

Create a new image from file path, optionally scaled to w and h pixels and rotated.

Parameters
grathe graphics instance
pathpath of the image to load
wwidth to rescale to, or IMAGE_W_H_UNSET for original width
hheight to rescale to, or IMAGE_W_H_UNSET for original height
rotateangle to rotate the image, in 90 degree steps (not supported by all plugins).
Returns
<>
Author
Martin Schaller (04/2008)

References dbg, file_wordexp_destroy(), file_wordexp_get_array(), file_wordexp_get_count(), file_wordexp_new(), graphics_image::height, graphics::image_cache_hash, image_new_helper(), lvl_debug, lvl_error, name, graphics_image::priv, file_wordexp::we, and graphics_image::width.

Referenced by displayitem_draw_icon(), displayitem_draw_image(), displayitem_draw_polygon(), graphics_image_new(), and graphics_image_new_scaled().

◆ graphics_init()

void graphics_init ( struct graphics this_)

FIXME

Parameters
<>
Returns
<>
Author
Martin Schaller (04/2008)

References graphics::gc, graphics_background_gc(), graphics_gc_init(), and graphics_gc_new().

Referenced by navit_handle_resize(), and vehicle_draw().

◆ graphics_is_disabled()

int graphics_is_disabled ( struct graphics this_)

References graphics::disabled, and graphics::parent.

Referenced by osd_std_keypress().

◆ graphics_load_mapset()

◆ graphics_named_font_new()

struct graphics_font* graphics_named_font_new ( struct graphics gra,
char *  font,
int  size,
int  flags 
)

◆ graphics_new()

◆ graphics_overlay_disable()

void graphics_overlay_disable ( struct graphics this_,
int  disable 
)

◆ graphics_overlay_new()

struct graphics* graphics_overlay_new ( struct graphics parent,
struct point p,
int  w,
int  h,
int  wraparound 
)

Create a new graphics overlay. An overlay is a graphics object that is independent of the main graphics object. When drawing everything to a window, the overlay will be shown on top of the main graphics object. Navit uses overlays for OSD elements and for the vehicle on the map. This allows updating OSD elements and the vehicle without redrawing the map.

Parameters
parentparent graphics context (should be the main graphics context as returned by graphics_new)
pdrawing position for the overlay
wwidth of overlay
hheight of overlay
wraparounduse wraparound (0/1). If set, position, width and height "wrap around": negative position coordinates wrap around the window, negative width/height specify difference to window width/height.
Returns
new overlay
Author
Martin Schaller (04/2008)

References graphics::dpi_factor, graphics::font_size, graphics_dpi_scale(), graphics_dpi_scale_point(), graphics_set_rect(), graphics::image_cache_hash, point_rect::lu, graphics::meth, p, graphics::parent, graphics::priv, point_rect::rl, point::x, and point::y.

Referenced by osd_set_std_graphic(), and vehicle_draw().

◆ graphics_overlay_resize()

void graphics_overlay_resize ( struct graphics this_,
struct point p,
int  w,
int  h,
int  wraparound 
)

Alters the size, position and wraparound for an overlay.

Parameters
this_The overlay's graphics struct
pThe new position of the overlay
wThe new width of the overlay
hThe new height of the overlay
wraparoundThe new wraparound of the overlay

References graphics_dpi_scale(), graphics_dpi_scale_point(), graphics::meth, graphics_methods::overlay_resize, p, and graphics::priv.

Referenced by osd_std_resize(), and vehicle_draw().

◆ graphics_process_selection()

static void graphics_process_selection ( struct graphics gra,
struct displaylist dl 
)
static

◆ graphics_process_selection_item()

◆ graphics_remove_callback()

void graphics_remove_callback ( struct graphics this_,
struct callback cb 
)

References callback_list_remove(), and graphics::cbl.

Referenced by navit_destroy().

◆ graphics_remove_selection()

void graphics_remove_selection ( struct graphics gra,
struct item item,
enum item_type  type,
struct displaylist dl 
)

◆ graphics_set_attr()

int graphics_set_attr ( struct graphics gra,
struct attr attr 
)

Sets an attribute of the graphics instance.

This method first tries to set one of the private attributes implemented by the current graphics plugin. If this fails, it tries to set one of the generic attributes.

If the graphics plugin does not supply a

static int set_attr(struct graphics_priv *gra, struct attr *attr)
Definition: graphics_android.c:543

method, this method currently does nothing and returns true, even if the attribute is a generic one.

Parameters
graThe graphics instance
attrThe attribute to set
Returns
True if the attribute was successfully set, false otherwise.

References dbg, graphics_set_attr_do(), lvl_debug, graphics::meth, graphics::priv, and graphics_methods::set_attr.

Referenced by NPP_SetWindow(), pedestrian_navit_init(), and request_graphics_set_attr().

◆ graphics_set_attr_do()

static int graphics_set_attr_do ( struct graphics gra,
struct attr attr 
)
static

Sets a generic attribute of the graphics instance.

This will only set one of the supported generic graphics attributes (currently

gamma

,

brightness

,

contrast

or

font_size

) and fail for other attribute types.

To set an attribute provided by a graphics plugin, use graphics_set_attr(struct graphics *, struct attr *) instead.

Parameters
graThe graphics instance
attrThe attribute to set
Returns
True if the attribute was set, false if not

References graphics::brightness, graphics::colormgmt, graphics::contrast, graphics::font_size, graphics::gamma, graphics_gc_init(), attr::num, attr::type, and attr::u.

Referenced by graphics_new(), and graphics_set_attr().

◆ graphics_set_rect()

void graphics_set_rect ( struct graphics gra,
struct point_rect pr 
)

◆ graphics_show_native_keyboard()

int graphics_show_native_keyboard ( struct graphics this_,
struct graphics_keyboard kbd 
)

Shows the native on-screen keyboard or other input method.

This method is a wrapper around the respective method of the graphics plugin.

The caller should populate the

kbd

argument with appropriate

mode

and

lang

members so the graphics plugin can determine the best matching layout.

If an input method is shown, the graphics plugin should try to select the configuration which best matches the specified

mode

. For example, if

mode

specifies a numeric layout, the graphics plugin should select a numeric keyboard layout (if available), or the equivalent for another input method (such as setting stroke recognition to identify strokes as numbers). Likewise, when an alphanumeric-uppercase mode is requested, it should switch to uppercase input.

Implementations should, however, consider that Navit's internal keyboard allows the user to switch modes at will (the only exception being degree mode) and thus must not "lock" the user into a limited layout with no means to switch to a general-purpose one. For example, house number entry in an address search dialog may default to numeric mode, but since some house numbers may contain non-numeric characters, a pure numeric keyboard is suitable only if the user has the option to switch to an alphanumeric layout.

When multiple alphanumeric layouts are available, the graphics plugin should use the

lang

argument to determine the best layout.

When selecting an input method, preference should always be given to the default or last selected input method and configuration if it matches the requested

mode

and

lang

.

If the native input method is going to obstruct parts of Navit's UI, the graphics plugin should set

kbd->w

and

kbd->h

to the height and width to the appropriate value in pixels. A value of -1 indicates that the input method fills the entire available width or height of the space available to Navit. On windowed platforms, where the on-screen input method and Navit's window may be moved relative to each other as needed and can be displayed alongside each other, the graphics plugin should report 0 for both dimensions.

Parameters
this_The graphics instance
kbdThe keyboard instance
Returns
1 if the native keyboard is going to be displayed, 0 if not, -1 if the method is not supported by the plugin

References dbg, lvl_debug, graphics::meth, and graphics_methods::show_native_keyboard.

Referenced by gui_internal_keyboard_show_native().

◆ graphics_texture_path()

char* graphics_texture_path ( const char *  texture)

◆ image_new_helper()

◆ intersection()

static int intersection ( struct point a1,
int  adx,
int  ady,
struct point b1,
int  bdx,
int  bdy,
struct point res 
)
static

References dbg, lvl_debug, point::x, and point::y.

Referenced by draw_middle(), and transform_reverse_near_far().

◆ is_inside()

static int is_inside ( struct point p,
struct point_rect r,
int  edge 
)
static

◆ label_line()

static void label_line ( struct graphics gra,
struct graphics_gc fg,
struct graphics_gc bg,
struct graphics_font font,
struct point p,
int  count,
char *  label 
)
static

FIXME

Parameters
<>
Returns
<>
Author
Martin Schaller (04/2008)

References graphics_methods::get_text_bbox, graphics_draw_text(), graphics_get_text_bbox(), label, point_rect::lu, graphics::meth, p, graphics::r, point::x, and point::y.

Referenced by displayitem_draw_text().

◆ limit_count()

static int limit_count ( struct coord c,
int  count 
)
static

References c.

Referenced by displayitem_draw(), and displayitem_transform_holes().

◆ multiline_label_draw()

static void multiline_label_draw ( struct graphics gra,
struct graphics_gc fg,
struct graphics_gc bg,
struct graphics_font font,
struct point  pref,
const char *  label,
int  line_spacing 
)
static

Draw a multi-line text next to a specified point pref.

Parameters
graThe graphics instance on which to draw
fgThe graphics color to use to draw the text
bgThe graphics background color to use to draw the text
fontThe font to use to draw the text
prefThe position to draw the text (draw at the right and vertically aligned relatively to this point)
labelThe text to draw (may contain '
' for multiline text, if so lines will be stacked vertically)
line_spacingThe delta between each line (set its value at to least the font text size, to be readable)

References dbg, graphics_draw_text(), label, lvl_warning, point::x, and point::y.

Referenced by displayitem_draw_circle().

◆ poly_intersection()

static void poly_intersection ( struct point p1,
struct point p2,
struct point_rect r,
int  edge,
struct point ret 
)
static

◆ relative_pos()

static int relative_pos ( struct wpoint p,
struct point_rect r 
)
static

◆ set_hash_entry()

static struct hash_entry* set_hash_entry ( struct displaylist dl,
enum item_type  type 
)
static

◆ within_dist_line()

static int within_dist_line ( struct point p,
struct point line_p0,
struct point line_p1,
int  dist 
)
static

FIXME

Parameters
<>
Returns
<>
Author
Martin Schaller (04/2008)

References c1, c2, p, within_dist_point(), point::x, and point::y.

Referenced by within_dist_polyline().

◆ within_dist_point()

static int within_dist_point ( struct point p0,
struct point p1,
int  dist 
)
static

FIXME

Parameters
<>
Returns
<>
Author
Martin Schaller (04/2008)

References point::x, and point::y.

Referenced by graphics_displayitem_within_dist(), and within_dist_line().

◆ within_dist_polygon()

static int within_dist_polygon ( struct point p,
struct point poly_pnt,
int  count,
int  dist 
)
static

FIXME

Parameters
<>
Returns
<>
Author
Martin Schaller (04/2008)

References c, p, within_dist_polyline(), point::x, and point::y.

Referenced by graphics_displayitem_within_dist().

◆ within_dist_polyline()

static int within_dist_polyline ( struct point p,
struct point line_pnt,
int  count,
int  dist,
int  close 
)
static

FIXME

Parameters
<>
Returns
<>
Author
Martin Schaller (04/2008)

References p, and within_dist_line().

Referenced by graphics_displayitem_within_dist(), and within_dist_polygon().

◆ xdisplay_draw()

static void xdisplay_draw ( struct displaylist display_list,
struct graphics gra,
struct layout l,
int  order 
)
static

FIXME

Parameters
<>
Returns
<>
Author
Martin Schaller (04/2008)

References layer::active, graphics::current_z_order, layout::layers, layer::ref, and xdisplay_draw_layer().

Referenced by graphics_displaylist_draw().

◆ xdisplay_draw_elements()

static void xdisplay_draw_elements ( struct graphics gra,
struct displaylist display_list,
struct itemgra itm,
struct layout l 
)
static

◆ xdisplay_draw_layer()

static void xdisplay_draw_layer ( struct displaylist display_list,
struct graphics gra,
struct layer lay,
int  order,
struct layout l 
)
static

FIXME

Parameters
<>
Returns
<>
Author
Martin Schaller (04/2008)

References layer::itemgras, and xdisplay_draw_elements().

Referenced by xdisplay_draw().

◆ xdisplay_free()

static void xdisplay_free ( struct displaylist dl)
static

FIXME

Parameters
<>
Returns
<>
Author
Martin Schaller (04/2008)

References hash_entry::di, displaylist::hash_entries, HASH_SIZE, displayitem::next, and next.

Referenced by graphics_load_mapset().

Variable Documentation

◆ circle64

struct circle circle64[]

◆ route_selection

void* route_selection
extern

FIXME

Parameters
<>
Returns
<>
Author
Martin Schaller (04/2008)

Referenced by do_draw().