1
0
Fork 0

2006-11-15 Emmanuele Bassi <ebassi@openedhand.com>

* clutter/clutter-alpha.h:
	* clutter/clutter-alpha.c: Add a data parameter to
	the ClutterAlphaFunc; add a data+destroy parameter
	to clutter_alpha_set_func() and to clutter_alpha_new(),
	and turned the latter into clutter_alpha_new_full();
	add a simple, empty constructor clutter_alpha_new().

	These changes makes writing bindings a tad more easy,
	as bindings require passing their own functions in
	order to call the real alpha function.

	* clutter/clutter-behaviour.h: Clean up the header.

	* clutter/clutter-behaviours.[ch]:
	* clutter/clutter-behaviour-opacity.[ch]:
	* clutter/clutter-behaviour-path.[ch]:
	* clutter/clutter-behaviour-scale.[ch]: Split the
	ClutterBehaviourPath, ClutterBehaviourOpacity and
	ClutterBehaviourScale into their own files as they
	have been growing a bit. Fix ClutterBehaviourPath
	API.

	* clutter/clutter-media.h: Remove the commented
	"metadata_available" signal: gtk-doc chokes up on that.

	* clutter/clutter-timeline.h:
	* clutter/clutter-timeline.c: Remove the useless
	ClutterTimelineAlphaFunc signature; add missing accessor
	methods for the properties; clean up a bit.

	* clutter/clutter-util.h:
	* clutter/clutter-util.c: Remove unneeded function
	clutter_util_can_create_texture().

	* clutter/clutter-feature.h: Sync the name of
	clutter_feature_get_all() with the name declared
	in clutter-feature.h.

	* clutter/Makefile.am:
	* clutter/clutter.h: Update.

	* examples/behave.c: Update to the new ClutterAlpha
	constructor.

	* examples/super-oh.c: Use the right pointer and avoid
	the compiler making a fuss about it.
This commit is contained in:
Emmanuele Bassi 2006-11-15 23:37:53 +00:00
parent 5ca4d3718d
commit 734f808fbc
39 changed files with 2248 additions and 1412 deletions

View file

@ -1,4 +1,76 @@
2006-11-16 Emmanuele Bassi <ebassi@openedhand.com>
2006-11-15 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-alpha.h:
* clutter/clutter-alpha.c: Add a data parameter to
the ClutterAlphaFunc; add a data+destroy parameter
to clutter_alpha_set_func() and to clutter_alpha_new(),
and turned the latter into clutter_alpha_new_full();
add a simple, empty constructor clutter_alpha_new().
These changes makes writing bindings a tad more easy,
as bindings require passing their own functions in
order to call the real alpha function.
* clutter/clutter-behaviour.h: Clean up the header.
* clutter/clutter-behaviours.[ch]:
* clutter/clutter-behaviour-opacity.[ch]:
* clutter/clutter-behaviour-path.[ch]:
* clutter/clutter-behaviour-scale.[ch]: Split the
ClutterBehaviourPath, ClutterBehaviourOpacity and
ClutterBehaviourScale into their own files as they
have been growing a bit. Fix ClutterBehaviourPath
API.
* clutter/clutter-media.h: Remove the commented
"metadata_available" signal: gtk-doc chokes up on that.
* clutter/clutter-timeline.h:
* clutter/clutter-timeline.c: Remove the useless
ClutterTimelineAlphaFunc signature; add missing accessor
methods for the properties; clean up a bit.
* clutter/clutter-util.h:
* clutter/clutter-util.c: Remove unneeded function
clutter_util_can_create_texture().
* clutter/clutter-feature.h: Sync the name of
clutter_feature_get_all() with the name declared
in clutter-feature.h.
* clutter/Makefile.am:
* clutter/clutter.h: Update.
* examples/behave.c: Update to the new ClutterAlpha
constructor.
* examples/super-oh.c: Use the right pointer and avoid
the compiler making a fuss about it.
2006-11-15 Matthew Allum <mallum@openedhand.com>
* clutter/clutter-actor.h:
* clutter/clutter-actor.c:
Add new API clutter_actor_move_by(), clutter_actor_get_size()
* clutter/clutter-alpha.c:
* clutter/clutter-alpha.h:
Add clutter alpha sine func
* clutter/clutter-behaviours.h:
* clutter/clutter-behaviours.c:
Add a basic scale behaviour (needs work)
* examples/behave.c: (main):
More playing with new behaviour functionality
* clutter/clutter-feature.c:
* clutter/clutter-feature.h:
* clutter/clutter-main.c:
Add new experimental sync to vblank code
Set env CLUTTER_VBLANK=none to disable.
2006-11-15 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-alpha.h:
* clutter/clutter-alpha.c: ClutterAlpha is an initially

View file

