mirror of https://github.com/GNOME/gimp.git
app: Rewire the the feature formely known as harndess back to gui as force
This commit is contained in:
parent
9ed712ddc4
commit
78a4cae2d5
|
@ -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 },
|
||||
|
|
|
@ -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" >*/
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -38,6 +38,7 @@ struct _GimpDynamics
|
|||
|
||||
GimpDynamicsOutput *opacity_output;
|
||||
GimpDynamicsOutput *hardness_output;
|
||||
GimpDynamicsOutput *force_output;
|
||||
GimpDynamicsOutput *rate_output;
|
||||
GimpDynamicsOutput *flow_output;
|
||||
GimpDynamicsOutput *size_output;
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -48,6 +48,7 @@ struct _GimpBrushCore
|
|||
gdouble scale;
|
||||
gdouble angle;
|
||||
gdouble hardness;
|
||||
gdouble force;
|
||||
gdouble aspect_ratio;
|
||||
|
||||
/* brush buffers */
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue