GTK 4.6.3
I’m trying to load a picture into Gdk.Pixbuf and display it using Gegl.
I’ve tried different variations, but I couldn’t get it to work.
Below is the workpiece with which I experimented.
int main(string[] args) {
Gegl.init(ref args);
var path = "/path/to/file/test.png";
Gdk.Pixbuf *pixbuf_ptr = null;
var root = new Gegl.Node();
var load = root.new_child("operation", "gegl:load", "path", path);
var to_pixbuf = root.new_child("operation", "gegl:save-pixbuf", "pixbuf", pixbuf_ptr);
load.link(to_pixbuf);
to_pixbuf.process();
var app = new Gtk.Application(null, GLib.ApplicationFlags.FLAGS_NONE);
app.activate.connect(() => {
var win = new Gtk.ApplicationWindow(app);
var pic = new Gtk.Picture.for_pixbuf(pixbuf_ptr);
win.child = pic;
win.present();
});
return app.run(args);
}
$ valac --debug --pkg gtk4 --pkg glib-2.0 --pkg gegl-0.4 ./main.vala
$ ./main