[gimp/goat-invasion: 63/73] app: some more gegl_buffer_clear()/set_color() on mask objects
- From: Ãyvind KolÃs <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/goat-invasion: 63/73] app: some more gegl_buffer_clear()/set_color() on mask objects
- Date: Fri, 16 Mar 2012 13:02:56 +0000 (UTC)
commit 3d2a8cffc14aceb86a788d2f1333cfdfde45fcb1
Author: Michael Natterer <mitch gimp org>
Date: Thu Mar 15 22:58:26 2012 +0100
app: some more gegl_buffer_clear()/set_color() on mask objects
app/core/gimpchannel-combine.c | 20 ++++++++++++--------
app/core/gimpchannel.c | 13 +++++--------
app/core/gimpdrawable-stroke.c | 10 +++++++---
3 files changed, 24 insertions(+), 19 deletions(-)
---
diff --git a/app/core/gimpchannel-combine.c b/app/core/gimpchannel-combine.c
index 0219783..e79609e 100644
--- a/app/core/gimpchannel-combine.c
+++ b/app/core/gimpchannel-combine.c
@@ -43,8 +43,8 @@ gimp_channel_combine_rect (GimpChannel *mask,
gint w,
gint h)
{
- PixelRegion maskPR;
- guchar color;
+ GeglColor *color;
+ GeglRectangle rect;
g_return_if_fail (GIMP_IS_CHANNEL (mask));
@@ -55,15 +55,19 @@ gimp_channel_combine_rect (GimpChannel *mask,
&x, &y, &w, &h))
return;
- pixel_region_init (&maskPR, gimp_drawable_get_tiles (GIMP_DRAWABLE (mask)),
- x, y, w, h, TRUE);
-
if (op == GIMP_CHANNEL_OP_ADD || op == GIMP_CHANNEL_OP_REPLACE)
- color = OPAQUE_OPACITY;
+ color = gegl_color_new ("#fff");
else
- color = TRANSPARENT_OPACITY;
+ color = gegl_color_new ("#000");
+
+ rect.x = x;
+ rect.y = y;
+ rect.width = w;
+ rect.height = h;
- color_region (&maskPR, &color);
+ gegl_buffer_set_color (gimp_drawable_get_write_buffer (GIMP_DRAWABLE (mask)),
+ &rect, color);
+ g_object_unref (color);
/* Determine new boundary */
if (mask->bounds_known && (op == GIMP_CHANNEL_OP_ADD) && ! mask->empty)
diff --git a/app/core/gimpchannel.c b/app/core/gimpchannel.c
index 530f50f..2e204ab 100644
--- a/app/core/gimpchannel.c
+++ b/app/core/gimpchannel.c
@@ -1366,8 +1366,7 @@ static void
gimp_channel_real_all (GimpChannel *channel,
gboolean push_undo)
{
- PixelRegion maskPR;
- guchar bg = OPAQUE_OPACITY;
+ GeglColor *color;
if (push_undo)
gimp_channel_push_undo (channel,
@@ -1376,12 +1375,10 @@ gimp_channel_real_all (GimpChannel *channel,
gimp_drawable_invalidate_boundary (GIMP_DRAWABLE (channel));
/* clear the channel */
- pixel_region_init (&maskPR,
- gimp_drawable_get_tiles (GIMP_DRAWABLE (channel)),
- 0, 0,
- gimp_item_get_width (GIMP_ITEM (channel)),
- gimp_item_get_height (GIMP_ITEM (channel)), TRUE);
- color_region (&maskPR, &bg);
+ color = gegl_color_new ("#fff");
+ gegl_buffer_set_color (gimp_drawable_get_write_buffer (GIMP_DRAWABLE (channel)),
+ NULL, color);
+ g_object_unref (color);
/* we know the bounds */
channel->bounds_known = TRUE;
diff --git a/app/core/gimpdrawable-stroke.c b/app/core/gimpdrawable-stroke.c
index eff1d8f..a1b38f4 100644
--- a/app/core/gimpdrawable-stroke.c
+++ b/app/core/gimpdrawable-stroke.c
@@ -36,6 +36,8 @@
#include "paint-funcs/paint-funcs.h"
+#include "gegl/gimp-gegl-utils.h"
+
#include "gimp.h"
#include "gimpbezierdesc.h"
#include "gimpchannel.h"
@@ -290,7 +292,7 @@ gimp_drawable_stroke_scan_convert (GimpDrawable *drawable,
gint bytes;
gint off_x;
gint off_y;
- guchar bg[1] = { 0, };
+ GeglBuffer *tmp_buffer;
PixelRegion maskPR;
PixelRegion basePR;
@@ -343,8 +345,10 @@ gimp_drawable_stroke_scan_convert (GimpDrawable *drawable,
* of the stroke.
*/
mask = tile_manager_new (w, h, 1);
- pixel_region_init (&maskPR, mask, 0, 0, w, h, TRUE);
- color_region (&maskPR, bg);
+
+ tmp_buffer = gimp_tile_manager_create_buffer (mask, TRUE);
+ gegl_buffer_clear (tmp_buffer, NULL);
+ g_object_unref (tmp_buffer);
/* render the stroke into it */
gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]