[gimp] app: Add dynamics to airbrush Flow



commit 336de7935f3733bd1adcb2433008efb62a021aa7
Author: Alexia Death <alexiadeath gmail com>
Date:   Sun Mar 14 19:09:55 2010 +0200

    app: Add dynamics to airbrush Flow

 app/core/core-enums.c    |    2 ++
 app/core/core-enums.h    |    1 +
 app/core/gimpdynamics.c  |   23 +++++++++++++++++++++++
 app/core/gimpdynamics.h  |    1 +
 app/paint/gimpairbrush.c |    2 +-
 5 files changed, 28 insertions(+), 1 deletions(-)
---
diff --git a/app/core/core-enums.c b/app/core/core-enums.c
index ea5b63c..9e46b37 100644
--- a/app/core/core-enums.c
+++ b/app/core/core-enums.c
@@ -1316,6 +1316,7 @@ gimp_dynamics_output_type_get_type (void)
     { GIMP_DYNAMICS_OUTPUT_ASPECT_RATIO, "GIMP_DYNAMICS_OUTPUT_ASPECT_RATIO", "aspect-ratio" },
     { GIMP_DYNAMICS_OUTPUT_SPACING, "GIMP_DYNAMICS_OUTPUT_SPACING", "spacing" },
     { GIMP_DYNAMICS_OUTPUT_RATE, "GIMP_DYNAMICS_OUTPUT_RATE", "rate" },
+    { GIMP_DYNAMICS_OUTPUT_FLOW, "GIMP_DYNAMICS_OUTPUT_FLOW", "flow" },
     { GIMP_DYNAMICS_OUTPUT_JITTER, "GIMP_DYNAMICS_OUTPUT_JITTER", "jitter" },
     { 0, NULL, NULL }
   };
@@ -1330,6 +1331,7 @@ gimp_dynamics_output_type_get_type (void)
     { GIMP_DYNAMICS_OUTPUT_ASPECT_RATIO, NC_("dynamics-output-type", "Aspect ratio"), NULL },
     { GIMP_DYNAMICS_OUTPUT_SPACING, NC_("dynamics-output-type", "Spacing"), NULL },
     { GIMP_DYNAMICS_OUTPUT_RATE, NC_("dynamics-output-type", "Rate"), NULL },
+    { GIMP_DYNAMICS_OUTPUT_FLOW, NC_("dynamics-output-type", "Flow"), NULL },
     { GIMP_DYNAMICS_OUTPUT_JITTER, NC_("dynamics-output-type", "Jitter"), NULL },
     { 0, NULL, NULL }
   };
diff --git a/app/core/core-enums.h b/app/core/core-enums.h
index 5b96977..e692897 100644
--- a/app/core/core-enums.h
+++ b/app/core/core-enums.h
@@ -598,6 +598,7 @@ typedef enum  /*< pdb-skip >*/
   GIMP_DYNAMICS_OUTPUT_ASPECT_RATIO, /*< desc="Aspect ratio" >*/
   GIMP_DYNAMICS_OUTPUT_SPACING,      /*< desc="Spacing"      >*/
   GIMP_DYNAMICS_OUTPUT_RATE,         /*< desc="Rate"         >*/
+  GIMP_DYNAMICS_OUTPUT_FLOW,         /*< desc="Flow"         >*/
   GIMP_DYNAMICS_OUTPUT_JITTER,       /*< desc="Jitter"       >*/
 } GimpDynamicsOutputType;
 
diff --git a/app/core/gimpdynamics.c b/app/core/gimpdynamics.c
index 87903be..95458aa 100644
--- a/app/core/gimpdynamics.c
+++ b/app/core/gimpdynamics.c
@@ -49,6 +49,7 @@ enum
   PROP_ASPECT_RATIO_OUTPUT,
   PROP_SPACING_OUTPUT,
   PROP_RATE_OUTPUT,
+  PROP_FLOW_OUTPUT,
   PROP_JITTER_OUTPUT
 };
 
@@ -118,6 +119,11 @@ gimp_dynamics_class_init (GimpDynamicsClass *klass)
                                    GIMP_TYPE_DYNAMICS_OUTPUT,
                                    GIMP_CONFIG_PARAM_AGGREGATE);
 
