2007-11-15 Emmanuele Bassi <ebassi@openedhand.com>
authorEmmanuele Bassi <ebassi@openedhand.com>
Thu, 15 Nov 2007 15:38:04 +0000 (15:38 +0000)
committerEmmanuele Bassi <ebassi@openedhand.com>
Thu, 15 Nov 2007 15:38:04 +0000 (15:38 +0000)
* 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.

ChangeLog
clutter.symbols
clutter/clutter-effect.c
clutter/clutter-effect.h
doc/reference/ChangeLog
doc/reference/clutter-sections.txt

index 325c480..88035ff 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2007-11-15  Emmanuele Bassi  <ebassi@openedhand.com>
 
+       * 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  <ebassi@openedhand.com>
+
        * clutter.symbols: Update with the new public symbols
 
        * clutter/clutter-script.h:
index 47a7b4e..fa89f8a 100644 (file)
@@ -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  
index 5f874d5..8a2d5b6 100644 (file)
@@ -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)
 {
index d4df3cd..79caca1 100644 (file)
@@ -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_);
index 231559e..cc1d8d7 100644 (file)
@@ -1,5 +1,9 @@
 2007-11-15  Emmanuele Bassi  <ebassi@openedhand.com>
 
+       * clutter-sections.txt: Add new ClutterEffectTemplate constructor.
+
+2007-11-15  Emmanuele Bassi  <ebassi@openedhand.com>
+
        * clutter-sections.txt: Add new ClutterScript signal connection
        functions.
 
index 8fb6313..7d83700 100644 (file)
@@ -1008,6 +1008,7 @@ clutter_padding_get_type
 <TITLE>Clutter Effects</TITLE>
 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