@ -7,26 +7,28 @@ GLIB_MKENUMS=`pkg-config --variable=glib_mkenums glib-2.0`
BUILT_SOURCES = $(MARSHALFILES) $(ENUMFILES)
source_h = \
$(srcdir)/clutter-keysyms.h \
$(srcdir)/clutter-util.h \
$(srcdir)/clutter-fixed.h \
$(srcdir)/clutter-event.h \
$(srcdir)/clutter-color.h \
$(srcdir)/clutter-feature.h \
$(srcdir)/clutter-timeline.h \
$(srcdir)/clutter-actor.h \
$(srcdir)/clutter-group.h \
$(srcdir)/clutter-stage.h \
$(srcdir)/clutter-rectangle.h \
$(srcdir)/clutter-texture.h \
$(srcdir)/clutter-clone-texture.h \
$(srcdir)/clutter-label.h \
$(srcdir)/clutter-behaviour.h \
$(srcdir)/clutter-behaviours.h \
$(srcdir)/clutter-alpha.h \
$(srcdir)/clutter-media.h \
$(srcdir)/clutter-main.h
source_h = \
$(srcdir)/clutter-keysyms.h \
$(srcdir)/clutter-util.h \
$(srcdir)/clutter-fixed.h \
$(srcdir)/clutter-event.h \
$(srcdir)/clutter-color.h \
$(srcdir)/clutter-feature.h \
$(srcdir)/clutter-timeline.h \
$(srcdir)/clutter-actor.h \
$(srcdir)/clutter-group.h \
$(srcdir)/clutter-stage.h \
$(srcdir)/clutter-rectangle.h \
$(srcdir)/clutter-texture.h \
$(srcdir)/clutter-clone-texture.h \
$(srcdir)/clutter-label.h \
$(srcdir)/clutter-behaviour.h \
$(srcdir)/clutter-behaviour-opacity.h \
$(srcdir)/clutter-behaviour-path.h \
$(srcdir)/clutter-behaviour-scale.h \
$(srcdir)/clutter-alpha.h \
$(srcdir)/clutter-media.h \
$(srcdir)/clutter-main.h
clutter-marshal.h: clutter-marshal.list
( $(GLIB_GENMARSHAL) --prefix=clutter_marshal \
@ -73,23 +75,25 @@ clutter-enum-types.c: clutter-enum-types.h
CLEANFILES = $(BUILT_SOURCES) stamp-clutter-enum-types.h
source_c = clutter-main.c \
clutter-util.c \
clutter-feature.c \
clutter-event.c \
clutter-color.c \
clutter-timeline.c \
clutter-group.c \
clutter-stage.c \
clutter-rectangle.c \
clutter-texture.c \
clutter-clone-texture.c \
clutter-label.c \
clutter-actor.c \
clutter-behaviour.c \
clutter-behaviours.c \
clutter-alpha.c \
clutter-media.c \
source_c = clutter-main.c \
clutter-util.c \
clutter-feature.c \
clutter-event.c \
clutter-color.c \
clutter-timeline.c \
clutter-group.c \
clutter-stage.c \
clutter-rectangle.c \
clutter-texture.c \
clutter-clone-texture.c \
clutter-label.c \
clutter-actor.c \
clutter-behaviour.c \
clutter-behaviour-opacity.c \
clutter-behaviour-path.c \
clutter-behaviour-scale.c \
clutter-alpha.c \
clutter-media.c \
clutter-enum-types.c
source_h_priv = clutter-private.h

View file

@ -5,6 +5,7 @@
*
* Authored By Matthew Allum <mallum@openedhand.com>
* Jorn Baayen <jorn@openedhand.com>
* Emmanuele Bassi <ebassi@openedhand.com>
*
* Copyright (C) 2006 OpenedHand
*
@ -33,6 +34,9 @@
* of time.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "clutter-alpha.h"
#include "clutter-main.h"
@ -41,107 +45,43 @@
G_DEFINE_TYPE (ClutterAlpha, clutter_alpha, G_TYPE_OBJECT);
struct _ClutterAlphaPrivate
{
ClutterTimeline *timeline;
guint timeline_new_frame_id;
guint32 alpha;
guint timeline_new_frame_id;
guint32 alpha;
ClutterAlphaFunc func;
gpointer data;
GDestroyNotify destroy;
};
enum
{
PROP_0,
PROP_TIMELINE,
PROP_FUNC,
PROP_ALPHA
};
/* Alpha funcs */
guint32
clutter_alpha_ramp_inc_func (ClutterAlpha *alpha)
{
int current_frame_num, nframes;
current_frame_num =
clutter_timeline_get_current_frame (alpha->priv->timeline);
nframes =
clutter_timeline_get_n_frames (alpha->priv->timeline);
return (current_frame_num * CLUTTER_ALPHA_MAX_ALPHA) / nframes;
}
guint32
clutter_alpha_ramp_dec_func (ClutterAlpha *alpha)
{
int current_frame_num, nframes;
current_frame_num =
clutter_timeline_get_current_frame (alpha->priv->timeline);
nframes =
clutter_timeline_get_n_frames (alpha->priv->timeline);
return ((nframes - current_frame_num) * CLUTTER_ALPHA_MAX_ALPHA) / nframes;
}
guint32
clutter_alpha_ramp_func (ClutterAlpha *alpha)
{
int current_frame_num, nframes;
current_frame_num =
clutter_timeline_get_current_frame (alpha->priv->timeline);
nframes =
clutter_timeline_get_n_frames (alpha->priv->timeline);
if (current_frame_num > (nframes/2))
{
return ((nframes - current_frame_num)
* CLUTTER_ALPHA_MAX_ALPHA) / (nframes/2);
}
else
{
return (current_frame_num * CLUTTER_ALPHA_MAX_ALPHA) / (nframes/2);
}
}
guint32
clutter_alpha_sine_func (ClutterAlpha *alpha)
{
int current_frame_num, nframes;
double x;
current_frame_num =
clutter_timeline_get_current_frame (alpha->priv->timeline);
nframes =
clutter_timeline_get_n_frames (alpha->priv->timeline);
/* FIXME: fixed point, and fixed point sine() */
x = (double)(current_frame_num * 2.0f * M_PI) / nframes ;
printf("%2f\n", ((sin(x-(M_PI/2.0f)) + 1.0f ) * 0.5f ));
return (guint32) (((sin(x-(M_PI/2.0f)) + 1.0f ) * 0.5f ) * (double)CLUTTER_ALPHA_MAX_ALPHA);
}
/* Object */
static void
timeline_new_frame_cb (ClutterTimeline *timeline,
guint current_frame_num,
ClutterAlpha *alpha)
{
ClutterAlphaPrivate *priv;
ClutterAlphaPrivate *priv = alpha->priv;
priv = alpha->priv;
/* Update alpha value and notify */
if (priv->func)
{
g_object_ref (alpha);
/* Update alpha value */
if (priv->func) {
priv->alpha = priv->func(alpha);
priv->alpha = priv->func (alpha, priv->data);
g_object_notify (G_OBJECT (alpha), "alpha");
g_object_notify (G_OBJECT (alpha), "alpha");
g_object_unref (alpha);
}
}
@ -151,10 +91,10 @@ clutter_alpha_set_property (GObject *object,
const GValue *value,
GParamSpec *pspec)
{
ClutterAlpha *alpha;
ClutterAlpha *alpha;
ClutterAlphaPrivate *priv;
alpha = CLUTTER_ALPHA(object);
alpha = CLUTTER_ALPHA (object);
priv = alpha->priv;
switch (prop_id)
@ -162,9 +102,6 @@ clutter_alpha_set_property (GObject *object,
case PROP_TIMELINE:
clutter_alpha_set_timeline (alpha, g_value_get_object (value));
break;
case PROP_FUNC:
priv->func = g_value_get_pointer (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -180,7 +117,7 @@ clutter_alpha_get_property (GObject *object,
ClutterAlpha *alpha;
ClutterAlphaPrivate *priv;
alpha = CLUTTER_ALPHA(object);
alpha = CLUTTER_ALPHA (object);
priv = alpha->priv;
switch (prop_id)
@ -188,9 +125,6 @@ clutter_alpha_get_property (GObject *object,
case PROP_TIMELINE:
g_value_set_object (value, priv->timeline);
break;
case PROP_FUNC:
g_value_set_pointer (value, priv->func);
break;
case PROP_ALPHA:
g_value_set_uint (value, priv->alpha);
break;
@ -203,6 +137,13 @@ clutter_alpha_get_property (GObject *object,
static void
clutter_alpha_finalize (GObject *object)
{
ClutterAlphaPrivate *priv = CLUTTER_ALPHA (object)->priv;
if (priv->destroy)
{
priv->destroy (priv->data);
}
G_OBJECT_CLASS (clutter_alpha_parent_class)->finalize (object);
}
@ -220,9 +161,7 @@ clutter_alpha_dispose (GObject *object)
static void
clutter_alpha_class_init (ClutterAlphaClass *klass)
{
GObjectClass *object_class;
object_class = (GObjectClass*) klass;
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->set_property = clutter_alpha_set_property;
object_class->get_property = clutter_alpha_get_property;
@ -231,40 +170,40 @@ clutter_alpha_class_init (ClutterAlphaClass *klass)
g_type_class_add_private (klass, sizeof (ClutterAlphaPrivate));
g_object_class_install_property
(object_class, PROP_TIMELINE,
g_param_spec_object ("timeline",
"Timeline",
"Timeline",
CLUTTER_TYPE_TIMELINE,
G_PARAM_READWRITE));
g_object_class_install_property
(object_class, PROP_FUNC,
g_param_spec_pointer ("func",
"Alpha function",
"Alpha function",
G_PARAM_READWRITE));
g_object_class_install_property
(object_class, PROP_ALPHA,
g_param_spec_uint ("alpha",
"Alpha value",
"Alpha value",
0,
CLUTTER_ALPHA_MAX_ALPHA,
0,
G_PARAM_READABLE));
/**
* ClutterAlpha:timeline:
*
* A #ClutterTimeline instance used to drive the alpha function.
*/
g_object_class_install_property (object_class,
PROP_TIMELINE,
g_param_spec_object ("timeline",
"Timeline",
"Timeline",
CLUTTER_TYPE_TIMELINE,
G_PARAM_READWRITE));
/**
* ClutterAlpha:alpha:
*
* The alpha value as computed by the alpha function.
*/
g_object_class_install_property (object_class,
PROP_ALPHA,
g_param_spec_uint ("alpha",
"Alpha value",
"Alpha value",
0,
CLUTTER_ALPHA_MAX_ALPHA,
0,
G_PARAM_READABLE));
}
static void
clutter_alpha_init (ClutterAlpha *self)
{
self->priv = G_TYPE_INSTANCE_GET_PRIVATE(self,
CLUTTER_TYPE_ALPHA,
ClutterAlphaPrivate);
self->priv->func = CLUTTER_ALPHA_RAMP_INC;
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
CLUTTER_TYPE_ALPHA,
ClutterAlphaPrivate);
}
/**
@ -275,7 +214,7 @@ clutter_alpha_init (ClutterAlpha *self)
*
* Return Value: The current alpha value for the alpha
*/
gint32
guint32
clutter_alpha_get_alpha (ClutterAlpha *alpha)
{
g_return_val_if_fail (CLUTTER_IS_ALPHA (alpha), FALSE);
@ -287,13 +226,36 @@ clutter_alpha_get_alpha (ClutterAlpha *alpha)
* clutter_alpha_set_func:
* @alpha: A #ClutterAlpha
* @func: A #ClutterAlphaAlphaFunc
* @data: user data to be passed to the alpha function, or %NULL
* @destroy: notify function used when disposing the alpha function
*
* Sets the #ClutterAlphaFunc function used to compute
* the alpha value at each frame of the #ClutterTimeline
* bound to @alpha.
*/
void
clutter_alpha_set_func (ClutterAlpha *alpha,
ClutterAlphaFunc func)
ClutterAlphaFunc func,
gpointer data,
GDestroyNotify destroy)
{
alpha->priv->func = func;
ClutterAlphaPrivate *priv;
g_return_if_fail (CLUTTER_IS_ALPHA (alpha));
priv = alpha->priv;
if (priv->destroy)
{
priv->destroy (priv->data);
priv->func = NULL;
priv->data = NULL;
priv->destroy = NULL;
}
priv->func = func;
priv->data = data;
priv->destroy = destroy;
}
/**
@ -304,27 +266,33 @@ clutter_alpha_set_func (ClutterAlpha *alpha,
* Binds @alpha to @timeline.
*/
void
clutter_alpha_set_timeline (ClutterAlpha *alpha,
clutter_alpha_set_timeline (ClutterAlpha *alpha,
ClutterTimeline *timeline)
{
if (alpha->priv->timeline)
{
g_signal_handler_disconnect (alpha->priv->timeline,
alpha->priv->timeline_new_frame_id);
ClutterAlphaPrivate *priv;
g_object_unref (alpha->priv->timeline);
alpha->priv->timeline = NULL;
g_return_if_fail (CLUTTER_IS_ALPHA (alpha));
g_return_if_fail (timeline == NULL || CLUTTER_IS_TIMELINE (timeline));
priv = alpha->priv;
if (priv->timeline)
{
g_signal_handlers_disconnect_by_func (priv->timeline,
timeline_new_frame_cb,
alpha);
g_object_unref (priv->timeline);
priv->timeline = NULL;
}
if (timeline)
{
alpha->priv->timeline = g_object_ref (timeline);
priv->timeline = g_object_ref (timeline);
alpha->priv->timeline_new_frame_id =
g_signal_connect (alpha->priv->timeline,
"new-frame",
G_CALLBACK (timeline_new_frame_cb),
alpha);
g_signal_connect (priv->timeline, "new-frame",
G_CALLBACK (timeline_new_frame_cb),
alpha);
}
}
@ -344,22 +312,131 @@ clutter_alpha_get_timeline (ClutterAlpha *alpha)
/**
* clutter_alpha_new:
*
* Creates a new #ClutterAlpha instance. You must set a function
* to compute the alpha value using clutter_alpha_set_func() and
* bind a #ClutterTimeline object to the #ClutterAlpha instance
* using clutter_alpha_set_timeline().
*
* You should use the newly created #ClutterAlpha instance inside
* a #ClutterBehaviour object.
*
* Return value: the newly created empty #ClutterAlpha instance.
*/
ClutterAlpha *
clutter_alpha_new (void)
{
return g_object_new (CLUTTER_TYPE_ALPHA, NULL);
}
/**
* clutter_alpha_new_full:
* @timeline: #ClutterTimeline timeline
* @func: #ClutterAlphaFunc alpha function
* @data: data to be passed to the alpha function
* @destroy: notify to be called when removing the alpha function
*
* Create a new #ClutterAlpha instance.
* Create a new #ClutterAlpha instance and sets the timeline
* and alpha function.
*
* Return Value: a new #ClutterAlpha
*/
ClutterAlpha*
clutter_alpha_new (ClutterTimeline *timeline,
ClutterAlphaFunc func)
ClutterAlpha *
clutter_alpha_new_full (ClutterTimeline *timeline,
ClutterAlphaFunc func,
gpointer data,
GDestroyNotify destroy)
{
ClutterAlpha *retval;
g_return_val_if_fail (CLUTTER_IS_TIMELINE (timeline), NULL);
g_return_val_if_fail (func != NULL, NULL);
return g_object_new (CLUTTER_TYPE_ALPHA,
"timeline", timeline,
"func", func,
NULL);
retval = clutter_alpha_new ();
clutter_alpha_set_timeline (retval, timeline);
clutter_alpha_set_func (retval, func, data, destroy);
return retval;
}
guint32
clutter_ramp_inc_func (ClutterAlpha *alpha,
gpointer dummy)
{
ClutterTimeline *timeline;
gint current_frame_num, n_frames;
timeline = clutter_alpha_get_timeline (alpha);
current_frame_num = clutter_timeline_get_current_frame (timeline);
n_frames = clutter_timeline_get_n_frames (timeline);
return (current_frame_num * CLUTTER_ALPHA_MAX_ALPHA) / n_frames;
}
guint32
clutter_ramp_dec_func (ClutterAlpha *alpha,
gpointer dummy)
{
ClutterTimeline *timeline;
gint current_frame_num, n_frames;
timeline = clutter_alpha_get_timeline (alpha);
current_frame_num = clutter_timeline_get_current_frame (timeline);
n_frames = clutter_timeline_get_n_frames (timeline);
return (n_frames - current_frame_num)
* CLUTTER_ALPHA_MAX_ALPHA
/ n_frames;
}
guint32
clutter_ramp_func (ClutterAlpha *alpha,
gpointer dummy)
{
ClutterTimeline *timeline;
gint current_frame_num, n_frames;
timeline = clutter_alpha_get_timeline (alpha);
current_frame_num = clutter_timeline_get_current_frame (timeline);
n_frames = clutter_timeline_get_n_frames (timeline);
if (current_frame_num > (n_frames / 2))
{
return (n_frames - current_frame_num)
* CLUTTER_ALPHA_MAX_ALPHA
/ (n_frames / 2);
}
else
{
return current_frame_num
* CLUTTER_ALPHA_MAX_ALPHA
/ (n_frames / 2);
}
}
guint32
clutter_sine_func (ClutterAlpha *alpha,
gpointer dummy)
{
ClutterTimeline *timeline;
gint current_frame_num, n_frames;
gdouble x;
timeline = clutter_alpha_get_timeline (alpha);
current_frame_num = clutter_timeline_get_current_frame (timeline);
n_frames = clutter_timeline_get_n_frames (timeline);
/* FIXME: fixed point, and fixed point sine() */
x = (gdouble) (current_frame_num * 2.0f * M_PI) / n_frames ;
CLUTTER_DBG ("%2f\n", ((sin (x - (M_PI / 2.0f)) + 1.0f) * 0.5f));
return (guint32) (((sin (x - (M_PI / 2.0f)) + 1.0f) * 0.5f)
* (gdouble) CLUTTER_ALPHA_MAX_ALPHA);
}

View file

@ -5,6 +5,7 @@
*
* Authored By Matthew Allum <mallum@openedhand.com>
* Jorn Baayen <jorn@openedhand.com>
* Emmanuele Bassi <ebassi@openedhand.com>
*
* Copyright (C) 2006 OpenedHand
*
@ -24,14 +25,11 @@
* Boston, MA 02111-1307, USA.
*/
#ifndef _HAVE_CLUTTER_ALPHA_H
#define _HAVE_CLUTTER_ALPHA_H
/* clutter-alpha.h */
#ifndef __CLUTTER_ALPHA_H__
#define __CLUTTER_ALPHA_H__
#include <glib-object.h>
#include "clutter-timeline.h"
#include <clutter/clutter-timeline.h>
G_BEGIN_DECLS
@ -61,10 +59,12 @@ typedef struct _ClutterAlpha ClutterAlpha;
typedef struct _ClutterAlphaClass ClutterAlphaClass;
typedef struct _ClutterAlphaPrivate ClutterAlphaPrivate;
typedef guint32 (*ClutterAlphaFunc) (ClutterAlpha *alpha);
typedef guint32 (*ClutterAlphaFunc) (ClutterAlpha *alpha,
gpointer user_data);
struct _ClutterAlpha
{
/*< private >*/
GInitiallyUnowned parent;
ClutterAlphaPrivate *priv;
};
@ -83,43 +83,37 @@ struct _ClutterAlphaClass
#define CLUTTER_ALPHA_MAX_ALPHA 0xffff
GType clutter_alpha_get_type (void) G_GNUC_CONST;
GType clutter_alpha_get_type (void) G_GNUC_CONST;
ClutterAlpha *
clutter_alpha_new (ClutterTimeline *timeline,
ClutterAlphaFunc func);
ClutterAlpha * clutter_alpha_new (void);
ClutterAlpha * clutter_alpha_new_full (ClutterTimeline *timeline,
ClutterAlphaFunc func,
gpointer data,
GDestroyNotify destroy);
guint32 clutter_alpha_get_alpha (ClutterAlpha *alpha);
void clutter_alpha_set_func (ClutterAlpha *alpha,
ClutterAlphaFunc func,
gpointer data,
GDestroyNotify destroy);
void clutter_alpha_set_timeline (ClutterAlpha *alpha,
ClutterTimeline *timeline);
ClutterTimeline *clutter_alpha_get_timeline (ClutterAlpha *alpha);
gint32
clutter_alpha_get_alpha (ClutterAlpha *alpha);
/* convenience functions */
#define CLUTTER_ALPHA_RAMP_INC clutter_ramp_inc_func
#define CLUTTER_ALPHA_RAMP_DEC clutter_ramp_dec_func
#define CLUTTER_ALPHA_RAMP clutter_ramp_func
#define CLUTTER_ALPHA_SINE clutter_sine_func
void
clutter_alpha_set_func (ClutterAlpha *alpha,
ClutterAlphaFunc func);
void
clutter_alpha_set_timeline (ClutterAlpha *alpha,
ClutterTimeline *timeline);
ClutterTimeline *
clutter_alpha_get_timeline (ClutterAlpha *alpha);
guint32
clutter_alpha_ramp_inc_func (ClutterAlpha *alpha);
guint32
clutter_alpha_ramp_dec_func (ClutterAlpha *alpha);
guint32
clutter_alpha_ramp_func (ClutterAlpha *alpha);
guint32
clutter_alpha_sine_func (ClutterAlpha *alpha);
#define CLUTTER_ALPHA_RAMP_INC clutter_alpha_ramp_inc_func
#define CLUTTER_ALPHA_RAMP_DEC clutter_alpha_ramp_dec_func
#define CLUTTER_ALPHA_RAMP clutter_alpha_ramp_func
#define CLUTTER_ALPHA_SINE clutter_alpha_sine_func
guint32 clutter_ramp_inc_func (ClutterAlpha *alpha,
gpointer dummy);
guint32 clutter_ramp_dec_func (ClutterAlpha *alpha,
gpointer dummy);
guint32 clutter_ramp_func (ClutterAlpha *alpha,
gpointer dummy);
guint32 clutter_sine_func (ClutterAlpha *alpha,
gpointer dummy);
G_END_DECLS
#endif
#endif /* __CLUTTER_ALPHA_H__ */

View file

@ -0,0 +1,126 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
*
* Copyright (C) 2006 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "clutter-actor.h"
#include "clutter-behaviour.h"
#include "clutter-behaviour-opacity.h"
#include "clutter-enum-types.h"
#include "clutter-main.h"
#include <math.h>
G_DEFINE_TYPE (ClutterBehaviourOpacity,
clutter_behaviour_opacity,
CLUTTER_TYPE_BEHAVIOUR);
struct _ClutterBehaviourOpacityPrivate
{
guint8 opacity_start;
guint8 opacity_end;
};
#define CLUTTER_BEHAVIOUR_OPACITY_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
CLUTTER_TYPE_BEHAVIOUR_OPACITY, \
ClutterBehaviourOpacityPrivate))
static void
clutter_behaviour_opacity_frame_foreach (ClutterActor *actor,
ClutterBehaviourOpacity *behave)
{
guint32 alpha;
guint8 opacity;
ClutterBehaviourOpacityPrivate *priv;
ClutterBehaviour *_behave;
priv = CLUTTER_BEHAVIOUR_OPACITY_GET_PRIVATE (behave);
_behave = CLUTTER_BEHAVIOUR (behave);
alpha = clutter_alpha_get_alpha (clutter_behaviour_get_alpha (_behave));
opacity = (alpha * (priv->opacity_end - priv->opacity_start))
/ CLUTTER_ALPHA_MAX_ALPHA;
opacity += priv->opacity_start;
CLUTTER_DBG ("alpha %i opacity %i\n", alpha, opacity);
clutter_actor_set_opacity (actor, opacity);
}
static void
clutter_behaviour_alpha_notify (ClutterBehaviour *behave)
{
clutter_behaviour_actors_foreach (behave,
(GFunc)clutter_behaviour_opacity_frame_foreach,
CLUTTER_BEHAVIOUR_OPACITY (behave));
}
static void
clutter_behaviour_opacity_finalize (GObject *object)
{
G_OBJECT_CLASS (clutter_behaviour_opacity_parent_class)->finalize (object);
}
static void
clutter_behaviour_opacity_class_init (ClutterBehaviourOpacityClass *klass)
{
ClutterBehaviourClass *behave_class;
behave_class = (ClutterBehaviourClass*) klass;
behave_class->alpha_notify = clutter_behaviour_alpha_notify;
g_type_class_add_private (klass, sizeof (ClutterBehaviourOpacityPrivate));
}
static void
clutter_behaviour_opacity_init (ClutterBehaviourOpacity *self)
{
self->priv = CLUTTER_BEHAVIOUR_OPACITY_GET_PRIVATE (self);
}
ClutterBehaviour*
clutter_behaviour_opacity_new (ClutterAlpha *alpha,
guint8 opacity_start,
guint8 opacity_end)
{
ClutterBehaviourOpacity *behave;
behave = g_object_new (CLUTTER_TYPE_BEHAVIOUR_OPACITY,
"alpha", alpha,
NULL);
behave->priv->opacity_start = opacity_start;
behave->priv->opacity_end = opacity_end;
return CLUTTER_BEHAVIOUR (behave);
}

View file

@ -0,0 +1,83 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
* Jorn Baayen <jorn@openedhand.com>
* Emmanuele Bassi <ebassi@openedhand.com>
*
* Copyright (C) 2006 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __CLUTTER_BEHAVIOUR_OPACITY_H__
#define __CLUTTER_BEHAVIOUR_OPACITY_H__
#include <clutter/clutter-alpha.h>
#include <clutter/clutter-behaviour.h>
G_BEGIN_DECLS
#define CLUTTER_TYPE_BEHAVIOUR_OPACITY (clutter_behaviour_opacity_get_type ())
#define CLUTTER_BEHAVIOUR_OPACITY(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), \
CLUTTER_TYPE_BEHAVIOUR_OPACITY, ClutterBehaviourOpacity))
#define CLUTTER_BEHAVIOUR_OPACITY_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), \
CLUTTER_TYPE_BEHAVIOUR_OPACITY, ClutterBehaviourOpacityClass))
#define CLUTTER_IS_BEHAVIOUR_OPACITY(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
CLUTTER_TYPE_BEHAVIOUR_OPACITY))
#define CLUTTER_IS_BEHAVIOUR_OPACITY_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), \
CLUTTER_TYPE_BEHAVIOUR_OPACITY))
#define CLUTTER_BEHAVIOUR_OPACITY_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), \
CLUTTER_TYPE_BEHAVIOUR_OPACITY, ClutterBehaviourOpacityClass))
typedef struct _ClutterBehaviourOpacity ClutterBehaviourOpacity;
typedef struct _ClutterBehaviourOpacityPrivate ClutterBehaviourOpacityPrivate;
typedef struct _ClutterBehaviourOpacityClass ClutterBehaviourOpacityClass;
struct _ClutterBehaviourOpacity
{
/*< private >*/
ClutterBehaviour parent;
ClutterBehaviourOpacityPrivate *priv;
};
struct _ClutterBehaviourOpacityClass
{
ClutterBehaviourClass parent_class;
};
GType clutter_behaviour_opacity_get_type (void) G_GNUC_CONST;
ClutterBehaviour *clutter_behaviour_opacity_new (ClutterAlpha *alpha,
guint8 opacity_start,
guint8 opacity_end);
G_END_DECLS
#endif /* __CLUTTER_BEHAVIOUR_OPACITY_H__ */

View file

