mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 17:40:40 -05:00
added clutter_exp_inc_func() and clutter_exp_dec_func()
This commit is contained in:
parent
a4eeaceda4
commit
733a767657
@ -1,3 +1,10 @@
|
||||
2007-05-17 Tomas Frydrych <tf@openedhand.com>
|
||||
|
||||
* clutter/clutter-alpha.h:
|
||||
* clutter/clutter-alpha.c:
|
||||
* doc/reference/clutter-sections.txt:
|
||||
Added clutter_exp_inc_func() and clutter_exp_dec_func().
|
||||
|
||||
2007-05-16 Emmanuele Bassi <ebassi@openedhand.com>
|
||||
|
||||
* clutter/clutter-main.[ch]: Add clutter_base_init(), semi-private
|
||||
|
@ -851,3 +851,90 @@ clutter_smoothstep_func (ClutterAlpha * alpha,
|
||||
|
||||
return CFX_INT (r * CLUTTER_ALPHA_MAX_ALPHA);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_exp_inc_func:
|
||||
* @alpha: a #ClutterAlpha
|
||||
* @dummy: unused argument
|
||||
*
|
||||
* Convenience alpha function for a 2^x curve. You can use this function as the
|
||||
* alpha function for clutter_alpha_set_func().
|
||||
*
|
||||
* Return value: an alpha value.
|
||||
*
|
||||
* Since: 0.4
|
||||
*/
|
||||
guint32
|
||||
clutter_exp_inc_func (ClutterAlpha *alpha,
|
||||
gpointer dummy)
|
||||
{
|
||||
ClutterTimeline * timeline;
|
||||
gint frame;
|
||||
gint n_frames;
|
||||
ClutterFixed x;
|
||||
ClutterFixed x_alpha_max = 0x100000;
|
||||
guint32 result;
|
||||
|
||||
/*
|
||||
* Choose x_alpha_max such that
|
||||
*
|
||||
* (2^x_alpha_max) - 1 == CLUTTER_ALPHA_MAX_ALPHA
|
||||
*/
|
||||
#if CLUTTER_ALPHA_MAX_ALPHA != 0xffff
|
||||
#error Adjust x_alpha_max to match CLUTTER_ALPHA_MAX_ALPHA
|
||||
#endif
|
||||
|
||||
timeline = clutter_alpha_get_timeline (alpha);
|
||||
frame = clutter_timeline_get_current_frame (timeline);
|
||||
n_frames = clutter_timeline_get_n_frames (timeline);
|
||||
|
||||
x = x_alpha_max * frame / n_frames;
|
||||
|
||||
result = clutter_pow2x (x) - 1;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* clutter_exp_dec_func:
|
||||
* @alpha: a #ClutterAlpha
|
||||
* @dummy: unused argument
|
||||
*
|
||||
* Convenience alpha function for a decreasing 2^x curve. You can use this
|
||||
* function as the alpha function for clutter_alpha_set_func().
|
||||
*
|
||||
* Return value: an alpha value.
|
||||
*
|
||||
* Since: 0.4
|
||||
*/
|
||||
guint32
|
||||
clutter_exp_dec_func (ClutterAlpha *alpha,
|
||||
gpointer dummy)
|
||||
{
|
||||
ClutterTimeline * timeline;
|
||||
gint frame;
|
||||
gint n_frames;
|
||||
ClutterFixed x;
|
||||
ClutterFixed x_alpha_max = 0x100000;
|
||||
guint32 result;
|
||||
|
||||
/*
|
||||
* Choose x_alpha_max such that
|
||||
*
|
||||
* (2^x_alpha_max) - 1 == CLUTTER_ALPHA_MAX_ALPHA
|
||||
*/
|
||||
#if CLUTTER_ALPHA_MAX_ALPHA != 0xffff
|
||||
#error Adjust x_alpha_max to match CLUTTER_ALPHA_MAX_ALPHA
|
||||
#endif
|
||||
|
||||
timeline = clutter_alpha_get_timeline (alpha);
|
||||
frame = clutter_timeline_get_current_frame (timeline);
|
||||
n_frames = clutter_timeline_get_n_frames (timeline);
|
||||
|
||||
x = (x_alpha_max * (n_frames - frame)) / n_frames;
|
||||
|
||||
result = clutter_pow2x (x) - 1;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -111,6 +111,8 @@ ClutterTimeline *clutter_alpha_get_timeline (ClutterAlpha *alpha);
|
||||
#define CLUTTER_ALPHA_SINE_HALF clutter_sine_half_func
|
||||
#define CLUTTER_ALPHA_SQUARE clutter_square_func
|
||||
#define CLUTTER_ALPHA_SMOOTHSTEP clutter_smoothstep_func
|
||||
#define CLUTTER_ALPHA_EXP_INC clutter_exp_inc_func
|
||||
#define CLUTTER_ALPHA_EXP_DEC clutter_exp_dec_func
|
||||
|
||||
#define CLUTTER_TYPE_SMOOTHSTEP (clutter_smoothstep_get_type ())
|
||||
|
||||
@ -144,6 +146,10 @@ guint32 clutter_square_func (ClutterAlpha *alpha,
|
||||
gpointer dummy);
|
||||
guint32 clutter_smoothstep_func (ClutterAlpha *alpha,
|
||||
gpointer *data);
|
||||
guint32 clutter_exp_inc_func (ClutterAlpha *alpha,
|
||||
gpointer dummy);
|
||||
guint32 clutter_exp_dec_func (ClutterAlpha *alpha,
|
||||
gpointer dummy);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -122,6 +122,10 @@ CLUTTER_ALPHA_SQUARE
|
||||
clutter_square_func
|
||||
CLUTTER_ALPHA_SMOOTHSTEP
|
||||
clutter_smoothstep_func
|
||||
CLUTTER_ALPHA_EXP_INC
|
||||
clutter_exp_inc_func
|
||||
CLUTTER_ALPHA_EXP_DEC
|
||||
clutter_exp_dec_func
|
||||
<SUBSECTION Standard>
|
||||
CLUTTER_ALPHA
|
||||
CLUTTER_IS_ALPHA
|
||||
|
Loading…
Reference in New Issue
Block a user