mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 03:22:04 +00:00
2007-07-24 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-effect.h: * clutter/clutter-effect.c: Add a secondary constructor for ClutterEffectTemplate, for use of the bindings.
This commit is contained in:
parent
2bf94df497
commit
8725ad7e60
@ -1,3 +1,9 @@
|
|||||||
|
2007-07-24 Emmanuele Bassi <ebassi@openedhand.com>
|
||||||
|
|
||||||
|
* clutter/clutter-effect.h:
|
||||||
|
* clutter/clutter-effect.c: Add a secondary constructor for
|
||||||
|
ClutterEffectTemplate, for use of the bindings.
|
||||||
|
|
||||||
2007-07-24 Matthew Allum <mallum@openedhand.com>
|
2007-07-24 Matthew Allum <mallum@openedhand.com>
|
||||||
|
|
||||||
* clutter/cogl/gles/cogl.c: (cogl_get_bitmasks):
|
* clutter/cogl/gles/cogl.c: (cogl_get_bitmasks):
|
||||||
|
@ -62,7 +62,9 @@ typedef struct ClutterEffectClosure
|
|||||||
ClutterTimeline *timeline;
|
ClutterTimeline *timeline;
|
||||||
ClutterAlpha *alpha;
|
ClutterAlpha *alpha;
|
||||||
ClutterBehaviour *behave;
|
ClutterBehaviour *behave;
|
||||||
|
|
||||||
gulong signal_id;
|
gulong signal_id;
|
||||||
|
|
||||||
ClutterEffectCompleteFunc completed_func;
|
ClutterEffectCompleteFunc completed_func;
|
||||||
gpointer completed_data;
|
gpointer completed_data;
|
||||||
ClutterEffectTemplate *template;
|
ClutterEffectTemplate *template;
|
||||||
@ -79,7 +81,10 @@ G_DEFINE_TYPE (ClutterEffectTemplate, clutter_effect_template, G_TYPE_OBJECT);
|
|||||||
struct _ClutterEffectTemplatePrivate
|
struct _ClutterEffectTemplatePrivate
|
||||||
{
|
{
|
||||||
ClutterTimeline *timeline;
|
ClutterTimeline *timeline;
|
||||||
|
|
||||||
ClutterAlphaFunc alpha_func;
|
ClutterAlphaFunc alpha_func;
|
||||||
|
gpointer alpha_data;
|
||||||
|
GDestroyNotify alpha_notify;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum
|
enum
|
||||||
@ -90,6 +95,24 @@ enum
|
|||||||
PROP_TIMELINE,
|
PROP_TIMELINE,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void
|
||||||
|
clutter_effect_template_finalize (GObject *gobject)
|
||||||
|
{
|
||||||
|
ClutterEffectTemplate *template = CLUTTER_EFFECT_TEMPLATE (gobject);
|
||||||
|
ClutterEffectTemplatePrivate *priv = template->priv;
|
||||||
|
|
||||||
|
if (priv->alpha_notify)
|
||||||
|
{
|
||||||
|
priv->alpha_notify (priv->alpha_data);
|
||||||
|
priv->alpha_notify = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
priv->alpha_data = NULL;
|
||||||
|
priv->alpha_func = NULL;
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (clutter_effect_template_parent_class)->finalize (gobject);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_effect_template_dispose (GObject *object)
|
clutter_effect_template_dispose (GObject *object)
|
||||||
{
|
{
|
||||||
@ -99,10 +122,11 @@ clutter_effect_template_dispose (GObject *object)
|
|||||||
template = CLUTTER_EFFECT_TEMPLATE (object);
|
template = CLUTTER_EFFECT_TEMPLATE (object);
|
||||||
priv = template->priv;
|
priv = template->priv;
|
||||||
|
|
||||||
g_object_unref (priv->timeline);
|
if (priv->timeline)
|
||||||
|
{
|
||||||
priv->timeline = NULL;
|
g_object_unref (priv->timeline);
|
||||||
priv->alpha_func = NULL;
|
priv->timeline = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
G_OBJECT_CLASS (clutter_effect_template_parent_class)->dispose (object);
|
G_OBJECT_CLASS (clutter_effect_template_parent_class)->dispose (object);
|
||||||
}
|
}
|
||||||
@ -167,6 +191,7 @@ clutter_effect_template_class_init (ClutterEffectTemplateClass *klass)
|
|||||||
|
|
||||||
g_type_class_add_private (klass, sizeof (ClutterEffectTemplatePrivate));
|
g_type_class_add_private (klass, sizeof (ClutterEffectTemplatePrivate));
|
||||||
|
|
||||||
|
object_class->finalize = clutter_effect_template_finalize;
|
||||||
object_class->dispose = clutter_effect_template_dispose;
|
object_class->dispose = clutter_effect_template_dispose;
|
||||||
object_class->set_property = clutter_effect_template_set_property;
|
object_class->set_property = clutter_effect_template_set_property;
|
||||||
object_class->get_property = clutter_effect_template_get_property;
|
object_class->get_property = clutter_effect_template_get_property;
|
||||||
@ -210,12 +235,41 @@ clutter_effect_template_init (ClutterEffectTemplate *self)
|
|||||||
self->priv = EFFECT_TEMPLATE_PRIVATE (self);
|
self->priv = EFFECT_TEMPLATE_PRIVATE (self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
clutter_effect_template_set_alpha_func (ClutterEffectTemplate *self,
|
||||||
|
ClutterAlphaFunc alpha_func,
|
||||||
|
gpointer alpha_data,
|
||||||
|
GDestroyNotify alpha_notify)
|
||||||
|
{
|
||||||
|
ClutterEffectTemplatePrivate *priv;
|
||||||
|
|
||||||
|
priv = self->priv;
|
||||||
|
|
||||||
|
if (priv->alpha_notify)
|
||||||
|
{
|
||||||
|
priv->alpha_notify (priv->alpha_data);
|
||||||
|
priv->alpha_notify = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
priv->alpha_data = alpha_data;
|
||||||
|
priv->alpha_notify = alpha_notify;
|
||||||
|
priv->alpha_func = alpha_func;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* clutter_effect_template_new:
|
* clutter_effect_template_new:
|
||||||
* @timeline: A #ClutterTimeline for the template (will be cloned)
|
* @timeline: A #ClutterTimeline for the template (will be cloned)
|
||||||
* @alpha_func: An alpha func to use for the template.
|
* @alpha_func: An alpha func to use for the template.
|
||||||
*
|
*
|
||||||
* Creates a template for use with clutter effect functions.
|
* 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.
|
||||||
*
|
*
|
||||||
* Return value: a #ClutterEffectTemplate
|
* Return value: a #ClutterEffectTemplate
|
||||||
*
|
*
|
||||||
@ -225,10 +279,63 @@ ClutterEffectTemplate *
|
|||||||
clutter_effect_template_new (ClutterTimeline *timeline,
|
clutter_effect_template_new (ClutterTimeline *timeline,
|
||||||
ClutterAlphaFunc alpha_func)
|
ClutterAlphaFunc alpha_func)
|
||||||
{
|
{
|
||||||
return g_object_new (CLUTTER_TYPE_EFFECT_TEMPLATE,
|
ClutterEffectTemplate *retval;
|
||||||
"timeline", timeline,
|
|
||||||
"alpha-func", alpha_func,
|
g_return_val_if_fail (CLUTTER_IS_TIMELINE (timeline), NULL);
|
||||||
NULL);
|
g_return_val_if_fail (alpha_func != NULL, NULL);
|
||||||
|
|
||||||
|
retval = g_object_new (CLUTTER_TYPE_EFFECT_TEMPLATE,
|
||||||
|
"timeline", timeline,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
clutter_effect_template_set_alpha_func (retval, alpha_func, NULL, NULL);
|
||||||
|
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clutter_effect_template_new_full:
|
||||||
|
* @timeline: a #ClutterTimeline
|
||||||
|
* @alpha_func: an alpha function to use for the template
|
||||||
|
* @user_data: data to be passed to the alpha function, or %NULL
|
||||||
|
* @notify: function to be called when disposing the alpha function's use
|
||||||
|
* data, or %NULL
|
||||||
|
*
|
||||||
|
* 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 is intended for language bindings only: if @notify is
|
||||||
|
* not %NULL it will be called to dispose of @user_data.
|
||||||
|
*
|
||||||
|
* Return value: the newly created #ClutterEffectTemplate object
|
||||||
|
*
|
||||||
|
* Since: 0.4
|
||||||
|
*/
|
||||||
|
ClutterEffectTemplate *
|
||||||
|
clutter_effect_template_new_full (ClutterTimeline *timeline,
|
||||||
|
ClutterAlphaFunc alpha_func,
|
||||||
|
gpointer user_data,
|
||||||
|
GDestroyNotify notify)
|
||||||
|
{
|
||||||
|
ClutterEffectTemplate *retval;
|
||||||
|
|
||||||
|
g_return_val_if_fail (CLUTTER_IS_TIMELINE (timeline), NULL);
|
||||||
|
g_return_val_if_fail (alpha_func != NULL, NULL);
|
||||||
|
|
||||||
|
retval = g_object_new (CLUTTER_TYPE_EFFECT_TEMPLATE,
|
||||||
|
"timeline", timeline,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
clutter_effect_template_set_alpha_func (retval, alpha_func, user_data, notify);
|
||||||
|
|
||||||
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -264,12 +371,12 @@ clutter_effect_closure_new (ClutterEffectTemplate *template,
|
|||||||
c->timeline = clutter_timeline_clone (priv->timeline);
|
c->timeline = clutter_timeline_clone (priv->timeline);
|
||||||
c->alpha = clutter_alpha_new_full (c->timeline,
|
c->alpha = clutter_alpha_new_full (c->timeline,
|
||||||
priv->alpha_func,
|
priv->alpha_func,
|
||||||
NULL, NULL);
|
priv->alpha_data,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
c->signal_id =
|
||||||
|
g_signal_connect (c->timeline, "completed",G_CALLBACK (complete), c);
|
||||||
|
|
||||||
c->signal_id = g_signal_connect (c->timeline,
|
|
||||||
"completed",
|
|
||||||
G_CALLBACK(complete),
|
|
||||||
c);
|
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,6 +88,10 @@ struct _ClutterEffectTemplateClass
|
|||||||
GType clutter_effect_template_get_type (void) G_GNUC_CONST;
|
GType clutter_effect_template_get_type (void) G_GNUC_CONST;
|
||||||
ClutterEffectTemplate *clutter_effect_template_new (ClutterTimeline *timeline,
|
ClutterEffectTemplate *clutter_effect_template_new (ClutterTimeline *timeline,
|
||||||
ClutterAlphaFunc alpha_func);
|
ClutterAlphaFunc alpha_func);
|
||||||
|
ClutterEffectTemplate *clutter_effect_template_new_full (ClutterTimeline *timeline,
|
||||||
|
ClutterAlphaFunc alpha_func,
|
||||||
|
gpointer user_data,
|
||||||
|
GDestroyNotify notify);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Clutter effects
|
* Clutter effects
|
||||||
|
Loading…
Reference in New Issue
Block a user