Enlightenment CVS committal Author : davemds Project : e17 Module : libs/edje
Dir : e17/libs/edje/src/lib Modified Files: Edje_Edit.h edje_edit.c Log Message: * work in progress for generate edc. thanks to dieb =================================================================== RCS file: /cvs/e/e17/libs/edje/src/lib/Edje_Edit.h,v retrieving revision 1.28 retrieving revision 1.29 diff -u -3 -r1.28 -r1.29 --- Edje_Edit.h 15 Jul 2008 01:03:24 -0000 1.28 +++ Edje_Edit.h 30 Jul 2008 22:41:04 -0000 1.29 @@ -29,6 +29,14 @@ # endif #endif + +enum { + EDJE_EDIT_IMAGE_COMP_RAW, + EDJE_EDIT_IMAGE_COMP_USER, + EDJE_EDIT_IMAGE_COMP_COMP, + EDJE_EDIT_IMAGE_COMP_LOSSY +}; + /** * @file * @brief Functions to deal with edje internal object. Don't use in standard @@ -1153,6 +1161,20 @@ edje_edit_image_id_get( Evas_Object *obj, ///< The edje object const char *image_name +); + +/**Get compression type for the given image.*/ +EAPI int ///@return One of EDJE_EDIT_IMAGE_COMP_RAW, EDJE_EDIT_IMAGE_COMP_USER, EDJE_EDIT_IMAGE_COMP_COMP or EDJE_EDIT_IMAGE_COMP_LOSSY +edje_edit_image_compression_type_get( + Evas_Object *obj, ///< The edje object + const char *image ///< The name of the image +); + +/**Get compression rate for the given image.*/ +EAPI int ///@return the compression rate if the image is EDJE_EDIT_IMAGE_COMP_LOSSY. Or < 0 on errors +edje_edit_image_compression_rate_get( + Evas_Object *obj, ///< The edje object + const char *image ///< The name of the image ); /**Get the image border of a part state. Pass NULL to any of [r,g,b,a] to get only the others.*/ =================================================================== RCS file: /cvs/e/e17/libs/edje/src/lib/edje_edit.c,v retrieving revision 1.22 retrieving revision 1.23 diff -u -3 -r1.22 -r1.23 --- edje_edit.c 15 Jul 2008 01:03:24 -0000 1.22 +++ edje_edit.c 30 Jul 2008 22:41:04 -0000 1.23 @@ -2684,6 +2684,68 @@ return _edje_image_id_find(obj, image_name); } +EAPI int +edje_edit_image_compression_type_get(Evas_Object *obj, const char *image) +{ + Edje_Image_Directory_Entry *i = NULL; + Evas_List *l; + + GET_ED_OR_RETURN(-1); + + if (!ed->file) return -1; + if (!ed->file->image_dir) return -1; + + for (l = ed->file->image_dir->entries; l; l = l->next) + { + i = l->data; + if (strcmp(i->entry, image) == 0) + break; + i = NULL; + } + + if (!i) return -1; + + switch(i->source_type) + { + case EDJE_IMAGE_SOURCE_TYPE_INLINE_PERFECT: + if (i->source_param == 0) // RAW + return EDJE_EDIT_IMAGE_COMP_RAW; + else // COMP + return EDJE_EDIT_IMAGE_COMP_COMP; + break; + case EDJE_IMAGE_SOURCE_TYPE_INLINE_LOSSY: // LOSSY + return EDJE_EDIT_IMAGE_COMP_LOSSY; + break; + case EDJE_IMAGE_SOURCE_TYPE_EXTERNAL: // USER + return EDJE_EDIT_IMAGE_COMP_USER; + break; + } + + return -1; +} + +EAPI int +edje_edit_image_compression_rate_get(Evas_Object *obj, const char *image) +{ + Evas_List *l; + Edje_Image_Directory_Entry *i; + + GET_ED_OR_RETURN(-1); + + // Gets the Image Entry + for (l = ed->file->image_dir->entries; l; l = l->next) + { + i = l->data; + if (strcmp(i->entry, image) == 0) break; + i = NULL; + } + + if (!i) return -1; + if (i->source_type != EDJE_IMAGE_SOURCE_TYPE_INLINE_LOSSY) return -2; + + return i->source_param; +} + EAPI const char * edje_edit_state_image_get(Evas_Object *obj, const char *part, const char *state) { @@ -3292,8 +3354,6 @@ return progs; } - - EAPI unsigned char edje_edit_program_add(Evas_Object *obj, const char *name) { @@ -4020,18 +4080,45 @@ //TODO Probably we need to save the file before generation /* Images */ - fprintf(f, "images {\n"); - ll = edje_edit_images_list_get(obj); - for (l = ll; l; l = l->next) + if (ll = edje_edit_images_list_get(obj)) { - fprintf(f, " image: \"%s\" LOSSY 100;\n", (char*)l->data); //TODO Support more that LOSSY 100 + fprintf(f, I0"images {\n"); + for (l = ll; l; l = l->next) + { + char *entry = l->data; // Name + int comp = edje_edit_image_compression_type_get(obj, entry); + if (comp < 0) continue; + + fprintf(f, I1"image: \"%s\" ", entry); + + if (comp == EDJE_EDIT_IMAGE_COMP_LOSSY) + fprintf(f, "LOSSY %d;\n", + edje_edit_image_compression_rate_get(obj, entry)); + else if (comp == EDJE_EDIT_IMAGE_COMP_RAW) + fprintf(f, "RAW;\n"); + else if (comp == EDJE_EDIT_IMAGE_COMP_USER) + fprintf(f, "USER;\n"); + else fprintf(f, "COMP;\n"); + } + fprintf(f, I0"}\n\n"); + evas_list_free(ll); } - fprintf(f, "}\n\n"); - edje_edit_string_list_free(ll); - + /* Fonts */ - //(same as images) - + if (ll = edje_edit_fonts_list_get(obj)) + { + fprintf(f, I0"fonts {\n"); + + for (l = ll; l; l = l->next) + { + char *entry = l->data; + // TODO Finish me + fprintf(f, I1"font: \"FIXME\" \"%s\";\n", entry); + } + fprintf(f, I0"}\n\n"); + evas_list_free(ll); + } + /* Data */ //TODO Support data ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs