mirror of
https://github.com/brl/mutter.git
synced 2024-11-23 08:30:42 -05:00
Merge remote branch 'elliot/c90-fix'
This commit is contained in:
commit
92e21ae936
@ -65,14 +65,13 @@ int
|
|||||||
main (int argc,
|
main (int argc,
|
||||||
char *argv[])
|
char *argv[])
|
||||||
{
|
{
|
||||||
/* seed random number generator */
|
|
||||||
srand ((unsigned int) time (NULL));
|
|
||||||
|
|
||||||
State *state = g_new0 (State, 1);
|
|
||||||
|
|
||||||
ClutterActor *red;
|
ClutterActor *red;
|
||||||
ClutterActor *green;
|
ClutterActor *green;
|
||||||
ClutterActor *blue;
|
ClutterActor *blue;
|
||||||
|
State *state = g_new0 (State, 1);
|
||||||
|
|
||||||
|
/* seed random number generator */
|
||||||
|
srand ((unsigned int) time (NULL));
|
||||||
|
|
||||||
clutter_init (&argc, &argv);
|
clutter_init (&argc, &argv);
|
||||||
|
|
||||||
|
@ -17,10 +17,12 @@ button_pressed_cb (ClutterActor *actor,
|
|||||||
ClutterEvent *event,
|
ClutterEvent *event,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
|
AnimationSpec *animation_spec;
|
||||||
|
|
||||||
if (clutter_actor_get_animation (actor) != NULL)
|
if (clutter_actor_get_animation (actor) != NULL)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
AnimationSpec *animation_spec = (AnimationSpec *) user_data;
|
animation_spec = (AnimationSpec *) user_data;
|
||||||
|
|
||||||
clutter_actor_animate (actor, CLUTTER_LINEAR, 500,
|
clutter_actor_animate (actor, CLUTTER_LINEAR, 500,
|
||||||
animation_spec->axis, animation_spec->target,
|
animation_spec->axis, animation_spec->target,
|
||||||
|
@ -115,13 +115,13 @@ int
|
|||||||
main (int argc,
|
main (int argc,
|
||||||
char *argv[])
|
char *argv[])
|
||||||
{
|
{
|
||||||
/* seed random number generator */
|
|
||||||
srand ((unsigned int) time (NULL));
|
|
||||||
|
|
||||||
Lasso *lasso = g_new0 (Lasso, 1);
|
Lasso *lasso = g_new0 (Lasso, 1);
|
||||||
|
|
||||||
ClutterActor *stage;
|
ClutterActor *stage;
|
||||||
|
|
||||||
|
/* seed random number generator */
|
||||||
|
srand ((unsigned int) time (NULL));
|
||||||
|
|
||||||
clutter_init (&argc, &argv);
|
clutter_init (&argc, &argv);
|
||||||
|
|
||||||
stage = clutter_stage_get_default ();
|
stage = clutter_stage_get_default ();
|
||||||
|
@ -13,14 +13,15 @@ _scroll_event_cb (ClutterActor *viewport,
|
|||||||
|
|
||||||
gfloat viewport_height = clutter_actor_get_height (viewport);
|
gfloat viewport_height = clutter_actor_get_height (viewport);
|
||||||
gfloat scrollable_height = clutter_actor_get_height (scrollable);
|
gfloat scrollable_height = clutter_actor_get_height (scrollable);
|
||||||
|
gfloat y;
|
||||||
|
ClutterScrollDirection direction;
|
||||||
|
|
||||||
/* no need to scroll if the scrollable is shorter than the viewport */
|
/* no need to scroll if the scrollable is shorter than the viewport */
|
||||||
if (scrollable_height < viewport_height)
|
if (scrollable_height < viewport_height)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
gfloat y = clutter_actor_get_y (scrollable);
|
y = clutter_actor_get_y (scrollable);
|
||||||
|
|
||||||
ClutterScrollDirection direction;
|
|
||||||
direction = clutter_event_get_scroll_direction (event);
|
direction = clutter_event_get_scroll_direction (event);
|
||||||
|
|
||||||
switch (direction)
|
switch (direction)
|
||||||
@ -63,6 +64,10 @@ _scroll_event_cb (ClutterActor *viewport,
|
|||||||
int
|
int
|
||||||
main (int argc, char *argv[])
|
main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
ClutterActor *stage;
|
||||||
|
ClutterActor *viewport;
|
||||||
|
ClutterActor *texture;
|
||||||
|
|
||||||
gchar *image_file_path = TESTS_DATA_DIR "/redhand.png";
|
gchar *image_file_path = TESTS_DATA_DIR "/redhand.png";
|
||||||
|
|
||||||
if (argc > 1)
|
if (argc > 1)
|
||||||
@ -70,10 +75,6 @@ main (int argc, char *argv[])
|
|||||||
image_file_path = argv[1];
|
image_file_path = argv[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
ClutterActor *stage;
|
|
||||||
ClutterActor *viewport;
|
|
||||||
ClutterActor *texture;
|
|
||||||
|
|
||||||
clutter_init (&argc, &argv);
|
clutter_init (&argc, &argv);
|
||||||
|
|
||||||
stage = clutter_stage_get_default ();
|
stage = clutter_stage_get_default ();
|
||||||
|
@ -16,10 +16,10 @@ static void
|
|||||||
_convert_clutter_path_node_to_cogl_path (const ClutterPathNode *node,
|
_convert_clutter_path_node_to_cogl_path (const ClutterPathNode *node,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
g_return_if_fail (node != NULL);
|
|
||||||
|
|
||||||
ClutterKnot knot;
|
ClutterKnot knot;
|
||||||
|
|
||||||
|
g_return_if_fail (node != NULL);
|
||||||
|
|
||||||
switch (node->type)
|
switch (node->type)
|
||||||
{
|
{
|
||||||
case CLUTTER_PATH_MOVE_TO:
|
case CLUTTER_PATH_MOVE_TO:
|
||||||
|
@ -22,8 +22,10 @@ _pointer_motion_cb (ClutterActor *actor,
|
|||||||
ClutterEvent *event,
|
ClutterEvent *event,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
/* get the coordinates where the pointer crossed into the actor */
|
|
||||||
gfloat stage_x, stage_y;
|
gfloat stage_x, stage_y;
|
||||||
|
gfloat actor_x, actor_y;
|
||||||
|
|
||||||
|
/* get the coordinates where the pointer crossed into the actor */
|
||||||
clutter_event_get_coords (event, &stage_x, &stage_y);
|
clutter_event_get_coords (event, &stage_x, &stage_y);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -31,7 +33,6 @@ _pointer_motion_cb (ClutterActor *actor,
|
|||||||
* the actor which emitted the signal, it can be useful to
|
* the actor which emitted the signal, it can be useful to
|
||||||
* transform them to actor-relative coordinates
|
* transform them to actor-relative coordinates
|
||||||
*/
|
*/
|
||||||
gfloat actor_x, actor_y;
|
|
||||||
clutter_actor_transform_stage_point (actor,
|
clutter_actor_transform_stage_point (actor,
|
||||||
stage_x, stage_y,
|
stage_x, stage_y,
|
||||||
&actor_x, &actor_y);
|
&actor_x, &actor_y);
|
||||||
|
@ -9,9 +9,10 @@ _pointer_motion_cb (ClutterActor *actor,
|
|||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
gfloat stage_x, stage_y;
|
gfloat stage_x, stage_y;
|
||||||
|
gfloat actor_x, actor_y;
|
||||||
|
|
||||||
clutter_event_get_coords (event, &stage_x, &stage_y);
|
clutter_event_get_coords (event, &stage_x, &stage_y);
|
||||||
|
|
||||||
gfloat actor_x, actor_y;
|
|
||||||
clutter_actor_transform_stage_point (actor,
|
clutter_actor_transform_stage_point (actor,
|
||||||
stage_x, stage_y,
|
stage_x, stage_y,
|
||||||
&actor_x, &actor_y);
|
&actor_x, &actor_y);
|
||||||
|
@ -11,6 +11,8 @@ main (int argc, char *argv[])
|
|||||||
ClutterActor *box;
|
ClutterActor *box;
|
||||||
ClutterActor *rect1, *rect2;
|
ClutterActor *rect1, *rect2;
|
||||||
guint align_x, align_y, diff_x, diff_y;
|
guint align_x, align_y, diff_x, diff_y;
|
||||||
|
ClutterColor *color;
|
||||||
|
ClutterActor *rect;
|
||||||
|
|
||||||
clutter_init (&argc, &argv);
|
clutter_init (&argc, &argv);
|
||||||
|
|
||||||
@ -54,11 +56,11 @@ main (int argc, char *argv[])
|
|||||||
else if (align_y == 4)
|
else if (align_y == 4)
|
||||||
diff_y = 2;
|
diff_y = 2;
|
||||||
|
|
||||||
ClutterColor *color = clutter_color_new (255 - diff_x * 50,
|
color = clutter_color_new (255 - diff_x * 50,
|
||||||
100 + diff_y * 50,
|
100 + diff_y * 50,
|
||||||
0,
|
0,
|
||||||
255);
|
255);
|
||||||
ClutterActor *rect = clutter_rectangle_new_with_color (color);
|
rect = clutter_rectangle_new_with_color (color);
|
||||||
clutter_actor_set_size (rect, 100, 100);
|
clutter_actor_set_size (rect, 100, 100);
|
||||||
clutter_bin_layout_set_alignment (CLUTTER_BIN_LAYOUT (layout),
|
clutter_bin_layout_set_alignment (CLUTTER_BIN_LAYOUT (layout),
|
||||||
rect,
|
rect,
|
||||||
|
@ -12,11 +12,6 @@ static const ClutterColor box_color = { 0x33, 0x33, 0x55, 0xff };
|
|||||||
int
|
int
|
||||||
main (int argc, char *argv[])
|
main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
gchar *filename = TESTS_DATA_DIR "/redhand.png";
|
|
||||||
|
|
||||||
if (argc > 1)
|
|
||||||
filename = argv[1];
|
|
||||||
|
|
||||||
ClutterLayoutManager *layout;
|
ClutterLayoutManager *layout;
|
||||||
ClutterActor *box;
|
ClutterActor *box;
|
||||||
ClutterActor *stage;
|
ClutterActor *stage;
|
||||||
@ -25,6 +20,11 @@ main (int argc, char *argv[])
|
|||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
gfloat width;
|
gfloat width;
|
||||||
|
|
||||||
|
gchar *filename = TESTS_DATA_DIR "/redhand.png";
|
||||||
|
|
||||||
|
if (argc > 1)
|
||||||
|
filename = argv[1];
|
||||||
|
|
||||||
clutter_init (&argc, &argv);
|
clutter_init (&argc, &argv);
|
||||||
|
|
||||||
stage = clutter_stage_get_default ();
|
stage = clutter_stage_get_default ();
|
||||||
|
@ -22,6 +22,8 @@ foo_button_clicked_cb (ClutterClickAction *action,
|
|||||||
ClutterActor *actor,
|
ClutterActor *actor,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
|
gfloat z_angle;
|
||||||
|
|
||||||
/* get the UI definition passed to the handler */
|
/* get the UI definition passed to the handler */
|
||||||
ClutterScript *ui = CLUTTER_SCRIPT (user_data);
|
ClutterScript *ui = CLUTTER_SCRIPT (user_data);
|
||||||
|
|
||||||
@ -36,7 +38,6 @@ foo_button_clicked_cb (ClutterClickAction *action,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
/* get the current rotation and increment it */
|
/* get the current rotation and increment it */
|
||||||
gfloat z_angle;
|
|
||||||
z_angle = clutter_actor_get_rotation (rectangle,
|
z_angle = clutter_actor_get_rotation (rectangle,
|
||||||
CLUTTER_Z_AXIS,
|
CLUTTER_Z_AXIS,
|
||||||
NULL, NULL, NULL);
|
NULL, NULL, NULL);
|
||||||
@ -54,13 +55,16 @@ foo_button_clicked_cb (ClutterClickAction *action,
|
|||||||
int
|
int
|
||||||
main (int argc, char *argv[])
|
main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
clutter_init (&argc, &argv);
|
ClutterActor *stage;
|
||||||
|
ClutterScript *ui;
|
||||||
ClutterScript *ui = clutter_script_new ();
|
|
||||||
|
|
||||||
gchar *filename = "script-signals.json";
|
gchar *filename = "script-signals.json";
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
|
clutter_init (&argc, &argv);
|
||||||
|
|
||||||
|
ui = clutter_script_new ();
|
||||||
|
|
||||||
clutter_script_load_from_file (ui, filename, &error);
|
clutter_script_load_from_file (ui, filename, &error);
|
||||||
|
|
||||||
if (error != NULL)
|
if (error != NULL)
|
||||||
@ -70,7 +74,6 @@ main (int argc, char *argv[])
|
|||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
ClutterActor *stage;
|
|
||||||
clutter_script_get_objects (ui,
|
clutter_script_get_objects (ui,
|
||||||
"stage", &stage,
|
"stage", &stage,
|
||||||
NULL);
|
NULL);
|
||||||
|
@ -4,13 +4,16 @@
|
|||||||
int
|
int
|
||||||
main (int argc, char *argv[])
|
main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
clutter_init (&argc, &argv);
|
ClutterActor *stage;
|
||||||
|
ClutterScript *ui;
|
||||||
ClutterScript *ui = clutter_script_new ();
|
|
||||||
|
|
||||||
gchar *filename = "script-ui.json";
|
gchar *filename = "script-ui.json";
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
|
clutter_init (&argc, &argv);
|
||||||
|
|
||||||
|
ui = clutter_script_new ();
|
||||||
|
|
||||||
/* load a JSON file into the script */
|
/* load a JSON file into the script */
|
||||||
clutter_script_load_from_file (ui, filename, &error);
|
clutter_script_load_from_file (ui, filename, &error);
|
||||||
|
|
||||||
@ -22,8 +25,6 @@ main (int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* retrieve objects from the script */
|
/* retrieve objects from the script */
|
||||||
ClutterActor *stage;
|
|
||||||
|
|
||||||
clutter_script_get_objects (ui,
|
clutter_script_get_objects (ui,
|
||||||
"stage", &stage,
|
"stage", &stage,
|
||||||
NULL);
|
NULL);
|
||||||
|
@ -9,24 +9,24 @@
|
|||||||
static void
|
static void
|
||||||
_text_paint_cb (ClutterActor *actor)
|
_text_paint_cb (ClutterActor *actor)
|
||||||
{
|
{
|
||||||
|
PangoLayout *layout;
|
||||||
|
guint8 real_opacity;
|
||||||
|
CoglColor color;
|
||||||
ClutterText *text = CLUTTER_TEXT (actor);
|
ClutterText *text = CLUTTER_TEXT (actor);
|
||||||
|
ClutterColor text_color = { 0, };
|
||||||
|
|
||||||
/* Get the PangoLayout that the Text actor is going to paint */
|
/* Get the PangoLayout that the Text actor is going to paint */
|
||||||
PangoLayout *layout;
|
|
||||||
layout = clutter_text_get_layout (text);
|
layout = clutter_text_get_layout (text);
|
||||||
|
|
||||||
/* Get the color of the text, to extract the alpha component */
|
/* Get the color of the text, to extract the alpha component */
|
||||||
ClutterColor text_color = { 0, };
|
|
||||||
clutter_text_get_color (text, &text_color);
|
clutter_text_get_color (text, &text_color);
|
||||||
|
|
||||||
/* Composite the opacity so that the shadow is correctly blended */
|
/* Composite the opacity so that the shadow is correctly blended */
|
||||||
guint8 real_opacity;
|
|
||||||
real_opacity = clutter_actor_get_paint_opacity (actor)
|
real_opacity = clutter_actor_get_paint_opacity (actor)
|
||||||
* text_color.alpha
|
* text_color.alpha
|
||||||
/ 255;
|
/ 255;
|
||||||
|
|
||||||
/* Create a #ccc color and premultiply it */
|
/* Create a #ccc color and premultiply it */
|
||||||
CoglColor color;
|
|
||||||
cogl_color_init_from_4ub (&color, 0xcc, 0xcc, 0xcc, real_opacity);
|
cogl_color_init_from_4ub (&color, 0xcc, 0xcc, 0xcc, real_opacity);
|
||||||
cogl_color_premultiply (&color);
|
cogl_color_premultiply (&color);
|
||||||
|
|
||||||
@ -37,15 +37,15 @@ _text_paint_cb (ClutterActor *actor)
|
|||||||
int
|
int
|
||||||
main (int argc, char *argv[])
|
main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
clutter_init (&argc, &argv);
|
|
||||||
|
|
||||||
ClutterActor *stage;
|
ClutterActor *stage;
|
||||||
|
ClutterActor *text;
|
||||||
|
|
||||||
|
clutter_init (&argc, &argv);
|
||||||
|
|
||||||
stage = clutter_stage_new ();
|
stage = clutter_stage_new ();
|
||||||
clutter_stage_set_title (CLUTTER_STAGE (stage), "Text shadow");
|
clutter_stage_set_title (CLUTTER_STAGE (stage), "Text shadow");
|
||||||
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
|
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
|
||||||
|
|
||||||
ClutterActor *text;
|
|
||||||
text = clutter_text_new ();
|
text = clutter_text_new ();
|
||||||
clutter_text_set_text (CLUTTER_TEXT (text), "Hello, World!");
|
clutter_text_set_text (CLUTTER_TEXT (text), "Hello, World!");
|
||||||
clutter_text_set_font_name (CLUTTER_TEXT (text), "Sans 64px");
|
clutter_text_set_font_name (CLUTTER_TEXT (text), "Sans 64px");
|
||||||
|
@ -33,7 +33,12 @@ _update_progress_cb (ClutterTimeline *timeline,
|
|||||||
guint elapsed_msecs,
|
guint elapsed_msecs,
|
||||||
ClutterTexture *texture)
|
ClutterTexture *texture)
|
||||||
{
|
{
|
||||||
|
CoglHandle copy;
|
||||||
|
gdouble progress;
|
||||||
|
CoglColor constant;
|
||||||
|
|
||||||
CoglHandle material = clutter_texture_get_cogl_material (texture);
|
CoglHandle material = clutter_texture_get_cogl_material (texture);
|
||||||
|
|
||||||
if (material == COGL_INVALID_HANDLE)
|
if (material == COGL_INVALID_HANDLE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -41,15 +46,14 @@ _update_progress_cb (ClutterTimeline *timeline,
|
|||||||
* its creation; if you need to modify it later you should use a copy
|
* its creation; if you need to modify it later you should use a copy
|
||||||
* instead. Cogl makes copying materials reasonably cheap
|
* instead. Cogl makes copying materials reasonably cheap
|
||||||
*/
|
*/
|
||||||
CoglHandle copy = cogl_material_copy (material);
|
copy = cogl_material_copy (material);
|
||||||
|
|
||||||
gdouble progress = clutter_timeline_get_progress (timeline);
|
progress = clutter_timeline_get_progress (timeline);
|
||||||
|
|
||||||
/* Create the constant color to be used when combining the two
|
/* Create the constant color to be used when combining the two
|
||||||
* material layers; we use a black color with an alpha component
|
* material layers; we use a black color with an alpha component
|
||||||
* depending on the current progress of the timeline
|
* depending on the current progress of the timeline
|
||||||
*/
|
*/
|
||||||
CoglColor constant;
|
|
||||||
cogl_color_init_from_4ub (&constant, 0x00, 0x00, 0x00, 0xff * progress);
|
cogl_color_init_from_4ub (&constant, 0x00, 0x00, 0x00, 0xff * progress);
|
||||||
|
|
||||||
/* This sets the value of the constant color we use when combining
|
/* This sets the value of the constant color we use when combining
|
||||||
@ -95,6 +99,13 @@ print_usage_and_exit (const char *exec_name,
|
|||||||
int
|
int
|
||||||
main (int argc, char *argv[])
|
main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
CoglHandle texture_1;
|
||||||
|
CoglHandle texture_2;
|
||||||
|
CoglHandle material;
|
||||||
|
ClutterActor *stage;
|
||||||
|
ClutterActor *texture;
|
||||||
|
ClutterTimeline *timeline;
|
||||||
|
|
||||||
clutter_init_with_args (&argc, &argv,
|
clutter_init_with_args (&argc, &argv,
|
||||||
" - Crossfade", entries,
|
" - Crossfade", entries,
|
||||||
NULL,
|
NULL,
|
||||||
@ -106,13 +117,13 @@ main (int argc, char *argv[])
|
|||||||
/* Load the source and target images using Cogl, because we need
|
/* Load the source and target images using Cogl, because we need
|
||||||
* to combine them into the same ClutterTexture.
|
* to combine them into the same ClutterTexture.
|
||||||
*/
|
*/
|
||||||
CoglHandle texture_1 = load_cogl_texture ("source", source);
|
texture_1 = load_cogl_texture ("source", source);
|
||||||
CoglHandle texture_2 = load_cogl_texture ("target", target);
|
texture_2 = load_cogl_texture ("target", target);
|
||||||
|
|
||||||
/* Create a new Cogl material holding the two textures inside two
|
/* Create a new Cogl material holding the two textures inside two
|
||||||
* separate layers.
|
* separate layers.
|
||||||
*/
|
*/
|
||||||
CoglHandle material = cogl_material_new ();
|
material = cogl_material_new ();
|
||||||
cogl_material_set_layer (material, 1, texture_1);
|
cogl_material_set_layer (material, 1, texture_1);
|
||||||
cogl_material_set_layer (material, 0, texture_2);
|
cogl_material_set_layer (material, 0, texture_2);
|
||||||
|
|
||||||
@ -137,13 +148,13 @@ main (int argc, char *argv[])
|
|||||||
* assign the material we created earlier to the Texture for painting
|
* assign the material we created earlier to the Texture for painting
|
||||||
* it
|
* it
|
||||||
*/
|
*/
|
||||||
ClutterActor *stage = clutter_stage_get_default ();
|
stage = clutter_stage_get_default ();
|
||||||
clutter_stage_set_title (CLUTTER_STAGE (stage), "cross-fade");
|
clutter_stage_set_title (CLUTTER_STAGE (stage), "cross-fade");
|
||||||
clutter_actor_set_size (stage, 400, 300);
|
clutter_actor_set_size (stage, 400, 300);
|
||||||
clutter_actor_show (stage);
|
clutter_actor_show (stage);
|
||||||
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
|
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
|
||||||
|
|
||||||
ClutterActor *texture = clutter_texture_new ();
|
texture = clutter_texture_new ();
|
||||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage), texture);
|
clutter_container_add_actor (CLUTTER_CONTAINER (stage), texture);
|
||||||
clutter_texture_set_cogl_material (CLUTTER_TEXTURE (texture), material);
|
clutter_texture_set_cogl_material (CLUTTER_TEXTURE (texture), material);
|
||||||
clutter_actor_add_constraint (texture, clutter_align_constraint_new (stage, CLUTTER_ALIGN_X_AXIS, 0.5));
|
clutter_actor_add_constraint (texture, clutter_align_constraint_new (stage, CLUTTER_ALIGN_X_AXIS, 0.5));
|
||||||
@ -151,7 +162,7 @@ main (int argc, char *argv[])
|
|||||||
cogl_handle_unref (material);
|
cogl_handle_unref (material);
|
||||||
|
|
||||||
/* The timeline will drive the cross-fading */
|
/* The timeline will drive the cross-fading */
|
||||||
ClutterTimeline *timeline = clutter_timeline_new (duration);
|
timeline = clutter_timeline_new (duration);
|
||||||
g_signal_connect (timeline, "new-frame", G_CALLBACK (_update_progress_cb), texture);
|
g_signal_connect (timeline, "new-frame", G_CALLBACK (_update_progress_cb), texture);
|
||||||
clutter_timeline_start (timeline);
|
clutter_timeline_start (timeline);
|
||||||
|
|
||||||
|
@ -26,6 +26,11 @@ typedef struct {
|
|||||||
static gboolean
|
static gboolean
|
||||||
load_next_image (State *app)
|
load_next_image (State *app)
|
||||||
{
|
{
|
||||||
|
gpointer next;
|
||||||
|
gchar *image_path;
|
||||||
|
CoglHandle *cogl_texture;
|
||||||
|
GError *error = NULL;
|
||||||
|
|
||||||
/* don't do anything if already animating */
|
/* don't do anything if already animating */
|
||||||
ClutterTimeline *timeline = clutter_state_get_timeline (app->transitions);
|
ClutterTimeline *timeline = clutter_state_get_timeline (app->transitions);
|
||||||
|
|
||||||
@ -38,16 +43,15 @@ load_next_image (State *app)
|
|||||||
if (!app->next_image_index)
|
if (!app->next_image_index)
|
||||||
app->next_image_index = 0;
|
app->next_image_index = 0;
|
||||||
|
|
||||||
gpointer next = g_slist_nth_data (app->image_paths, app->next_image_index);
|
next = g_slist_nth_data (app->image_paths, app->next_image_index);
|
||||||
|
|
||||||
if (next == NULL)
|
if (next == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
gchar *image_path = (gchar *)next;
|
image_path = (gchar *)next;
|
||||||
|
|
||||||
g_debug ("Loading %s", image_path);
|
g_debug ("Loading %s", image_path);
|
||||||
|
|
||||||
CoglHandle *cogl_texture;
|
|
||||||
cogl_texture = clutter_texture_get_cogl_texture (CLUTTER_TEXTURE (app->top));
|
cogl_texture = clutter_texture_get_cogl_texture (CLUTTER_TEXTURE (app->top));
|
||||||
|
|
||||||
if (cogl_texture != NULL)
|
if (cogl_texture != NULL)
|
||||||
@ -60,7 +64,6 @@ load_next_image (State *app)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* load the next image into the top */
|
/* load the next image into the top */
|
||||||
GError *error = NULL;
|
|
||||||
clutter_texture_set_from_file (CLUTTER_TEXTURE (app->top),
|
clutter_texture_set_from_file (CLUTTER_TEXTURE (app->top),
|
||||||
image_path,
|
image_path,
|
||||||
&error);
|
&error);
|
||||||
@ -95,23 +98,8 @@ _key_pressed_cb (ClutterActor *actor,
|
|||||||
int
|
int
|
||||||
main (int argc, char *argv[])
|
main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
if (argc < 2)
|
|
||||||
{
|
|
||||||
g_print ("Usage: %s <image paths to load>\n", argv[0]);
|
|
||||||
exit (EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
State *app = g_new0 (State, 1);
|
State *app = g_new0 (State, 1);
|
||||||
app->image_paths = NULL;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* NB if your shell globs arguments to this program so argv
|
|
||||||
* includes non-image files, they will fail to load and throw errors
|
|
||||||
*/
|
|
||||||
guint i;
|
guint i;
|
||||||
for (i = 1; i < argc; i++)
|
|
||||||
app->image_paths = g_slist_append (app->image_paths, argv[i]);
|
|
||||||
|
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
/* UI */
|
/* UI */
|
||||||
@ -119,6 +107,21 @@ main (int argc, char *argv[])
|
|||||||
ClutterLayoutManager *layout;
|
ClutterLayoutManager *layout;
|
||||||
ClutterActor *box;
|
ClutterActor *box;
|
||||||
|
|
||||||
|
if (argc < 2)
|
||||||
|
{
|
||||||
|
g_print ("Usage: %s <image paths to load>\n", argv[0]);
|
||||||
|
exit (EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
app->image_paths = NULL;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* NB if your shell globs arguments to this program so argv
|
||||||
|
* includes non-image files, they will fail to load and throw errors
|
||||||
|
*/
|
||||||
|
for (i = 1; i < argc; i++)
|
||||||
|
app->image_paths = g_slist_append (app->image_paths, argv[i]);
|
||||||
|
|
||||||
clutter_init (&argc, &argv);
|
clutter_init (&argc, &argv);
|
||||||
|
|
||||||
stage = clutter_stage_get_default ();
|
stage = clutter_stage_get_default ();
|
||||||
|
@ -61,6 +61,15 @@ load_image (ClutterTexture *texture,
|
|||||||
int
|
int
|
||||||
main (int argc, char *argv[])
|
main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
GError *error = NULL;
|
||||||
|
|
||||||
|
/* UI */
|
||||||
|
ClutterActor *stage;
|
||||||
|
ClutterLayoutManager *layout;
|
||||||
|
ClutterActor *box;
|
||||||
|
ClutterActor *top, *bottom;
|
||||||
|
ClutterState *transitions;
|
||||||
|
|
||||||
clutter_init_with_args (&argc, &argv,
|
clutter_init_with_args (&argc, &argv,
|
||||||
" - cross-fade", entries,
|
" - cross-fade", entries,
|
||||||
NULL,
|
NULL,
|
||||||
@ -72,15 +81,6 @@ main (int argc, char *argv[])
|
|||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
GError *error = NULL;
|
|
||||||
|
|
||||||
/* UI */
|
|
||||||
ClutterActor *stage;
|
|
||||||
ClutterLayoutManager *layout;
|
|
||||||
ClutterActor *box;
|
|
||||||
ClutterActor *top, *bottom;
|
|
||||||
ClutterState *transitions;
|
|
||||||
|
|
||||||
clutter_init (&argc, &argv);
|
clutter_init (&argc, &argv);
|
||||||
|
|
||||||
stage = clutter_stage_get_default ();
|
stage = clutter_stage_get_default ();
|
||||||
|
@ -71,17 +71,18 @@ out:
|
|||||||
int
|
int
|
||||||
main (int argc, char *argv[])
|
main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
clutter_init (&argc, &argv);
|
|
||||||
|
|
||||||
ClutterActor *stage;
|
ClutterActor *stage;
|
||||||
|
ClutterActor *texture;
|
||||||
|
GError *error = NULL;
|
||||||
|
ClutterActor *clone;
|
||||||
|
gfloat y_offset;
|
||||||
|
|
||||||
|
clutter_init (&argc, &argv);
|
||||||
|
|
||||||
stage = clutter_stage_new ();
|
stage = clutter_stage_new ();
|
||||||
clutter_stage_set_title (CLUTTER_STAGE (stage), "Reflection");
|
clutter_stage_set_title (CLUTTER_STAGE (stage), "Reflection");
|
||||||
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
|
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
|
||||||
|
|
||||||
ClutterActor *texture;
|
|
||||||
GError *error = NULL;
|
|
||||||
|
|
||||||
texture = clutter_texture_new ();
|
texture = clutter_texture_new ();
|
||||||
clutter_texture_set_from_file (CLUTTER_TEXTURE (texture),
|
clutter_texture_set_from_file (CLUTTER_TEXTURE (texture),
|
||||||
TESTS_DATA_DIR "/redhand.png",
|
TESTS_DATA_DIR "/redhand.png",
|
||||||
@ -89,8 +90,7 @@ main (int argc, char *argv[])
|
|||||||
clutter_actor_add_constraint (texture, clutter_align_constraint_new (stage, CLUTTER_ALIGN_X_AXIS, 0.5));
|
clutter_actor_add_constraint (texture, clutter_align_constraint_new (stage, CLUTTER_ALIGN_X_AXIS, 0.5));
|
||||||
clutter_actor_add_constraint (texture, clutter_align_constraint_new (stage, CLUTTER_ALIGN_Y_AXIS, 0.2));
|
clutter_actor_add_constraint (texture, clutter_align_constraint_new (stage, CLUTTER_ALIGN_Y_AXIS, 0.2));
|
||||||
|
|
||||||
ClutterActor *clone;
|
y_offset = clutter_actor_get_height (texture) + V_PADDING;
|
||||||
gfloat y_offset = clutter_actor_get_height (texture) + V_PADDING;
|
|
||||||
|
|
||||||
clone = clutter_clone_new (texture);
|
clone = clutter_clone_new (texture);
|
||||||
clutter_actor_add_constraint (clone, clutter_bind_constraint_new (texture, CLUTTER_BIND_X, 0.0));
|
clutter_actor_add_constraint (clone, clutter_bind_constraint_new (texture, CLUTTER_BIND_X, 0.0));
|
||||||
|
Loading…
Reference in New Issue
Block a user