mirror of
https://github.com/brl/mutter.git
synced 2024-12-26 21:02:14 +00:00
Fixed clutter_sine_inc_func(); added clutter_sine_dec_func()
This commit is contained in:
parent
9dfe31a542
commit
9a10979e0f
@ -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>
|
||||
|
||||
* clutter/clutter-alpha.h:
|
||||
|
@ -603,8 +603,9 @@ clutter_sine_func (ClutterAlpha *alpha,
|
||||
* @alpha: a #ClutterAlpha
|
||||
* @dummy: unused argument
|
||||
*
|
||||
* Convenience alpha function for a sine wave. You can use this
|
||||
* function as the alpha function for clutter_alpha_set_func().
|
||||
* Convenience alpha function for a sine wave over interval <0, pi/2>.
|
||||
* You can use this function as the alpha function for
|
||||
* clutter_alpha_set_func().
|
||||
*
|
||||
* Return value: an alpha value.
|
||||
*
|
||||
@ -614,11 +615,55 @@ guint32
|
||||
clutter_sine_inc_func (ClutterAlpha *alpha,
|
||||
gpointer dummy)
|
||||
{
|
||||
#if 0
|
||||
return sinc_func (alpha, 0.5, 1.0);
|
||||
#else
|
||||
return sincx1024_func (alpha, 256, CFX_ONE);
|
||||
#endif
|
||||
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;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -106,7 +106,8 @@ ClutterTimeline *clutter_alpha_get_timeline (ClutterAlpha *alpha);
|
||||
#define CLUTTER_ALPHA_RAMP_DEC clutter_ramp_dec_func
|
||||
#define CLUTTER_ALPHA_RAMP clutter_ramp_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_SMOOTHSTEP clutter_smoothstep_func
|
||||
|
||||
@ -132,6 +133,10 @@ guint32 clutter_ramp_func (ClutterAlpha *alpha,
|
||||
gpointer dummy);
|
||||
guint32 clutter_sine_func (ClutterAlpha *alpha,
|
||||
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,
|
||||
gpointer dummy);
|
||||
guint32 clutter_smoothstep_func (ClutterAlpha *alpha,
|
||||
|
@ -112,6 +112,10 @@ CLUTTER_ALPHA_RAMP
|
||||
clutter_ramp_func
|
||||
CLUTTER_ALPHA_SINE
|
||||
clutter_sine_func
|
||||
CLUTTER_ALPHA_SINE_INC
|
||||
clutter_sine_inc_func
|
||||
CLUTTER_ALPHA_SINE_DEC
|
||||
clutter_sine_dec_func
|
||||
CLUTTER_ALPHA_SQUARE
|
||||
clutter_square_func
|
||||
CLUTTER_ALPHA_SMOOTHSTEP
|
||||
|
Loading…
Reference in New Issue
Block a user