@ -0,0 +1,331 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
*
* Copyright (C) 2006 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "clutter-actor.h"
#include "clutter-behaviour.h"
#include "clutter-enum-types.h"
#include "clutter-main.h"
#include "clutter-behaviour-path.h"
#include <math.h>
static ClutterKnot *
clutter_knot_copy (const ClutterKnot *knot)
{
ClutterKnot *copy;
copy = g_slice_new0 (ClutterKnot);
*copy = *knot;
return copy;
}
static void
clutter_knot_free (ClutterKnot *knot)
{
if (G_LIKELY (knot))
{
g_slice_free (ClutterKnot, knot);
}
}
GType
clutter_knot_get_type (void)
{
static GType our_type = 0;
if (G_UNLIKELY (!our_type))
our_type = g_boxed_type_register_static
("ClutterKnot",
(GBoxedCopyFunc) clutter_knot_copy,
(GBoxedFreeFunc) clutter_knot_free);
return our_type;
}
G_DEFINE_TYPE (ClutterBehaviourPath, \
clutter_behaviour_path, \
CLUTTER_TYPE_BEHAVIOUR);
struct _ClutterBehaviourPathPrivate
{
GSList *knots;
};
#define CLUTTER_BEHAVIOUR_PATH_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
CLUTTER_TYPE_BEHAVIOUR_PATH, \
ClutterBehaviourPathPrivate))
static void
clutter_behaviour_path_finalize (GObject *object)
{
ClutterBehaviourPath *self = CLUTTER_BEHAVIOUR_PATH(object);
g_slist_foreach (self->priv->knots, (GFunc) clutter_knot_free, NULL);
g_slist_free (self->priv->knots);
G_OBJECT_CLASS (clutter_behaviour_path_parent_class)->finalize (object);
}
static void
interpolate (const ClutterKnot *begin,
const ClutterKnot *end,
ClutterKnot *out,
double t)
{
/* FIXME: fixed point */
out->x = begin->x + t * (end->x - begin->x);
out->y = begin->y + t * (end->y - begin->y);
}
static gint
node_distance (const ClutterKnot *begin, const ClutterKnot *end)
{
g_return_val_if_fail (begin != NULL, 0);
g_return_val_if_fail (end != NULL, 0);
/* FIXME: need fixed point here */
return sqrt ((end->x - begin->x) * (end->x - begin->x) +
(end->y - begin->y) * (end->y - begin->y));
}
static gint
path_total_length (ClutterBehaviourPath *behave)
{
GSList *l;
gint len = 0;
for (l = behave->priv->knots; l != NULL; l = l->next)
if (l->next)
len += node_distance (l->data, l->next->data);
return len;
}
static void
actor_apply_knot_foreach (ClutterActor *actor,
ClutterKnot *knot)
{
clutter_actor_set_position (actor, knot->x, knot->y);
}
static void
path_alpha_to_position (ClutterBehaviourPath *behave)
{
ClutterBehaviourPathPrivate *priv = behave->priv;
ClutterBehaviour *behaviour = CLUTTER_BEHAVIOUR (behave);
guint32 alpha;
GSList *l;
gint total_len, offset, dist_to_next, dist = 0;
/* FIXME: Optimise. Much of the data used here can be pre-generated
* ( total_len, dist between knots ) when knots are added/removed.
*/
/* Calculation as follows:
* o Get total length of path
* o Find the offset on path where alpha val corresponds to
* o Figure out between which knots this offset lies.
* o Interpolate new co-ords via dist between these knots
* o Apply to actors.
*/
alpha = clutter_alpha_get_alpha (clutter_behaviour_get_alpha (behaviour));
total_len = path_total_length (behave);
offset = (alpha * total_len) / CLUTTER_ALPHA_MAX_ALPHA;
if (offset == 0)
{
clutter_behaviour_actors_foreach (behaviour,
(GFunc) actor_apply_knot_foreach,
priv->knots->data);
return;
}
for (l = priv->knots; l != NULL; l = l->next)
{
ClutterKnot *knot = l->data;
if (l->next)
{
ClutterKnot *next = l->next->data;
dist_to_next = node_distance (knot, next);
if (offset >= dist && offset < (dist + dist_to_next))
{
ClutterKnot new;
double t;
/* FIXME: Use fixed */
t = (double) (offset - dist) / dist_to_next;
interpolate (knot, next, &new, t);
clutter_behaviour_actors_foreach (behaviour,
(GFunc)actor_apply_knot_foreach,
&new);
return;
}
}
dist += dist_to_next;
}
}
static void
clutter_behaviour_path_alpha_notify (ClutterBehaviour *behave)
{
path_alpha_to_position (CLUTTER_BEHAVIOUR_PATH(behave));
}
static void
clutter_behaviour_path_class_init (ClutterBehaviourPathClass *klass)
{
GObjectClass *object_class;
ClutterBehaviourClass *behave_class;
object_class = (GObjectClass*) klass;
behave_class = (ClutterBehaviourClass*) klass;
object_class->finalize = clutter_behaviour_path_finalize;
behave_class->alpha_notify = clutter_behaviour_path_alpha_notify;
g_type_class_add_private (object_class, sizeof (ClutterBehaviourPathPrivate));
}
static void
clutter_behaviour_path_init (ClutterBehaviourPath *self)
{
ClutterBehaviourPathPrivate *priv;
self->priv = priv = CLUTTER_BEHAVIOUR_PATH_GET_PRIVATE (self);
}
/**
* clutter_behaviour_path_new:
* @alpha: a #ClutterAlpha
* @knots: a list of #ClutterKnots
* @n_knots: the number of nodes in the path
*
* FIXME
*
* Return value: a #ClutterBehaviour
*/
ClutterBehaviour *
clutter_behaviour_path_new (ClutterAlpha *alpha,
const ClutterKnot *knots,
guint n_knots)
{
ClutterBehaviourPath *behave;
gint i;
behave = g_object_new (CLUTTER_TYPE_BEHAVIOUR_PATH,
"alpha", alpha,
NULL);
for (i = 0; i < n_knots; i++)
{
ClutterKnot knot = knots[i];
clutter_behaviour_path_append_knot (behave, &knot);
}
return CLUTTER_BEHAVIOUR (behave);
}
GSList *
clutter_behaviour_path_get_knots (ClutterBehaviourPath *behave)
{
GSList *retval, *l;
g_return_val_if_fail (CLUTTER_IS_BEHAVIOUR_PATH (behave), NULL);
retval = NULL;
for (l = behave->priv->knots; l != NULL; l = l->next)
retval = g_slist_prepend (retval, l->data);
return g_slist_reverse (retval);
}
void
clutter_behaviour_path_append_knot (ClutterBehaviourPath *pathb,
const ClutterKnot *knot)
{
ClutterBehaviourPathPrivate *priv;
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_PATH (pathb));
g_return_if_fail (knot != NULL);
priv = pathb->priv;
priv->knots = g_slist_append (priv->knots, clutter_knot_copy (knot));
}
static void
clutter_behaviour_path_append_knots_valist (ClutterBehaviourPath *pathb,
const ClutterKnot *first_knot,
va_list args)
{
const ClutterKnot * knot;
knot = first_knot;
while (knot)
{
clutter_behaviour_path_append_knot (pathb, knot);
knot = va_arg (args, ClutterKnot*);
}
}
void
clutter_behaviour_path_append_knots (ClutterBehaviourPath *pathb,
const ClutterKnot *first_knot,
...)
{
va_list args;
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_PATH (pathb));
g_return_if_fail (first_knot != NULL);
va_start (args, first_knot);
clutter_behaviour_path_append_knots_valist (pathb, first_knot, args);
va_end (args);
}
void
clutter_behaviour_path_clear (ClutterBehaviourPath *pathb)
{
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_PATH (pathb));
g_slist_foreach (pathb->priv->knots, (GFunc) clutter_knot_free, NULL);
g_slist_free (pathb->priv->knots);
pathb->priv->knots = NULL;
}

View file

@ -0,0 +1,100 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
* Jorn Baayen <jorn@openedhand.com>
* Emmanuele Bassi <ebassi@openedhand.com>
*
* Copyright (C) 2006 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __CLUTTER_BEHAVIOUR_PATH_H__
#define __CLUTTER_BEHAVIOUR_PATH_H__
#include <clutter/clutter-alpha.h>
#include <clutter/clutter-behaviour.h>
G_BEGIN_DECLS
#define CLUTTER_TYPE_KNOT (clutter_knot_get_type ())
typedef struct _ClutterKnot ClutterKnot;
struct _ClutterKnot
{
gint x,y;
/* FIXME: optionally include bezier control points also ? */
};
GType clutter_knot_get_type (void) G_GNUC_CONST;
#define CLUTTER_TYPE_BEHAVIOUR_PATH (clutter_behaviour_path_get_type ())
#define CLUTTER_BEHAVIOUR_PATH(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), \
CLUTTER_TYPE_BEHAVIOUR_PATH, ClutterBehaviourPath))
#define CLUTTER_BEHAVIOUR_PATH_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), \
CLUTTER_TYPE_BEHAVIOUR_PATH, ClutterBehaviourPathClass))
#define CLUTTER_IS_BEHAVIOUR_PATH(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
CLUTTER_TYPE_BEHAVIOUR_PATH))
#define CLUTTER_IS_BEHAVIOUR_PATH_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), \
CLUTTER_TYPE_BEHAVIOUR_PATH))
#define CLUTTER_BEHAVIOUR_PATH_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), \
CLUTTER_TYPE_BEHAVIOUR_PATH, ClutterBehaviourPathClass))
typedef struct _ClutterBehaviourPath ClutterBehaviourPath;
typedef struct _ClutterBehaviourPathPrivate ClutterBehaviourPathPrivate;
typedef struct _ClutterBehaviourPathClass ClutterBehaviourPathClass;
struct _ClutterBehaviourPath
{
ClutterBehaviour parent;
ClutterBehaviourPathPrivate *priv;
};
struct _ClutterBehaviourPathClass
{
ClutterBehaviourClass parent_class;
};
GType clutter_behaviour_path_get_type (void) G_GNUC_CONST;
ClutterBehaviour *clutter_behaviour_path_new (ClutterAlpha *alpha,
const ClutterKnot *knots,
guint n_knots);
GSList * clutter_behaviour_path_get_knots (ClutterBehaviourPath *behave);
void clutter_behaviour_path_append_knot (ClutterBehaviourPath *behave,
const ClutterKnot *knot);
void clutter_behaviour_path_append_knots (ClutterBehaviourPath *pathb,
const ClutterKnot *first_knot,
...) G_GNUC_NULL_TERMINATED;
void clutter_behaviour_path_clear (ClutterBehaviourPath *path);
G_END_DECLS
#endif /* __CLUTTER_BEHAVIOUR_PATH_H__ */

View file

@ -0,0 +1,170 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
*
* Copyright (C) 2006 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "clutter-actor.h"
#include "clutter-behaviour.h"
#include "clutter-enum-types.h"
#include "clutter-main.h"
#include "clutter-fixed.h"
#include "clutter-behaviour-scale.h"
#include <math.h>
G_DEFINE_TYPE (ClutterBehaviourScale,
clutter_behaviour_scale,
CLUTTER_TYPE_BEHAVIOUR);
struct _ClutterBehaviourScalePrivate
{
ClutterFixed scale_begin;
ClutterFixed scale_end;
ClutterGravity gravity;
};
#define CLUTTER_BEHAVIOUR_SCALE_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
CLUTTER_TYPE_BEHAVIOUR_SCALE, \
ClutterBehaviourScalePrivate))
static void
clutter_behaviour_scale_frame_foreach (ClutterActor *actor,
ClutterBehaviourScale *behave)
{
ClutterFixed scale, factor;
guint32 alpha;
ClutterBehaviourScalePrivate *priv;
ClutterBehaviour *_behave;
gint sw, sh, w, h;
priv = CLUTTER_BEHAVIOUR_SCALE_GET_PRIVATE (behave);
_behave = CLUTTER_BEHAVIOUR (behave);
alpha = clutter_alpha_get_alpha (clutter_behaviour_get_alpha (_behave));
/* FIXME: use all fixed if possible
factor = CLUTTER_FIXED_DIV(CLUTTER_INT_TO_FIXED(alpha/2),
CLUTTER_INT_TO_FIXED(CLUTTER_ALPHA_MAX_ALPHA/2));
*/
factor = CLUTTER_FLOAT_TO_FIXED ((gdouble) alpha / CLUTTER_ALPHA_MAX_ALPHA);
scale = CLUTTER_FIXED_MUL (factor, (priv->scale_end - priv->scale_begin));
scale += priv->scale_begin;
clutter_actor_set_scalex (actor, scale, scale);
if (priv->gravity == CLUTTER_GRAVITY_NONE ||
priv->gravity == CLUTTER_GRAVITY_NORTH_WEST)
return;
clutter_actor_get_abs_size (actor, (guint*) &sw, (guint*) &sh);
clutter_actor_get_size (actor, (guint*) &w, (guint*) &h);
switch (priv->gravity)
{
case CLUTTER_GRAVITY_NORTH:
break;
case CLUTTER_GRAVITY_NORTH_EAST:
break;
case CLUTTER_GRAVITY_EAST:
break;
case CLUTTER_GRAVITY_SOUTH_EAST:
break;
case CLUTTER_GRAVITY_SOUTH:
break;
case CLUTTER_GRAVITY_SOUTH_WEST:
break;
case CLUTTER_GRAVITY_WEST:
break;
case CLUTTER_GRAVITY_CENTER:
CLUTTER_DBG ("%i vs %i\n", sw, w);
clutter_actor_move_by (actor, sw - w, sh - h);
default:
break;
}
}
static void
clutter_behaviour_scale_alpha_notify (ClutterBehaviour *behave)
{
clutter_behaviour_actors_foreach (behave,
(GFunc)clutter_behaviour_scale_frame_foreach,
CLUTTER_BEHAVIOUR_SCALE (behave));
}
static void
clutter_behaviour_scale_class_init (ClutterBehaviourScaleClass *klass)
{
ClutterBehaviourClass *behave_class;
behave_class = (ClutterBehaviourClass*) klass;
behave_class->alpha_notify = clutter_behaviour_scale_alpha_notify;
g_type_class_add_private (klass, sizeof (ClutterBehaviourScalePrivate));
}
static void
clutter_behaviour_scale_init (ClutterBehaviourScale *self)
{
ClutterBehaviourScalePrivate *priv;
self->priv = priv = CLUTTER_BEHAVIOUR_SCALE_GET_PRIVATE (self);
}
/**
* clutter_behaviour_scale_new:
* @alpha: a #ClutterAlpha
* @scale_begin: FIXME
* @scale_end: FIXME
*
* FIXME
*
* Return value: the newly created #ClutterBehaviourScale
*/
ClutterBehaviour *
clutter_behaviour_scale_new (ClutterAlpha *alpha,
gdouble scale_begin,
gdouble scale_end,
ClutterGravity gravity)
{
ClutterBehaviourScale *behave;
behave = g_object_new (CLUTTER_TYPE_BEHAVIOUR_SCALE,
"alpha", alpha,
NULL);
behave->priv->scale_begin = CLUTTER_FLOAT_TO_FIXED (scale_begin);
behave->priv->scale_end = CLUTTER_FLOAT_TO_FIXED (scale_end);
behave->priv->gravity = gravity;
return CLUTTER_BEHAVIOUR (behave);
}

View file

