[PATCH] Improve brush outline for fuzzy brushes, sample screenshot included

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi

I think the current brush outline for fuzzy brushes is too big. The attached patch improves the brush outline for fuzzy brushes (see screenshot [1]). If using a higher threshold doesn't result in any outline at all, the patch fallbacks to the old brush outline so that a brush outline always is shown even if the brush only has low-intensity values.

Does this patch make sense to anyone else?

 / Martin

[1] http://www.chromecode.com/temp/improve-fuzzy-brush-outline.png

--

My GIMP Blog:
http://www.chromecode.com/
>From c59b28cd84a94534cf9ad3c309d4666ca8a8eaf4 Mon Sep 17 00:00:00 2001
From: Martin Nordholts <martinn@xxxxxxxxxxxxx>
Date: Sun, 30 Aug 2009 11:40:44 +0200
Subject: [PATCH] app: Improve brush outline for fuzzy brushes

Use a 25% threshold instead of 0% so that we get a nicer outline for
fuzzy brushes. If the 25% doesn't result in a outline at all, fallback
to 0% though.
---
 app/base/boundary.h       |    4 ++--
 app/paint/gimpbrushcore.c |   13 ++++++++++++-
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/app/base/boundary.h b/app/base/boundary.h
index 9577d9c..4cff8bb 100644
--- a/app/base/boundary.h
+++ b/app/base/boundary.h
@@ -19,8 +19,8 @@
 #define  __BOUNDARY_H__
 
 
-/* half intensity for mask */
-#define BOUNDARY_HALF_WAY 127
+#define BOUNDARY_ONE_QUARTER 64
+#define BOUNDARY_HALF_WAY    127
 
 
 typedef enum
diff --git a/app/paint/gimpbrushcore.c b/app/paint/gimpbrushcore.c
index 1d424c1..4980ca0 100644
--- a/app/paint/gimpbrushcore.c
+++ b/app/paint/gimpbrushcore.c
@@ -849,11 +849,22 @@ gimp_brush_core_create_bound_segs (GimpBrushCore    *core,
         smooth_region (&PR);
 
 
+      /* Use BOUNDARY_ONE_QUARTER to get a nice mask for fuzzy brushes */
       boundary = boundary_find (&PR, BOUNDARY_WITHIN_BOUNDS,
                                 0, 0, PR.w, PR.h,
-                                0,
+                                BOUNDARY_ONE_QUARTER,
                                 &core->n_brush_bound_segs);
 
+      /* If we didn't get any boundary try without a threshold */
+      if (core->n_brush_bound_segs <= 0)
+        {
+          g_free (boundary);
+          boundary = boundary_find (&PR, BOUNDARY_WITHIN_BOUNDS,
+                                    0, 0, PR.w, PR.h,
+                                    0,
+                                    &core->n_brush_bound_segs);
+        }
+
       core->brush_bound_segs = boundary_sort (boundary,
                                               core->n_brush_bound_segs,
                                               &num_groups);
-- 
1.6.2.5

_______________________________________________
Gimp-developer mailing list
Gimp-developer@xxxxxxxxxxxxxxxxxxxxxx
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

[Index of Archives]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [GIMP for Windows]     [KDE]     [GEGL]     [Gimp's Home]     [Gimp on GUI]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux