[gil] undocumented/unintended concept requirements in color_convert
I was trying to add other color spaces support and noticed that the rgb to cmyk converter contains: typedef typename channel_type<P2>::type T2; T2 x = channel_traits<T2>::max_value()-get_color(dst,black_t()); if (x>0.0001f) { float x1 = channel_traits<T2>::max_value()/float(x); T2 should model: http://www.boost.org/doc/libs/1_53_0/libs/gil/doc/html/g_i_l_0264.html but this code additionally requires T2 to be greater-than comparable to float and convertible to float.
Hi Michael,
On Mon, Mar 18, 2013 at 12:28 AM, Michael Marcin
I was trying to add other color spaces support and noticed that the rgb to cmyk converter contains:
In case you haven't noticed there are some more color spaces in the toolbox which has been added to boost trunk.
typedef typename channel_type<P2>::type T2; T2 x = channel_traits<T2>::max_value()-get_color(dst,black_t()); if (x>0.0001f) { float x1 = channel_traits<T2>::max_value()/float(x);
T2 should model: http://www.boost.org/doc/libs/1_53_0/libs/gil/doc/html/g_i_l_0264.html
but this code additionally requires T2 to be greater-than comparable to float and convertible to float.
Do you propose to change gil_concept.hpp and just add those requirements? By any chance do you have a patch? Thanks, Christian
Christian Henning wrote:
Hi Michael,
On Mon, Mar 18, 2013 at 12:28 AM, Michael Marcin
wrote: I was trying to add other color spaces support and noticed that the rgb to cmyk converter contains:
In case you haven't noticed there are some more color spaces in the toolbox which has been added to boost trunk.
typedef typename channel_type<P2>::type T2; T2 x = channel_traits<T2>::max_value()-get_color(dst,black_t()); if (x>0.0001f) { float x1 = channel_traits<T2>::max_value()/float(x);
T2 should model: http://www.boost.org/doc/libs/1_53_0/libs/gil/doc/html/g_i_l_0264.html
but this code additionally requires T2 to be greater-than comparable to float and convertible to float.
Do you propose to change gil_concept.hpp and just add those requirements? By any chance do you have a patch?
No I think this code is broken and shouldn't rely upon those features that aren't part of the concept. It should be possible to implement the color conversions without requiring the channel to be convertible to float. I'll see if I can come up with a patch for you.
No I think this code is broken and shouldn't rely upon those features that aren't part of the concept.
It should be possible to implement the color conversions without requiring the channel to be convertible to float.
You think we should use a rgb->cmyk conversion without floating point arithmetic?
I'll see if I can come up with a patch for you.
Thanks! Christian
on Sun Mar 17 2013, Michael Marcin
I was trying to add other color spaces support and noticed that the rgb to cmyk converter contains:
typedef typename channel_type<P2>::type T2; T2 x = channel_traits<T2>::max_value()-get_color(dst,black_t()); if (x>0.0001f) { float x1 = channel_traits<T2>::max_value()/float(x);
T2 should model: http://www.boost.org/doc/libs/1_53_0/libs/gil/doc/html/g_i_l_0264.html
but this code additionally requires T2 to be greater-than comparable to float and convertible to float.
This shows that the authors of that library didn't use archetypes to test that component. http://www.boost.org/doc/libs/1_53_0/libs/concept_check/concept_covering.htm -- Dave Abrahams
participants (3)
-
Christian Henning
-
Dave Abrahams
-
Michael Marcin