[gimp/blend-tool-fun: 93/163] app: save gradient first and last color with dynamics color output...



commit 25d21f37c0e3019e60809447eeec65d2b877c629
Author: Jehan <jehan girinstud io>
Date:   Wed Sep 30 17:30:50 2015 +0200

    app: save gradient first and last color with dynamics color output...
    
    in the recently used colors palette.

 app/paint/gimppaintbrush.c |   25 +++++++++++++++----------
 1 files changed, 15 insertions(+), 10 deletions(-)
---
diff --git a/app/paint/gimppaintbrush.c b/app/paint/gimppaintbrush.c
index a41c278..4233cae 100644
--- a/app/paint/gimppaintbrush.c
+++ b/app/paint/gimppaintbrush.c
@@ -98,20 +98,25 @@ gimp_paintbrush_paint (GimpPaintCore    *paint_core,
           GimpContext   *context = GIMP_CONTEXT (paint_options);
           GimpBrushCore *brush_core = GIMP_BRUSH_CORE (paint_core);
           GimpDynamics  *dynamics;
+          GimpRGB        color;
 
           dynamics = gimp_context_get_dynamics (GIMP_CONTEXT (paint_options));
 
-          if (! gimp_dynamics_is_output_enabled (dynamics, GIMP_DYNAMICS_OUTPUT_COLOR) &&
-              (! brush_core->brush || ! gimp_brush_get_pixmap (brush_core->brush)))
+          if (gimp_dynamics_is_output_enabled (dynamics, GIMP_DYNAMICS_OUTPUT_COLOR))
             {
-              /* We don't save gradient color history and
-               * pixmap brushes have no color to save.
-               */
-              GimpRGB foreground;
-
-              gimp_context_get_foreground (context, &foreground);
-              gimp_palettes_add_color_history (context->gimp,
-                                               &foreground);
+              /* Getting colors from a gradient. */
+              GimpGradient *gradient = gimp_context_get_gradient (context);
+
+              gimp_gradient_get_color_at (gradient, context, NULL, 0.0, FALSE, &color);
+              gimp_palettes_add_color_history (context->gimp, &color);
+              gimp_gradient_get_color_at (gradient, context, NULL, 1.0, FALSE, &color);
+              gimp_palettes_add_color_history (context->gimp, &color);
+            }
+          else if (! brush_core->brush || ! gimp_brush_get_pixmap (brush_core->brush))
+            {
+              /* We don't save color history for pixmap brushes. */
+              gimp_context_get_foreground (context, &color);
+              gimp_palettes_add_color_history (context->gimp, &color);
             }
         }
       break;


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