@ -0,0 +1,97 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
* Jorn Baayen <jorn@openedhand.com>
* Emmanuele Bassi <ebassi@openedhand.com>
*
* Copyright (C) 2006 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __CLUTTER_BEHAVIOUR_SCALE_H__
#define __CLUTTER_BEHAVIOUR_SCALE_H__
#include <clutter/clutter-alpha.h>
#include <clutter/clutter-behaviour.h>
G_BEGIN_DECLS
#define CLUTTER_TYPE_BEHAVIOUR_SCALE (clutter_behaviour_scale_get_type ())
#define CLUTTER_BEHAVIOUR_SCALE(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), \
CLUTTER_TYPE_BEHAVIOUR_SCALE, ClutterBehaviourScale))
#define CLUTTER_BEHAVIOUR_SCALE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), \
CLUTTER_TYPE_BEHAVIOUR_SCALE, ClutterBehaviourScaleClass))
#define CLUTTER_IS_BEHAVIOUR_SCALE(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
CLUTTER_TYPE_BEHAVIOUR_SCALE))
#define CLUTTER_IS_BEHAVIOUR_SCALE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), \
CLUTTER_TYPE_BEHAVIOUR_SCALE))
#define CLUTTER_BEHAVIOUR_SCALE_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), \
CLUTTER_TYPE_BEHAVIOUR_SCALE, ClutterBehaviourScaleClass))
typedef struct _ClutterBehaviourScale ClutterBehaviourScale;
typedef struct _ClutterBehaviourScalePrivate ClutterBehaviourScalePrivate;
typedef struct _ClutterBehaviourScaleClass ClutterBehaviourScaleClass;
struct _ClutterBehaviourScale
{
ClutterBehaviour parent;
ClutterBehaviourScalePrivate *priv;
};
struct _ClutterBehaviourScaleClass
{
ClutterBehaviourClass parent_class;
};
typedef enum {
CLUTTER_GRAVITY_NONE = 0,
CLUTTER_GRAVITY_NORTH,
CLUTTER_GRAVITY_NORTH_EAST,
CLUTTER_GRAVITY_EAST,
CLUTTER_GRAVITY_SOUTH_EAST,
CLUTTER_GRAVITY_SOUTH,
CLUTTER_GRAVITY_SOUTH_WEST,
CLUTTER_GRAVITY_WEST,
CLUTTER_GRAVITY_NORTH_WEST,
CLUTTER_GRAVITY_CENTER
} ClutterGravity;
GType clutter_behaviour_scale_get_type (void) G_GNUC_CONST;
ClutterBehaviour*
clutter_behaviour_scale_new (ClutterAlpha *alpha,
gdouble scale_begin,
gdouble scale_end,
ClutterGravity gravity);
G_END_DECLS
#endif

View file

@ -1,8 +1,35 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
* Jorn Baayen <jorn@openedhand.com>
* Emmanuele Bassi <ebassi@openedhand.com>
*
* Copyright (C) 2006 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef _HAVE_CLUTTER_BEHAVIOUR_H
#define _HAVE_CLUTTER_BEHAVIOUR_H
#include <glib-object.h>
#include "clutter-alpha.h"
#include <clutter/clutter-alpha.h>
G_BEGIN_DECLS
@ -34,7 +61,8 @@ typedef struct _ClutterBehaviourClass ClutterBehaviourClass;
struct _ClutterBehaviour
{
GObject parent;
/*< private >*/
GObject parent;
ClutterBehaviourPrivate *priv;
};
@ -43,27 +71,27 @@ struct _ClutterBehaviourClass
GObjectClass parent_class;
void (*alpha_notify) (ClutterBehaviour *behave);
void (*_clutter_behaviour1) (void);
void (*_clutter_behaviour2) (void);
void (*_clutter_behaviour3) (void);
void (*_clutter_behaviour4) (void);
void (*_clutter_behaviour5) (void);
void (*_clutter_behaviour6) (void);
};
GType clutter_behaviour_get_type (void);
GType clutter_behaviour_get_type (void) G_GNUC_CONST;
void
clutter_behaviour_apply (ClutterBehaviour *behave, ClutterActor *actor);
void
clutter_behaviour_remove (ClutterBehaviour *behave, ClutterActor *actor);
void
clutter_behaviour_actors_foreach (ClutterBehaviour *behave,
GFunc func,
gpointer userdata);
ClutterAlpha*
clutter_behaviour_get_alpha (ClutterBehaviour *behave);
void
clutter_behaviour_set_alpha (ClutterBehaviour *behave,
ClutterAlpha *alpha);
void clutter_behaviour_apply (ClutterBehaviour *behave,
ClutterActor *actor);
void clutter_behaviour_remove (ClutterBehaviour *behave,
ClutterActor *actor);
void clutter_behaviour_actors_foreach (ClutterBehaviour *behave,
GFunc func,
gpointer data);
ClutterAlpha *clutter_behaviour_get_alpha (ClutterBehaviour *behave);
void clutter_behaviour_set_alpha (ClutterBehaviour *behave,
ClutterAlpha *alpha);
G_END_DECLS

View file

@ -1,631 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
*
* Copyright (C) 2006 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/**
* SECTION:clutter-behaviour
* @short_description: Class for providing common behaviours to actors
*
*/
/* TODO:
* o Document
* o Add props
* o Optimise
*/
#include "config.h"
#include "clutter-actor.h"
#include "clutter-behaviour.h"
#include "clutter-behaviours.h"
#include "clutter-enum-types.h"
#include "clutter-main.h"
#include <math.h>
static ClutterKnot *
clutter_knot_copy (const ClutterKnot *knot)
{
ClutterKnot *copy;
copy = g_slice_new0 (ClutterKnot);
*copy = *knot;
return copy;
}
static void
clutter_knot_free (ClutterKnot *knot)
{
if (G_LIKELY (knot))
{
g_slice_free (ClutterKnot, knot);
}
}
GType
clutter_knot_get_type (void)
{
static GType our_type = 0;
if (G_UNLIKELY (!our_type))
our_type = g_boxed_type_register_static
("ClutterKnot",
(GBoxedCopyFunc) clutter_knot_copy,
(GBoxedFreeFunc) clutter_knot_free);
return our_type;
}
G_DEFINE_TYPE (ClutterBehaviourPath, \
clutter_behaviour_path, \
CLUTTER_TYPE_BEHAVIOUR);
struct _ClutterBehaviourPathPrivate
{
GSList *knots;
};
#define CLUTTER_BEHAVIOUR_PATH_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
CLUTTER_TYPE_BEHAVIOUR_PATH, \
ClutterBehaviourPathPrivate))
static void
clutter_behaviour_path_alpha_notify (ClutterBehaviour *behave);
static void
clutter_behaviour_path_dispose (GObject *object)
{
ClutterBehaviourPath *self = CLUTTER_BEHAVIOUR_PATH(object);
if (self->priv)
{
/* FIXME: unref knots */
}
G_OBJECT_CLASS (clutter_behaviour_path_parent_class)->dispose (object);
}
static void
clutter_behaviour_path_finalize (GObject *object)
{
ClutterBehaviourPath *self = CLUTTER_BEHAVIOUR_PATH(object);
if (self->priv)
{
g_free(self->priv);
self->priv = NULL;
}
G_OBJECT_CLASS (clutter_behaviour_path_parent_class)->finalize (object);
}
static void
clutter_behaviour_path_class_init (ClutterBehaviourPathClass *klass)
{
GObjectClass *object_class;
ClutterBehaviourClass *behave_class;
object_class = (GObjectClass*) klass;
behave_class = (ClutterBehaviourClass*) klass;
object_class->finalize = clutter_behaviour_path_finalize;
object_class->dispose = clutter_behaviour_path_dispose;
behave_class->alpha_notify = clutter_behaviour_path_alpha_notify;
g_type_class_add_private (object_class, sizeof (ClutterBehaviourPathPrivate));
}
static void
clutter_behaviour_path_init (ClutterBehaviourPath *self)
{
ClutterBehaviourPathPrivate *priv;
self->priv = priv = CLUTTER_BEHAVIOUR_PATH_GET_PRIVATE (self);
}
static void
interpolate (const ClutterKnot *begin,
const ClutterKnot *end,
ClutterKnot *out,
double t)
{
/* FIXME: fixed point */
out->x = begin->x + t * (end->x - begin->x);
out->y = begin->y + t * (end->y - begin->y);
}
static gint
node_distance (const ClutterKnot *begin, const ClutterKnot *end)
{
g_return_val_if_fail (begin != NULL, 0);
g_return_val_if_fail (end != NULL, 0);
/* FIXME: need fixed point here */
return sqrt ((end->x - begin->x) * (end->x - begin->x) +
(end->y - begin->y) * (end->y - begin->y));
}
static gint
path_total_length (ClutterBehaviourPath *behave)
{
GSList *l;
gint len = 0;
for (l = behave->priv->knots; l != NULL; l = l->next)
if (l->next)
len += node_distance (l->data, l->next->data);
return len;
}
static void
actor_apply_knot_foreach (ClutterActor *actor,
ClutterKnot *knot)
{
clutter_actor_set_position (actor, knot->x, knot->y);
}
static void
path_alpha_to_position (ClutterBehaviourPath *behave)
{
guint32 alpha;
GSList *l;
gint total_len, offset, dist_to_next, dist = 0;
/* FIXME: Optimise. Much of the data used here can be pre-generated
* ( total_len, dist between knots ) when knots are added/removed.
*/
/* Calculation as follows:
* o Get total length of path
* o Find the offset on path where alpha val corresponds to
* o Figure out between which knots this offset lies.
* o Interpolate new co-ords via dist between these knots
* o Apply to actors.
*/
alpha = clutter_alpha_get_alpha
(clutter_behaviour_get_alpha (CLUTTER_BEHAVIOUR(behave)));
total_len = path_total_length (behave);
offset = (alpha * total_len) / CLUTTER_ALPHA_MAX_ALPHA;
if (offset == 0)
{
clutter_behaviour_actors_foreach (CLUTTER_BEHAVIOUR(behave),
(GFunc)actor_apply_knot_foreach,
behave->priv->knots->data);
return;
}
for (l = behave->priv->knots; l != NULL; l = l->next)
if (l->next)
{
dist_to_next = node_distance (l->data, l->next->data);
if (offset >= dist && offset < (dist + dist_to_next))
{
ClutterKnot new;
double t;
/* FIXME: Use fixed */
t = (double)(offset - dist) / dist_to_next ;
interpolate (l->data, l->next->data, &new, t);
clutter_behaviour_actors_foreach (CLUTTER_BEHAVIOUR(behave),
(GFunc)actor_apply_knot_foreach,
&new);
return;
}
dist += dist_to_next;
}
}
static void
clutter_behaviour_path_alpha_notify (ClutterBehaviour *behave)
{
path_alpha_to_position (CLUTTER_BEHAVIOUR_PATH(behave));
}
ClutterBehaviour*
clutter_behaviour_path_new (ClutterAlpha *alpha,
const ClutterKnot *knots,
guint n_knots)
{
ClutterBehaviourPath *behave;
gint i;
behave = g_object_new (CLUTTER_TYPE_BEHAVIOUR_PATH,
"alpha", alpha,
NULL);
for (i = 0; i < n_knots; i++)
{
ClutterKnot knot = knots[i];
clutter_path_behaviour_append_knot (behave, &knot);
}
return CLUTTER_BEHAVIOUR(behave);
}
GSList*
clutter_path_behaviour_get_knots (ClutterBehaviourPath *behave)
{
GSList *retval, *l;
g_return_val_if_fail (CLUTTER_IS_BEHAVIOUR_PATH (behave), NULL);
retval = NULL;
for (l = behave->priv->knots; l != NULL; l = l->next)
retval = g_slist_prepend (retval, l->data);
return g_slist_reverse (retval);
}
void
clutter_path_behaviour_append_knot (ClutterBehaviourPath *pathb,
const ClutterKnot *knot)
{
ClutterBehaviourPathPrivate *priv;
g_return_if_fail (knot != NULL);
priv = pathb->priv;
priv->knots = g_slist_append (priv->knots,
clutter_knot_copy (knot));
}
void
clutter_path_behaviour_append_knots_valist (ClutterBehaviourPath *pathb,
const ClutterKnot *first_knot,
va_list args)
{
const ClutterKnot * knot;
knot = first_knot;
while (knot)
{
clutter_path_behaviour_append_knot (pathb, knot);
knot = va_arg (args, ClutterKnot*);
}
}
void
clutter_path_behavior_append_knots (ClutterBehaviourPath *pathb,
const ClutterKnot *first_knot,
...)
{
va_list args;
g_return_if_fail (first_knot != NULL);
va_start (args, first_knot);
clutter_path_behaviour_append_knots_valist (pathb, first_knot, args);
va_end (args);
}
void
clutter_path_behavior_remove_knot (ClutterBehaviourPath *behave,
guint index)
{
/* FIXME: implement */
}
ClutterKnot*
clutter_path_behavior_get_knot (ClutterBehaviourPath *behave,
guint index)
{
/* FIXME: implement */
return NULL;
}
void
clutter_path_behavior_insert_knot (ClutterBehaviourPath *behave,
ClutterKnot *knot,
guint index)
{
/* FIXME: implement */
}
/*
* ====================== Opacity ============================
*/
G_DEFINE_TYPE (ClutterBehaviourOpacity, \
clutter_behaviour_opacity, \
CLUTTER_TYPE_BEHAVIOUR);
struct ClutterBehaviourOpacityPrivate
{
guint8 opacity_start;
guint8 opacity_end;
};
#define CLUTTER_BEHAVIOUR_OPACITY_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
CLUTTER_TYPE_BEHAVIOUR_OPACITY, \
ClutterBehaviourOpacityPrivate))
static void
clutter_behaviour_opacity_frame_foreach (ClutterActor *actor,
ClutterBehaviourOpacity *behave)
{
guint32 alpha;
guint8 opacity;
ClutterBehaviourOpacityPrivate *priv;
ClutterBehaviour *_behave;
priv = CLUTTER_BEHAVIOUR_OPACITY_GET_PRIVATE (behave);
_behave = CLUTTER_BEHAVIOUR (behave);
alpha = clutter_alpha_get_alpha (clutter_behaviour_get_alpha (_behave));
opacity = (alpha * (priv->opacity_end - priv->opacity_start))
/ CLUTTER_ALPHA_MAX_ALPHA;
opacity += priv->opacity_start;
CLUTTER_DBG("alpha %i opacity %i\n", alpha, opacity);
clutter_actor_set_opacity (actor, opacity);
}
static void
clutter_behaviour_opacity_alpha_notify (ClutterBehaviour *behave)
{
clutter_behaviour_actors_foreach
(behave,
(GFunc)clutter_behaviour_opacity_frame_foreach,
CLUTTER_BEHAVIOUR_OPACITY(behave));
}
static void
clutter_behaviour_opacity_dispose (GObject *object)
{
G_OBJECT_CLASS (clutter_behaviour_opacity_parent_class)->dispose (object);
}
static void
clutter_behaviour_opacity_finalize (GObject *object)
{
ClutterBehaviourOpacity *self = CLUTTER_BEHAVIOUR_OPACITY(object);
if (self->priv)
{
g_free(self->priv);
self->priv = NULL;
}
G_OBJECT_CLASS (clutter_behaviour_opacity_parent_class)->finalize (object);
}
static void
clutter_behaviour_opacity_class_init (ClutterBehaviourOpacityClass *klass)
{
GObjectClass *object_class;
ClutterBehaviourClass *behave_class;
object_class = (GObjectClass*) klass;
object_class->finalize = clutter_behaviour_opacity_finalize;
object_class->dispose = clutter_behaviour_opacity_dispose;
behave_class = (ClutterBehaviourClass*) klass;
behave_class->alpha_notify = clutter_behaviour_opacity_alpha_notify;
g_type_class_add_private (object_class, sizeof (ClutterBehaviourOpacityPrivate));
}
static void
clutter_behaviour_opacity_init (ClutterBehaviourOpacity *self)
{
ClutterBehaviourOpacityPrivate *priv;
self->priv = priv = CLUTTER_BEHAVIOUR_OPACITY_GET_PRIVATE (self);
}
ClutterBehaviour*
clutter_behaviour_opacity_new (ClutterAlpha *alpha,
guint8 opacity_start,
guint8 opacity_end)
{
ClutterBehaviourOpacity *behave;
behave = g_object_new (CLUTTER_TYPE_BEHAVIOUR_OPACITY,
"alpha", alpha,
NULL);
behave->priv->opacity_start = opacity_start;
behave->priv->opacity_end = opacity_end;
return CLUTTER_BEHAVIOUR(behave);
}
/*
* ====================== Scale ============================
*/
G_DEFINE_TYPE (ClutterBehaviourScale, \
clutter_behaviour_scale, \
CLUTTER_TYPE_BEHAVIOUR);
struct ClutterBehaviourScalePrivate
{
ClutterFixed scale_begin;
ClutterFixed scale_end;
ClutterGravity gravity;
};
#define CLUTTER_BEHAVIOUR_SCALE_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
CLUTTER_TYPE_BEHAVIOUR_SCALE, \
ClutterBehaviourScalePrivate))
static void
clutter_behaviour_scale_frame_foreach (ClutterActor *actor,
ClutterBehaviourScale *behave)
{
ClutterFixed scale, factor;
guint32 alpha;
ClutterBehaviourScalePrivate *priv;
ClutterBehaviour *_behave;
gint sw, sh, w, h;
priv = CLUTTER_BEHAVIOUR_SCALE_GET_PRIVATE (behave);
_behave = CLUTTER_BEHAVIOUR (behave);
alpha = clutter_alpha_get_alpha (clutter_behaviour_get_alpha (_behave));
/* FIXME: use all fixed if possible
factor = CLUTTER_FIXED_DIV(CLUTTER_INT_TO_FIXED(alpha/2),
CLUTTER_INT_TO_FIXED(CLUTTER_ALPHA_MAX_ALPHA/2));
*/
factor = CLUTTER_FLOAT_TO_FIXED((double) alpha / CLUTTER_ALPHA_MAX_ALPHA);
scale = CLUTTER_FIXED_MUL(factor, (priv->scale_end - priv->scale_begin));
scale += priv->scale_begin;
clutter_actor_set_scalex (actor, scale, scale);
if (priv->gravity == CLUTTER_GRAVITY_NONE
|| priv->gravity == CLUTTER_GRAVITY_NORTH_WEST)
return;
clutter_actor_get_abs_size (actor, (guint*)&sw, (guint*)&sh);
clutter_actor_get_size (actor, (guint*)&w, (guint*)&h);
switch (priv->gravity)
{
case CLUTTER_GRAVITY_NORTH:
break;
case CLUTTER_GRAVITY_NORTH_EAST:
break;
case CLUTTER_GRAVITY_EAST:
break;
case CLUTTER_GRAVITY_SOUTH_EAST:
break;
case CLUTTER_GRAVITY_SOUTH:
break;
case CLUTTER_GRAVITY_SOUTH_WEST:
break;
case CLUTTER_GRAVITY_WEST:
break;
case CLUTTER_GRAVITY_CENTER:
printf("%i vs %i\n", sw, w);
clutter_actor_move_by (actor, sw - w, sh - h);
default:
break;
}
}
static void
clutter_behaviour_scale_alpha_notify (ClutterBehaviour *behave)
{
clutter_behaviour_actors_foreach
(behave,
(GFunc)clutter_behaviour_scale_frame_foreach,
CLUTTER_BEHAVIOUR_SCALE(behave));
}
static void
clutter_behaviour_scale_dispose (GObject *object)
{
G_OBJECT_CLASS (clutter_behaviour_scale_parent_class)->dispose (object);
}
static void
clutter_behaviour_scale_finalize (GObject *object)
{
ClutterBehaviourScale *self = CLUTTER_BEHAVIOUR_SCALE(object);
if (self->priv)
{
g_free(self->priv);
self->priv = NULL;
}
G_OBJECT_CLASS (clutter_behaviour_scale_parent_class)->finalize (object);
}
static void
clutter_behaviour_scale_class_init (ClutterBehaviourScaleClass *klass)
{
GObjectClass *object_class;
ClutterBehaviourClass *behave_class;
object_class = (GObjectClass*) klass;
object_class->finalize = clutter_behaviour_scale_finalize;
object_class->dispose = clutter_behaviour_scale_dispose;
behave_class = (ClutterBehaviourClass*) klass;
behave_class->alpha_notify = clutter_behaviour_scale_alpha_notify;
g_type_class_add_private (object_class, sizeof (ClutterBehaviourScalePrivate));
}
static void
clutter_behaviour_scale_init (ClutterBehaviourScale *self)
{
ClutterBehaviourScalePrivate *priv;
self->priv = priv = CLUTTER_BEHAVIOUR_SCALE_GET_PRIVATE (self);
}
ClutterBehaviour*
clutter_behaviour_scale_new (ClutterAlpha *alpha,
double scale_begin,
double scale_end,
ClutterGravity gravity)
{
ClutterBehaviourScale *behave;
behave = g_object_new (CLUTTER_TYPE_BEHAVIOUR_SCALE,
"alpha", alpha,
NULL);
behave->priv->scale_begin = CLUTTER_FLOAT_TO_FIXED (scale_begin);
behave->priv->scale_end = CLUTTER_FLOAT_TO_FIXED (scale_end);
behave->priv->gravity = gravity;
return CLUTTER_BEHAVIOUR(behave);
}

