diff --git a/ChangeLog b/ChangeLog index 325c48041..88035ffdb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-11-15 Emmanuele Bassi + + * clutter/clutter-effect.h: + * clutter/clutter-effect.c: + (clutter_effect_template_new_for_duration): Add a simple constructor + for implicitly creating a ClutterTimeline with a given duration. + 2007-11-15 Emmanuele Bassi * clutter.symbols: Update with the new public symbols diff --git a/clutter.symbols b/clutter.symbols index 47a7b4e4e..fa89f8a85 100644 --- a/clutter.symbols +++ b/clutter.symbols @@ -230,6 +230,7 @@ clutter_debug_flags; clutter_effect_template_get_type clutter_effect_template_new clutter_effect_template_new_full +clutter_effect_template_new_for_duration clutter_effect_template_set_timeline_clone clutter_effect_template_get_timeline_clone clutter_effect_fade diff --git a/clutter/clutter-effect.c b/clutter/clutter-effect.c index 5f874d55d..8a2d5b6f5 100644 --- a/clutter/clutter-effect.c +++ b/clutter/clutter-effect.c @@ -411,6 +411,48 @@ clutter_effect_template_new_full (ClutterTimeline *timeline, return retval; } +/** + * clutter_effect_template_new_for_duration: + * @msecs: the duration of the effects, in milliseconds + * @alpha_func: an alpha function to use for the template + * + * Creates a new #ClutterEffectTemplate, to be used with the effects API. + * + * A #ClutterEffectTemplate binds a timeline and an alpha function and can + * be used as a template for multiple calls of clutter_effect_fade(), + * clutter_effect_move() and clutter_effect_scale(). + * + * This API is intended for simple animations involving a single actor; + * for more complex animations, you should see #ClutterBehaviour and the + * derived classes. + * + * This function creates a #ClutterTimeline with a duration of @msecs + * milliseconds and transfers ownership of the timeline object to the + * returned #ClutterEffectTemplate. + * + * Return value: the newly created #ClutterEffectTemplate object + * + * Since: 0.6 + */ +ClutterEffectTemplate * +clutter_effect_template_new_for_duration (guint msecs, + ClutterAlphaFunc alpha_func) +{ + ClutterTimeline *timeline; + ClutterEffectTemplate *retval; + + g_return_val_if_fail (msecs > 0, NULL); + g_return_val_if_fail (alpha_func != NULL, NULL); + + timeline = clutter_timeline_new_for_duration (msecs); + retval = clutter_effect_template_new (timeline, alpha_func); + + /* the effect template takes ownership of the timeline */ + g_object_unref (timeline); + + return retval; +} + static void clutter_effect_closure_destroy (ClutterEffectClosure *c) { diff --git a/clutter/clutter-effect.h b/clutter/clutter-effect.h index d4df3cd63..79caca1c3 100644 --- a/clutter/clutter-effect.h +++ b/clutter/clutter-effect.h @@ -93,14 +93,15 @@ struct _ClutterEffectTemplateClass void (*_clutter_reserved4) (void); }; -GType clutter_effect_template_get_type (void) G_GNUC_CONST; -ClutterEffectTemplate *clutter_effect_template_new (ClutterTimeline *timeline, - ClutterAlphaFunc alpha_func); -ClutterEffectTemplate *clutter_effect_template_new_full (ClutterTimeline *timeline, - ClutterAlphaFunc alpha_func, - gpointer user_data, - GDestroyNotify notify); - +GType clutter_effect_template_get_type (void) G_GNUC_CONST; +ClutterEffectTemplate *clutter_effect_template_new (ClutterTimeline *timeline, + ClutterAlphaFunc alpha_func); +ClutterEffectTemplate *clutter_effect_template_new_full (ClutterTimeline *timeline, + ClutterAlphaFunc alpha_func, + gpointer user_data, + GDestroyNotify notify); +ClutterEffectTemplate *clutter_effect_template_new_for_duration (guint msecs, + ClutterAlphaFunc alpha_func); void clutter_effect_template_set_timeline_clone (ClutterEffectTemplate *template_, gboolean setting); gboolean clutter_effect_template_get_timeline_clone (ClutterEffectTemplate *template_); diff --git a/doc/reference/ChangeLog b/doc/reference/ChangeLog index 231559ed5..cc1d8d779 100644 --- a/doc/reference/ChangeLog +++ b/doc/reference/ChangeLog @@ -1,3 +1,7 @@ +2007-11-15 Emmanuele Bassi + + * clutter-sections.txt: Add new ClutterEffectTemplate constructor. + 2007-11-15 Emmanuele Bassi * clutter-sections.txt: Add new ClutterScript signal connection diff --git a/doc/reference/clutter-sections.txt b/doc/reference/clutter-sections.txt index 8fb631328..7d83700b7 100644 --- a/doc/reference/clutter-sections.txt +++ b/doc/reference/clutter-sections.txt @@ -1008,6 +1008,7 @@ clutter_padding_get_type Clutter Effects clutter_effect_template_new clutter_effect_template_new_full +clutter_effect_template_new_for_duration clutter_effect_template_get_timeline_clone clutter_effect_template_set_timeline_clone