[GIL] Premultiplications when using color_convert

Hi all, I am working on rgba32f view that have alpha values of 0. I need to apply a color_convert but it drops the values because of the 0 alpha valued. How can I disable alpha premultiplication ? If impossible, it should be a good idea to give a choice on copy_and_convert & color_convert. code sample: rgb32f_pixel p1, p2; p1[0] = 1.0f; p1[3] = 0.0f; color_convert(p1, p2); assert(p1[0] == p2[0]); Thank you by advance, Eloi Du Bois.

Hi Eloi,
One solution is to define your own color space “rgba_premultiplied_t” and provide color conversion functions from/to it.
In your example, did you mean to use rgba32f_pixel_t ? Also wouldn’t p1[3]=0.0f set the alpha to zero? In this case the color is fully transparent. I am not sure what you would expect...
Lubomir
On 4/12/10 6:38 AM, "Eloi Du Bois"

Yes sorry, the example was quickly written.
In some cases, alpha is zero but we want to keep the pixel data, that why I
would like to disable premultiplication.
2010/4/12 Lubomir Bourdev
Hi Eloi,
One solution is to define your own color space “rgba_premultiplied_t” and provide color conversion functions from/to it.
In your example, did you mean to use rgba32f_pixel_t ? Also wouldn’t p1[3]=0.0f set the alpha to zero? In this case the color is fully transparent. I am not sure what you would expect...
Lubomir
On 4/12/10 6:38 AM, "Eloi Du Bois"
wrote: Hi all,
I am working on rgba32f view that have alpha values of 0. I need to apply a color_convert but it drops the values because of the 0 alpha valued. How can I disable alpha premultiplication ? If impossible, it should be a good idea to give a choice on copy_and_convert & color_convert.
code sample: rgb32f_pixel p1, p2; p1[0] = 1.0f; p1[3] = 0.0f; color_convert(p1, p2); assert(p1[0] == p2[0]);
Thank you by advance, Eloi Du Bois.
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Eloi Du Bois
-
Lubomir Bourdev