navit  0.5.3-trunk
graphics.h File Reference

Exported functions / structures for the graphics subsystem. More...

#include "coord.h"

Go to the source code of this file.

Data Structures

struct  graphics_keyboard
 
struct  padding
 The functions to be implemented by graphics plugins. More...
 
struct  graphics_methods
 
struct  graphics_font_methods
 
struct  graphics_font
 
struct  graphics_gc_methods
 
struct  graphics_gc
 graphics context A graphics context encapsulates a set of drawing parameters, such as linewidth and drawing color. More...
 
struct  graphics_image_methods
 
struct  graphics_image
 
struct  graphics_data_image
 

Enumerations

enum  draw_mode_num { draw_mode_begin , draw_mode_end , draw_mode_begin_clear }
 

Functions

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)
 
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)
 
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)
 
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)
 
gboolean graphics_gc_has_texture (struct graphics_gc *gc)
 
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...
 
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)
 
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)
 
int graphics_draw_drag (struct graphics *this_, struct point *p)
 
void graphics_background_gc (struct graphics *this_, struct graphics_gc *gc)
 
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)
 
void graphics_draw_itemgra (struct graphics *gra, struct itemgra *itm, struct transformation *t, char *label)
 
void graphics_displaylist_draw (struct graphics *gra, struct displaylist *displaylist, struct transformation *trans, struct layout *l, 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 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...
 
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...
 
struct itemgraphics_displayitem_get_item (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)
 
int graphics_displayitem_get_z_order (struct displayitem *di)
 
int graphics_displayitem_within_dist (struct displaylist *displaylist, struct displayitem *di, struct point *p, int dist)
 
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)
 
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...
 
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...
 
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...
 
navit_float graphics_get_dpi (struct graphics *gra)
 get display resolution in DPI This method returns the native display density in DPI More...
 

Detailed Description

Exported functions / structures for the graphics subsystem.

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 Library 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 Library General Public License for more details.

You should have received a copy of the GNU Library 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.

Enumeration Type Documentation

◆ draw_mode_num

Enumerator
draw_mode_begin 
draw_mode_end 
draw_mode_begin_clear 

Function Documentation

◆ 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().

◆ 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_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_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_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_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_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_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_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_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_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)