[gimp/goat-invasion: 171/418] app: add gimp_gegl_buffer_new() to create a TileManager-backed buffer



commit ca071cf7c7cd646317907313ad6812f751beed42
Author: Michael Natterer <mitch gimp org>
Date:   Wed Mar 21 00:06:27 2012 +0100

    app: add gimp_gegl_buffer_new() to create a TileManager-backed buffer

 app/gegl/gimp-gegl-utils.c |   18 ++++++++++++++++++
 app/gegl/gimp-gegl-utils.h |    2 ++
 2 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/app/gegl/gimp-gegl-utils.c b/app/gegl/gimp-gegl-utils.c
index b2f8cc4..441cae2 100644
--- a/app/gegl/gimp-gegl-utils.c
+++ b/app/gegl/gimp-gegl-utils.c
@@ -204,6 +204,24 @@ gimp_pixbuf_create_buffer (GdkPixbuf *pixbuf)
 }
 
 GeglBuffer *
+gimp_gegl_buffer_new (const GeglRectangle *rect,
+                      const Babl          *format)
+{
+  TileManager *tiles;
+  GeglBuffer  *buffer;
+
+  g_return_val_if_fail (rect != NULL, NULL);
+  g_return_val_if_fail (format != NULL, NULL);
+
+  tiles = tile_manager_new (rect->width, rect->height,
+                            babl_format_get_bytes_per_pixel (format));
+  buffer = gimp_tile_manager_create_buffer (tiles, format, TRUE);
+  tile_manager_unref (tiles);
+
+  return buffer;
+}
+
+GeglBuffer *
 gimp_tile_manager_create_buffer (TileManager *tm,
                                  const Babl  *format,
                                  gboolean     write)
diff --git a/app/gegl/gimp-gegl-utils.h b/app/gegl/gimp-gegl-utils.h
index 595100e..b94262b 100644
--- a/app/gegl/gimp-gegl-utils.h
+++ b/app/gegl/gimp-gegl-utils.h
@@ -33,6 +33,8 @@ const Babl  * gimp_bpp_to_babl_format_with_alpha (guint                  bpp,
 const gchar * gimp_layer_mode_to_gegl_operation  (GimpLayerModeEffects   mode) G_GNUC_CONST;
 const gchar * gimp_interpolation_to_gegl_filter  (GimpInterpolationType  interpolation) G_GNUC_CONST;
 
+GeglBuffer  * gimp_gegl_buffer_new               (const GeglRectangle   *rect,
+                                                  const Babl            *format);
 GeglBuffer  * gimp_tile_manager_create_buffer    (TileManager           *tm,
                                                   const Babl            *format,
                                                   gboolean               write);



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