[gnome-photos/wip/rishi/misc-fixes: 2/17] utils: Add photos_utils_create_buffer_from_node
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/wip/rishi/misc-fixes: 2/17] utils: Add photos_utils_create_buffer_from_node
- Date: Tue, 29 Dec 2015 10:27:43 +0000 (UTC)
commit e62b5b94eb7240a6d64d4c5549dea8874af32c13
Author: Debarshi Ray <debarshir gnome org>
Date: Tue Dec 29 10:45:59 2015 +0100
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.
src/photos-utils.c | 20 ++++++++++++++++++++
src/photos-utils.h | 2 ++
2 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/src/photos-utils.c b/src/photos-utils.c
index e9f9f60..c7118f5 100644
--- a/src/photos-utils.c
+++ b/src/photos-utils.c
@@ -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)
{
diff --git a/src/photos-utils.h b/src/photos-utils.h
index 00fa8a9..d2e503f 100644
--- a/src/photos-utils.h
+++ b/src/photos-utils.h
@@ -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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]