Clean up of the ClutterColor API

The ClutterColor API has some inconsistencies:

  - the string deserialization function does not match the rest of
    the conversion function naming policy; the naming should be:

        clutter_color_parse()   ->      clutter_color_from_string()

    and the first parameter should be the ClutterColor that will
    be set from the string, not the string itself (a GDK-ism).

  - the fixed point API should not be exposed, especially in the
    form of ClutterFixed values

  - the non-fixed point HLS conversion functions do not make any
    sense. The values returned should be:

      hue        := range [ 0, 360 ]
      luminance  := range [ 0,   1 ]
      saturation := range [ 0,   1 ]

    like the current fixed point API does. Returning a value in
    the [ 0, 255 ] range is completely useless

  - the clutter_color_equal() should be converted for its use inside
    a GHashTable; a clutter_color_hash() should be added as well

  - the second parameter of the clutter_color_shade() function should
    be the shading factor, not the result (another GDK-ism). this way
    the function call can be translated from this:

      color.shade(out result, factor)

    to the more natural:

      color.shade(factor, out result)

This somewhat large commit fixes all these issues and updates the
internal users of the API.
This commit is contained in:
Emmanuele Bassi
2009-02-28 16:16:09 +00:00
parent 8a1eca7287
commit 7d674db9d2
7 changed files with 376 additions and 343 deletions

View File

@ -1052,7 +1052,7 @@ clutter_script_parse_node (ClutterScript *script,
ClutterColor color = { 0, };
if (str && str[0] != '\0')
clutter_color_parse (str, &color);
clutter_color_from_string (&color, str);
g_value_set_boxed (value, &color);
retval = TRUE;