dont use evas_imaging anymore... and... do svg test the right way.

SVN revision: 51708
This commit is contained in:
Carsten Haitzler 2010-08-29 02:25:57 +00:00
parent 1911aa77e0
commit 62862fa56f
4 changed files with 115 additions and 40 deletions

View File

@ -5,6 +5,7 @@ enlightenment.png \
test.png \
test.jpg \
test.edj \
test.svg \
lang-bg_BG.png \
lang-ca_ES.png \
lang-cs_CZ.png \

74
data/images/test.svg Normal file
View File

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="16"
height="16"
id="svg2816"
version="1.1">
<defs
id="defs2818">
</defs>
<metadata
id="metadata2821">
</metadata>
<g
id="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer"
transform="translate(0,-16)">
<path
style="opacity:1;fill:#000000;fill-opacity:1;stroke:none"
d="M 0,8 4,8 4,4 8,4 8,0 0,0 0,8 z"
id="path2828"
transform="translate(0,16)" />
<path
transform="matrix(0,-1,1,0,0,32)"
id="path3602"
d="M 0,8 4,8 4,4 8,4 8,0 0,0 0,8 z"
style="fill:#0000ff;fill-opacity:1;stroke:none" />
<path
transform="matrix(-1,0,0,-1,16,32)"
id="path3604"
d="M 0,8 4,8 4,4 8,4 8,0 0,0 0,8 z"
style="fill:#00ff00;fill-opacity:1;stroke:none" />
<path
style="fill:#ff0000;fill-opacity:1;stroke:none"
d="M 0,8 4,8 4,4 8,4 8,0 0,0 0,8 z"
id="path3606"
transform="matrix(0,1,-1,0,16,16)" />
<rect
style="fill:#ffffff;fill-opacity:1;stroke:none"
id="rect3608"
width="4"
height="4"
x="4"
y="4"
transform="translate(0,16)" />
<rect
style="fill:#00ffff;fill-opacity:1;stroke:none"
id="rect3612"
width="4"
height="4"
x="4"
y="8"
transform="translate(0,16)" />
<rect
style="fill:#ffff00;fill-opacity:1;stroke:none"
id="rect3614"
width="4"
height="4"
x="8"
y="4"
transform="translate(0,16)" />
<rect
style="fill:#808080;fill-opacity:1;stroke:none"
id="rect3616"
width="4"
height="4"
x="8"
y="8"
transform="translate(0,16)" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -83,7 +83,6 @@ static Eina_Bool _e_main_cb_eet_cacheburst_end(void *data __UNUSED__);
static Eina_Bool _e_main_cb_startup_fake_end(void *data __UNUSED__);
static void _e_main_desk_save(void);
static void _e_main_desk_restore(E_Manager *man, E_Container *con);
static void _e_main_test_svg_loader(void);
/* local subsystem globals */
#define MAX_LEVEL 64
@ -723,7 +722,7 @@ main(int argc, char **argv)
"loader support.\n"));
_e_main_shutdown(-1);
}
e_prefix_data_concat_static(buf, "data/images/test.edj");
evas_object_image_file_set(im, buf, "images/0");
if (evas_object_image_load_error_get(im) != EVAS_LOAD_ERROR_NONE)
@ -749,6 +748,36 @@ main(int argc, char **argv)
}
}
e_init_status_set(_("Check SVG Support"));
TS("svg");
{
Ecore_Evas *ee;
Evas_Object *im;
char buf[PATH_MAX];
ee = ecore_evas_buffer_new(1, 1);
if (!ee)
{
e_error_message_show(_("Enlightenment found Evas can't create a buffer canvas. Please check\n"
"Evas has Software Buffer engine support.\n"));
_e_main_shutdown(-1);
}
e_canvas_add(ee);
im = evas_object_image_add(ecore_evas_get(ee));
e_prefix_data_concat_static(buf, "data/images/test.svg");
evas_object_image_file_set(im, buf, NULL);
if (evas_object_image_load_error_get(im) == EVAS_LOAD_ERROR_NONE)
{
efreet_icon_extension_add(".svg");
/* prefer png over svg */
efreet_icon_extension_add(".png");
}
evas_object_del(im);
e_canvas_del(ee);
ecore_evas_free(ee);
}
e_init_status_set(_("Setup Screens"));
TS("screens");
/* manage the root window */
@ -811,7 +840,6 @@ main(int argc, char **argv)
*list = eina_list_prepend(*list, (void *)eina_stringshare_add(buf));
}
}
_e_main_test_svg_loader();
efreet_icon_extension_add(".edj");
TS("efreet paths done");
@ -1689,34 +1717,3 @@ _e_main_desk_restore(E_Manager *man, E_Container *con)
e_desk_show(desk);
}
}
static void
_e_main_test_svg_loader(void)
{
Evas_Imaging_Image *tmp;
char file[] = "/tmp/e17-1341234234.svg";
FILE *fp = fopen(file, "w");
if (!fp) return;
fputs("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>"
"<svg xmlns:svg=\"http://www.w3.org/2000/svg\""
" xmlns=\"http://www.w3.org/2000/svg\""
" xmlns:xlink=\"http://www.w3.org/1999/xlink\""
" version=\"1.0\""
" width=\"128\""
" height=\"128\""
" id=\"svg3486\">"
"</svg>", fp);
fclose(fp);
tmp = evas_imaging_image_load (file, NULL);
ecore_file_remove(file);
if (tmp)
{
evas_imaging_image_free(tmp);
efreet_icon_extension_add(".svg");
/* prefer png over svg */
efreet_icon_extension_add(".png");
}
}

View File

@ -1239,7 +1239,8 @@ e_util_image_import(const char *image_path, const char *edje_path, const char *e
{
static const char *tmpdir = NULL;
E_Util_Image_Import_Handle *handle;
Evas_Imaging_Image *img;
Ecore_Evas *ee;
Evas_Object *img;
int fd, w, h;
const char *escaped_file;
char cmd[PATH_MAX * 2], tmpn[PATH_MAX];
@ -1249,15 +1250,17 @@ e_util_image_import(const char *image_path, const char *edje_path, const char *e
if (!edje_path) return NULL;
if (!edje_group) return NULL;
if (!cb) return NULL;
img = evas_imaging_image_load(image_path, NULL);
if (!img)
ee = ecore_evas_buffer_new(1, 1);
img = evas_object_image_add(ecore_evas_get(ee));
evas_object_image_file_set(img, image_path, NULL);
if (evas_object_image_load_error_get(img) != EVAS_LOAD_ERROR_NONE)
{
ecore_evas_free(ee);
printf("Error loading image '%s'\n", image_path);
return NULL;
}
evas_imaging_image_size_get(img, &w, &h);
evas_imaging_image_free(img);
evas_object_image_size_get(img, &w, &h);
ecore_evas_free(ee);
if (!tmpdir)
{