View file

@ -1,192 +0,0 @@
#ifndef _HAVE_CLUTTER_BEHAVIOURS_H
#define _HAVE_CLUTTER_BEHAVIOURS_H
#include <glib-object.h>
#include "clutter-alpha.h"
#include "clutter-behaviour.h"
G_BEGIN_DECLS
#define CLUTTER_TYPE_KNOT (clutter_knot_get_type ())
typedef struct _ClutterKnot ClutterKnot;
struct _ClutterKnot
{
gint x,y;
/* FIXME: optionally include bezier control points also ? */
};
GType clutter_knot_get_type (void) G_GNUC_CONST;
#define CLUTTER_TYPE_BEHAVIOUR_PATH (clutter_behaviour_path_get_type ())
#define CLUTTER_BEHAVIOUR_PATH(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), \
CLUTTER_TYPE_BEHAVIOUR_PATH, ClutterBehaviourPath))
#define CLUTTER_BEHAVIOUR_PATH_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), \
CLUTTER_TYPE_BEHAVIOUR_PATH, ClutterBehaviourPathClass))
#define CLUTTER_IS_BEHAVIOUR_PATH(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
CLUTTER_TYPE_BEHAVIOUR_PATH))
#define CLUTTER_IS_BEHAVIOUR_PATH_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), \
CLUTTER_TYPE_BEHAVIOUR_PATH))
#define CLUTTER_BEHAVIOUR_PATH_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), \
CLUTTER_TYPE_BEHAVIOUR_PATH, ClutterBehaviourPathClass))
typedef struct _ClutterBehaviourPath ClutterBehaviourPath;
typedef struct _ClutterBehaviourPathPrivate ClutterBehaviourPathPrivate;
typedef struct _ClutterBehaviourPathClass ClutterBehaviourPathClass;
struct _ClutterBehaviourPath
{
ClutterBehaviour parent;
ClutterBehaviourPathPrivate *priv;
};
struct _ClutterBehaviourPathClass
{
ClutterBehaviourClass parent_class;
};
GType clutter_behaviour_path_get_type (void);
ClutterBehaviour*
clutter_behaviour_path_new (ClutterAlpha *alpha,
const ClutterKnot *knots,
guint n_knots);
GSList*
clutter_path_behaviour_get_knots (ClutterBehaviourPath *behave);
void
clutter_path_behaviour_append_knot (ClutterBehaviourPath *pathb,
const ClutterKnot *knot);
void
clutter_path_behaviour_append_knots_valist (ClutterBehaviourPath *pathb,
const ClutterKnot *first_knot,
va_list args);
void
clutter_path_behavior_append_knots (ClutterBehaviourPath *pathb,
const ClutterKnot *first_knot,
...);
/* ============================ opacity ======================== */
#define CLUTTER_TYPE_BEHAVIOUR_OPACITY clutter_behaviour_opacity_get_type()
#define CLUTTER_BEHAVIOUR_OPACITY(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), \
CLUTTER_TYPE_BEHAVIOUR_OPACITY, ClutterBehaviourOpacity))
#define CLUTTER_BEHAVIOUR_OPACITY_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), \
CLUTTER_TYPE_BEHAVIOUR_OPACITY, ClutterBehaviourOpacityClass))
#define CLUTTER_IS_BEHAVIOUR_OPACITY(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
CLUTTER_TYPE_BEHAVIOUR_OPACITY))
#define CLUTTER_IS_BEHAVIOUR_OPACITY_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), \
CLUTTER_TYPE_BEHAVIOUR_OPACITY))
#define CLUTTER_BEHAVIOUR_OPACITY_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), \
CLUTTER_TYPE_BEHAVIOUR_OPACITY, ClutterBehaviourOpacityClass))
typedef struct _ClutterBehaviourOpacity ClutterBehaviourOpacity;
typedef struct ClutterBehaviourOpacityPrivate ClutterBehaviourOpacityPrivate;
typedef struct _ClutterBehaviourOpacityClass ClutterBehaviourOpacityClass;
struct _ClutterBehaviourOpacity
{
ClutterBehaviour parent;
ClutterBehaviourOpacityPrivate *priv;
};
struct _ClutterBehaviourOpacityClass
{
ClutterBehaviourClass parent_class;
};
GType clutter_behaviour_opacity_get_type (void);
ClutterBehaviour*
clutter_behaviour_opacity_new (ClutterAlpha *alpha,
guint8 opacity_start,
guint8 opacity_end);
/* ============================ scale ======================== */
#define CLUTTER_TYPE_BEHAVIOUR_SCALE clutter_behaviour_scale_get_type()
#define CLUTTER_BEHAVIOUR_SCALE(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), \
CLUTTER_TYPE_BEHAVIOUR_SCALE, ClutterBehaviourScale))
#define CLUTTER_BEHAVIOUR_SCALE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), \
CLUTTER_TYPE_BEHAVIOUR_SCALE, ClutterBehaviourScaleClass))
#define CLUTTER_IS_BEHAVIOUR_SCALE(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
CLUTTER_TYPE_BEHAVIOUR_SCALE))
#define CLUTTER_IS_BEHAVIOUR_SCALE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), \
CLUTTER_TYPE_BEHAVIOUR_SCALE))
#define CLUTTER_BEHAVIOUR_SCALE_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), \
CLUTTER_TYPE_BEHAVIOUR_SCALE, ClutterBehaviourScaleClass))
typedef struct _ClutterBehaviourScale ClutterBehaviourScale;
typedef struct ClutterBehaviourScalePrivate ClutterBehaviourScalePrivate;
typedef struct _ClutterBehaviourScaleClass ClutterBehaviourScaleClass;
struct _ClutterBehaviourScale
{
ClutterBehaviour parent;
ClutterBehaviourScalePrivate *priv;
};
struct _ClutterBehaviourScaleClass
{
ClutterBehaviourClass parent_class;
};
typedef enum {
CLUTTER_GRAVITY_NONE = 0,
CLUTTER_GRAVITY_NORTH,
CLUTTER_GRAVITY_NORTH_EAST,
CLUTTER_GRAVITY_EAST,
CLUTTER_GRAVITY_SOUTH_EAST,
CLUTTER_GRAVITY_SOUTH,
CLUTTER_GRAVITY_SOUTH_WEST,
CLUTTER_GRAVITY_WEST,
CLUTTER_GRAVITY_NORTH_WEST,
CLUTTER_GRAVITY_CENTER
} ClutterGravity;
GType clutter_behaviour_scale_get_type (void);
ClutterBehaviour*
clutter_behaviour_scale_new (ClutterAlpha *alpha,
double scale_begin,
double scale_end,
ClutterGravity gravity);
G_END_DECLS
#endif

View file

@ -277,7 +277,7 @@ clutter_feature_available (ClutterFeatureFlags feature)
}
/**
* clutter_feature_all:
* clutter_feature_get_all:
*
* Returns all the suppoerted features.
*
@ -286,7 +286,7 @@ clutter_feature_available (ClutterFeatureFlags feature)
* Since: 0.1.1
*/
ClutterFeatureFlags
clutter_feature_all (void)
clutter_feature_get_all (void)
{
return __features->flags;
}

View file

@ -45,9 +45,9 @@ typedef enum
CLUTTER_FEATURE_SYNC_TO_VBLANK = (1 << 2)
} ClutterFeatureFlags;
gboolean clutter_feature_available (ClutterFeatureFlags flags);
ClutterFeatureFlags clutter_feature_get_all (void);
void clutter_feature_wait_for_vblank ();
gboolean clutter_feature_available (ClutterFeatureFlags flags);
ClutterFeatureFlags clutter_feature_get_all (void);
void clutter_feature_wait_for_vblank (void);
G_END_DECLS

View file

@ -67,10 +67,6 @@ struct _ClutterMediaInterface
int (*get_duration) (ClutterMedia *media);
/* signals */
#if 0
void (* metadata_available) (ClutterMedia *media,
GstTagList *tag_list);
#endif
void (* eos) (ClutterMedia *media);
void (* error) (ClutterMedia *media,
GError *error);

View file

