Mapbuf widget settings

This code snippet shows how to use more advanced mapbuf setting like: alpha, smooth and point color.
static void mapbuf_test(Evas_Object *parent) {
	//create a mapbuf object
	Evas_Object *mapbuf = elm_mapbuf_add(parent);
	elm_win_resize_object_add(parent, mapbuf);
	evas_object_show(mapbuf);

	//create a table
	Evas_Object *table = elm_table_add(parent);
	elm_win_resize_object_add(parent, table);
	evas_object_show(table);
	for (int i = 0; i < 4; i++) {
		for (int j = 0; j < 6; j++) {
			Evas_Object *icon = elm_icon_add(parent);
			elm_icon_standard_set(icon, "home");
			elm_image_resizable_set(icon, EINA_FALSE, EINA_FALSE);
			evas_object_show(icon);
			elm_table_pack(table, icon, i, j, 1, 1);
		}
	}

	//set up mapbuf
	elm_object_content_set(mapbuf, table);
	elm_mapbuf_enabled_set(mapbuf, EINA_TRUE);

	//disable alpha blending (enabled by default)
	//it works only on image objects,
	elm_mapbuf_alpha_set(mapbuf, EINA_FALSE);

	//change color of a vertex in mapbuf (by default all are solid white)
	elm_mapbuf_point_color_set(mapbuf, 1, 0, 0, 200, 200);
	elm_mapbuf_point_color_set(mapbuf, 2, 200, 0, 0, 200);
	elm_mapbuf_point_color_set(mapbuf, 3, 0, 200, 0, 200);

	//disable smooth map rendering (enabled by default)
	elm_mapbuf_smooth_set(mapbuf, EINA_TRUE);
}

Responses

0 Replies