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

* clutter/clutter-behaviour-path.h:
	* clutter/clutter-behaviour-path.c: Add "since" strings; add
	a "knot" property which can be used to append a knot to the path;
	fix apidoc.

	* clutter/clutter-alpha.c: Add "since" strings.

	* clutter/clutter-feature.c: Add apidoc.

	* clutter/clutter-behaviour-opacity.c: Add the "opacity-start"
	and "opacity-end" properties; rewrite constructor to use them.
This commit is contained in:
Emmanuele Bassi 2006-11-17 19:17:40 +00:00
parent 237496fa75
commit c9b6a89d04
9 changed files with 219 additions and 41 deletions

View File

@ -1,3 +1,17 @@
2006-11-17 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-behaviour-path.h:
* clutter/clutter-behaviour-path.c: Add "since" strings; add
a "knot" property which can be used to append a knot to the path;
fix apidoc.
* clutter/clutter-alpha.c: Add "since" strings.
* clutter/clutter-feature.c: Add apidoc.
* clutter/clutter-behaviour-opacity.c: Add the "opacity-start"
and "opacity-end" properties; rewrite constructor to use them.
2006-11-17 Emmanuele Bassi <ebassi@openedhand.com> 2006-11-17 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-behaviour-path.h: * clutter/clutter-behaviour-path.h:

View File

