[gimp] app: add debug utility function gimp_create_image_from_buffer()
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: add debug utility function gimp_create_image_from_buffer()
- Date: Tue, 30 Apr 2013 16:40:06 +0000 (UTC)
commit f4d7d1475d74db065a98cffdd5482862f1381432
Author: Michael Natterer <mitch gimp org>
Date: Tue Apr 30 17:17:43 2013 +0200
app: add debug utility function gimp_create_image_from_buffer()
app/core/gimp-utils.c | 38 +++++++++++++++++++++++++++++++++++++-
app/core/gimp-utils.h | 3 +++
2 files changed, 40 insertions(+), 1 deletions(-)
---
diff --git a/app/core/gimp-utils.c b/app/core/gimp-utils.c
index 28d783c..181ac12 100644
--- a/app/core/gimp-utils.c
+++ b/app/core/gimp-utils.c
@@ -778,7 +778,7 @@ gimp_enum_get_value_name (GType enum_type,
gint value)
{
const gchar *value_name = NULL;
-
+
gimp_enum_get_value (enum_type,
value,
&value_name,
@@ -875,3 +875,39 @@ gimp_constrain_line (gdouble start_x,
}
}
}
+
+
+/* debug stuff */
+
+#include "gegl/gimp-babl.h"
+#include "gimpimage.h"
+#include "gimplayer.h"
+
+void
+gimp_create_image_from_buffer (Gimp *gimp,
+ GeglBuffer *buffer)
+{
+ GimpImage *image;
+ GimpLayer *layer;
+ const Babl *format;
+
+ g_return_if_fail (GIMP_IS_GIMP (gimp));
+ g_return_if_fail (GEGL_IS_BUFFER (buffer));
+
+ format = gegl_buffer_get_format (buffer);
+
+ image = gimp_create_image (gimp,
+ gegl_buffer_get_width (buffer),
+ gegl_buffer_get_height (buffer),
+ gimp_babl_format_get_base_type (format),
+ gimp_babl_format_get_precision (format),
+ FALSE);
+
+ layer = gimp_layer_new_from_buffer (buffer, image, format,
+ "Debug Image",
+ GIMP_OPACITY_OPAQUE,
+ GIMP_NORMAL_MODE);
+ gimp_image_add_layer (image, layer, NULL, -1, FALSE);
+
+ gimp_create_display (gimp, image, GIMP_UNIT_PIXEL, 1.0);
+}
diff --git a/app/core/gimp-utils.h b/app/core/gimp-utils.h
index 8630c04..8857050 100644
--- a/app/core/gimp-utils.h
+++ b/app/core/gimp-utils.h
@@ -94,5 +94,8 @@ void gimp_constrain_line (gdouble start_x,
gdouble *end_y,
gint n_snap_lines);
+void gimp_create_image_from_buffer (Gimp *gimp,
+ GeglBuffer *buffer);
+
#endif /* __APP_GIMP_UTILS_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]