[gimp] app: add gimp_drawable_set_buffer() and set_buffer_full()



commit 6274b269caab30c3ea1858c2ad9a5ec8e4421a5c
Author: Michael Natterer <mitch gimp org>
Date:   Wed Mar 21 01:01:24 2012 +0100

    app: add gimp_drawable_set_buffer() and set_buffer_full()

 app/core/gimpdrawable.c |   44 ++++++++++++++++++++++++++++++++++++++++++++
 app/core/gimpdrawable.h |   13 ++++++++++++-
 2 files changed, 56 insertions(+), 1 deletions(-)
---
diff --git a/app/core/gimpdrawable.c b/app/core/gimpdrawable.c
index 3d2935f..e70b0d4 100644
--- a/app/core/gimpdrawable.c
+++ b/app/core/gimpdrawable.c
@@ -1528,6 +1528,50 @@ gimp_drawable_get_buffer (GimpDrawable *drawable)
 }
 
 void
+gimp_drawable_set_buffer (GimpDrawable  *drawable,
+                          gboolean       push_undo,
+                          const gchar   *undo_desc,
+                          GeglBuffer    *buffer,
+                          GimpImageType  type)
+{
+  gint offset_x, offset_y;
+
+  g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
+  g_return_if_fail (GEGL_IS_BUFFER (buffer));
+
+  if (! gimp_item_is_attached (GIMP_ITEM (drawable)))
+    push_undo = FALSE;
+
+  gimp_item_get_offset (GIMP_ITEM (drawable), &offset_x, &offset_y);
+
+  gimp_drawable_set_buffer_full (drawable, push_undo, undo_desc, buffer, type,
+                                 offset_x, offset_y);
+}
+
+void
+gimp_drawable_set_buffer_full (GimpDrawable  *drawable,
+                               gboolean       push_undo,
+                               const gchar   *undo_desc,
+                               GeglBuffer    *buffer,
+                               GimpImageType  type,
+                               gint           offset_x,
+                               gint           offset_y)
+{
+  TileManager *tiles;
+
+  g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
+  g_return_if_fail (GEGL_IS_BUFFER (buffer));
+
+  if (! gimp_item_is_attached (GIMP_ITEM (drawable)))
+    push_undo = FALSE;
+
+  tiles = gimp_gegl_buffer_get_tiles (buffer);
+
+  gimp_drawable_set_tiles_full (drawable, push_undo, undo_desc, tiles, type,
+                                offset_x, offset_y);
+}
+
+void
 gimp_drawable_recreate_buffers (GimpDrawable *drawable)
 {
   g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
diff --git a/app/core/gimpdrawable.h b/app/core/gimpdrawable.h
index a9b9a31..4b5dfe4 100644
--- a/app/core/gimpdrawable.h
+++ b/app/core/gimpdrawable.h
@@ -179,7 +179,18 @@ void            gimp_drawable_init_src_region    (GimpDrawable       *drawable,
                                                   TileManager       **temp_tiles);
 
 GeglBuffer    * gimp_drawable_get_buffer         (GimpDrawable       *drawable);
-
+void            gimp_drawable_set_buffer         (GimpDrawable       *drawable,
+                                                  gboolean            push_undo,
+                                                  const gchar        *undo_desc,
+                                                  GeglBuffer         *buffer,
+                                                  GimpImageType       type);
+void            gimp_drawable_set_buffer_full    (GimpDrawable       *drawable,
+                                                  gboolean            push_undo,
+                                                  const gchar        *undo_desc,
+                                                  GeglBuffer         *buffer,
+                                                  GimpImageType       type,
+                                                  gint                offset_x,
+                                                  gint                offset_y);
 /* FIXME gegl migration hack */
 void            gimp_drawable_recreate_buffers   (GimpDrawable       *drawable);
 



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