All pastes #946385 Raw Edit

Untitled

public text v1 · immutable
·published 2008-03-17 17:47 UTC
rendered paste body
#include <clutter/clutter.h>
#include <gdk/gdk.h>

static GdkPixbuf    *pixbuf = NULL;
static ClutterActor *texture = NULL;

static gboolean
set_pixbuf (gint i)
{
  ClutterActor *new_texture = clutter_texture_new_from_pixbuf (pixbuf);
  clutter_container_add_actor (CLUTTER_CONTAINER (clutter_stage_get_default ()),
                               new_texture);
  clutter_actor_show (new_texture);

  clutter_actor_destroy (texture);
  texture = new_texture;

  g_print ("setting new texture\n");
  return TRUE;
}

int
main (int argc, char **argv)
{
  ClutterActor *stage;
  ClutterColor color = { 0xff, 0xff, 0xff, 0xff };

  clutter_init (&argc, &argv);

  stage = clutter_stage_get_default ();
  clutter_actor_set_size (stage, 800, 600);
  clutter_stage_set_color (CLUTTER_STAGE (stage), &color);

  pixbuf = gdk_pixbuf_new_from_file_at_size ("test.svg", 512, 512, NULL);

  texture = clutter_texture_new_from_pixbuf (pixbuf);
  clutter_container_add_actor (CLUTTER_CONTAINER (stage), texture);
  
  clutter_actor_show_all (stage);

  g_timeout_add (200, (GSourceFunc)set_pixbuf, NULL);

  clutter_main ();
}