Remove Units from the public API
With the recent change to internal floating point values, ClutterUnit has become a redundant type, defined to be a float. All integer entry points are being internally converted to floating point values to be passed to the GL pipeline with the least amount of conversion. ClutterUnit is thus exposed as just a "pixel with fractionary bits", and not -- as users might think -- as generic, resolution and device independent units. not that it was the case, but a definitive amount of people was convinced it did provide this "feature", and was flummoxed about the mere existence of this type. So, having ClutterUnit exposed in the public API doubles the entry points and has the following disadvantages: - we have to maintain twice the amount of entry points in ClutterActor - we still do an integer-to-float implicit conversion - we introduce a weird impedance between pixels and "pixels with fractionary bits" - language bindings will have to choose what to bind, and resort to manually overriding the API + *except* for language bindings based on GObject-Introspection, as they cannot do manual overrides, thus will replicate the entire set of entry points For these reason, we should coalesces every Actor entry point for pixels and for ClutterUnit into a single entry point taking a float, like: void clutter_actor_set_x (ClutterActor *self, gfloat x); void clutter_actor_get_size (ClutterActor *self, gfloat *width, gfloat *height); gfloat clutter_actor_get_height (ClutterActor *self); etc. The issues I have identified are: - we'll have a two cases of compiler warnings: - printf() format of the return values from %d to %f - clutter_actor_get_size() taking floats instead of unsigned ints - we'll have a problem with varargs when passing an integer instead of a floating point value, except on 64bit platforms where the size of a float is the same as the size of an int To be clear: the *intent* of the API should not change -- we still use pixels everywhere -- but: - we remove ambiguity in the API with regard to pixels and units - we remove entry points we get to maintain for the whole 1.0 version of the API - we make things simpler to bind for both manual language bindings and automatic (gobject-introspection based) ones - we have the simplest API possible while still exposing the capabilities of the underlying GL implementation
This commit is contained in:
@ -552,13 +552,16 @@ notify_cb (GObject *object,
|
||||
* @behave: a #ClutterBehaviour
|
||||
* @alpha: a #ClutterAlpha or %NULL to unset a previously set alpha
|
||||
*
|
||||
* Binds @alpha to a #ClutterBehaviour. The #ClutterAlpha object
|
||||
* Binds @alpha to a #ClutterBehaviour. The #ClutterAlpha object
|
||||
* is what makes a behaviour work: for each tick of the timeline
|
||||
* used by #ClutterAlpha a new value of the alpha parameter is
|
||||
* computed by the alpha function; the value should be used by
|
||||
* the #ClutterBehaviour to update one or more properties of the
|
||||
* actors to which the behaviour applies.
|
||||
*
|
||||
* If @alpha is not %NULL, the #ClutterBehaviour will take ownership
|
||||
* of the #ClutterAlpha instance.
|
||||
*
|
||||
* Since: 0.2
|
||||
*/
|
||||
void
|
||||
|
Reference in New Issue
Block a user