+  GIMP_CONFIG_INSTALL_PROP_OBJECT (object_class, PROP_FLOW_OUTPUT,
+                                   "flow-output", NULL,
+                                   GIMP_TYPE_DYNAMICS_OUTPUT,
+                                   GIMP_CONFIG_PARAM_AGGREGATE);
+
   GIMP_CONFIG_INSTALL_PROP_OBJECT (object_class, PROP_SIZE_OUTPUT,
                                    "size-output", NULL,
                                    GIMP_TYPE_DYNAMICS_OUTPUT,
@@ -161,6 +167,9 @@ gimp_dynamics_init (GimpDynamics *dynamics)
   dynamics->rate_output         = gimp_dynamics_create_output (dynamics,
                                                                "rate-output",
                                                                GIMP_DYNAMICS_OUTPUT_RATE);
+  dynamics->flow_output         = gimp_dynamics_create_output (dynamics,
+                                                               "flow-output",
+                                                               GIMP_DYNAMICS_OUTPUT_RATE);
   dynamics->size_output         = gimp_dynamics_create_output (dynamics,
                                                                "size-output",
                                                                GIMP_DYNAMICS_OUTPUT_SIZE);
@@ -189,6 +198,7 @@ gimp_dynamics_finalize (GObject *object)
   g_object_unref (dynamics->opacity_output);
   g_object_unref (dynamics->hardness_output);
   g_object_unref (dynamics->rate_output);
+  g_object_unref (dynamics->flow_output);
   g_object_unref (dynamics->size_output);
   g_object_unref (dynamics->aspect_ratio_output);
   g_object_unref (dynamics->color_output);
@@ -230,6 +240,11 @@ gimp_dynamics_set_property (GObject      *object,
       dest_output = dynamics->rate_output;
       break;
 
+    case PROP_FLOW_OUTPUT:
+      src_output  = g_value_get_object (value);
+      dest_output = dynamics->flow_output;
+      break;
+
     case PROP_SIZE_OUTPUT:
       src_output  = g_value_get_object (value);
       dest_output = dynamics->size_output;
@@ -299,6 +314,10 @@ gimp_dynamics_get_property (GObject    *object,
       g_value_set_object (value, dynamics->rate_output);
       break;
 
+    case PROP_FLOW_OUTPUT:
+      g_value_set_object (value, dynamics->flow_output);
+      break;
+
     case PROP_SIZE_OUTPUT:
       g_value_set_object (value, dynamics->size_output);
       break;
@@ -403,6 +422,10 @@ gimp_dynamics_get_output (GimpDynamics           *dynamics,
       return dynamics->rate_output;
       break;
 
+    case GIMP_DYNAMICS_OUTPUT_FLOW:
+      return dynamics->flow_output;
+      break;
+
     case GIMP_DYNAMICS_OUTPUT_SIZE:
       return dynamics->size_output;
       break;
diff --git a/app/core/gimpdynamics.h b/app/core/gimpdynamics.h
index efcfa26..824429f 100644
--- a/app/core/gimpdynamics.h
+++ b/app/core/gimpdynamics.h
@@ -39,6 +39,7 @@ struct _GimpDynamics
   GimpDynamicsOutput *opacity_output;
   GimpDynamicsOutput *hardness_output;
   GimpDynamicsOutput *rate_output;
+  GimpDynamicsOutput *flow_output;
   GimpDynamicsOutput *size_output;
   GimpDynamicsOutput *aspect_ratio_output;
   GimpDynamicsOutput *color_output;
diff --git a/app/paint/gimpairbrush.c b/app/paint/gimpairbrush.c
index 4eee96f..27ff463 100644
--- a/app/paint/gimpairbrush.c
+++ b/app/paint/gimpairbrush.c
@@ -197,7 +197,7 @@ gimp_airbrush_motion (GimpPaintCore    *paint_core,
   fade_point = gimp_paint_options_get_fade (paint_options, image,
                                             paint_core->pixel_dist);
   opacity  = options->flow / 100.0;
-  opacity *= gimp_dynamics_output_get_linear_value(GIMP_BRUSH_CORE(paint_core)->dynamics->opacity_output,
+  opacity *= gimp_dynamics_output_get_linear_value(GIMP_BRUSH_CORE(paint_core)->dynamics->flow_output,
                                                    coords,
                                                    paint_options,
                                                    fade_point);



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