gimp r28068 - trunk/app/gegl
- From: martinn svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r28068 - trunk/app/gegl
- Date: Mon, 23 Feb 2009 20:43:26 +0000 (UTC)
Author: martinn
Date: Mon Feb 23 20:43:26 2009
New Revision: 28068
URL: http://svn.gnome.org/viewvc/gimp?rev=28068&view=rev
Log:
Add a GEGL utility function gimp_buffer_to_tiles()
Modified:
trunk/app/gegl/gimp-gegl-utils.c
trunk/app/gegl/gimp-gegl-utils.h
Modified: trunk/app/gegl/gimp-gegl-utils.c
==============================================================================
--- trunk/app/gegl/gimp-gegl-utils.c (original)
+++ trunk/app/gegl/gimp-gegl-utils.c Mon Feb 23 20:43:26 2009
@@ -24,6 +24,8 @@
#include "gimp-gegl-types.h"
+#include "base/tile-manager.h"
+
#include "gimp-gegl-utils.h"
@@ -74,3 +76,41 @@
return NULL;
}
+
+static gint
+gimp_babl_format_to_legacy_bpp (const Babl *format)
+{
+ return babl_format_get_n_components (format);
+}
+
+TileManager *
+gimp_buffer_to_tiles (GeglBuffer *buffer)
+{
+ const Babl *format = gegl_buffer_get_format (buffer);
+ TileManager *new_tiles = NULL;
+ GeglNode *source = NULL;
+ GeglNode *sink = NULL;
+
+ g_return_val_if_fail (buffer != NULL, NULL);
+
+ /* Setup and process the graph */
+ new_tiles = tile_manager_new (gegl_buffer_get_width (buffer),
+ gegl_buffer_get_height (buffer),
+ gimp_babl_format_to_legacy_bpp (format));
+ source = gegl_node_new_child (NULL,
+ "operation", "gegl:buffer-source",
+ "buffer", buffer,
+ NULL);
+ sink = gegl_node_new_child (NULL,
+ "operation", "gimp:tilemanager-sink",
+ "tile-manager", new_tiles,
+ NULL);
+ gegl_node_link_many (source, sink, NULL);
+ gegl_node_process (sink);
+
+ /* Clenaup */
+ g_object_unref (sink);
+ g_object_unref (source);
+
+ return new_tiles;
+}
Modified: trunk/app/gegl/gimp-gegl-utils.h
==============================================================================
--- trunk/app/gegl/gimp-gegl-utils.h (original)
+++ trunk/app/gegl/gimp-gegl-utils.h Mon Feb 23 20:43:26 2009
@@ -25,5 +25,7 @@
const Babl * gimp_bpp_to_babl_format (guint bpp,
gboolean linear) G_GNUC_CONST;
+TileManager * gimp_buffer_to_tiles (GeglBuffer *buffer);
+
#endif /* __GIMP_GEGL_UTILS_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]