Created new function edje_edit_image_data_add().

Now it's possible to add an image that is already inside the eet (with a
default key name) to the edje image collection.



SVN revision: 41320
This commit is contained in:
Rafael Antognolli 2009-07-13 19:17:35 +00:00
parent 05f61cd086
commit d147af24e3
2 changed files with 62 additions and 0 deletions

View File

@ -1575,6 +1575,21 @@ edje_edit_image_add(
const char* path ///< The name of the image file to include in the edje
);
/**Add an image entry to the image collection
*
* This function adds the given image entry to the edje image collection. The
* image needs to be inside the eet already, with key name "images/id". After
* you have to create a new image_part that use this image, referring to it as
* "name". Note that all the parts in the edje share the same image collection,
* thus you can/must use the same image for different part.
*/
EAPI unsigned char /// @return TRUE on success or FALSE on failure
edje_edit_image_data_add(
Evas_Object *obj, ///< The edje object
const char *name, ///< The image entry name
int id ///< The image id
);
/**Get normal image name for a given part state. Remember to free the returned string using edje_edit_string_free().*/
EAPI const char * ///@return The name of the image used by state
edje_edit_state_image_get(

View File

@ -3443,6 +3443,53 @@ edje_edit_image_add(Evas_Object *obj, const char* path)
return 1;
}
EAPI unsigned char
edje_edit_image_data_add(Evas_Object *obj, const char *name, int id)
{
Eina_List *l;
Edje_Image_Directory_Entry *de;
Edje_Image_Directory_Entry *i, *t;
int free_id = 0;
GET_ED_OR_RETURN(0);
if (!name) return 0;
if (!ed->file) return 0;
if (!ed->path) return 0;
/* Create Image_Directory if not exist */
if (!ed->file->image_dir)
ed->file->image_dir = mem_alloc(sizeof(Edje_Image_Directory));
/* Loop trough image directory to find if image exist */
t = NULL;
EINA_LIST_FOREACH(ed->file->image_dir->entries, l, i)
{
if (!i) return 0;
if (i->id == id) t = i;
}
/* Create Image Entry */
if (!t)
de = mem_alloc(sizeof(Edje_Image_Directory_Entry));
else
{
de = t;
free(de->entry);
}
de->entry = mem_strdup(name);
de->id = id;
de->source_type = 1;
de->source_param = 1;
/* Add image to Image Directory */
if (!t)
ed->file->image_dir->entries =
eina_list_append(ed->file->image_dir->entries, de);
return 1;
}
EAPI int
edje_edit_image_id_get(Evas_Object *obj, const char *image_name)
{