@ -32,6 +32,9 @@
* as animations.
*/
#ifndef HAVE_CONFIG_H
#include "config.h"
#endif
#include "clutter-timeline.h"
#include "clutter-main.h"
@ -42,32 +45,35 @@ G_DEFINE_TYPE (ClutterTimeline, clutter_timeline, G_TYPE_OBJECT);
#define FPS_TO_INTERVAL(f) (1000/f)
struct ClutterTimelinePrivate
struct _ClutterTimelinePrivate
{
guint timeout_id;
guint fps;
guint nframes;
guint current_frame_num;
gulong last_frame_msecs;
gulong start_frame_secs;
guint timeout_id;
guint fps;
guint n_frames;
guint current_frame_num;
guint loop : 1;
gulong last_frame_msecs;
gulong start_frame_secs;
guint loop : 1;
};
enum
{
PROP_0,
PROP_FPS,
PROP_NFRAMES,
PROP_NUM_FRAMES,
PROP_LOOP
};
enum
{
SIGNAL_NEW_FRAME,
SIGNAL_STARTED,
SIGNAL_PAUSED,
SIGNAL_COMPLETED,
NEW_FRAME,
STARTED,
PAUSED,
COMPLETED,
LAST_SIGNAL
};
@ -92,8 +98,8 @@ clutter_timeline_set_property (GObject *object,
case PROP_FPS:
clutter_timeline_set_speed (timeline, g_value_get_int (value));
break;
case PROP_NFRAMES:
priv->nframes = g_value_get_int (value);
case PROP_NUM_FRAMES:
priv->n_frames = g_value_get_int (value);
break;
case PROP_LOOP:
priv->loop = g_value_get_boolean (value);
@ -121,8 +127,8 @@ clutter_timeline_get_property (GObject *object,
case PROP_FPS:
g_value_set_int (value, priv->fps);
break;
case PROP_NFRAMES:
g_value_set_int (value, priv->nframes);
case PROP_NUM_FRAMES:
g_value_set_int (value, priv->n_frames);
break;
case PROP_LOOP:
g_value_set_boolean (value, priv->loop);
@ -185,7 +191,7 @@ clutter_timeline_class_init (ClutterTimelineClass *klass)
G_PARAM_CONSTRUCT | G_PARAM_READWRITE));
g_object_class_install_property
(object_class, PROP_NFRAMES,
(object_class, PROP_NUM_FRAMES,
g_param_spec_int ("num-frames",
"Total number of frames",
"Timelines total number of frames",
@ -202,7 +208,7 @@ clutter_timeline_class_init (ClutterTimelineClass *klass)
FALSE,
G_PARAM_CONSTRUCT | G_PARAM_READWRITE));
timeline_signals[SIGNAL_NEW_FRAME] =
timeline_signals[NEW_FRAME] =
g_signal_new ("new-frame",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
@ -211,7 +217,7 @@ clutter_timeline_class_init (ClutterTimelineClass *klass)
clutter_marshal_VOID__INT,
G_TYPE_NONE,
1, G_TYPE_INT);
timeline_signals[SIGNAL_COMPLETED] =
timeline_signals[COMPLETED] =
g_signal_new ("completed",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
@ -219,7 +225,7 @@ clutter_timeline_class_init (ClutterTimelineClass *klass)
NULL, NULL,
clutter_marshal_VOID__VOID,
G_TYPE_NONE, 0);
timeline_signals[SIGNAL_STARTED] =
timeline_signals[STARTED] =
g_signal_new ("started",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
@ -227,7 +233,7 @@ clutter_timeline_class_init (ClutterTimelineClass *klass)
NULL, NULL,
clutter_marshal_VOID__VOID,
G_TYPE_NONE, 0);
timeline_signals[SIGNAL_PAUSED] =
timeline_signals[PAUSED] =
g_signal_new ("paused",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
@ -251,7 +257,7 @@ timeline_timeout_func (gpointer data)
ClutterTimeline *timeline = CLUTTER_TIMELINE(data);
ClutterTimelinePrivate *priv;
GTimeVal timeval;
gint nframes;
gint n_frames;
gulong msecs;
priv = timeline->priv;
@ -260,7 +266,7 @@ timeline_timeout_func (gpointer data)
g_get_current_time (&timeval);
/* Fire off signal */
g_signal_emit (timeline, timeline_signals[SIGNAL_NEW_FRAME],
g_signal_emit (timeline, timeline_signals[NEW_FRAME],
0, priv->current_frame_num);
/* Signal frees timeline ? */
@ -281,33 +287,35 @@ timeline_timeout_func (gpointer data)
*/
msecs = ((timeval.tv_sec - priv->start_frame_secs) * 1000)
+ (timeval.tv_usec / 1000);
nframes = (msecs - priv->last_frame_msecs ) / (1000 / priv->fps);
if (nframes < 0) nframes = 1;
n_frames = (msecs - priv->last_frame_msecs ) / (1000 / priv->fps);
if (n_frames < 0)
n_frames = 1;
if (nframes > 1)
CLUTTER_DBG("*** Skipping %i frames ***", nframes);
if (n_frames > 1)
CLUTTER_DBG("*** Skipping %i frames ***", n_frames);
}
else
{
/* First frame, set up timings.*/
priv->start_frame_secs = timeval.tv_sec;
msecs = timeval.tv_usec / 1000;
nframes = 1;
n_frames = 1;
}
priv->last_frame_msecs = msecs;
/* Advance frames */
priv->current_frame_num += nframes;;
priv->current_frame_num += n_frames;;
/* Handle loop or stop */
if (priv->current_frame_num > priv->nframes)
if (priv->current_frame_num > priv->n_frames)
{
priv->current_frame_num = priv->nframes;
priv->current_frame_num = priv->n_frames;
if (nframes > 1)
if (n_frames > 1)
{
g_signal_emit (timeline, timeline_signals[SIGNAL_NEW_FRAME],
g_signal_emit (timeline, timeline_signals[NEW_FRAME],
0, priv->current_frame_num);
}
@ -316,7 +324,7 @@ timeline_timeout_func (gpointer data)
else
{
clutter_timeline_stop (timeline);
g_signal_emit (timeline, timeline_signals[SIGNAL_COMPLETED], 0);
g_signal_emit (timeline, timeline_signals[COMPLETED], 0);
return FALSE;
}
}
@ -344,7 +352,7 @@ clutter_timeline_start (ClutterTimeline *timeline)
timeline_timeout_func,
(gpointer)timeline);
g_signal_emit (timeline, timeline_signals[SIGNAL_STARTED], 0);
g_signal_emit (timeline, timeline_signals[STARTED], 0);
}
/**
@ -364,7 +372,7 @@ clutter_timeline_pause (ClutterTimeline *timeline)
timeline->priv->timeout_id = 0;
timeline->priv->last_frame_msecs = 0;
g_signal_emit (timeline, timeline_signals[SIGNAL_PAUSED], 0);
g_signal_emit (timeline, timeline_signals[PAUSED], 0);
}
/**
@ -395,9 +403,12 @@ clutter_timeline_set_loop (ClutterTimeline *timeline,
if (timeline->priv->loop != loop)
{
g_object_ref (timeline);
timeline->priv->loop = loop;
g_object_notify (G_OBJECT (timeline), "loop");
g_object_unref (timeline);
}
}
@ -434,12 +445,13 @@ clutter_timeline_rewind (ClutterTimeline *timeline)
/**
* clutter_timeline_skip:
* @timeline: A #ClutterTimeline
* @nframes: Number of frames to skip
* @n_frames: Number of frames to skip
*
* Advance timeline by requested number of frames.
**/
void
clutter_timeline_skip (ClutterTimeline *timeline, guint nframes)
clutter_timeline_skip (ClutterTimeline *timeline,
guint n_frames)
{
ClutterTimelinePrivate *priv;
@ -447,9 +459,9 @@ clutter_timeline_skip (ClutterTimeline *timeline, guint nframes)
priv = timeline->priv;
priv->current_frame_num += nframes;
priv->current_frame_num += n_frames;
if (priv->current_frame_num > priv->nframes)
if (priv->current_frame_num > priv->n_frames)
priv->current_frame_num = 1;
}
@ -461,7 +473,8 @@ clutter_timeline_skip (ClutterTimeline *timeline, guint nframes)
* Advance timeline to requested frame number
**/
void
clutter_timeline_advance (ClutterTimeline *timeline, guint frame_num)
clutter_timeline_advance (ClutterTimeline *timeline,
guint frame_num)
{
ClutterTimelinePrivate *priv;
@ -469,7 +482,7 @@ clutter_timeline_advance (ClutterTimeline *timeline, guint frame_num)
priv = timeline->priv;
if (frame_num < priv->nframes)
if (frame_num < priv->n_frames)
priv->current_frame_num = frame_num;
}
@ -493,7 +506,7 @@ clutter_timeline_get_current_frame (ClutterTimeline *timeline)
* clutter_timeline_get_n_frames:
* @timeline: A #ClutterTimeline
*
* Request the totle number of frames for the #ClutterTimeline.
* Request the total number of frames for the #ClutterTimeline.
*
* Return Value: Number of frames for this #ClutterTimeline.
**/
@ -502,7 +515,35 @@ clutter_timeline_get_n_frames (ClutterTimeline *timeline)
{
g_return_val_if_fail (CLUTTER_IS_TIMELINE (timeline), 0);
return timeline->priv->nframes;
return timeline->priv->n_frames;
}
/**
* clutter_timeline_set_n_frames:
* @timeline: a #ClutterTimeline
* @n_frames: the number of frames
*
* Sets the total number of frames for @timeline
*/
void
clutter_timeline_set_n_frames (ClutterTimeline *timeline,
guint n_frames)
{
ClutterTimelinePrivate *priv;
g_return_if_fail (CLUTTER_IS_TIMELINE (timeline));
priv = timeline->priv;
if (priv->n_frames != n_frames)
{
g_object_ref (timeline);
priv->n_frames = n_frames;
g_object_notify (G_OBJECT (timeline), "num-frames");
g_object_unref (timeline);
}
}
/**
@ -513,7 +554,8 @@ clutter_timeline_get_n_frames (ClutterTimeline *timeline)
* Set the speed in frames per second of the timeline.
**/
void
clutter_timeline_set_speed (ClutterTimeline *timeline, guint fps)
clutter_timeline_set_speed (ClutterTimeline *timeline,
guint fps)
{
ClutterTimelinePrivate *priv;
@ -521,18 +563,43 @@ clutter_timeline_set_speed (ClutterTimeline *timeline, guint fps)
priv = timeline->priv;
priv->fps = fps;
/* if the timeline is playing restart */
if (priv->timeout_id)
if (priv->fps != fps)
{
g_source_remove (priv->timeout_id);
priv->timeout_id = g_timeout_add (FPS_TO_INTERVAL(priv->fps),
timeline_timeout_func,
(gpointer)timeline);
g_object_ref (timeline);
priv->fps = fps;
/* if the timeline is playing restart */
if (priv->timeout_id)
{
g_source_remove (priv->timeout_id);
priv->timeout_id = g_timeout_add (FPS_TO_INTERVAL (priv->fps),
timeline_timeout_func,
timeline);
}
g_object_notify (G_OBJECT (timeline), "fps");
g_object_unref (timeline);
}
}
/**
* clutter_timeline_get_speed:
* @timeline: a #ClutterTimeline
*
* Gets the frames per second played by @timeline
*
* Return value: the number of frames per second.
*/
guint
clutter_timeline_get_speed (ClutterTimeline *timeline)
{
g_return_val_if_fail (CLUTTER_IS_TIMELINE (timeline), 0);
return timeline->priv->fps;
}
/**
* clutter_timeline_is_playing:
* @timeline: A #ClutterTimeline
@ -551,19 +618,19 @@ clutter_timeline_is_playing (ClutterTimeline *timeline)
/**
* clutter_timeline_new:
* @nframes: #ClutterTimeline number of frames
* @fps: #ClutterTimeline frames per second
* @n_frames: the number of frames
* @fps: the number of frames per second
*
* Create a new #ClutterTimeline instance.
*
* Return Value: a new #ClutterTimeline
*/
ClutterTimeline*
clutter_timeline_new (guint nframes,
clutter_timeline_new (guint n_frames,
guint fps)
{
return g_object_new (CLUTTER_TYPE_TIMELINE,
"fps", fps,
"num-frames", nframes,
"num-frames", n_frames,
NULL);
}

View file

@ -54,14 +54,13 @@ G_BEGIN_DECLS
(G_TYPE_INSTANCE_GET_CLASS ((obj), \
CLUTTER_TYPE_TIMELINE, ClutterTimelineClass))
typedef struct _ClutterTimeline ClutterTimeline;
typedef struct _ClutterTimelineClass ClutterTimelineClass;
typedef struct ClutterTimelinePrivate ClutterTimelinePrivate;
typedef guint32 (*ClutterTimelineAlphaFunc) (ClutterTimeline *timeline);
typedef struct _ClutterTimeline ClutterTimeline;
typedef struct _ClutterTimelineClass ClutterTimelineClass;
typedef struct _ClutterTimelinePrivate ClutterTimelinePrivate;
struct _ClutterTimeline
{
/*< private >*/
GObject parent;
ClutterTimelinePrivate *priv;
};
@ -84,46 +83,29 @@ struct _ClutterTimelineClass
void (*_clutter_timeline_5) (void);
};
GType clutter_timeline_get_type (void);
GType clutter_timeline_get_type (void) G_GNUC_CONST;
ClutterTimeline*
clutter_timeline_new (guint nframes, guint fps);
void
clutter_timeline_set_speed (ClutterTimeline *timeline, guint fps);
void
clutter_timeline_start (ClutterTimeline *timeline);
void
clutter_timeline_pause (ClutterTimeline *timeline);
void
clutter_timeline_stop (ClutterTimeline *timeline);
void
clutter_timeline_set_loop (ClutterTimeline *timeline, gboolean loop);
gboolean
clutter_timeline_get_loop (ClutterTimeline *timeline);
void
clutter_timeline_rewind (ClutterTimeline *timeline);
void
clutter_timeline_skip (ClutterTimeline *timeline, guint nframes);
void
clutter_timeline_advance (ClutterTimeline *timeline, guint frame_num);
gint
clutter_timeline_get_current_frame (ClutterTimeline *timeline);
guint
clutter_timeline_get_n_frames (ClutterTimeline *timeline);
gboolean
clutter_timeline_is_playing (ClutterTimeline *timeline);
ClutterTimeline *clutter_timeline_new (guint n_frames,
guint fps);
guint clutter_timeline_get_speed (ClutterTimeline *timeline);
void clutter_timeline_set_speed (ClutterTimeline *timeline,
guint fps);
void clutter_timeline_start (ClutterTimeline *timeline);
void clutter_timeline_pause (ClutterTimeline *timeline);
void clutter_timeline_stop (ClutterTimeline *timeline);
void clutter_timeline_set_loop (ClutterTimeline *timeline,
gboolean loop);
gboolean clutter_timeline_get_loop (ClutterTimeline *timeline);
void clutter_timeline_rewind (ClutterTimeline *timeline);
void clutter_timeline_skip (ClutterTimeline *timeline,
guint n_frames);
void clutter_timeline_advance (ClutterTimeline *timeline,
guint frame_num);
gint clutter_timeline_get_current_frame (ClutterTimeline *timeline);
void clutter_timeline_set_n_frames (ClutterTimeline *timeline,
guint n_frames);
guint clutter_timeline_get_n_frames (ClutterTimeline *timeline);
gboolean clutter_timeline_is_playing (ClutterTimeline *timeline);
G_END_DECLS

View file

@ -89,20 +89,3 @@ clutter_util_next_p2 (int a)
return rval;
}
#if 0
gboolean
clutter_util_can_create_texture (int width, int height)
{
GLint new_width;
glTexImage2D (GL_PROXY_VIDEO_TEXTURE_2D, 0, GL_RGBA,
width, height, 0 /* border */,
GL_RGBA, PIXEL_TYPE, NULL);
glGetTexLevelParameteriv (GL_PROXY_VIDEO_TEXTURE_2D, 0,
GL_VIDEO_TEXTURE_WIDTH, &new_width);
return new_width != 0;
}
#endif

View file

@ -39,9 +39,6 @@ clutter_util_untrap_x_errors(void);
int
clutter_util_next_p2 (int a);
gboolean
clutter_util_can_create_texture (int width, int height);
G_END_DECLS
#endif

View file

@ -8,7 +8,9 @@
#include "clutter-event.h"
#include "clutter-timeline.h"
#include "clutter-behaviour.h"
#include "clutter-behaviours.h"
#include "clutter-behaviour-opacity.h"
#include "clutter-behaviour-path.h"
#include "clutter-behaviour-scale.h"
#include "clutter-stage.h"
#include "clutter-actor.h"
#include "clutter-rectangle.h"

View file

