navit  0.5.3-trunk
graphics_sdl.c File Reference
#include <glib.h>
#include <pthread.h>
#include <poll.h>
#include <signal.h>
#include "config.h"
#include "debug.h"
#include "point.h"
#include "graphics.h"
#include "color.h"
#include "plugin.h"
#include "window.h"
#include "navit.h"
#include "keys.h"
#include "item.h"
#include "attr.h"
#include "callback.h"
#include "font/freetype/font_freetype.h"
#include "SDL.h"
#include <math.h>
#include "raster.h"
#include <event.h>
#include "SDL_image.h"
#include <alloca.h>

Data Structures

struct  graphics_priv
 
struct  graphics_gc_priv
 
struct  graphics_image_priv
 

Macros

#define DISPLAY_W   800
 
#define DISPLAY_H   600
 
#define OVERLAY_MAX   32
 

Functions

static void graphics_destroy (struct graphics_priv *gr)
 
static void gc_destroy (struct graphics_gc_priv *gc)
 
static void gc_set_linewidth (struct graphics_gc_priv *gc, int w)
 
static void gc_set_dashes (struct graphics_gc_priv *gc, int w, int offset, unsigned char *dash_list, int n)
 
static void gc_set_foreground (struct graphics_gc_priv *gc, struct color *c)
 
static void gc_set_background (struct graphics_gc_priv *gc, struct color *c)
 
static struct graphics_gc_privgc_new (struct graphics_priv *gr, struct graphics_gc_methods *meth)
 
static struct graphics_image_privimage_new (struct graphics_priv *gr, struct graphics_image_methods *meth, char *name, int *w, int *h, struct point *hot, int rotation)
 
static void image_free (struct graphics_priv *gr, struct graphics_image_priv *gi)
 
static void draw_polygon_with_holes (struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count, int hole_count, int *ccount, struct point **holes)
 
static void draw_polygon (struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count)
 
static void draw_rectangle (struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int w, int h)
 
static void draw_circle (struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int r)
 
static void draw_lines (struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count)
 
static void set_pixel (SDL_Surface *surface, int x, int y, Uint8 r2, Uint8 g2, Uint8 b2, Uint8 a2)
 
static void resize_ft_buffer (unsigned int new_size)
 
static void display_text_draw (struct font_freetype_text *text, struct graphics_priv *gr, struct graphics_gc_priv *fg, struct graphics_gc_priv *bg, int color, struct point *p)
 
static void draw_text (struct graphics_priv *gr, struct graphics_gc_priv *fg, struct graphics_gc_priv *bg, struct graphics_font_priv *font, char *text, struct point *p, int dx, int dy)
 
static void draw_image (struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, struct graphics_image_priv *img)
 
static void background_gc (struct graphics_priv *gr, struct graphics_gc_priv *gc)
 
static void draw_mode (struct graphics_priv *gr, enum draw_mode_num mode)
 
static void overlay_disable (struct graphics_priv *gr, int disable)
 
static struct graphics_privoverlay_new (struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, int w, int h, int wraparound)
 
static int window_fullscreen (struct window *win, int on)
 
static void * get_data (struct graphics_priv *this, char const *type)
 
static void draw_drag (struct graphics_priv *gr, struct point *p)
 
static gboolean graphics_sdl_idle (void *data)
 
static struct graphics_privgraphics_sdl_new (struct navit *nav, struct graphics_methods *meth, struct attr **attrs, struct callback_list *cbl)
 
void plugin_init (void)
 

Variables

unsigned char * ft_buffer = NULL
 
unsigned int ft_buffer_size = 0
 
static struct graphics_gc_methods gc_methods
 
static struct graphics_methods graphics_methods
 

Macro Definition Documentation

◆ DISPLAY_H

#define DISPLAY_H   600

◆ DISPLAY_W

#define DISPLAY_W   800

◆ OVERLAY_MAX

#define OVERLAY_MAX   32

Function Documentation

◆ background_gc()

static void background_gc ( struct graphics_priv gr,
struct graphics_gc_priv gc 
)
static

References dbg, and lvl_debug.

◆ display_text_draw()

◆ draw_circle()

◆ draw_drag()

static void draw_drag ( struct graphics_priv gr,
struct point p 
)
static

◆ draw_image()

static void draw_image ( struct graphics_priv gr,
struct graphics_gc_priv fg,
struct point p,
struct graphics_image_priv img 
)
static

◆ draw_lines()

◆ draw_mode()

◆ draw_polygon()

static void draw_polygon ( struct graphics_priv gr,
struct graphics_gc_priv gc,
struct point p,
int  count 
)
static

References dbg, draw_polygon_with_holes(), lvl_debug, and p.

Referenced by draw_lines().

◆ draw_polygon_with_holes()

static void draw_polygon_with_holes ( struct graphics_priv gr,
struct graphics_gc_priv gc,
struct point p,
int  count,
int  hole_count,
int *  ccount,
struct point **  holes 
)
static

◆ draw_rectangle()

◆ draw_text()