@ -41,6 +41,8 @@
* the #ClutterTimeline object. * the #ClutterTimeline object.
* *
* #ClutterAlpha is used to "drive" a #ClutterBehaviour instance. * #ClutterAlpha is used to "drive" a #ClutterBehaviour instance.
*
* Since: 0.2
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
@ -187,6 +189,8 @@ clutter_alpha_class_init (ClutterAlphaClass *klass)
* ClutterAlpha:timeline: * ClutterAlpha:timeline:
* *
* A #ClutterTimeline instance used to drive the alpha function. * A #ClutterTimeline instance used to drive the alpha function.
*
* Since: 0.2
*/ */
g_object_class_install_property (object_class, g_object_class_install_property (object_class,
PROP_TIMELINE, PROP_TIMELINE,
@ -199,6 +203,8 @@ clutter_alpha_class_init (ClutterAlphaClass *klass)
* ClutterAlpha:alpha: * ClutterAlpha:alpha:
* *
* The alpha value as computed by the alpha function. * The alpha value as computed by the alpha function.
*
* Since: 0.2
*/ */
g_object_class_install_property (object_class, g_object_class_install_property (object_class,
PROP_ALPHA, PROP_ALPHA,
@ -226,6 +232,8 @@ clutter_alpha_init (ClutterAlpha *self)
* Query the current alpha value. * Query the current alpha value.
* *
* Return Value: The current alpha value for the alpha * Return Value: The current alpha value for the alpha
*
* Since: 0.2
*/ */
guint32 guint32
clutter_alpha_get_alpha (ClutterAlpha *alpha) clutter_alpha_get_alpha (ClutterAlpha *alpha)
@ -245,6 +253,8 @@ clutter_alpha_get_alpha (ClutterAlpha *alpha)
* Sets the #ClutterAlphaFunc function used to compute * Sets the #ClutterAlphaFunc function used to compute
* the alpha value at each frame of the #ClutterTimeline * the alpha value at each frame of the #ClutterTimeline
* bound to @alpha. * bound to @alpha.
*
* Since: 0.2
*/ */
void void
clutter_alpha_set_func (ClutterAlpha *alpha, clutter_alpha_set_func (ClutterAlpha *alpha,
@ -277,6 +287,8 @@ clutter_alpha_set_func (ClutterAlpha *alpha,
* @timeline: A #ClutterTimeline * @timeline: A #ClutterTimeline
* *
* Binds @alpha to @timeline. * Binds @alpha to @timeline.
*
* Since: 0.2
*/ */
void void
clutter_alpha_set_timeline (ClutterAlpha *alpha, clutter_alpha_set_timeline (ClutterAlpha *alpha,
@ -316,6 +328,8 @@ clutter_alpha_set_timeline (ClutterAlpha *alpha,
* Gets the #ClutterTimeline bound to @alpha. * Gets the #ClutterTimeline bound to @alpha.
* *
* Return value: a #ClutterTimeline instance * Return value: a #ClutterTimeline instance
*
* Since: 0.2
*/ */
ClutterTimeline * ClutterTimeline *
clutter_alpha_get_timeline (ClutterAlpha *alpha) clutter_alpha_get_timeline (ClutterAlpha *alpha)
@ -337,6 +351,8 @@ clutter_alpha_get_timeline (ClutterAlpha *alpha)
* a #ClutterBehaviour object. * a #ClutterBehaviour object.
* *
* Return value: the newly created empty #ClutterAlpha instance. * Return value: the newly created empty #ClutterAlpha instance.
*
* Since: 0.2
*/ */
ClutterAlpha * ClutterAlpha *
clutter_alpha_new (void) clutter_alpha_new (void)
@ -355,6 +371,8 @@ clutter_alpha_new (void)
* and alpha function. * and alpha function.
* *
* Return Value: the newly created #ClutterAlpha * Return Value: the newly created #ClutterAlpha
*
* Since: 0.2
*/ */
ClutterAlpha * ClutterAlpha *
clutter_alpha_new_full (ClutterTimeline *timeline, clutter_alpha_new_full (ClutterTimeline *timeline,
@ -384,6 +402,8 @@ clutter_alpha_new_full (ClutterTimeline *timeline,
* can use this function as the alpha function for clutter_alpha_set_func(). * can use this function as the alpha function for clutter_alpha_set_func().
* *
* Return value: an alpha value. * Return value: an alpha value.
*
* Since: 0.2
*/ */
guint32 guint32
clutter_ramp_inc_func (ClutterAlpha *alpha, clutter_ramp_inc_func (ClutterAlpha *alpha,
@ -409,6 +429,8 @@ clutter_ramp_inc_func (ClutterAlpha *alpha,
* can use this function as the alpha function for clutter_alpha_set_func(). * can use this function as the alpha function for clutter_alpha_set_func().
* *
* Return value: an alpha value. * Return value: an alpha value.
*
* Since: 0.2
*/ */
guint32 guint32
clutter_ramp_dec_func (ClutterAlpha *alpha, clutter_ramp_dec_func (ClutterAlpha *alpha,
@ -437,6 +459,8 @@ clutter_ramp_dec_func (ClutterAlpha *alpha,
* function as the alpha function for clutter_alpha_set_func(). * function as the alpha function for clutter_alpha_set_func().
* *
* Return value: an alpha value. * Return value: an alpha value.
*
* Since: 0.2
*/ */
guint32 guint32
clutter_ramp_func (ClutterAlpha *alpha, clutter_ramp_func (ClutterAlpha *alpha,
@ -473,6 +497,8 @@ clutter_ramp_func (ClutterAlpha *alpha,
* function as the alpha function for clutter_alpha_set_func(). * function as the alpha function for clutter_alpha_set_func().
* *
* Return value: an alpha value. * Return value: an alpha value.
*
* Since: 0.2
*/ */
guint32 guint32
clutter_sine_func (ClutterAlpha *alpha, clutter_sine_func (ClutterAlpha *alpha,

View File

@ -49,6 +49,8 @@
* @short_description: Behaviour controlling the opacity * @short_description: Behaviour controlling the opacity
* *
* #ClutterBehaviourOpacity controls the opacity of a set of actors. * #ClutterBehaviourOpacity controls the opacity of a set of actors.
*
* Since: 0.2
*/ */
G_DEFINE_TYPE (ClutterBehaviourOpacity, G_DEFINE_TYPE (ClutterBehaviourOpacity,
@ -66,6 +68,14 @@ struct _ClutterBehaviourOpacityPrivate
CLUTTER_TYPE_BEHAVIOUR_OPACITY, \ CLUTTER_TYPE_BEHAVIOUR_OPACITY, \
ClutterBehaviourOpacityPrivate)) ClutterBehaviourOpacityPrivate))
enum
{
PROP_0,
PROP_OPACITY_START,
PROP_OPACITY_END
};
static void static void
opacity_frame_foreach (ClutterActor *actor, opacity_frame_foreach (ClutterActor *actor,
ClutterBehaviourOpacity *behave) ClutterBehaviourOpacity *behave)
@ -105,13 +115,92 @@ clutter_behaviour_opacity_finalize (GObject *object)
G_OBJECT_CLASS (clutter_behaviour_opacity_parent_class)->finalize (object); G_OBJECT_CLASS (clutter_behaviour_opacity_parent_class)->finalize (object);
} }
static void
clutter_behaviour_opacity_set_property (GObject *gobject,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
ClutterBehaviourOpacity *opacityb = CLUTTER_BEHAVIOUR_OPACITY (gobject);
switch (prop_id)
{
case PROP_OPACITY_START:
opacityb->priv->opacity_start = g_value_get_uint (value);
break;
case PROP_OPACITY_END:
opacityb->priv->opacity_end = g_value_get_uint (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
}
}
static void
clutter_behaviour_opacity_get_property (GObject *gobject,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
ClutterBehaviourOpacity *opacityb = CLUTTER_BEHAVIOUR_OPACITY (gobject);
switch (prop_id)
{
case PROP_OPACITY_START:
g_value_set_uint (value, opacityb->priv->opacity_start);
break;
case PROP_OPACITY_END:
g_value_set_uint (value, opacityb->priv->opacity_end);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
}
}
static void static void
clutter_behaviour_opacity_class_init (ClutterBehaviourOpacityClass *klass) clutter_behaviour_opacity_class_init (ClutterBehaviourOpacityClass *klass)
{ {
ClutterBehaviourClass *behave_class; GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
ClutterBehaviourClass *behave_class = CLUTTER_BEHAVIOUR_CLASS (klass);
behave_class = (ClutterBehaviourClass*) klass; gobject_class->set_property = clutter_behaviour_opacity_set_property;
gobject_class->get_property = clutter_behaviour_opacity_get_property;
/**
* ClutterBehaviourOpacity:opacity-start:
*
* Initial opacity level of the behaviour.
*
* Since: 0.2
*/
g_object_class_install_property (gobject_class,
PROP_OPACITY_START,
g_param_spec_uint ("opacity-start",
"Opacity Start",
"Initial opacity level",
0, 255,
0,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
/**
* ClutterBehaviourOpacity:opacity-end:
*
* Final opacity level of the behaviour.
*
* Since: 0.2
*/
g_object_class_install_property (gobject_class,
PROP_OPACITY_END,
g_param_spec_uint ("opacity-end",
"Opacity End",
"Final opacity level",
0, 255,
0,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
behave_class->alpha_notify = clutter_behaviour_alpha_notify; behave_class->alpha_notify = clutter_behaviour_alpha_notify;
@ -135,21 +224,18 @@ clutter_behaviour_opacity_init (ClutterBehaviourOpacity *self)
* change in the interval between @opacity_start and @opacity_end. * change in the interval between @opacity_start and @opacity_end.
* *
* Return value: the newly created #ClutterBehaviourOpacity * Return value: the newly created #ClutterBehaviourOpacity
*
* Since: 0.2
*/ */
ClutterBehaviour * ClutterBehaviour *
clutter_behaviour_opacity_new (ClutterAlpha *alpha, clutter_behaviour_opacity_new (ClutterAlpha *alpha,
guint8 opacity_start, guint8 opacity_start,
guint8 opacity_end) guint8 opacity_end)
{ {
ClutterBehaviourOpacity *behave; return g_object_new (CLUTTER_TYPE_BEHAVIOUR_OPACITY,
"alpha", alpha,
behave = g_object_new (CLUTTER_TYPE_BEHAVIOUR_OPACITY, "opacity-start", opacity_start,
"alpha", alpha, "opacity-end", opacity_end,
NULL); NULL);
behave->priv->opacity_start = opacity_start;
behave->priv->opacity_end = opacity_end;
return CLUTTER_BEHAVIOUR (behave);
} }

View File

@ -28,8 +28,15 @@
* @short_description: A behaviour class interpolating actors along a defined * @short_description: A behaviour class interpolating actors along a defined
* path. * path.
* *
* #ClutterBehaviourPath interpolates actors along a defined path of points. * #ClutterBehaviourPath interpolates actors along a defined path.
* *
* A path is a set of #ClutterKnots object given when creating a new
* #ClutterBehaviourPath instance. Knots can be also added to the path
* using clutter_behaviour_path_append_knot(). The whole path can be
* cleared using clutter_behaviour_path_clear(). Each time the behaviour
* reaches a knot in the path, the "knot-reached" signal is emitted.
*
* Since: 0.2
*/ */
@ -46,18 +53,6 @@
#include <math.h> #include <math.h>
/**
* SECTION:clutter-behaviour-path
* @short_description: Behaviour for walking on a path
*
* #ClutterBehaviourPath makes all the actors driven by it walk on a path.
* A path is a set of #ClutterKnots object given when creating a new
* #ClutterBehaviourPath instance. Knots can be also added to the path
* using clutter_behaviour_path_append_knot(). The whole path can be
* cleared using clutter_behaviour_path_clear(). Each time the behaviour
* reaches a knot in the path, the "knot-reached" signal is emitted.
*/
static ClutterKnot * static ClutterKnot *
clutter_knot_copy (const ClutterKnot *knot) clutter_knot_copy (const ClutterKnot *knot)
{ {
@ -116,6 +111,13 @@ enum
static guint path_signals[LAST_SIGNAL] = { 0, }; static guint path_signals[LAST_SIGNAL] = { 0, };
enum
{
PROP_0,
PROP_KNOT
};
static void static void
clutter_behaviour_path_finalize (GObject *object) clutter_behaviour_path_finalize (GObject *object)
{ {
@ -245,14 +247,49 @@ clutter_behaviour_path_alpha_notify (ClutterBehaviour *behave,
path_alpha_to_position (CLUTTER_BEHAVIOUR_PATH (behave), alpha_value); path_alpha_to_position (CLUTTER_BEHAVIOUR_PATH (behave), alpha_value);
} }
static void
clutter_behaviour_path_set_property (GObject *gobject,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
ClutterBehaviourPath *pathb = CLUTTER_BEHAVIOUR_PATH (gobject);
switch (prop_id)
{
case PROP_KNOT:
clutter_behaviour_path_append_knot (pathb, g_value_get_boxed (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
}
}
static void static void
clutter_behaviour_path_class_init (ClutterBehaviourPathClass *klass) clutter_behaviour_path_class_init (ClutterBehaviourPathClass *klass)
{ {
GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
ClutterBehaviourClass *behave_class = CLUTTER_BEHAVIOUR_CLASS (klass); ClutterBehaviourClass *behave_class = CLUTTER_BEHAVIOUR_CLASS (klass);
gobject_class->set_property = clutter_behaviour_path_set_property;
gobject_class->finalize = clutter_behaviour_path_finalize; gobject_class->finalize = clutter_behaviour_path_finalize;
/**
* ClutterBehaviourPath:knot:
*
* This property can be used to append a new knot to the path.
*
* Since: 0.2
*/
g_object_class_install_property (gobject_class,
PROP_KNOT,
g_param_spec_boxed ("knot",
"Knot",
"Can be used to append a knot to the path",
CLUTTER_TYPE_KNOT,
G_PARAM_WRITABLE));
/** /**
* ClutterBehaviourPath::knot-reached: * ClutterBehaviourPath::knot-reached:
* @pathb: the object which received the signal * @pathb: the object which received the signal
@ -260,6 +297,8 @@ clutter_behaviour_path_class_init (ClutterBehaviourPathClass *klass)
* *
* This signal is emitted each time a node defined inside the path * This signal is emitted each time a node defined inside the path
* is reached. * is reached.
*
* Since: 0.2
*/ */
path_signals[KNOT_REACHED] = path_signals[KNOT_REACHED] =
g_signal_new ("knot-reached", g_signal_new ("knot-reached",
@ -366,7 +405,7 @@ clutter_behaviour_path_append_knot (ClutterBehaviourPath *pathb,
} }
/** /**
* clutter_behaviour_path_append_knot: * clutter_behaviour_path_insert_knot:
* @pathb: a #ClutterBehvaiourPath * @pathb: a #ClutterBehvaiourPath
* @offset: position in path to insert knot. * @offset: position in path to insert knot.
* @knot: a #ClutterKnot to append. * @knot: a #ClutterKnot to append.
@ -394,7 +433,6 @@ clutter_behaviour_path_insert_knot (ClutterBehaviourPath *pathb,
* clutter_behaviour_path_remove_knot: * clutter_behaviour_path_remove_knot:
* @pathb: a #ClutterBehvaiourPath * @pathb: a #ClutterBehvaiourPath
* @offset: position in path to remove knot. * @offset: position in path to remove knot.
* @knot: a #ClutterKnot to append.
* *
* Removes a #ClutterKnot in the path at specified offset. * Removes a #ClutterKnot in the path at specified offset.
* *
@ -420,17 +458,6 @@ clutter_behaviour_path_remove_knot (ClutterBehaviourPath *pathb,
} }
} }
/**
* clutter_behaviour_path_append_knots_valist:
* @pathb: a #ClutterBehvaiourPath
* @first_know: the #ClutterKnot knot to add to the path
* @args: the knots to be added
*
* Similar to clutter_behaviour_path_append_knots() but using a va_list.
* Use this function inside bindings.
*
* Since: 0.2
*/
static void static void
clutter_behaviour_path_append_knots_valist (ClutterBehaviourPath *pathb, clutter_behaviour_path_append_knots_valist (ClutterBehaviourPath *pathb,
const ClutterKnot *first_knot, const ClutterKnot *first_knot,
@ -449,7 +476,7 @@ clutter_behaviour_path_append_knots_valist (ClutterBehaviourPath *pathb,
/** /**
* clutter_behaviour_path_append_knots: * clutter_behaviour_path_append_knots:
* @pathb: a #ClutterBehvaiourPath * @pathb: a #ClutterBehvaiourPath
* @first_know: the #ClutterKnot knot to add to the path * @first_knot: the #ClutterKnot knot to add to the path
* @Varargs: additional knots to add to the path * @Varargs: additional knots to add to the path
* *
* Adds a NULL-terminated list of knots to a path. This function is * Adds a NULL-terminated list of knots to a path. This function is

View File

@ -107,7 +107,7 @@ void clutter_behaviour_path_insert_knot (ClutterBehaviourPath *pa
void clutter_behaviour_path_remove_knot (ClutterBehaviourPath *pathb, void clutter_behaviour_path_remove_knot (ClutterBehaviourPath *pathb,
guint offset); guint offset);
void clutter_behaviour_path_clear (ClutterBehaviourPath *path); void clutter_behaviour_path_clear (ClutterBehaviourPath *pathb);
G_END_DECLS G_END_DECLS

View File

@ -291,6 +291,13 @@ clutter_feature_get_all (void)
return __features->flags; return __features->flags;
} }
/**
* clutter_feature_wait_for_vblank:
*
* FIXME
*
* Since: 0.2
*/
void void
clutter_feature_wait_for_vblank (void) clutter_feature_wait_for_vblank (void)
{ {

View File

@ -23,6 +23,16 @@ ClutterBehaviourOpacity
</para> </para>
<!-- ##### ARG ClutterBehaviourOpacity:opacity-end ##### -->
<para>
</para>
<!-- ##### ARG ClutterBehaviourOpacity:opacity-start ##### -->
<para>
</para>
<!-- ##### STRUCT ClutterBehaviourOpacityClass ##### --> <!-- ##### STRUCT ClutterBehaviourOpacityClass ##### -->
<para> <para>

View File

@ -46,6 +46,11 @@ ClutterBehaviourPath
@clutterbehaviourpath: the object which received the signal. @clutterbehaviourpath: the object which received the signal.
@arg1: @arg1:
<!-- ##### ARG ClutterBehaviourPath:knot ##### -->
<para>
</para>
<!-- ##### STRUCT ClutterBehaviourPathClass ##### --> <!-- ##### STRUCT ClutterBehaviourPathClass ##### -->
<para> <para>
@ -102,6 +107,6 @@ ClutterBehaviourPath
</para> </para>
@path: @pathb:

View File

@ -53,6 +53,9 @@ clutter-main
@a...: @a...:
@a...: @a...:
@a...: @a...:
@a...:
@a...:
@a...:
@a...: @a...: