All pastes #417457 Raw Edit

Anonymous

public c v1 · immutable
#417457 ·published 2007-03-30 21:33 UTC
rendered paste body
	GdkPixbuf *screenshot, *image;	GError *error = NULL;	GThread *thread;	GeglNode *root;	GeglNode *color, *crop, *over, *save;	GeglNode *load, *shadow;	GeglProcessor *processor;	gchar *filename;	GeglRectangle roi;	gdouble progress;	gint h, w;	guchar *data;		filename = g_strconcat (G_OBJECT_TYPE_NAME (widget),							".png", NULL);				screenshot = get_pixbuf (widget);	w = gdk_pixbuf_get_width (screenshot);	h = gdk_pixbuf_get_height (screenshot);		g_debug ("Original size: %ix%i", w, h);	g_debug ("Creating pipeline.");		root = gegl_node_new ();		g_debug ("Operation color");	color = gegl_node_new_child (root,								 "operation", "color",								 NULL);		g_debug ("Operation crop");	crop = gegl_node_new_child (root,								"operation", "crop",								"x", 0.,								"y", 0.,								"width", (gdouble) w + 20. + 12.,								"height", (gdouble) h + 20. + 12.,								NULL);		g_debug ("Operation over");	over = gegl_node_new_child (root,								"operation", "over",								NULL);		g_debug ("Operation png-save");	save = gegl_node_new_child (root,								"operation", "png-save",								"path", filename,								NULL);		gegl_node_link_many (color, crop, over, save, NULL);		g_debug ("Operation pixbuf");	load = gegl_node_new_child (over,								"operation", "pixbuf",								"pixbuf", screenshot,								NULL);	g_debug ("Operation load");	load = gegl_node_new_child (over,								"operation", "load",								"path", "/home/bersace/Pictures/Théophane.png",								"cache", TRUE,								NULL);		g_debug ("Operation dropshadow");	shadow = gegl_node_new_child (over,								  "operation", "dropshadow",								  "opacity", 1.,								  "radius", 6.,								  "x", 10.,								  "y", 10.,								  NULL);		gegl_node_link_many (load, shadow, NULL);	gegl_node_connect_to (shadow, "output", over, "aux");		g_debug ("Processing");	processor = gegl_node_new_processor (save, NULL);		while (gegl_processor_work (processor, &progress))		g_debug ("%3.2f%% complete.", progress * 100);		gegl_processor_destroy (processor);	g_object_unref (screenshot);	g_free (filename);	g_debug ("Saved.");