[gimp/goat-invasion: 182/401] app: add gimp_selection_extract_buffer ()



commit 71bc94bc65d37535cf2066c74eec1ec9f376541f
Author: Michael Natterer <mitch gimp org>
Date:   Wed Mar 21 14:27:07 2012 +0100

    app: add gimp_selection_extract_buffer ()

 app/core/gimpselection.c |   32 ++++++++++++++++++++++++++++++++
 app/core/gimpselection.h |    9 +++++++++
 2 files changed, 41 insertions(+), 0 deletions(-)
---
diff --git a/app/core/gimpselection.c b/app/core/gimpselection.c
index 71e2b4d..000556d 100644
--- a/app/core/gimpselection.c
+++ b/app/core/gimpselection.c
@@ -614,6 +614,38 @@ gimp_selection_save (GimpSelection *selection)
   return new_channel;
 }
 
+GeglBuffer *
+gimp_selection_extract_buffer (GimpSelection *selection,
+                               GimpPickable  *pickable,
+                               GimpContext   *context,
+                               gboolean       cut_image,
+                               gboolean       keep_indexed,
+                               gboolean       add_alpha,
+                               gint          *offset_x,
+                               gint          *offset_y,
+                               GError       **error)
+{
+  TileManager *tiles;
+  const Babl  *format;
+
+  tiles = gimp_selection_extract (selection, pickable, context,
+                                  cut_image, keep_indexed, add_alpha,
+                                  &format,
+                                  offset_x, offset_y, error);
+
+  if (tiles)
+    {
+      GeglBuffer *buffer;
+
+      buffer = gimp_tile_manager_create_buffer (tiles, format);
+      tile_manager_unref (tiles);
+
+      return buffer;
+    }
+
+  return NULL;
+}
+
 TileManager *
 gimp_selection_extract (GimpSelection *selection,
                         GimpPickable  *pickable,
diff --git a/app/core/gimpselection.h b/app/core/gimpselection.h
index 5315e0f..b707351 100644
--- a/app/core/gimpselection.h
+++ b/app/core/gimpselection.h
@@ -58,6 +58,15 @@ void          gimp_selection_load          (GimpSelection *selection,
                                             GimpChannel   *channel);
 GimpChannel * gimp_selection_save          (GimpSelection *selection);
 
+GeglBuffer  * gimp_selection_extract_buffer(GimpSelection *selection,
+                                            GimpPickable  *pickable,
+                                            GimpContext   *context,
+                                            gboolean       cut_image,
+                                            gboolean       keep_indexed,
+                                            gboolean       add_alpha,
+                                            gint          *offset_x,
+                                            gint          *offset_y,
+                                            GError       **error);
 TileManager * gimp_selection_extract       (GimpSelection *selection,
                                             GimpPickable  *pickable,
                                             GimpContext   *context,



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