[gimp] app: the blend tool was rendering all gradients off-by-0.5



commit 97e55692ebad5897be334c81c133b6626b9b6920
Author: Michael Natterer <mitch gimp org>
Date:   Wed Aug 26 23:23:16 2015 +0200

    app: the blend tool was rendering all gradients off-by-0.5
    
    When calculating the color of a pixel, we want to calculate the color
    at its center, not at its top-left corner. Found by Raymond Jennings.

 app/core/gimpdrawable-blend.c       |    4 ++++
 app/operations/gimpoperationblend.c |    4 ++++
 2 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/app/core/gimpdrawable-blend.c b/app/core/gimpdrawable-blend.c
index af565d1..e4f92a1 100644
--- a/app/core/gimpdrawable-blend.c
+++ b/app/core/gimpdrawable-blend.c
@@ -628,6 +628,10 @@ gradient_render_pixel (gdouble   x,
   RenderBlendData *rbd = render_data;
   gdouble          factor;
 
+  /*  we want to calculate the color at the pixel's center  */
+  x += 0.5;
+  y += 0.5;
+
   /* Calculate blending factor */
 
   switch (rbd->gradient_type)
diff --git a/app/operations/gimpoperationblend.c b/app/operations/gimpoperationblend.c
index 36aa5f6..358af8a 100644
--- a/app/operations/gimpoperationblend.c
+++ b/app/operations/gimpoperationblend.c
@@ -810,6 +810,10 @@ gradient_render_pixel (gdouble   x,
   RenderBlendData *rbd = render_data;
   gdouble          factor;
 
+  /*  we want to calculate the color at the pixel's center  */
+  x += 0.5;
+  y += 0.5;
+
   /* Calculate blending factor */
 
   switch (rbd->gradient_type)


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