Well to be general i do some sort of loader of winamp3 skin from xml files. As evas manage transparency and have good function to manage imagesand interact with user like the winamp modern skin i use it instead of gtk+ where 'widgets' are not transparents).
Well the problem is that i'm coding a winamp2_slider 'like' widget that is managed with evas.
So as evas can't load .bmp files i'm using imlib2 to do the job. I do like this to select a part of the bmp file (that could contain more than only one state of a button for example) :
/**********/
int evas_object_wa3Bitmap_setsubimage(Evas_Object* obj, wa3bitmap* bitmap,
int x, int y, int w, int h)
{
Imlib_Image* image = 0;
Imlib_Image* image_cropped = 0;
Imlib_Context* ctx;
Imlib_Context* ctx2;ctx = imlib_context_new();
imlib_context_push(ctx);
image = imlib_load_image(bitmap->file);
if(!image){
g_print("Unable to load with imlib %s\n", bitmap->file);
imlib_context_pop();
imlib_context_free(ctx);
return(FALSE);
}
imlib_context_set_image(image);
image_cropped = imlib_create_cropped_image(x, y,w, h);
if(!image_cropped){
g_print("Unable to crop image %s\n", bitmap->file);
imlib_context_pop();
imlib_context_free(ctx);
return(FALSE);
}
ctx2 = imlib_context_new();
imlib_context_push(ctx2);
imlib_context_set_image(image_cropped);
evas_object_image_size_set(obj, w, h);
evas_object_image_fill_set(obj, 0, 0, w, h);
evas_object_image_data_copy_set(obj, imlib_image_get_data_for_reading_only());
evas_object_resize(obj, w, h);
imlib_context_pop();
imlib_context_pop();
imlib_context_free(ctx);
imlib_context_free(ctx2);
return(TRUE);
}
/**********/
then when the image is loaded correctly in evas (so not all the image is in the evas_object, but only a part of it). i could show it in the window :
/*****/
evas_object_move(slider->background, slider->x, slider->y);
evas_object_show(slider->background);
/*****/
then i could do same things for the button image...
button is 2 evas objects one for normal state and the second for the pressed state.
i add 3 callbacks event on the background to allow the user move the button allong size the area. So i have a great slider skinned area handle with evas. Buttons object can't received events since i add function to pass events, and are over the background.
/***/
evas_object_pass_events_set(slider->button_normal, 1);
/****/
The problem is now. The background image change depending of the button position. And the redraw of the background is not done correctly as you could see with this screenshot :
http://fondriest.frederic.free.fr/wa2.jpg
instead having all the background 'red', i just have the good image area around the button object.
You could see on the right that if i don't move the button all the background is 'green'. so the image part of the .bmp is loaded correctly.
I'm pretty sure that this problem is, because of a bad redraw of the evas area when my background object datas change. But well i suppose :-). I just try to play a little with evas..
I'm using the evas 1.0.0_pre13 given by gentoo. Maybe it's too old and new cvs version remove this problem. Just waiting your answer before if i need to upgrade evas or not.
-- ciberfred
------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ enlightenment-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
