[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [E-devel] Premultiply or not



Jose writes:
> 
> 	Let me warn everyone who still intends to work using
> non-premul data (and/or colors) -- it's tricky to mix these
> two color spaces, you may end up getting mixed-up yourself.
> 
> 	Here's an example of what happens right now in evas
> because we're using non-premul data in the software based
> engines vs what happens when we use the xrender engine.
> 
> 	Take the following Simon inspired example:
> 
>    Evas_Object  *obj;
>    unsigned int data[2] = {0xff00ff00, 0x00ff0000};
> //  This gives 2x1 sized image data with "opaque-green"
> //  and "transparent-red" pixels.
> 
>    obj = evas_object_image_add(some_evas);
>    evas_object_image_size_set(obj, 2, 1);
>    evas_object_image_data_set(obj, (unsigned int *)data);
>    evas_object_iamge_alpha_set(obj, 1);
>    evas_object_resize(obj, 100, 100);
>    evas_object_image_fill_set(obj, 0, 0, 100, 100);
>    evas_object_image_smooth_scale_set(obj, 1);
>    evas_object_image_border_set(obj, 0, 0, 0, 0);
>    evas_object_move(obj, some_x, some_y);
>    evas_object_layer_set(obj, some_layer);
>    evas_object_clip_set(obj, some_clip);
>    evas_object_show(obj);
> 
> 	If you display this with the software-x11 engine
> (onto a white background say), you will see a 100x100 image
> which varies from opaque-green at the left edje to transparent
> at the right edje, with some redish and brownish in between.
> 	However, if you display this with the xrender-x11 engine,
> you will see an image varying from opaque-green at the left edje
> to transparent at the right edje with no 'redish' or 'brownish'
> anywhere.
> 

This is the sort of example that really helps make the case for pre-mul
everywhere. As in this case, the 'image' LOOKS like its half green and
half nothing. So, I would think most would be surprised if there were
reddish/brownish appearing with smooth scaling.

Thanks again.
Brian