diff options
author | martin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2012-12-15 22:40:24 +0000 |
---|---|---|
committer | martin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2012-12-15 22:40:24 +0000 |
commit | 6e767bc5f90133f1317b58896254a6bf7d49cbe0 (patch) | |
tree | 4febde5a777f6c233492bdec8e1105b99cc66f36 /navit | |
parent | c9ea40747432a112290af549e6ca39189f7734a3 (diff) | |
download | navit-6e767bc5f90133f1317b58896254a6bf7d49cbe0.tar.gz |
Add:core:Option to specify hot point for pngs/svgs
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@5293 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit')
-rw-r--r-- | navit/graphics.c | 9 | ||||
-rw-r--r-- | navit/layout.c | 10 | ||||
-rw-r--r-- | navit/layout.h | 2 |
3 files changed, 18 insertions, 3 deletions
diff --git a/navit/graphics.c b/navit/graphics.c index cf0b3f442..8372c9216 100644 --- a/navit/graphics.c +++ b/navit/graphics.c @@ -1961,8 +1961,13 @@ displayitem_draw(struct displayitem *di, void *dummy, struct display_context *dc g_free(path); } if (img) { - p.x=pa[0].x - img->hot.x; - p.y=pa[0].y - img->hot.y; + if (e->u.icon.x != -1 || e->u.icon.y != -1) { + p.x=pa[0].x - e->u.icon.x; + p.y=pa[0].y - e->u.icon.y; + } else { + p.x=pa[0].x - img->hot.x; + p.y=pa[0].y - img->hot.y; + } gra->meth.draw_image(gra->priv, gra->gc[0]->priv, &p, img->priv); } } diff --git a/navit/layout.c b/navit/layout.c index 21d10ab53..85623a1d7 100644 --- a/navit/layout.c +++ b/navit/layout.c @@ -511,7 +511,7 @@ struct icon * icon_new(struct attr *parent, struct attr **attrs) { struct element *e; - struct attr *src,*w,*h,*rotation; + struct attr *src,*w,*h,*rotation,*x,*y; src=attr_search(attrs, NULL, attr_src); if (! src) return NULL; @@ -527,6 +527,14 @@ icon_new(struct attr *parent, struct attr **attrs) e->u.icon.height=h->u.num; else e->u.icon.height=-1; + if ((x=attr_search(attrs, NULL, attr_x))) + e->u.icon.x=x->u.num; + else + e->u.icon.x=-1; + if ((y=attr_search(attrs, NULL, attr_y))) + e->u.icon.y=y->u.num; + else + e->u.icon.y=-1; if ((rotation=attr_search(attrs, NULL, attr_rotation))) e->u.icon.rotation=rotation->u.num; strcpy(e->u.icon.src,src->u.str); diff --git a/navit/layout.h b/navit/layout.h index e8ff4c0a8..1f36459d0 100644 --- a/navit/layout.h +++ b/navit/layout.h @@ -56,6 +56,8 @@ struct element { int width; int height; int rotation; + int x; + int y; } icon; struct element_text { struct color background_color; |