@ -1,3 +1,8 @@
2006-11-15 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-sections.txt:
* tmpl/*.sgml: Update with the latest API changes.
2006-09-14 Emmanuele Bassi <ebassi@openedhand.com>
D tmpl/clutter-video-texture.sgml

View file

@ -12,7 +12,7 @@ AUTOMAKE_OPTIONS = 1.6
DOC_MODULE=clutter
# The top-level SGML file. You can change this if you want to.
DOC_MAIN_SGML_FILE=clutter-docs.sgml
DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.sgml
# The directory containing the source code. Relative to $(srcdir).
# gtk-doc will search all .c & .h files beneath here for inline comments
@ -21,7 +21,7 @@ DOC_MAIN_SGML_FILE=clutter-docs.sgml
DOC_SOURCE_DIR=../../clutter
# Extra options to pass to gtkdoc-scangobj. Not normally needed.
SCANGOBJ_OPTIONS=
SCANGOBJ_OPTIONS=--type-init-func="clutter_init(0,0)"
# Extra options to supply to gtkdoc-scan.
# e.g. SCAN_OPTIONS=--deprecated-guards="GTK_DISABLE_DEPRECATED"

View file

@ -73,11 +73,18 @@
<xi:include href="xml/clutter-rectangle.xml"/>
<xi:include href="xml/clutter-texture.xml"/>
<xi:include href="xml/clutter-clone-texture.xml"/>
<xi:include href="xml/clutter-video-texture.xml"/>
<xi:include href="xml/clutter-label.xml"/>
<xi:include href="xml/clutter-timeline.xml"/>
<xi:include href="xml/clutter-media.xml"/>
</chapter>
<chapter>
<title>Clutter Behaviours</title>
<xi:include href="xml/clutter-alpha.xml"/>
<xi:include href="xml/clutter-behaviour.xml"/>
<xi:include href="xml/clutter-behaviour-opacity.xml"/>
<xi:include href="xml/clutter-behaviour-path.xml"/>
<xi:include href="xml/clutter-behaviour-scale.xml"/>
</chapter>
<chapter>
<title>Clutter Tools</title>
<xi:include href="xml/clutter-main.xml"/>

View file

@ -1,183 +1,3 @@
<SECTION>
<FILE>clutter-label</FILE>
<TITLE>ClutterLabel</TITLE>
ClutterLabel
clutter_label_new
clutter_label_new_with_text
clutter_label_set_text
clutter_label_get_text
clutter_label_set_font_name
clutter_label_get_font_name
clutter_label_set_color
clutter_label_get_color
clutter_label_set_text_extents
clutter_label_get_text_extents
<SUBSECTION Standard>
ClutterLabelClass
CLUTTER_LABEL
CLUTTER_IS_LABEL
CLUTTER_TYPE_LABEL
CLUTTER_LABEL_CLASS
CLUTTER_IS_LABEL_CLASS
CLUTTER_LABEL_GET_CLASS
<SUBSECTION Private>
ClutterLabelPrivate
clutter_label_get_type
</SECTION>
<SECTION>
<FILE>clutter-clone-texture</FILE>
<TITLE>ClutterCloneTexture</TITLE>
ClutterCloneTexture
clutter_clone_texture_new
<SUBSECTION Standard>
ClutterCloneTextureClass
CLUTTER_CLONE_TEXTURE
CLUTTER_IS_CLONE_TEXTURE
CLUTTER_TYPE_CLONE_TEXTURE
CLUTTER_CLONE_TEXTURE_CLASS
CLUTTER_IS_CLONE_TEXTURE_CLASS
CLUTTER_CLONE_TEXTURE_GET_CLASS
<SUBSECTION Private>
ClutterCloneTexturePrivate
clutter_clone_texture_get_type
</SECTION>
<SECTION>
<FILE>clutter-group</FILE>
<TITLE>ClutterGroup</TITLE>
ClutterGroup
clutter_group_new
clutter_group_get_children
clutter_group_foreach
clutter_group_add
clutter_group_add_many_valist
clutter_group_add_many
clutter_group_remove
clutter_group_show_all
clutter_group_hide_all
clutter_group_find_child_by_id
clutter_group_raise
clutter_group_lower
clutter_group_sort_depth_order
<SUBSECTION Standard>
ClutterGroupClass
CLUTTER_GROUP
CLUTTER_IS_GROUP
CLUTTER_TYPE_GROUP
CLUTTER_GROUP_CLASS
CLUTTER_IS_GROUP_CLASS
CLUTTER_GROUP_GET_CLASS
<SUBSECTION Private>
ClutterGroupPrivate
clutter_group_get_type
</SECTION>
<SECTION>
<FILE>clutter-texture</FILE>
<TITLE>ClutterTexture</TITLE>
ClutterTexture
clutter_texture_new_from_pixbuf
clutter_texture_new
clutter_texture_set_pixbuf
clutter_texture_get_pixbuf
clutter_texture_get_base_size
clutter_texture_bind_tile
clutter_texture_get_n_tiles
clutter_texture_get_x_tile_detail
clutter_texture_get_y_tile_detail
clutter_texture_has_generated_tiles
clutter_texture_is_tiled
<SUBSECTION Standard>
ClutterTextureClass
CLUTTER_TEXTURE
CLUTTER_IS_TEXTURE
CLUTTER_TYPE_TEXTURE
CLUTTER_TEXTURE_CLASS
CLUTTER_IS_TEXTURE_CLASS
CLUTTER_TEXTURE_GET_CLASS
<SUBSECTION Private>
ClutterTexturePrivate
clutter_texture_get_type
</SECTION>
<SECTION>
<FILE>clutter-stage</FILE>
CLUTTER_STAGE_WIDTH
CLUTTER_STAGE_HEIGHT
<TITLE>ClutterStage</TITLE>
ClutterStage
clutter_stage_get_default
clutter_stage_get_xwindow
clutter_stage_set_xwindow_foreign
clutter_stage_set_color
clutter_stage_get_color
clutter_stage_get_actor_at_pos
clutter_stage_snapshot
<SUBSECTION Standard>
ClutterStageClass
CLUTTER_STAGE
CLUTTER_IS_STAGE
CLUTTER_TYPE_STAGE
CLUTTER_STAGE_CLASS
CLUTTER_IS_STAGE_CLASS
CLUTTER_STAGE_GET_CLASS
<SUBSECTION Private>
ClutterStagePrivate
clutter_stage_get_type
</SECTION>
<SECTION>
<FILE>clutter-rectangle</FILE>
<TITLE>ClutterRectangle</TITLE>
ClutterRectangle
clutter_rectangle_new
clutter_rectangle_new_with_color
clutter_rectangle_get_color
clutter_rectangle_set_color
<SUBSECTION Standard>
ClutterRectangleClass
CLUTTER_RECTANGLE
CLUTTER_IS_RECTANGLE
CLUTTER_TYPE_RECTANGLE
CLUTTER_RECTANGLE_CLASS
CLUTTER_IS_RECTANGLE_CLASS
CLUTTER_RECTANGLE_GET_CLASS
<SUBSECTION Private>
ClutterRectanglePrivate
clutter_rectangle_get_type
</SECTION>
<SECTION>
<FILE>clutter-timeline</FILE>
<TITLE>ClutterTimeline</TITLE>
ClutterTimeline
clutter_timeline_new
clutter_timeline_set_speed
clutter_timeline_start
clutter_timeline_pause
clutter_timeline_stop
clutter_timeline_set_loop
clutter_timeline_get_loop
clutter_timeline_rewind
clutter_timeline_skip
clutter_timeline_advance
clutter_timeline_get_current_frame
clutter_timeline_get_n_frames
clutter_timeline_is_playing
<SUBSECTION Standard>
ClutterTimelineClass
CLUTTER_TIMELINE
CLUTTER_IS_TIMELINE
CLUTTER_TYPE_TIMELINE
CLUTTER_TIMELINE_CLASS
CLUTTER_IS_TIMELINE_CLASS
CLUTTER_TIMELINE_GET_CLASS
<SUBSECTION Private>
ClutterTimelinePrivate
clutter_timeline_get_type
</SECTION>
<SECTION>
<FILE>clutter-media</FILE>
CLUTTER_MEDIA_GET_INTERFACE
@ -199,10 +19,163 @@ clutter_media_set_filename
CLUTTER_MEDIA
CLUTTER_IS_MEDIA
CLUTTER_TYPE_MEDIA
<SUBSECTION Private>
clutter_media_get_type
</SECTION>
<SECTION>
<FILE>clutter-label</FILE>
<TITLE>ClutterLabel</TITLE>
ClutterLabel
ClutterLabelClass
clutter_label_new
clutter_label_new_with_text
clutter_label_set_text
clutter_label_get_text
clutter_label_set_font_name
clutter_label_get_font_name
clutter_label_set_color
clutter_label_get_color
clutter_label_set_ellipsize
clutter_label_get_ellipsize
clutter_label_set_line_wrap
clutter_label_get_line_wrap
clutter_label_set_line_wrap_mode
clutter_label_get_line_wrap_mode
clutter_label_get_layout
clutter_label_set_attributes
clutter_label_get_attributes
clutter_label_set_use_markup
clutter_label_get_use_markup
clutter_label_set_alignment
clutter_label_get_alignment
<SUBSECTION Standard>
CLUTTER_LABEL
CLUTTER_IS_LABEL
CLUTTER_TYPE_LABEL
CLUTTER_LABEL_CLASS
CLUTTER_IS_LABEL_CLASS
CLUTTER_LABEL_GET_CLASS
<SUBSECTION Private>
ClutterLabelPrivate
clutter_label_get_type
</SECTION>
<SECTION>
<FILE>clutter-behaviour</FILE>
<TITLE>ClutterBehaviour</TITLE>
ClutterBehaviour
ClutterBehaviourClass
clutter_behaviour_apply
clutter_behaviour_remove
clutter_behaviour_actors_foreach
clutter_behaviour_get_alpha
clutter_behaviour_set_alpha
<SUBSECTION Standard>
CLUTTER_BEHAVIOUR
CLUTTER_IS_BEHAVIOUR
CLUTTER_TYPE_BEHAVIOUR
CLUTTER_BEHAVIOUR_CLASS
CLUTTER_IS_BEHAVIOUR_CLASS
CLUTTER_BEHAVIOUR_GET_CLASS
<SUBSECTION Private>
ClutterBehaviourPrivate
clutter_behaviour_get_type
</SECTION>
<SECTION>
<FILE>clutter-alpha</FILE>
<TITLE>ClutterAlpha</TITLE>
ClutterAlpha
ClutterAlphaClass
clutter_alpha_new
clutter_alpha_new_full
clutter_alpha_get_alpha
CLUTTER_ALPHA_MAX_ALPHA
ClutterAlphaFunc
clutter_alpha_set_func
clutter_alpha_set_timeline
clutter_alpha_get_timeline
<SUBSECTION Standard>
CLUTTER_ALPHA
CLUTTER_IS_ALPHA
CLUTTER_TYPE_ALPHA
clutter_alpha_get_type
CLUTTER_ALPHA_CLASS
CLUTTER_IS_ALPHA_CLASS
CLUTTER_ALPHA_GET_CLASS
<SUBSECTION Private>
ClutterAlphaPrivate
</SECTION>
<SECTION>
<FILE>clutter-clone-texture</FILE>
<TITLE>ClutterCloneTexture</TITLE>
ClutterCloneTexture
ClutterCloneTextureClass
clutter_clone_texture_new
<SUBSECTION Standard>
CLUTTER_CLONE_TEXTURE
CLUTTER_IS_CLONE_TEXTURE
CLUTTER_TYPE_CLONE_TEXTURE
CLUTTER_CLONE_TEXTURE_CLASS
CLUTTER_IS_CLONE_TEXTURE_CLASS
CLUTTER_CLONE_TEXTURE_GET_CLASS
<SUBSECTION Private>
ClutterCloneTexturePrivate
clutter_clone_texture_get_type
</SECTION>
<SECTION>
<FILE>clutter-group</FILE>
<TITLE>ClutterGroup</TITLE>
ClutterGroup
ClutterGroupClass
clutter_group_new
clutter_group_get_children
clutter_group_foreach
clutter_group_add
clutter_group_add_many_valist
clutter_group_add_many
clutter_group_remove
clutter_group_show_all
clutter_group_hide_all
clutter_group_find_child_by_id
clutter_group_raise
clutter_group_lower
clutter_group_sort_depth_order
<SUBSECTION Standard>
CLUTTER_GROUP
CLUTTER_IS_GROUP
CLUTTER_TYPE_GROUP
CLUTTER_GROUP_CLASS
CLUTTER_IS_GROUP_CLASS
CLUTTER_GROUP_GET_CLASS
<SUBSECTION Private>
ClutterGroupPrivate
clutter_group_get_type
</SECTION>
<SECTION>
<FILE>clutter-rectangle</FILE>
<TITLE>ClutterRectangle</TITLE>
ClutterRectangle
ClutterRectangleClass
clutter_rectangle_new
clutter_rectangle_new_with_color
clutter_rectangle_get_color
clutter_rectangle_set_color
<SUBSECTION Standard>
CLUTTER_RECTANGLE
CLUTTER_IS_RECTANGLE
CLUTTER_TYPE_RECTANGLE
CLUTTER_RECTANGLE_CLASS
CLUTTER_IS_RECTANGLE_CLASS
CLUTTER_RECTANGLE_GET_CLASS
<SUBSECTION Private>
ClutterRectanglePrivate
clutter_rectangle_get_type
</SECTION>
<SECTION>
<FILE>clutter-actor</FILE>
CLUTTER_TYPE_GEOMETRY
@ -213,32 +186,38 @@ CLUTTER_ACTOR_IS_MAPPED
CLUTTER_ACTOR_IS_REALIZED
CLUTTER_ACTOR_IS_VISIBLE
ClutterActorBox
ClutterActorPrivate
ClutterGeometry
ClutterCallback
CLUTTER_CALLBACK
ClutterActorFlags
clutter_actor_box_get_type
<TITLE>ClutterActor</TITLE>
ClutterActor
ClutterActorClass
clutter_actor_get_type
clutter_actor_show
clutter_actor_hide
clutter_actor_realize
clutter_actor_unrealize
clutter_actor_paint
clutter_actor_queue_redraw
clutter_actor_destroy
clutter_actor_request_coords
clutter_actor_allocate_coords
clutter_actor_set_geometry
clutter_actor_get_geometry
clutter_actor_get_coords
clutter_actor_set_position
clutter_actor_set_size
clutter_actor_set_position
clutter_actor_get_abs_position
clutter_actor_get_width
clutter_actor_get_height
clutter_actor_get_x
clutter_actor_get_y
clutter_actor_rotate_z
clutter_actor_rotate_x
clutter_actor_rotate_y
clutter_actor_rotate_z
clutter_actor_set_opacity
clutter_actor_get_opacity
clutter_actor_set_name
@ -249,6 +228,7 @@ clutter_actor_remove_clip
clutter_actor_has_clip
clutter_actor_set_parent
clutter_actor_get_parent
clutter_actor_reparent
clutter_actor_unparent
clutter_actor_raise
clutter_actor_lower
@ -256,19 +236,213 @@ clutter_actor_raise_top
clutter_actor_lower_bottom
clutter_actor_set_depth
clutter_actor_get_depth
clutter_actor_set_scalex
clutter_actor_set_scale
clutter_actor_get_scalex
clutter_actor_get_scale
clutter_actor_get_abs_size
<SUBSECTION Standard>
ClutterActorClass
CLUTTER_ACTOR
CLUTTER_IS_ACTOR
CLUTTER_TYPE_ACTOR
clutter_geometry_get_type
CLUTTER_ACTOR_CLASS
CLUTTER_IS_ACTOR_CLASS
CLUTTER_ACTOR_GET_CLASS
</SECTION>
<SECTION>
<FILE>clutter-texture</FILE>
<TITLE>ClutterTexture</TITLE>
ClutterTexture
ClutterTextureClass
clutter_texture_new_from_pixbuf
clutter_texture_new
clutter_texture_set_from_data
clutter_texture_set_pixbuf
clutter_texture_get_pixbuf
clutter_texture_get_base_size
clutter_texture_bind_tile
clutter_texture_get_n_tiles
clutter_texture_get_x_tile_detail
clutter_texture_get_y_tile_detail
clutter_texture_has_generated_tiles
clutter_texture_is_tiled
<SUBSECTION Standard>
CLUTTER_TEXTURE
CLUTTER_IS_TEXTURE
CLUTTER_TYPE_TEXTURE
CLUTTER_TEXTURE_CLASS
CLUTTER_IS_TEXTURE_CLASS
CLUTTER_TEXTURE_GET_CLASS
<SUBSECTION Private>
ClutterActorPrivate
clutter_actor_get_type
clutter_actor_box_get_type
clutter_geometry_get_type
ClutterTexturePrivate
clutter_texture_get_type
</SECTION>
<SECTION>
<FILE>clutter-stage</FILE>
CLUTTER_STAGE_WIDTH
CLUTTER_STAGE_HEIGHT
<TITLE>ClutterStage</TITLE>
ClutterStage
ClutterStageClass
clutter_stage_get_default
clutter_stage_get_xwindow
clutter_stage_set_xwindow_foreign
clutter_stage_set_color
clutter_stage_get_color
clutter_stage_get_actor_at_pos
clutter_stage_snapshot
clutter_stage_get_xvisual
<SUBSECTION Standard>
CLUTTER_STAGE
CLUTTER_IS_STAGE
CLUTTER_TYPE_STAGE
CLUTTER_STAGE_CLASS
CLUTTER_IS_STAGE_CLASS
CLUTTER_STAGE_GET_CLASS
<SUBSECTION Private>
ClutterStagePrivate
clutter_stage_get_type
</SECTION>
<SECTION>
<FILE>clutter-timeline</FILE>
<TITLE>ClutterTimeline</TITLE>
ClutterTimeline
ClutterTimelineClass
clutter_timeline_new
clutter_timeline_set_speed
clutter_timeline_get_speed
clutter_timeline_start
clutter_timeline_pause
clutter_timeline_stop
clutter_timeline_set_loop
clutter_timeline_get_loop
clutter_timeline_rewind
clutter_timeline_skip
clutter_timeline_advance
clutter_timeline_get_current_frame
clutter_timeline_set_n_frames
clutter_timeline_get_n_frames
clutter_timeline_is_playing
<SUBSECTION Standard>
CLUTTER_TIMELINE
CLUTTER_IS_TIMELINE
CLUTTER_TYPE_TIMELINE
CLUTTER_TIMELINE_CLASS
CLUTTER_IS_TIMELINE_CLASS
CLUTTER_TIMELINE_GET_CLASS
<SUBSECTION Private>
ClutterTimelinePrivate
clutter_timeline_get_type
</SECTION>
<SECTION>
<FILE>clutter-behaviour-path</FILE>
CLUTTER_TYPE_KNOT
ClutterKnot
<TITLE>ClutterBehaviourPath</TITLE>
ClutterBehaviourPath
ClutterBehaviourPathClass
clutter_behaviour_path_new
clutter_behaviour_path_get_knots
clutter_behaviour_path_append_knot
clutter_behaviour_path_append_knots
clutter_behaviour_path_clear
<SUBSECTION Standard>
CLUTTER_BEHAVIOUR_PATH
CLUTTER_IS_BEHAVIOUR_PATH
CLUTTER_TYPE_BEHAVIOUR_PATH
CLUTTER_BEHAVIOUR_PATH_CLASS
CLUTTER_IS_BEHAVIOUR_PATH_CLASS
CLUTTER_BEHAVIOUR_PATH_GET_CLASS
<SUBSECTION Private>
ClutterBehaviourPathPrivate
clutter_behaviour_path_get_type
</SECTION>
<SECTION>
<FILE>clutter-behaviour-opacity</FILE>
<TITLE>ClutterBehaviourOpacity</TITLE>
ClutterBehaviourOpacity
ClutterBehaviourOpacityClass
clutter_behaviour_opacity_new
<SUBSECTION Standard>
CLUTTER_BEHAVIOUR_OPACITY
CLUTTER_IS_BEHAVIOUR_OPACITY
CLUTTER_TYPE_BEHAVIOUR_OPACITY
CLUTTER_BEHAVIOUR_OPACITY_CLASS
CLUTTER_IS_BEHAVIOUR_OPACITY_CLASS
CLUTTER_BEHAVIOUR_OPACITY_GET_CLASS
<SUBSECTION Private>
ClutterBehaviourOpacityPrivate
clutter_behaviour_opacity_get_type
</SECTION>
<SECTION>
<FILE>clutter-behaviour-scale</FILE>
<TITLE>ClutterBehaviourScale</TITLE>
ClutterBehaviourScale
ClutterBehaviourScaleClass
clutter_behaviour_scale_new
<SUBSECTION Standard>
CLUTTER_BEHAVIOUR_SCALE
CLUTTER_IS_BEHAVIOUR_SCALE
CLUTTER_TYPE_BEHAVIOUR_SCALE
CLUTTER_BEHAVIOUR_SCALE_CLASS
CLUTTER_IS_BEHAVIOUR_SCALE_CLASS
CLUTTER_BEHAVIOUR_SCALE_GET_CLASS
<SUBSECTION Private>
ClutterBehaviourScalePrivate
clutter_behaviour_scale_get_type
</SECTION>
<SECTION>
<FILE>pangoclutter-private</FILE>
PANGO_SCALE_26_6
PANGO_PIXELS_26_6
PANGO_UNITS_26_6
PANGO_CLUTTER_FONT
PangoClutterFont
PangoClutterGlyphInfo
pango_clutter_get_unknown_glyph
pango_clutter_font_get_face
PangoClutterRenderer
PANGO_TYPE_CLUTTER_RENDERER
PANGO_CLUTTER_RENDERER
PANGO_IS_CLUTTER_RENDERER
pango_clutter_renderer_get_type
pango_fc_font_get_raw_extents
<SUBSECTION Standard>
PANGO_TYPE_CLUTTER_FONT
PANGO_CLUTTER_IS_FONT
pango_clutter_font_get_type
</SECTION>
<SECTION>
<FILE>pangoclutter</FILE>
PANGO_ENABLE_BACKEND
G_DISABLE_CAST_CHECKS
PANGO_CLUTTER_FONT_MAP
PangoClutterFontMap
PangoClutterFontMapClass
PangoClutterSubstituteFunc
pango_clutter_font_map_new
pango_clutter_font_map_set_default_substitute
pango_clutter_font_map_substitute_changed
pango_clutter_font_map_create_context
FLAG_INVERSE
FLAG_OUTLINE
pango_clutter_render_layout_subpixel
pango_clutter_render_layout
pango_clutter_render_layout_line
pango_clutter_render_clear_caches
<SUBSECTION Standard>
PANGO_TYPE_CLUTTER_FONT_MAP
PANGO_CLUTTER_IS_FONT_MAP
pango_clutter_font_map_get_type
</SECTION>
<SECTION>
@ -276,12 +450,40 @@ clutter_geometry_get_type
clutter_util_trap_x_errors
clutter_util_untrap_x_errors
clutter_util_next_p2
clutter_util_can_create_texture
</SECTION>
<SECTION>
<FILE>clutter-feature</FILE>
ClutterFeatureFlags
clutter_feature_available
clutter_feature_get_all
</SECTION>
<SECTION>
<FILE>clutter-fixed</FILE>
ClutterFixed
CFX_Q
CFX_ONE
CFX_MAX
CFX_MIN
CLUTTER_FIXED_TO_FLOAT
CLUTTER_FIXED_TO_DOUBLE
CLUTTER_FLOAT_TO_FIXED
CLUTTER_INT_TO_FIXED
CLUTTER_FIXED_INT
CLUTTER_FIXED_FRACTION
CLUTTER_FIXED_FLOOR
CLUTTER_FIXED_CEIL
CLUTTER_FIXED_MUL
CLUTTER_FIXED_DIV
</SECTION>
<SECTION>
<FILE>clutter-color</FILE>
CLUTTER_TYPE_COLOR
ClutterColor
clutter_color_get_type
clutter_color_add
clutter_color_subtract
clutter_color_lighten
@ -291,8 +493,6 @@ clutter_color_to_hls
clutter_color_from_hls
clutter_color_to_pixel
clutter_color_from_pixel
<SUBSECTION Private>
clutter_color_get_type
</SECTION>
<SECTION>
@ -305,18 +505,19 @@ ClutterButtonEvent
ClutterMotionEvent
ClutterInputDevice
ClutterEvent
clutter_event_get_type
clutter_event_new
clutter_event_copy
clutter_event_free
clutter_key_event_type
clutter_key_event_time
clutter_key_event_state
clutter_button_event_x
clutter_button_event_y
clutter_key_event_symbol
clutter_key_event_code
clutter_key_event_unicode
clutter_keysym_to_unicode
<SUBSECTION Private>
clutter_event_get_type
</SECTION>
<SECTION>
@ -325,6 +526,7 @@ CLUTTER_HAS_DEBUG_MESSGES
CLUTTER_DBG
CLUTTER_GLERR
CLUTTER_MARK
ClutterInitError
clutter_init
clutter_main
clutter_main_quit
@ -342,21 +544,17 @@ clutter_threads_leave
<FILE>clutter</FILE>
</SECTION>
<SECTION>
<FILE>clutter-marshal</FILE>
clutter_marshal_VOID__INT64_INT64_FLOAT_BOOLEAN
clutter_marshal_VOID__STRING_BOOLEAN_BOOLEAN
clutter_marshal_VOID__INT_INT
clutter_marshal_VOID__BOXED
clutter_marshal_VOID__OBJECT
</SECTION>
<SECTION>
<FILE>clutter-enum-types</FILE>
CLUTTER_TYPE_EVENT_TYPE
CLUTTER_TYPE_ACTOR_FLAGS
<SUBSECTION Private>
clutter_actor_flags_get_type
clutter_event_type_get_type
CLUTTER_TYPE_FEATURE_FLAGS
clutter_feature_flags_get_type
CLUTTER_TYPE_ACTOR_FLAGS
clutter_actor_flags_get_type
CLUTTER_TYPE_RAMP_TYPE
clutter_ramp_type_get_type
CLUTTER_TYPE_INIT_ERROR
clutter_init_error_get_type
</SECTION>

View file

@ -9,3 +9,8 @@ clutter_clone_texture_get_type
clutter_label_get_type
clutter_timeline_get_type
clutter_media_get_type
clutter_behaviour_get_type
clutter_alpha_get_type
clutter_behaviour_opacity_get_type
clutter_behaviour_path_get_type
clutter_behaviour_scale_get_type

View file

@ -28,6 +28,17 @@ ClutterCloneTexture
</para>
<!-- ##### STRUCT ClutterCloneTextureClass ##### -->
<para>
</para>
@parent_class:
@_clutter_clone_1:
@_clutter_clone_2:
@_clutter_clone_3:
@_clutter_clone_4:
<!-- ##### FUNCTION clutter_clone_texture_new ##### -->
<para>

View file

@ -34,6 +34,14 @@ clutter-color
@blue:
@alpha:
<!-- ##### FUNCTION clutter_color_get_type ##### -->
<para>
</para>
@Returns:
<!-- ##### FUNCTION clutter_color_add ##### -->
<para>

View file

@ -24,6 +24,29 @@ clutter-enum-types
<!-- ##### FUNCTION clutter_event_type_get_type ##### -->
<para>
</para>
@Returns:
<!-- ##### MACRO CLUTTER_TYPE_FEATURE_FLAGS ##### -->
<para>
</para>
<!-- ##### FUNCTION clutter_feature_flags_get_type ##### -->
<para>
</para>
@Returns:
<!-- ##### MACRO CLUTTER_TYPE_ACTOR_FLAGS ##### -->
<para>
@ -31,3 +54,26 @@ clutter-enum-types
<!-- ##### FUNCTION clutter_actor_flags_get_type ##### -->
<para>
</para>
@Returns:
<!-- ##### MACRO CLUTTER_TYPE_INIT_ERROR ##### -->
<para>
</para>
<!-- ##### FUNCTION clutter_init_error_get_type ##### -->
<para>
</para>
@Returns:

View file

@ -94,6 +94,14 @@ clutter-event
</para>
<!-- ##### FUNCTION clutter_event_get_type ##### -->
<para>
</para>
@Returns:
<!-- ##### FUNCTION clutter_event_new ##### -->
<para>
@ -147,6 +155,24 @@ clutter-event
@Returns:
<!-- ##### FUNCTION clutter_button_event_x ##### -->
<para>
</para>
@buttev:
@Returns:
<!-- ##### FUNCTION clutter_button_event_y ##### -->
<para>
</para>
@buttev:
@Returns:
<!-- ##### FUNCTION clutter_key_event_symbol ##### -->
<para>

View file

@ -39,6 +39,12 @@ The #ClutterActor @arg1 was removed from the group.
@cluttergroup: the object which received the signal.
@arg1: a #ClutterActor.
<!-- ##### STRUCT ClutterGroupClass ##### -->
<para>
</para>
<!-- ##### FUNCTION clutter_group_new ##### -->
<para>

View file

@ -68,6 +68,12 @@ ClutterLabel
</para>
<!-- ##### STRUCT ClutterLabelClass ##### -->
<para>
</para>
<!-- ##### FUNCTION clutter_label_new ##### -->
<para>
@ -140,3 +146,120 @@ ClutterLabel
@color:
<!-- ##### FUNCTION clutter_label_set_ellipsize ##### -->
<para>
</para>
@label:
@mode:
<!-- ##### FUNCTION clutter_label_get_ellipsize ##### -->
<para>
</para>
@label:
@Returns:
<!-- ##### FUNCTION clutter_label_set_line_wrap ##### -->
<para>
</para>
@label:
@wrap:
<!-- ##### FUNCTION clutter_label_get_line_wrap ##### -->
<para>
</para>
@label:
@Returns:
<!-- ##### FUNCTION clutter_label_set_line_wrap_mode ##### -->
<para>
</para>
@label:
@wrap_mode:
<!-- ##### FUNCTION clutter_label_get_line_wrap_mode ##### -->
<para>
</para>
@label:
@Returns:
<!-- ##### FUNCTION clutter_label_get_layout ##### -->
<para>
</para>
@label:
@Returns:
<!-- ##### FUNCTION clutter_label_set_attributes ##### -->
<para>
</para>
@label:
@attrs:
<!-- ##### FUNCTION clutter_label_get_attributes ##### -->
<para>
</para>
@label:
@Returns:
<!-- ##### FUNCTION clutter_label_set_use_markup ##### -->
<para>
</para>
@label:
@setting:
<!-- ##### FUNCTION clutter_label_get_use_markup ##### -->
<para>
</para>
@label:
@Returns:
<!-- ##### FUNCTION clutter_label_set_alignment ##### -->
<para>
</para>
@label:
@alignment:
<!-- ##### FUNCTION clutter_label_get_alignment ##### -->
<para>
</para>
@label:
@Returns:

View file

@ -32,6 +32,11 @@ clutter-main
@x:
@a...:
@a...:
@a...:
@a...:
@a...:
@a...:
@a...:
@a...:
@ -49,6 +54,18 @@ clutter-main
<!-- ##### ENUM ClutterInitError ##### -->
<para>
</para>
@CLUTTER_INIT_SUCCESS:
@CLUTTER_INIT_ERROR_UNKOWN:
@CLUTTER_INIT_ERROR_THREADS:
@CLUTTER_INIT_ERROR_DISPLAY:
@CLUTTER_INIT_ERROR_INTERNAL:
@CLUTTER_INIT_ERROR_OPENGL:
<!-- ##### FUNCTION clutter_init ##### -->
<para>

View file

@ -28,6 +28,17 @@ ClutterRectangle
</para>
<!-- ##### STRUCT ClutterRectangleClass ##### -->
<para>
</para>
@parent_class:
@_clutter_rectangle1:
@_clutter_rectangle2:
@_clutter_rectangle3:
@_clutter_rectangle4:
<!-- ##### FUNCTION clutter_rectangle_new ##### -->
<para>

View file

@ -105,6 +105,25 @@ ClutterStage
</para>
<!-- ##### STRUCT ClutterStageClass ##### -->
<para>
</para>
@parent_class:
@input_event:
@button_press_event:
@button_release_event:
@key_press_event:
@key_release_event:
@motion_event:
@_clutter_stage1:
@_clutter_stage2:
@_clutter_stage3:
@_clutter_stage4:
@_clutter_stage5:
@_clutter_stage6:
<!-- ##### FUNCTION clutter_stage_get_default ##### -->
<para>
@ -174,3 +193,12 @@ ClutterStage
@Returns:
<!-- ##### FUNCTION clutter_stage_get_xvisual ##### -->
<para>
</para>
@stage:
@Returns:

View file

@ -84,6 +84,15 @@ ClutterTexture
</para>
<!-- ##### STRUCT ClutterTextureClass ##### -->
<para>
</para>
@parent_class:
@size_change:
@pixbuf_change:
<!-- ##### FUNCTION clutter_texture_new_from_pixbuf ##### -->
<para>
@ -101,6 +110,20 @@ ClutterTexture
@Returns:
<!-- ##### FUNCTION clutter_texture_set_from_data ##### -->
<para>
</para>
@texture:
@data:
@has_alpha:
@width:
@height:
@rowstride:
@bpp:
<!-- ##### FUNCTION clutter_texture_set_pixbuf ##### -->
<para>

View file

@ -67,12 +67,28 @@ The #ClutterTimeline has been started.
</para>
<!-- ##### STRUCT ClutterTimelineClass ##### -->
<para>
</para>
@parent_class:
@started:
@completed:
@paused:
@new_frame:
@_clutter_timeline_1:
@_clutter_timeline_2:
@_clutter_timeline_3:
@_clutter_timeline_4:
@_clutter_timeline_5:
<!-- ##### FUNCTION clutter_timeline_new ##### -->
<para>
</para>
@nframes:
@n_frames:
@fps:
@Returns:
@ -86,6 +102,15 @@ The #ClutterTimeline has been started.
@fps:
<!-- ##### FUNCTION clutter_timeline_get_speed ##### -->
<para>
</para>
@timeline:
@Returns:
<!-- ##### FUNCTION clutter_timeline_start ##### -->
<para>
@ -142,7 +167,7 @@ The #ClutterTimeline has been started.
</para>
@timeline:
@nframes:
@n_frames:
<!-- ##### FUNCTION clutter_timeline_advance ##### -->
@ -163,6 +188,15 @@ The #ClutterTimeline has been started.
@Returns:
<!-- ##### FUNCTION clutter_timeline_set_n_frames ##### -->
<para>
</para>
@timeline:
@n_frames:
<!-- ##### FUNCTION clutter_timeline_get_n_frames ##### -->
<para>

View file

@ -32,10 +32,12 @@ main (int argc, char *argv[])
/* Make a timeline */
timeline = clutter_timeline_new (100, 60); /* num frames, fps */
g_object_set(timeline, "loop", TRUE, 0);
g_object_set (timeline, "loop", TRUE, 0);
/* Set an alpha func to power behaviour - ramp is constant rise/fall */
alpha = clutter_alpha_new (timeline, CLUTTER_ALPHA_RAMP);
alpha = clutter_alpha_new_full (timeline,
CLUTTER_ALPHA_RAMP,
NULL, NULL);
/* Create a behaviour for that alpha */
behave = clutter_behaviour_opacity_new (alpha, 0X33, 0xff);

View file

@ -59,8 +59,8 @@ input_cb (ClutterStage *stage,
bev->button);
e = clutter_stage_get_actor_at_pos (stage,
clutter_button_event_x (event),
clutter_button_event_y (event));
clutter_button_event_x (bev),
clutter_button_event_y (bev));
if (e)
clutter_actor_hide(e);