static void draw_text ( struct graphics_priv gr,
struct graphics_gc_priv fg,
struct graphics_gc_priv bg,
struct graphics_font_priv font,
char *  text,
struct point p,
int  dx,
int  dy 
)
static

◆ gc_destroy()

static void gc_destroy ( struct graphics_gc_priv gc)
static

◆ gc_new()

static struct graphics_gc_priv* gc_new ( struct graphics_priv gr,
struct graphics_gc_methods meth 
)
static

◆ gc_set_background()

static void gc_set_background ( struct graphics_gc_priv gc,
struct color c 
)
static

◆ gc_set_dashes()

static void gc_set_dashes ( struct graphics_gc_priv gc,
int  w,
int  offset,
unsigned char *  dash_list,
int  n 
)
static

◆ gc_set_foreground()

static void gc_set_foreground ( struct graphics_gc_priv gc,
struct color c 
)
static

◆ gc_set_linewidth()

static void gc_set_linewidth ( struct graphics_gc_priv gc,
int  w 
)
static

◆ get_data()

static void* get_data ( struct graphics_priv this,
char const *  type 
)
static

◆ graphics_destroy()

◆ graphics_sdl_idle()

◆ graphics_sdl_new()

◆ image_free()

static void image_free ( struct graphics_priv gr,
struct graphics_image_priv gi 
)
static

◆ image_new()

static struct graphics_image_priv* image_new ( struct graphics_priv gr,
struct graphics_image_methods meth,
char *  name,
int *  w,
int *  h,
struct point hot,
int  rotation 
)
static

◆ overlay_disable()

static void overlay_disable ( struct graphics_priv gr,
int  disable 
)
static

◆ overlay_new()

◆ plugin_init()

void plugin_init ( void  )

◆ resize_ft_buffer()

static void resize_ft_buffer ( unsigned int  new_size)
static

References dbg, ft_buffer, ft_buffer_size, and lvl_debug.

Referenced by display_text_draw().

◆ set_pixel()

static void set_pixel ( SDL_Surface *  surface,
int  x,
int  y,
Uint8  r2,
Uint8  g2,
Uint8  b2,
Uint8  a2 
)
static

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

Referenced by display_text_draw().

◆ window_fullscreen()

Variable Documentation

◆ ft_buffer

unsigned char* ft_buffer = NULL

◆ ft_buffer_size

unsigned int ft_buffer_size = 0

Referenced by resize_ft_buffer().

◆ gc_methods

struct graphics_gc_methods gc_methods
static
Initial value:
= {
}
static void gc_destroy(struct graphics_gc_priv *gc)
Definition: graphics_sdl.c:209
static void gc_set_foreground(struct graphics_gc_priv *gc, struct color *c)
Definition: graphics_sdl.c:222
static void gc_set_background(struct graphics_gc_priv *gc, struct color *c)
Definition: graphics_sdl.c:230
static void gc_set_dashes(struct graphics_gc_priv *gc, int w, int offset, unsigned char *dash_list, int n)
Definition: graphics_sdl.c:218
static void gc_set_linewidth(struct graphics_gc_priv *gc, int w)
Definition: graphics_sdl.c:213

Referenced by gc_new().

◆ graphics_methods

Initial value:
= {
NULL ,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
}
static void * get_data(struct graphics_priv *this, char const *type)
Definition: graphics_sdl.c:780
static struct graphics_priv * overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, int w, int h, int wraparound)
Definition: graphics_sdl.c:828
static void draw_drag(struct graphics_priv *gr, struct point *p)
Definition: graphics_sdl.c:793
static void overlay_disable(struct graphics_priv *gr, int disable)
Definition: graphics_sdl.c:748
static void draw_rectangle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int w, int h)
Definition: graphics_sdl.c:328
static void draw_image(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, struct graphics_image_priv *img)
Definition: graphics_sdl.c:693
static void draw_text(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct graphics_gc_priv *bg, struct graphics_font_priv *font, char *text, struct point *p, int dx, int dy)
Definition: graphics_sdl.c:668
static void background_gc(struct graphics_priv *gr, struct graphics_gc_priv *gc)
Definition: graphics_sdl.c:710
static void draw_lines(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count)
Definition: graphics_sdl.c:382
static void image_free(struct graphics_priv *gr, struct graphics_image_priv *gi)
Definition: graphics_sdl.c:282
static void draw_mode(struct graphics_priv *gr, enum draw_mode_num mode)
Definition: graphics_sdl.c:715
static void draw_polygon_with_holes(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count, int hole_count, int *ccount, struct point **holes)
Definition: graphics_sdl.c:287
static void draw_polygon(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count)
Definition: graphics_sdl.c:321
static struct graphics_gc_priv * gc_new(struct graphics_priv *gr, struct graphics_gc_methods *meth)
Definition: graphics_sdl.c:246
static struct graphics_image_priv * image_new(struct graphics_priv *gr, struct graphics_image_methods *meth, char *name, int *w, int *h, struct point *hot, int rotation)
Definition: graphics_sdl.c:255
static void graphics_destroy(struct graphics_priv *gr)
Definition: graphics_sdl.c:185

Referenced by graphics_sdl_new(), and overlay_new().