[gegl] buffer: make gegl_buffer_set_color_from_pixel public
- From: Øyvind "pippin" Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] buffer: make gegl_buffer_set_color_from_pixel public
- Date: Thu, 27 Sep 2018 12:29:09 +0000 (UTC)
commit 443e0c1c3b80fe05b6b6c01b5857dfc570fe65c5
Author: Øyvind Kolås <pippin gimp org>
Date: Thu Sep 27 14:22:16 2018 +0200
buffer: make gegl_buffer_set_color_from_pixel public
gegl/buffer/gegl-buffer-access.c | 19 ++++++++++---------
gegl/buffer/gegl-buffer.h | 17 +++++++++++++++++
2 files changed, 27 insertions(+), 9 deletions(-)
---
diff --git a/gegl/buffer/gegl-buffer-access.c b/gegl/buffer/gegl-buffer-access.c
index 3525a4258..7e8f463de 100644
--- a/gegl/buffer/gegl-buffer-access.c
+++ b/gegl/buffer/gegl-buffer-access.c
@@ -2774,17 +2774,19 @@ gegl_buffer_set_pattern (GeglBuffer *buffer,
gegl_free (pattern_data);
}
-static void
-gegl_buffer_set_value (GeglBuffer *dst,
- const GeglRectangle *dst_rect,
- uint8_t *value,
- const Babl *pixel_format)
+void
+gegl_buffer_set_color_from_pixel (GeglBuffer *dst,
+ const GeglRectangle *dst_rect,
+ const uint8_t *pixel,
+ const Babl *pixel_format)
{
GeglBufferIterator *i;
gint bpp;
g_return_if_fail (GEGL_IS_BUFFER (dst));
- g_return_if_fail (value);
+ g_return_if_fail (pixel);
+ if (pixel_format == NULL)
+ pixel_format = dst->soft_format;
if (!dst_rect)
{
@@ -2803,11 +2805,10 @@ gegl_buffer_set_value (GeglBuffer *dst,
GEGL_ACCESS_WRITE, GEGL_ABYSS_NONE, 1);
while (gegl_buffer_iterator_next (i))
{
- gegl_memset_pattern (i->items[0].data, value, bpp, i->length);
+ gegl_memset_pattern (i->items[0].data, pixel, bpp, i->length);
}
}
-
void
gegl_buffer_set_color (GeglBuffer *dst,
const GeglRectangle *dst_rect,
@@ -2818,7 +2819,7 @@ gegl_buffer_set_color (GeglBuffer *dst,
g_return_if_fail (color);
gegl_color_get_pixel (color, dst->soft_format, pixel);
- gegl_buffer_set_value (dst, dst_rect, &pixel[0], dst->soft_format);
+ gegl_buffer_set_color_from_pixel (dst, dst_rect, &pixel[0], dst->soft_format);
}
GeglBuffer *
diff --git a/gegl/buffer/gegl-buffer.h b/gegl/buffer/gegl-buffer.h
index a830cb495..4253ec52f 100644
--- a/gegl/buffer/gegl-buffer.h
+++ b/gegl/buffer/gegl-buffer.h
@@ -304,6 +304,23 @@ void gegl_buffer_set_color (GeglBuffer *buffer,
GeglColor *color);
+
+/**
+ * gegl_buffer_set_color_from_pixel:
+ * @buffer: a #GeglBuffer
+ * @rect: a rectangular region to fill with a color.
+ * @pixel: pointer to the data of a single pixel
+ * @pixel_format: the babl format of the pixel, if missing - the soft format of dst.
+ *
+ * Sets the region covered by rect to the the provided pixel.
+ */
+void
+gegl_buffer_set_color_from_pixel (GeglBuffer *buffer,
+ const GeglRectangle *rect,
+ const guchar *pixel,
+ const Babl *pixel_format);
+
+
/**
* gegl_buffer_set_pattern:
* @buffer: a #GeglBuffer
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]