All pastes #1004163 Raw Edit

Something

public text v1 · immutable
#1004163 ·published 2008-05-01 18:28 UTC
rendered paste body
/*-*- java -*-*/

using GLib;
using Gegl;

public class GeglPipeline {
	static int main (string[] args) {
		Gegl.Node root;
		weak Gegl.Node color, crop, text, layer, save;
		Gegl.Processor proc;

		Gegl.init(ref args);

		root = new Gegl.Node();

		layer = root.new_child("operation", "layer",
				       "x", 2.0,
				       "y", 4.0,
				       "opacity", 1.0);

		color = root.new_child("operation", "color",
				       "value", new Gegl.Color("rgba(1.0,1.0,1.0,0.5)"));

		crop = root.new_child("operation", "crop",
				      "x", 0., "y", 0.,
				      "width", 512.,
				      "height", 128.);
		color.link(crop);
		crop.link(layer);

		save = root.new_child("operation", "png-save",
				      "path", "pipeline.png",
				      "compression", 9);

		layer.link(save);

		// text
		text = root.new_child("operation", "text",
				      "string", "Hello world !",
				      "font", "Aniron",
				      "size", 24.0,
				      "color", new Gegl.Color("black"));

		text.connect_to("output", layer, "aux");
		
		// processor
		proc = new Gegl.Processor(save);
		double progress;

		while (proc.work(out progress))
			GLib.printerr("processing %.2f%%\n", progress*100);

		Gegl.exit();

		GLib.printerr("Return\n");

		return 0;
	}
}