Fixed clutter_sine_inc_func(); added clutter_sine_dec_func()

This commit is contained in:
Tomas Frydrych 2007-05-16 13:46:54 +00:00
parent 9dfe31a542
commit 9a10979e0f
4 changed files with 69 additions and 8 deletions

View File

@ -1,3 +1,10 @@
2007-05-16 Tomas Frydrych <tf@openedhand.com>
* clutter/clutter-alpha.h:
* clutter/clutter-alpha.c:
* doc/reference/clutter-sections.txt:
Fixed clutter_sine_inc(), added clutter_sine_dec().
2007-05-16 Tomas Frydrych <tf@openedhand.com> 2007-05-16 Tomas Frydrych <tf@openedhand.com>
* clutter/clutter-alpha.h: * clutter/clutter-alpha.h:

View File

@ -603,8 +603,9 @@ clutter_sine_func (ClutterAlpha *alpha,
* @alpha: a #ClutterAlpha * @alpha: a #ClutterAlpha
* @dummy: unused argument * @dummy: unused argument
* *
* Convenience alpha function for a sine wave. You can use this * Convenience alpha function for a sine wave over interval <0, pi/2>.
* function as the alpha function for clutter_alpha_set_func(). * You can use this function as the alpha function for
* clutter_alpha_set_func().
* *
* Return value: an alpha value. * Return value: an alpha value.
* *
@ -614,11 +615,55 @@ guint32
clutter_sine_inc_func (ClutterAlpha *alpha, clutter_sine_inc_func (ClutterAlpha *alpha,
gpointer dummy) gpointer dummy)
{ {
#if 0 ClutterTimeline * timeline;
return sinc_func (alpha, 0.5, 1.0); gint frame;
#else gint n_frames;
return sincx1024_func (alpha, 256, CFX_ONE); ClutterAngle x;
#endif ClutterFixed sine;
timeline = clutter_alpha_get_timeline (alpha);
frame = clutter_timeline_get_current_frame (timeline);
n_frames = clutter_timeline_get_n_frames (timeline);
x = 256 * frame / n_frames;
sine = clutter_sini (x) * CLUTTER_ALPHA_MAX_ALPHA;
return CFX_INT (sine);
}
/**
* clutter_sine_dec_func:
* @alpha: a #ClutterAlpha
* @dummy: unused argument
*
* Convenience alpha function for a sine wave over interval <pi/2, pi>.
* You can use this function as the alpha function for
* clutter_alpha_set_func().
*
* Return value: an alpha value.
*
* Since: 0.4
*/
guint32
clutter_sine_dec_func (ClutterAlpha *alpha,
gpointer dummy)
{
ClutterTimeline * timeline;
gint frame;
gint n_frames;
ClutterAngle x;
ClutterFixed sine;
timeline = clutter_alpha_get_timeline (alpha);
frame = clutter_timeline_get_current_frame (timeline);
n_frames = clutter_timeline_get_n_frames (timeline);
x = 256 * frame / n_frames + 256;
sine = clutter_sini (x) * CLUTTER_ALPHA_MAX_ALPHA;
return CFX_INT (sine);
} }
/** /**

View File

@ -106,7 +106,8 @@ ClutterTimeline *clutter_alpha_get_timeline (ClutterAlpha *alpha);
#define CLUTTER_ALPHA_RAMP_DEC clutter_ramp_dec_func #define CLUTTER_ALPHA_RAMP_DEC clutter_ramp_dec_func
#define CLUTTER_ALPHA_RAMP clutter_ramp_func #define CLUTTER_ALPHA_RAMP clutter_ramp_func
#define CLUTTER_ALPHA_SINE clutter_sine_func #define CLUTTER_ALPHA_SINE clutter_sine_func
/* FIXME add SINE_INC/DEC */ #define CLUTTER_ALPHA_SINE_INC clutter_sine_inc_func
#define CLUTTER_ALPHA_SINE_DEC clutter_sine_dec_func
#define CLUTTER_ALPHA_SQUARE clutter_square_func #define CLUTTER_ALPHA_SQUARE clutter_square_func
#define CLUTTER_ALPHA_SMOOTHSTEP clutter_smoothstep_func #define CLUTTER_ALPHA_SMOOTHSTEP clutter_smoothstep_func
@ -132,6 +133,10 @@ guint32 clutter_ramp_func (ClutterAlpha *alpha,
gpointer dummy); gpointer dummy);
guint32 clutter_sine_func (ClutterAlpha *alpha, guint32 clutter_sine_func (ClutterAlpha *alpha,
gpointer dummy); gpointer dummy);
guint32 clutter_sine_inc_func (ClutterAlpha *alpha,
gpointer dummy);
guint32 clutter_sine_dec_func (ClutterAlpha *alpha,
gpointer dummy);
guint32 clutter_square_func (ClutterAlpha *alpha, guint32 clutter_square_func (ClutterAlpha *alpha,
gpointer dummy); gpointer dummy);
guint32 clutter_smoothstep_func (ClutterAlpha *alpha, guint32 clutter_smoothstep_func (ClutterAlpha *alpha,

View File

@ -112,6 +112,10 @@ CLUTTER_ALPHA_RAMP
clutter_ramp_func clutter_ramp_func
CLUTTER_ALPHA_SINE CLUTTER_ALPHA_SINE
clutter_sine_func clutter_sine_func
CLUTTER_ALPHA_SINE_INC
clutter_sine_inc_func
CLUTTER_ALPHA_SINE_DEC
clutter_sine_dec_func
CLUTTER_ALPHA_SQUARE CLUTTER_ALPHA_SQUARE
clutter_square_func clutter_square_func
CLUTTER_ALPHA_SMOOTHSTEP CLUTTER_ALPHA_SMOOTHSTEP