Function to save Ecore_X_Icon. To be used for saving ARGB icon before

creating eap.

Untested.


SVN revision: 24040
This commit is contained in:
sebastid 2006-07-19 01:39:43 +00:00 committed by sebastid
parent e590454a61
commit 457b86c2ce
2 changed files with 32 additions and 0 deletions

View File

@ -563,6 +563,37 @@ e_util_filename_escape(const char *filename)
return buf;
}
EAPI int
e_util_save_icon(Ecore_X_Icon *icon, const char *filename)
{
Ecore_Evas *ee;
Evas *evas;
Evas_Object *im;
int ret;
ee = ecore_evas_buffer_new(icon->width, icon->height);
if (!ee) return 0;
evas = ecore_evas_get(ee);
evas_image_cache_set(evas, 0);
evas_font_cache_set(evas, 0);
im = evas_object_image_add(evas);
if (!im)
{
ecore_evas_free(ee);
return 0;
}
evas_object_move(im, 0, 0);
evas_object_resize(im, icon->width, icon->height);
evas_object_image_size_set(im, icon->width, icon->height);
evas_object_image_data_copy_set(im, icon->data);
evas_object_show(im);
ret = evas_object_image_save(im, filename, NULL, NULL);
evas_object_del(im);
ecore_evas_free(ee);
return ret;
}
/* local subsystem functions */
static void
_e_util_container_fake_mouse_up_cb(void *data)

View File

@ -40,6 +40,7 @@ EAPI E_Border *e_util_desk_border_below(E_Border *bd);
EAPI int e_util_edje_collection_exists(const char *file, const char *coll);
EAPI void e_util_dialog_internal(const char *title, const char *txt);
EAPI const char *e_util_filename_escape(const char *filename);
EAPI int e_util_save_icon(Ecore_X_Icon *icon, const char *filename);
#endif
#endif