Commit 0d7b10cb authored by Miroslav Talasek's avatar Miroslav Talasek Committed by Michael Natterer

app: add gimp_channel_new_from_buffer() and gimp_layer_mask_new_from_buffer()

parent 02505451
......@@ -1554,6 +1554,29 @@ gimp_channel_new (GimpImage *image,
return channel;
}
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,
......
......@@ -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,
......
......@@ -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)
......
......@@ -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__ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment