[gimp] app: add gimp_channel_new_from_buffer() and gimp_layer_mask_new_from_buffer()
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: add gimp_channel_new_from_buffer() and gimp_layer_mask_new_from_buffer()
- Date: Tue, 7 May 2013 21:08:03 +0000 (UTC)
commit 0d7b10cb745a5f5ce54fe102a219aa88fb37788a
Author: Miroslav Talasek <miroslav talasek seznam cz>
Date: Tue May 7 23:06:43 2013 +0200
app: add gimp_channel_new_from_buffer() and gimp_layer_mask_new_from_buffer()
app/core/gimpchannel.c | 23 +++++++++++++++++++++++
app/core/gimpchannel.h | 5 ++++-
app/core/gimplayermask.c | 23 +++++++++++++++++++++++
app/core/gimplayermask.h | 26 +++++++++++++++-----------
4 files changed, 65 insertions(+), 12 deletions(-)
---
diff --git a/app/core/gimpchannel.c b/app/core/gimpchannel.c
index d719fec..511b6e1 100644
--- a/app/core/gimpchannel.c
+++ b/app/core/gimpchannel.c
@@ -1555,6 +1555,29 @@ gimp_channel_new (GimpImage *image,
}
GimpChannel *
+gimp_channel_new_from_buffer (GeglBuffer *buffer,
+ GimpImage *image,
+ const gchar *name,
+ const GimpRGB *color)
+{
+ GimpChannel *channel;
+ GeglBuffer *dest;
+
+ g_return_val_if_fail (GEGL_IS_BUFFER (buffer), NULL);
+ g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
+
+ channel = gimp_channel_new (image,
+ gegl_buffer_get_width (buffer),
+ gegl_buffer_get_height (buffer),
+ name, color);
+
+ dest = gimp_drawable_get_buffer (GIMP_DRAWABLE (channel));
+ gegl_buffer_copy (buffer, NULL, dest, NULL);
+
+ return channel;
+}
+
+GimpChannel *
gimp_channel_new_from_alpha (GimpImage *image,
GimpDrawable *drawable,
const gchar *name,
diff --git a/app/core/gimpchannel.h b/app/core/gimpchannel.h
index b0255c1..b0bef97 100644
--- a/app/core/gimpchannel.h
+++ b/app/core/gimpchannel.h
@@ -128,7 +128,10 @@ GimpChannel * gimp_channel_new (GimpImage *image,
gint height,
const gchar *name,
const GimpRGB *color);
-
+GimpChannel * gimp_channel_new_from_buffer (GeglBuffer *buffer,
+ GimpImage *image,
+ const gchar *name,
+ const GimpRGB *color);
GimpChannel * gimp_channel_new_from_alpha (GimpImage *image,
GimpDrawable *drawable,
const gchar *name,
diff --git a/app/core/gimplayermask.c b/app/core/gimplayermask.c
index d54d9fb..67e7114 100644
--- a/app/core/gimplayermask.c
+++ b/app/core/gimplayermask.c
@@ -211,6 +211,29 @@ gimp_layer_mask_new (GimpImage *image,
return layer_mask;
}
+GimpLayerMask *
+gimp_layer_mask_new_from_buffer (GeglBuffer *buffer,
+ GimpImage *image,
+ const gchar *name,
+ const GimpRGB *color)
+{
+ GimpLayerMask *layer_mask;
+ GeglBuffer *dest;
+
+ g_return_val_if_fail (GEGL_IS_BUFFER (buffer), NULL);
+ g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
+
+ layer_mask = gimp_layer_mask_new (image,
+ gegl_buffer_get_width (buffer),
+ gegl_buffer_get_height (buffer),
+ name, color);
+
+ dest = gimp_drawable_get_buffer (GIMP_DRAWABLE (layer_mask));
+ gegl_buffer_copy (buffer, NULL, dest, NULL);
+
+ return layer_mask;
+}
+
void
gimp_layer_mask_set_layer (GimpLayerMask *layer_mask,
GimpLayer *layer)
diff --git a/app/core/gimplayermask.h b/app/core/gimplayermask.h
index 29d4ac6..2fbed71 100644
--- a/app/core/gimplayermask.h
+++ b/app/core/gimplayermask.h
@@ -47,17 +47,21 @@ struct _GimpLayerMaskClass
/* function declarations */
-GType gimp_layer_mask_get_type (void) G_GNUC_CONST;
-
-GimpLayerMask * gimp_layer_mask_new (GimpImage *image,
- gint width,
- gint height,
- const gchar *name,
- const GimpRGB *color);
-
-void gimp_layer_mask_set_layer (GimpLayerMask *layer_mask,
- GimpLayer *layer);
-GimpLayer * gimp_layer_mask_get_layer (const GimpLayerMask *layer_mask);
+GType gimp_layer_mask_get_type (void) G_GNUC_CONST;
+
+GimpLayerMask * gimp_layer_mask_new (GimpImage *image,
+ gint width,
+ gint height,
+ const gchar *name,
+ const GimpRGB *color);
+GimpLayerMask * gimp_layer_mask_new_from_buffer (GeglBuffer *buffer,
+ GimpImage *image,
+ const gchar *name,
+ const GimpRGB *color);
+
+void gimp_layer_mask_set_layer (GimpLayerMask *layer_mask,
+ GimpLayer *layer);
+GimpLayer * gimp_layer_mask_get_layer (const GimpLayerMask *layer_mask);
#endif /* __GIMP_LAYER_MASK_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]