[gimp] app: Rewire the the feature formely known as harndess back to gui as force
- From: Alexia Death <alexiade src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: Rewire the the feature formely known as harndess back to gui as force
- Date: Thu, 8 Apr 2010 21:46:26 +0000 (UTC)
commit 78a4cae2d51918306f18a1ecbb9b4bbb7c744f60
Author: Alexia Death <alexiadeath gmail com>
Date: Fri Apr 9 00:44:52 2010 +0300
app: Rewire the the feature formely known as harndess back to gui as force
app/core/core-enums.c | 2 +
app/core/core-enums.h | 1 +
app/core/gimpdynamics.c | 26 +++++++++++++++++++++++
app/core/gimpdynamics.h | 1 +
app/paint/gimpbrushcore.c | 47 +++++++++++++++++++++--------------------
app/paint/gimpbrushcore.h | 1 +
app/paint/gimpclone.c | 6 ++--
app/paint/gimperaser.c | 6 ++--
app/paint/gimppaintbrush.c | 6 ++--
app/paint/gimppaintoptions.c | 8 ++----
10 files changed, 67 insertions(+), 37 deletions(-)
---
diff --git a/app/core/core-enums.c b/app/core/core-enums.c
index 9e46b37..88a23b1 100644
--- a/app/core/core-enums.c
+++ b/app/core/core-enums.c
@@ -1313,6 +1313,7 @@ gimp_dynamics_output_type_get_type (void)
{ GIMP_DYNAMICS_OUTPUT_ANGLE, "GIMP_DYNAMICS_OUTPUT_ANGLE", "angle" },
{ GIMP_DYNAMICS_OUTPUT_COLOR, "GIMP_DYNAMICS_OUTPUT_COLOR", "color" },
{ GIMP_DYNAMICS_OUTPUT_HARDNESS, "GIMP_DYNAMICS_OUTPUT_HARDNESS", "hardness" },
+ { GIMP_DYNAMICS_OUTPUT_FORCE, "GIMP_DYNAMICS_OUTPUT_FORCE", "force" },
{ 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" },
@@ -1328,6 +1329,7 @@ gimp_dynamics_output_type_get_type (void)
{ GIMP_DYNAMICS_OUTPUT_ANGLE, NC_("dynamics-output-type", "Angle"), NULL },
{ GIMP_DYNAMICS_OUTPUT_COLOR, NC_("dynamics-output-type", "Color"), NULL },
{ GIMP_DYNAMICS_OUTPUT_HARDNESS, NC_("dynamics-output-type", "Hardness"), NULL },
+ { GIMP_DYNAMICS_OUTPUT_FORCE, NC_("dynamics-output-type", "Force"), NULL },
{ 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 },
diff --git a/app/core/core-enums.h b/app/core/core-enums.h
index a5f76ee..029eb66 100644
--- a/app/core/core-enums.h
+++ b/app/core/core-enums.h
@@ -595,6 +595,7 @@ typedef enum /*< pdb-skip >*/
GIMP_DYNAMICS_OUTPUT_ANGLE, /*< desc="Angle" >*/
GIMP_DYNAMICS_OUTPUT_COLOR, /*< desc="Color" >*/
GIMP_DYNAMICS_OUTPUT_HARDNESS, /*< desc="Hardness" >*/
+ GIMP_DYNAMICS_OUTPUT_FORCE, /*< desc="Force" >*/
GIMP_DYNAMICS_OUTPUT_ASPECT_RATIO, /*< desc="Aspect ratio" >*/
GIMP_DYNAMICS_OUTPUT_SPACING, /*< desc="Spacing" >*/
GIMP_DYNAMICS_OUTPUT_RATE, /*< desc="Rate" >*/
diff --git a/app/core/gimpdynamics.c b/app/core/gimpdynamics.c
index 91d0a12..672e6bf 100644
--- a/app/core/gimpdynamics.c
+++ b/app/core/gimpdynamics.c
@@ -45,6 +45,7 @@ enum
PROP_SIZE_OUTPUT,
PROP_ANGLE_OUTPUT,
PROP_COLOR_OUTPUT,
+ PROP_FORCE_OUTPUT,
PROP_HARDNESS_OUTPUT,
PROP_ASPECT_RATIO_OUTPUT,
PROP_SPACING_OUTPUT,
@@ -109,6 +110,11 @@ gimp_dynamics_class_init (GimpDynamicsClass *klass)
GIMP_TYPE_DYNAMICS_OUTPUT,
GIMP_CONFIG_PARAM_AGGREGATE);
+ GIMP_CONFIG_INSTALL_PROP_OBJECT (object_class, PROP_FORCE_OUTPUT,
+ "force-output", NULL,
+ GIMP_TYPE_DYNAMICS_OUTPUT,
+ GIMP_CONFIG_PARAM_AGGREGATE);
+
GIMP_CONFIG_INSTALL_PROP_OBJECT (object_class, PROP_HARDNESS_OUTPUT,
"hardness-output", NULL,
GIMP_TYPE_DYNAMICS_OUTPUT,
@@ -161,6 +167,11 @@ gimp_dynamics_init (GimpDynamics *dynamics)
dynamics->opacity_output = gimp_dynamics_create_output (dynamics,
"opacity-output",
GIMP_DYNAMICS_OUTPUT_OPACITY);
+
+ dynamics->force_output = gimp_dynamics_create_output (dynamics,
+ "force-output",
+ GIMP_DYNAMICS_OUTPUT_FORCE);
+
dynamics->hardness_output = gimp_dynamics_create_output (dynamics,
"hardness-output",
GIMP_DYNAMICS_OUTPUT_HARDNESS);
@@ -196,6 +207,7 @@ gimp_dynamics_finalize (GObject *object)
GimpDynamics *dynamics = GIMP_DYNAMICS (object);
g_object_unref (dynamics->opacity_output);
+ g_object_unref (dynamics->force_output);
g_object_unref (dynamics->hardness_output);
g_object_unref (dynamics->rate_output);
g_object_unref (dynamics->flow_output);
@@ -230,6 +242,11 @@ gimp_dynamics_set_property (GObject *object,
dest_output = dynamics->opacity_output;
break;
+ case PROP_FORCE_OUTPUT:
+ src_output = g_value_get_object (value);
+ dest_output = dynamics->force_output;
+ break;
+
case PROP_HARDNESS_OUTPUT:
src_output = g_value_get_object (value);
dest_output = dynamics->hardness_output;
@@ -306,6 +323,10 @@ gimp_dynamics_get_property (GObject *object,
g_value_set_object (value, dynamics->opacity_output);
break;
+ case PROP_FORCE_OUTPUT:
+ g_value_set_object (value, dynamics->force_output);
+ break;
+
case PROP_HARDNESS_OUTPUT:
g_value_set_object (value, dynamics->hardness_output);
break;
@@ -415,6 +436,11 @@ gimp_dynamics_get_output (GimpDynamics *dynamics,
return dynamics->opacity_output;
break;
+
+ case GIMP_DYNAMICS_OUTPUT_FORCE:
+ return dynamics->force_output;
+ break;
+
case GIMP_DYNAMICS_OUTPUT_HARDNESS:
return dynamics->hardness_output;
break;
diff --git a/app/core/gimpdynamics.h b/app/core/gimpdynamics.h
index a81e183..d1f2545 100644
--- a/app/core/gimpdynamics.h
+++ b/app/core/gimpdynamics.h
@@ -38,6 +38,7 @@ struct _GimpDynamics
GimpDynamicsOutput *opacity_output;
GimpDynamicsOutput *hardness_output;
+ GimpDynamicsOutput *force_output;
GimpDynamicsOutput *rate_output;
GimpDynamicsOutput *flow_output;
GimpDynamicsOutput *size_output;
diff --git a/app/paint/gimpbrushcore.c b/app/paint/gimpbrushcore.c
index d0df765..5d0286c 100644
--- a/app/paint/gimpbrushcore.c
+++ b/app/paint/gimpbrushcore.c
@@ -191,6 +191,7 @@ gimp_brush_core_init (GimpBrushCore *core)
core->scale = 1.0;
core->angle = 1.0;
core->hardness = 1.0;
+ core->force = 1.0;
core->pressure_brush = NULL;
@@ -357,25 +358,25 @@ gimp_brush_core_pre_paint (GimpPaintCore *paint_core,
{
return FALSE;
}
- /*No drawing anything if the scale is too small*/
- if (GIMP_BRUSH_CORE_GET_CLASS (core)->handles_transforming_brush)
- {
- GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
- gdouble fade_point;
-
- if (GIMP_BRUSH_CORE_GET_CLASS (core)->handles_dynamic_transforming_brush)
+ /*No drawing anything if the scale is too small*/
+ if (GIMP_BRUSH_CORE_GET_CLASS (core)->handles_transforming_brush)
{
- fade_point = gimp_paint_options_get_fade (paint_options, image,
- paint_core->pixel_dist);
+ GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
+ gdouble fade_point;
- scale = paint_options->brush_scale *
- gimp_dynamics_output_get_linear_value (core->dynamics->size_output,
- ¤t_coords,
- paint_options,
- fade_point);
- if (scale < 0.0001) return FALSE;
+ if (GIMP_BRUSH_CORE_GET_CLASS (core)->handles_dynamic_transforming_brush)
+ {
+ fade_point = gimp_paint_options_get_fade (paint_options, image,
+ paint_core->pixel_dist);
+
+ scale = paint_options->brush_scale *
+ gimp_dynamics_output_get_linear_value (core->dynamics->size_output,
+ ¤t_coords,
+ paint_options,
+ fade_point);
+ if (scale < 0.0001) return FALSE;
+ }
}
- }
if (GIMP_BRUSH_CORE_GET_CLASS (paint_core)->handles_changing_brush)
{
@@ -1069,13 +1070,13 @@ gimp_brush_core_paste_canvas (GimpBrushCore *core,
gdouble image_opacity,
GimpLayerModeEffects paint_mode,
GimpBrushApplicationMode brush_hardness,
- gdouble dynamic_hardness,
+ gdouble dynamic_force,
GimpPaintApplicationMode mode)
{
TempBuf *brush_mask = gimp_brush_core_get_brush_mask (core,
coords,
brush_hardness,
- dynamic_hardness);
+ dynamic_force);
if (brush_mask)
{
@@ -1115,13 +1116,13 @@ gimp_brush_core_replace_canvas (GimpBrushCore *core,
gdouble brush_opacity,
gdouble image_opacity,
GimpBrushApplicationMode brush_hardness,
- gdouble dynamic_hardness,
+ gdouble dynamic_force,
GimpPaintApplicationMode mode)
{
TempBuf *brush_mask = gimp_brush_core_get_brush_mask (core,
coords,
brush_hardness,
- dynamic_hardness);
+ dynamic_force);
if (brush_mask)
{
@@ -1632,7 +1633,7 @@ TempBuf *
gimp_brush_core_get_brush_mask (GimpBrushCore *core,
const GimpCoords *coords,
GimpBrushApplicationMode brush_hardness,
- gdouble dynamic_hardness)
+ gdouble dynamic_force)
{
TempBuf *mask;
@@ -1659,7 +1660,7 @@ gimp_brush_core_get_brush_mask (GimpBrushCore *core,
mask = gimp_brush_core_pressurize_mask (core, mask,
coords->x,
coords->y,
- dynamic_hardness);
+ dynamic_force);
break;
default:
diff --git a/app/paint/gimpbrushcore.h b/app/paint/gimpbrushcore.h
index 16c055b..c9ecb4b 100644
--- a/app/paint/gimpbrushcore.h
+++ b/app/paint/gimpbrushcore.h
@@ -48,6 +48,7 @@ struct _GimpBrushCore
gdouble scale;
gdouble angle;
gdouble hardness;
+ gdouble force;
gdouble aspect_ratio;
/* brush buffers */
diff --git a/app/paint/gimpclone.c b/app/paint/gimpclone.c
index 4990e2b..992aa71 100644
--- a/app/paint/gimpclone.c
+++ b/app/paint/gimpclone.c
@@ -178,7 +178,7 @@ gimp_clone_motion (GimpSourceCore *source_core,
PixelRegion destPR;
GimpPattern *pattern = NULL;
gdouble fade_point;
- gdouble hardness;
+ gdouble force;
switch (options->clone_type)
{
@@ -243,7 +243,7 @@ gimp_clone_motion (GimpSourceCore *source_core,
fade_point = gimp_paint_options_get_fade (paint_options, image,
paint_core->pixel_dist);
- hardness = gimp_dynamics_output_get_linear_value (dynamics->hardness_output,
+ force = gimp_dynamics_output_get_linear_value (dynamics->force_output,
coords,
paint_options,
fade_point);
@@ -254,7 +254,7 @@ gimp_clone_motion (GimpSourceCore *source_core,
gimp_context_get_opacity (context),
gimp_context_get_paint_mode (context),
gimp_paint_options_get_brush_mode (paint_options),
- hardness,
+ force,
/* In fixed mode, paint incremental so the
* individual brushes are properly applied
diff --git a/app/paint/gimperaser.c b/app/paint/gimperaser.c
index 79c648e..daafb91 100644
--- a/app/paint/gimperaser.c
+++ b/app/paint/gimperaser.c
@@ -115,7 +115,7 @@ gimp_eraser_motion (GimpPaintCore *paint_core,
gdouble opacity;
TempBuf *area;
guchar col[MAX_CHANNELS];
- gdouble hardness;
+ gdouble force;
image = gimp_item_get_image (GIMP_ITEM (drawable));
@@ -145,7 +145,7 @@ gimp_eraser_motion (GimpPaintCore *paint_core,
color_pixels (temp_buf_get_data (area), col,
area->width * area->height, area->bytes);
- hardness = gimp_dynamics_output_get_linear_value (dynamics->hardness_output,
+ force = gimp_dynamics_output_get_linear_value (dynamics->force_output,
coords,
paint_options,
fade_point);
@@ -157,6 +157,6 @@ gimp_eraser_motion (GimpPaintCore *paint_core,
(options->anti_erase ?
GIMP_ANTI_ERASE_MODE : GIMP_ERASE_MODE),
gimp_paint_options_get_brush_mode (paint_options),
- hardness,
+ force,
paint_options->application_mode);
}
diff --git a/app/paint/gimppaintbrush.c b/app/paint/gimppaintbrush.c
index b842729..0bfcecc 100644
--- a/app/paint/gimppaintbrush.c
+++ b/app/paint/gimppaintbrush.c
@@ -119,7 +119,7 @@ _gimp_paintbrush_motion (GimpPaintCore *paint_core,
GimpPaintApplicationMode paint_appl_mode;
gdouble fade_point;
gdouble grad_point;
- gdouble hardness;
+ gdouble force;
image = gimp_item_get_image (GIMP_ITEM (drawable));
@@ -188,7 +188,7 @@ _gimp_paintbrush_motion (GimpPaintCore *paint_core,
area->bytes);
}
- hardness = gimp_dynamics_output_get_linear_value (dynamics->hardness_output,
+ force = gimp_dynamics_output_get_linear_value (dynamics->force_output,
coords,
paint_options,
fade_point);
@@ -200,6 +200,6 @@ _gimp_paintbrush_motion (GimpPaintCore *paint_core,
gimp_context_get_opacity (context),
gimp_context_get_paint_mode (context),
gimp_paint_options_get_brush_mode (paint_options),
- hardness,
+ force,
paint_appl_mode);
}
diff --git a/app/paint/gimppaintoptions.c b/app/paint/gimppaintoptions.c
index 15395cb..c369566 100644
--- a/app/paint/gimppaintoptions.c
+++ b/app/paint/gimppaintoptions.c
@@ -645,11 +645,9 @@ gimp_paint_options_get_brush_mode (GimpPaintOptions *paint_options)
dynamics = gimp_context_get_dynamics (GIMP_CONTEXT (paint_options));
-/* Im leaving the pressurize code in here, but Im not sure how,
- * or if at all it should be used. Not as hardness anyway.
- *
- * if (gimp_dynamics_output_is_enabled(dynamics->hardness_output))
- * return GIMP_BRUSH_PRESSURE; */
+
+ if (gimp_dynamics_output_is_enabled(dynamics->force_output))
+ return GIMP_BRUSH_PRESSURE;
return GIMP_BRUSH_SOFT;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]