graphics_displaylist_draw(struct graphics *gra, struct displaylist *displaylist, struct transformation *trans, GList *layouts)
{
int order=transform_get_order(trans);
+ // FIXME find a better place to set the background color
+ graphics_gc_set_background(gra->gc[0], ((struct layout *)layouts->data)->color);
+ graphics_gc_set_foreground(gra->gc[0], ((struct layout *)layouts->data)->color);
+ gra->meth.background_gc(gra->priv, gra->gc[0]->priv);
gra->meth.draw_mode(gra->priv, draw_mode_begin);
xdisplay_draw(displaylist->dl, gra, layouts, order);
gra->meth.draw_mode(gra->priv, draw_mode_end);
#include <string.h>
#include "layout.h"
-struct layout * layout_new(const char *name)
+struct layout * layout_new(const char *name, struct color *color)
{
struct layout *l;
l = g_new0(struct layout, 1);
l->name = g_strdup(name);
+ l->color = g_new0(struct color,1);
+ *(l->color) = *color;
return l;
}
GList *elements;
};
+struct color;
+
struct layer { char *name; int details; GList *itemtypes; };
-struct layout { char *name; GList *layers; };
+struct layout { char *name; struct color *color; GList *layers; };
/* prototypes */
enum item_type;
-struct color;
struct element;
struct itemtype;
struct layer;
struct layout;
-struct layout *layout_new(const char *name);
+struct layout *layout_new(const char *name, struct color *color);
struct layer *layer_new(const char *name, int details);
void layout_add_layer(struct layout *layout, struct layer *layer);
struct itemtype *itemtype_new(int order_min, int order_max);
<!ATTLIST map debug CDATA #IMPLIED>
<!ELEMENT layout (layer*)>
<!ATTLIST layout name CDATA #REQUIRED>
+<!ATTLIST layout color CDATA #IMPLIED>
<!ELEMENT layer (item+)>
<!ATTLIST layer name CDATA #REQUIRED>
<!ATTLIST layer details CDATA #REQUIRED>
<map type="garmin" enabled="yes" data="/path/to/img" debug="4"/>
</mapset>
- <layout name="Tag">
+ <layout name="Tag" color= "#ffefb7">
<layer name="sea" details="0">
<item type="poly_wood" order="0-">
<polygon color="#8ec78d" />
</item>
</layer>
</layout>
- <layout name="Nacht">
+ <layout name="Nacht" color="#ffefb7">
</layout>
</navit>
</config>
xmlconfig_layout(struct xmlstate *state)
{
const char *name=find_attribute(state, "name", 1);
+ struct color color = {0xffff, 0xefef, 0xb7b7, 0xffff};
if (! name)
return 0;
- state->element_object = layout_new(name);
+ find_color(state, 1, &color);
+ state->element_object = layout_new(name, &color);
if (! state->element_object)
return 0;
navit_add_layout(state->parent->element_object, state->element_object);