Commit ca964e19 authored by Debarshi Ray's avatar Debarshi Ray

utils: Add photos_utils_create_buffer_from_node

In the following patches, we need a way to get the output of a fully
processed GeglNode as a GeglBuffer, which we are going to use in a
separate thread to run various throwaway operations. eg., guessing the
number of bytes if the buffer is JPEG compressed, or zooming it before
saving.
parent 44bed2be
......@@ -142,6 +142,26 @@ photos_utils_convert_path_to_uri (const gchar *path)
}
GeglBuffer *
photos_utils_create_buffer_from_node (GeglNode *node)
{
GeglBuffer *buffer = NULL;
GeglNode *buffer_sink;
GeglNode *graph;
graph = gegl_node_get_parent (node);
buffer_sink = gegl_node_new_child (graph,
"operation", "gegl:buffer-sink",
"buffer", &buffer,
NULL);
gegl_node_link (node, buffer_sink);
gegl_node_process (buffer_sink);
g_object_unref (buffer_sink);
return buffer;
}
GIcon *
photos_utils_create_collection_icon (gint base_size, GList *pixbufs)
{
......
......@@ -63,6 +63,8 @@ GdkPixbuf *photos_utils_center_pixbuf (GdkPixbuf *pixbuf, gi
gchar *photos_utils_convert_path_to_uri (const gchar *path);
GeglBuffer *photos_utils_create_buffer_from_node (GeglNode *node);
GIcon *photos_utils_create_collection_icon (gint base_size, GList *pixbufs);
GeglNode *photos_utils_create_orientation_node (GeglNode *parent, GQuark orientation);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment