Clean up ClutterEffect
Make ClutterEffectTemplate use a pointer to the private data to avoid a type check each time it dereferences the ClutterEffectTemplatePrivate structure pointer. Clean up the header file for parsing purposes. Add a description for the gtk-doc reference.
This commit is contained in:
parent
52b5bad316
commit
255edd4e26
@ -29,6 +29,11 @@
|
|||||||
* SECTION:clutter-effect
|
* SECTION:clutter-effect
|
||||||
* @short_description: Utility Class for basic visual effects
|
* @short_description: Utility Class for basic visual effects
|
||||||
*
|
*
|
||||||
|
* The #ClutterEffectTemplate class provides a simple API for applying
|
||||||
|
* pre-defined effects to a single actor. It works as a wrapper around
|
||||||
|
* the #ClutterBehaviour objects
|
||||||
|
*
|
||||||
|
* Since: 0.4
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
@ -71,8 +76,6 @@ G_DEFINE_TYPE (ClutterEffectTemplate, clutter_effect_template, G_TYPE_OBJECT);
|
|||||||
CLUTTER_TYPE_EFFECT_TEMPLATE, \
|
CLUTTER_TYPE_EFFECT_TEMPLATE, \
|
||||||
ClutterEffectTemplatePrivate))
|
ClutterEffectTemplatePrivate))
|
||||||
|
|
||||||
typedef struct _ClutterEffectTemplatePrivate ClutterEffectTemplatePrivate;
|
|
||||||
|
|
||||||
struct _ClutterEffectTemplatePrivate
|
struct _ClutterEffectTemplatePrivate
|
||||||
{
|
{
|
||||||
ClutterTimeline *timeline;
|
ClutterTimeline *timeline;
|
||||||
@ -82,6 +85,7 @@ struct _ClutterEffectTemplatePrivate
|
|||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
PROP_0,
|
PROP_0,
|
||||||
|
|
||||||
PROP_ALPHA_FUNC,
|
PROP_ALPHA_FUNC,
|
||||||
PROP_TIMELINE,
|
PROP_TIMELINE,
|
||||||
};
|
};
|
||||||
@ -92,23 +96,15 @@ clutter_effect_template_dispose (GObject *object)
|
|||||||
ClutterEffectTemplate *template;
|
ClutterEffectTemplate *template;
|
||||||
ClutterEffectTemplatePrivate *priv;
|
ClutterEffectTemplatePrivate *priv;
|
||||||
|
|
||||||
template = CLUTTER_EFFECT_TEMPLATE(object);
|
template = CLUTTER_EFFECT_TEMPLATE (object);
|
||||||
priv = EFFECT_TEMPLATE_PRIVATE(template);
|
priv = template->priv;
|
||||||
|
|
||||||
g_object_unref (priv->timeline);
|
g_object_unref (priv->timeline);
|
||||||
|
|
||||||
priv->timeline = NULL;
|
priv->timeline = NULL;
|
||||||
priv->alpha_func = NULL;
|
priv->alpha_func = NULL;
|
||||||
|
|
||||||
if (G_OBJECT_CLASS (clutter_effect_template_parent_class)->dispose)
|
G_OBJECT_CLASS (clutter_effect_template_parent_class)->dispose (object);
|
||||||
G_OBJECT_CLASS (clutter_effect_template_parent_class)->dispose (object);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
clutter_effect_template_finalize (GObject *object)
|
|
||||||
{
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (clutter_effect_template_parent_class)->finalize (object);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -120,8 +116,8 @@ clutter_effect_template_set_property (GObject *object,
|
|||||||
ClutterEffectTemplate *template;
|
ClutterEffectTemplate *template;
|
||||||
ClutterEffectTemplatePrivate *priv;
|
ClutterEffectTemplatePrivate *priv;
|
||||||
|
|
||||||
template = CLUTTER_EFFECT_TEMPLATE(object);
|
template = CLUTTER_EFFECT_TEMPLATE (object);
|
||||||
priv = EFFECT_TEMPLATE_PRIVATE(template);
|
priv = template->priv;
|
||||||
|
|
||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
@ -147,8 +143,8 @@ clutter_effect_template_get_property (GObject *object,
|
|||||||
ClutterEffectTemplate *template;
|
ClutterEffectTemplate *template;
|
||||||
ClutterEffectTemplatePrivate *priv;
|
ClutterEffectTemplatePrivate *priv;
|
||||||
|
|
||||||
template = CLUTTER_EFFECT_TEMPLATE(object);
|
template = CLUTTER_EFFECT_TEMPLATE (object);
|
||||||
priv = EFFECT_TEMPLATE_PRIVATE(template);
|
priv = template->priv;
|
||||||
|
|
||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
@ -172,8 +168,6 @@ 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->dispose = clutter_effect_template_dispose;
|
object_class->dispose = clutter_effect_template_dispose;
|
||||||
object_class->finalize = clutter_effect_template_finalize;
|
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
@ -200,6 +194,7 @@ clutter_effect_template_class_init (ClutterEffectTemplateClass *klass)
|
|||||||
static void
|
static void
|
||||||
clutter_effect_template_init (ClutterEffectTemplate *self)
|
clutter_effect_template_init (ClutterEffectTemplate *self)
|
||||||
{
|
{
|
||||||
|
self->priv = EFFECT_TEMPLATE_PRIVATE (self);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -239,7 +234,7 @@ clutter_effect_closure_destroy (ClutterEffectClosure *c)
|
|||||||
g_slice_free (ClutterEffectClosure, c);
|
g_slice_free (ClutterEffectClosure, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ClutterEffectClosure*
|
static ClutterEffectClosure *
|
||||||
clutter_effect_closure_new (ClutterEffectTemplate *template,
|
clutter_effect_closure_new (ClutterEffectTemplate *template,
|
||||||
ClutterActor *actor,
|
ClutterActor *actor,
|
||||||
GCallback complete)
|
GCallback complete)
|
||||||
@ -295,11 +290,11 @@ on_effect_complete (ClutterTimeline *timeline,
|
|||||||
*/
|
*/
|
||||||
ClutterTimeline*
|
ClutterTimeline*
|
||||||
clutter_effect_fade (ClutterEffectTemplate *template,
|
clutter_effect_fade (ClutterEffectTemplate *template,
|
||||||
ClutterActor *actor,
|
ClutterActor *actor,
|
||||||
guint8 start_opacity,
|
guint8 start_opacity,
|
||||||
guint8 end_opacity,
|
guint8 end_opacity,
|
||||||
ClutterEffectCompleteFunc completed_func,
|
ClutterEffectCompleteFunc completed_func,
|
||||||
gpointer completed_userdata)
|
gpointer completed_userdata)
|
||||||
{
|
{
|
||||||
ClutterEffectClosure *c;
|
ClutterEffectClosure *c;
|
||||||
|
|
||||||
@ -336,12 +331,12 @@ clutter_effect_fade (ClutterEffectTemplate *template,
|
|||||||
* Since: 0.4
|
* Since: 0.4
|
||||||
*/
|
*/
|
||||||
ClutterTimeline*
|
ClutterTimeline*
|
||||||
clutter_effect_move (ClutterEffectTemplate *template,
|
clutter_effect_move (ClutterEffectTemplate *template,
|
||||||
ClutterActor *actor,
|
ClutterActor *actor,
|
||||||
const ClutterKnot *knots,
|
const ClutterKnot *knots,
|
||||||
guint n_knots,
|
guint n_knots,
|
||||||
ClutterEffectCompleteFunc completed_func,
|
ClutterEffectCompleteFunc completed_func,
|
||||||
gpointer completed_userdata)
|
gpointer completed_userdata)
|
||||||
{
|
{
|
||||||
ClutterEffectClosure *c;
|
ClutterEffectClosure *c;
|
||||||
|
|
||||||
@ -377,13 +372,13 @@ clutter_effect_move (ClutterEffectTemplate *template,
|
|||||||
* Since: 0.4
|
* Since: 0.4
|
||||||
*/
|
*/
|
||||||
ClutterTimeline*
|
ClutterTimeline*
|
||||||
clutter_effect_scale (ClutterEffectTemplate *template,
|
clutter_effect_scale (ClutterEffectTemplate *template,
|
||||||
ClutterActor *actor,
|
ClutterActor *actor,
|
||||||
gdouble scale_begin,
|
gdouble scale_begin,
|
||||||
gdouble scale_end,
|
gdouble scale_end,
|
||||||
ClutterGravity gravity,
|
ClutterGravity gravity,
|
||||||
ClutterEffectCompleteFunc completed_func,
|
ClutterEffectCompleteFunc completed_func,
|
||||||
gpointer completed_userdata)
|
gpointer completed_userdata)
|
||||||
{
|
{
|
||||||
ClutterEffectClosure *c;
|
ClutterEffectClosure *c;
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#define _CLUTTER_EFFECT
|
#define _CLUTTER_EFFECT
|
||||||
|
|
||||||
#include <glib-object.h>
|
#include <glib-object.h>
|
||||||
|
#include <clutter/clutter-actor.h>
|
||||||
#include <clutter/clutter-timeline.h>
|
#include <clutter/clutter-timeline.h>
|
||||||
#include <clutter/clutter-alpha.h>
|
#include <clutter/clutter-alpha.h>
|
||||||
#include <clutter/clutter-behaviour.h>
|
#include <clutter/clutter-behaviour.h>
|
||||||
@ -34,7 +35,7 @@
|
|||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
typedef void (*ClutterEffectCompleteFunc) (ClutterActor *actor,
|
typedef void (*ClutterEffectCompleteFunc) (ClutterActor *actor,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
|
||||||
#define CLUTTER_TYPE_EFFECT_TEMPLATE clutter_effect_template_get_type()
|
#define CLUTTER_TYPE_EFFECT_TEMPLATE clutter_effect_template_get_type()
|
||||||
|
|
||||||
@ -58,47 +59,59 @@ typedef void (*ClutterEffectCompleteFunc) (ClutterActor *actor,
|
|||||||
(G_TYPE_INSTANCE_GET_CLASS ((obj), \
|
(G_TYPE_INSTANCE_GET_CLASS ((obj), \
|
||||||
CLUTTER_TYPE_EFFECT_TEMPLATE, ClutterEffectTemplateClass))
|
CLUTTER_TYPE_EFFECT_TEMPLATE, ClutterEffectTemplateClass))
|
||||||
|
|
||||||
typedef struct _ClutterEffectTemplate ClutterEffectTemplate;
|
typedef struct _ClutterEffectTemplate ClutterEffectTemplate;
|
||||||
typedef struct _ClutterEffectTemplateClass ClutterEffectTemplateClass;
|
typedef struct _ClutterEffectTemplatePrivate ClutterEffectTemplatePrivate;
|
||||||
|
typedef struct _ClutterEffectTemplateClass ClutterEffectTemplateClass;
|
||||||
|
|
||||||
struct _ClutterEffectTemplate{
|
|
||||||
GObject parent;
|
struct _ClutterEffectTemplate
|
||||||
|
{
|
||||||
|
GObject parent_instance;
|
||||||
|
|
||||||
|
/*< private >*/
|
||||||
|
ClutterEffectTemplatePrivate *priv;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _ClutterEffectTemplateClass{
|
struct _ClutterEffectTemplateClass
|
||||||
|
{
|
||||||
GObjectClass parent_class;
|
GObjectClass parent_class;
|
||||||
|
|
||||||
|
/*< private >*/
|
||||||
|
|
||||||
|
/* padding, for future expansion */
|
||||||
|
void (*_clutter_reserved1) (void);
|
||||||
|
void (*_clutter_reserved2) (void);
|
||||||
|
void (*_clutter_reserved3) (void);
|
||||||
|
void (*_clutter_reserved4) (void);
|
||||||
};
|
};
|
||||||
|
|
||||||
GType clutter_effect_template_get_type (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 (ClutterTimeline *timeline,
|
* Clutter effects
|
||||||
ClutterAlphaFunc alpha_func);
|
*/
|
||||||
|
|
||||||
ClutterTimeline*
|
ClutterTimeline *clutter_effect_fade (ClutterEffectTemplate *template_,
|
||||||
clutter_effect_fade (ClutterEffectTemplate *template,
|
ClutterActor *actor,
|
||||||
ClutterActor *actor,
|
guint8 start_opacity,
|
||||||
guint8 start_opacity,
|
guint8 end_opacity,
|
||||||
guint8 end_opacity,
|
ClutterEffectCompleteFunc completed_func,
|
||||||
ClutterEffectCompleteFunc completed_func,
|
gpointer completed_data);
|
||||||
gpointer completed_data);
|
ClutterTimeline *clutter_effect_move (ClutterEffectTemplate *template_,
|
||||||
|
ClutterActor *actor,
|
||||||
ClutterTimeline*
|
const ClutterKnot *knots,
|
||||||
clutter_effect_move (ClutterEffectTemplate *template,
|
guint n_knots,
|
||||||
ClutterActor *actor,
|
ClutterEffectCompleteFunc completed_func,
|
||||||
const ClutterKnot *knots,
|
gpointer completed_data);
|
||||||
guint n_knots,
|
ClutterTimeline *clutter_effect_scale (ClutterEffectTemplate *template_,
|
||||||
ClutterEffectCompleteFunc completed_func,
|
ClutterActor *actor,
|
||||||
gpointer completed_data);
|
gdouble scale_begin,
|
||||||
|
gdouble scale_end,
|
||||||
ClutterTimeline*
|
ClutterGravity gravity,
|
||||||
clutter_effect_scale (ClutterEffectTemplate *template,
|
ClutterEffectCompleteFunc completed_func,
|
||||||
ClutterActor *actor,
|
gpointer completed_userdata);
|
||||||
gdouble scale_begin,
|
|
||||||
gdouble scale_end,
|
|
||||||
ClutterGravity gravity,
|
|
||||||
ClutterEffectCompleteFunc completed_func,
|
|
||||||
gpointer completed_userdata);
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user