[color] Fix HLS to RGB colorspace conversion
authorEmmanuele Bassi <ebassi@linux.intel.com>
Mon, 27 Jul 2009 11:04:40 +0000 (12:04 +0100)
committerEmmanuele Bassi <ebassi@linux.intel.com>
Mon, 27 Jul 2009 11:04:40 +0000 (12:04 +0100)
commitad7dcc989648791e8fec1bb45711c9f71671dfe0
treeb4c86d8a83daf5cdcf36b817d99ad9cc3932563d
parentdb2fda9c430beed64309c1881a44917933863bd0
[color] Fix HLS to RGB colorspace conversion

The HLS to RGB conversion in case the S value is zero is:

  R = G = B = luminance

ClutterColor uses a byte (0 to 255) for the R, G and B channels
encoding, while luminance is expressed using a floating point value
in the closed interval [0, 1]; thus the case above becomes:

  R = G = B = (luminance * 255)

The clutter_color_from_hls() code is missing the final step of
de-normalizing the luminance value, and so it breaks the roundtrip
colorspace conversion between RGB and HLS.

Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1695
clutter/clutter-color.c