basic concepts and usage of gegl in gtk

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,
I'm evaluating gegl to replace the image display part of siril, a free
astronomy image processor [1]. Siril is a GTK+3 application, so I
naturally tried gegl-gtk which seems to have be abandonned for some
time. I have updated it to compile with gegl 3.10, and examples are
apparently working, if someone is interested the code is available [2].

I have a hard time understanding the basic concepts of GEGL, in
particular the graph. I could not find a clear documentation for GEGL so
my knowledge comes mainly from the gegl-gtk examples, so please tell me
if the following is right: some nodes of the graph are data producers,
some are data processors, some are data consumers like saving to disk or
displaying. In general, there's one data producer and one data consumer
in the graph, and there can be many data processors, the image
processing operations. The fact that there seems to be a root to all
graphs, from which all other nodes are instantiated as children with
gegl_node_new_child() is very disturbing because that would mean that it
is a tree, not a graph, so I assumed that nodes are automatically
connected from parent to child, which doesn't seem to be the case at
all.

That being said, I tried to make a simple application that takes a
16-bit integer pixel buffer and display it in gegl-gtk. I figured that
would make a graph such as:

gegl:buffer_source -> insert here some -> gegl-gtk widget
              |      brightness mapping
	buffer|      or other operations
	      |
gegl_buffer --|

The code I'm using is the following, without any operation in the middle:
    const Babl* format = babl_format("Y u16");
    GeglBuffer *buf = gegl_buffer_new(&_rect, format);
    gegl_buffer_set(buf, &_rect, 1, format, image_buffer, GEGL_AUTO_ROWSTRIDE);
    /* create the graph that displays this buffer */
    GeglNode *bufnode = gegl_node_new_child(gegl,
                    "operation", "gegl:buffer-source", "buffer", buf, NULL);
    gegl_node_process(bufnode);

    // Get the GtkWindow from glade and add gegl-gtk to it
    GtkWidget *box = lookup_widget("a_window");
    view = GTK_WIDGET(gegl_gtk_view_new_for_node(bufnode));
    gtk_container_add(GTK_CONTAINER(box), view);

Of course _rect is set to the correct 0,0,width,height of the buffer.

The problem is that all I get from this code is segfaults. What did I
miss? Isn't gegl-gtk supposed to display the image data given by the
output port of a node? Is something required to transform the gegl
buffer data to a format that the gegl-gtk widget can understand?

I will need two types of graphs for image data display: one for grey
images channels display with at least a basic brightness/contrast
control duplicated for each of the R G and B channels, one that displays
colour images recombined from the three greys. Anybody has an idea about
how I can recombine the resulting images from the three grey graphs and
display it into a new gegl-gtk widget?

Thank you

[1] https://free-astro.org/index.php/Siril
[2] https://free-astro.org/svn/siril/trunk/deps/gegl-gtk/

_______________________________________________
gegl-developer-list mailing list
List address:    gegl-developer-list@xxxxxxxxx
List membership: https://mail.gnome.org/mailman/listinfo/gegl-developer-list




[Index of Archives]     [Yosemite News]     [Yosemite Photos]     [gtk]     [GIMP Users]     [KDE]     [Gimp's Home]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux