app: add shortcut functions gimp_dynamics_get_foo_value()

and use them for simple use cases instead of dynamics_get_output() and
output_get_foo_value().
This commit is contained in:
Michael Natterer 2012-04-28 11:42:33 +02:00
parent 46ce18f994
commit a3a62b4546
13 changed files with 256 additions and 264 deletions

View File

@ -553,6 +553,57 @@ gimp_dynamics_get_output (GimpDynamics *dynamics,
}
}
gdouble
gimp_dynamics_get_linear_value (GimpDynamics *dynamics,
GimpDynamicsOutputType type,
const GimpCoords *coords,
GimpPaintOptions *options,
gdouble fade_point)
{
GimpDynamicsOutput *output;
g_return_val_if_fail (GIMP_IS_DYNAMICS (dynamics), 0.0);
output = gimp_dynamics_get_output (dynamics, type);
return gimp_dynamics_output_get_linear_value (output, coords,
options, fade_point);
}
gdouble
gimp_dynamics_get_angular_value (GimpDynamics *dynamics,
GimpDynamicsOutputType type,
const GimpCoords *coords,
GimpPaintOptions *options,
gdouble fade_point)
{
GimpDynamicsOutput *output;
g_return_val_if_fail (GIMP_IS_DYNAMICS (dynamics), 0.0);
output = gimp_dynamics_get_output (dynamics, type);
return gimp_dynamics_output_get_angular_value (output, coords,
options, fade_point);
}
gdouble
gimp_dynamics_get_aspect_value (GimpDynamics *dynamics,
GimpDynamicsOutputType type,
const GimpCoords *coords,
GimpPaintOptions *options,
gdouble fade_point)
{
GimpDynamicsOutput *output;
g_return_val_if_fail (GIMP_IS_DYNAMICS (dynamics), 0.0);
output = gimp_dynamics_get_output (dynamics, type);
return gimp_dynamics_output_get_aspect_value (output, coords,
options, fade_point);
}
/* private functions */

View File

@ -52,5 +52,23 @@ GimpData * gimp_dynamics_get_standard (GimpContext *context
GimpDynamicsOutput * gimp_dynamics_get_output (GimpDynamics *dynamics,
GimpDynamicsOutputType type);
gdouble gimp_dynamics_get_linear_value (GimpDynamics *dynamics,
GimpDynamicsOutputType type,
const GimpCoords *coords,
GimpPaintOptions *options,
gdouble fade_point);
gdouble gimp_dynamics_get_angular_value (GimpDynamics *dynamics,
GimpDynamicsOutputType type,
const GimpCoords *coords,
GimpPaintOptions *options,
gdouble fade_point);
gdouble gimp_dynamics_get_aspect_value (GimpDynamics *dynamics,
GimpDynamicsOutputType type,
const GimpCoords *coords,
GimpPaintOptions *options,
gdouble fade_point);
#endif /* __GIMP_DYNAMICS_H__ */

View File

@ -28,7 +28,6 @@
#include "core/gimpbrush.h"
#include "core/gimpdrawable.h"
#include "core/gimpdynamics.h"
#include "core/gimpdynamicsoutput.h"
#include "core/gimpgradient.h"
#include "core/gimpimage.h"
@ -139,11 +138,10 @@ gimp_airbrush_paint (GimpPaintCore *paint_core,
if ((options->rate != 0.0) && (!options->motion_only))
{
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GimpDynamicsOutput *rate_output;
gdouble fade_point;
gdouble dynamic_rate;
gint timeout;
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
gdouble fade_point;
gdouble dynamic_rate;
gint timeout;
fade_point = gimp_paint_options_get_fade (paint_options, image,
paint_core->pixel_dist);
@ -151,13 +149,11 @@ gimp_airbrush_paint (GimpPaintCore *paint_core,
airbrush->drawable = drawable;
airbrush->paint_options = paint_options;
rate_output = gimp_dynamics_get_output (dynamics,
GIMP_DYNAMICS_OUTPUT_RATE);
dynamic_rate = gimp_dynamics_output_get_linear_value (rate_output,
coords,
paint_options,
fade_point);
dynamic_rate = gimp_dynamics_get_linear_value (dynamics,
GIMP_DYNAMICS_OUTPUT_RATE,
coords,
paint_options,
fade_point);
timeout = 10000 / (options->rate * dynamic_rate);
@ -189,23 +185,21 @@ gimp_airbrush_motion (GimpPaintCore *paint_core,
const GimpCoords *coords)
{
GimpAirbrushOptions *options = GIMP_AIRBRUSH_OPTIONS (paint_options);
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GimpDynamicsOutput *flow_output;
GimpAirbrushOptions *options = GIMP_AIRBRUSH_OPTIONS (paint_options);
GimpDynamics *dynamics = GIMP_BRUSH_CORE (paint_core)->dynamics;
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
gdouble opacity;
gdouble fade_point;
flow_output = gimp_dynamics_get_output (GIMP_BRUSH_CORE (paint_core)->dynamics,
GIMP_DYNAMICS_OUTPUT_FLOW);
fade_point = gimp_paint_options_get_fade (paint_options, image,
paint_core->pixel_dist);
opacity = (options->flow / 100.0 *
gimp_dynamics_output_get_linear_value (flow_output,
coords,
paint_options,
fade_point));
gimp_dynamics_get_linear_value (dynamics,
GIMP_DYNAMICS_OUTPUT_FLOW,
coords,
paint_options,
fade_point));
_gimp_paintbrush_motion (paint_core, drawable, paint_options, coords, opacity);
}

View File

@ -228,7 +228,6 @@ gimp_brush_core_init (GimpBrushCore *core)
core->subsample_brushes[i][j] = NULL;
}
}
}
static void
@ -323,21 +322,17 @@ gimp_brush_core_pre_paint (GimpPaintCore *paint_core,
if (GIMP_BRUSH_CORE_GET_CLASS (core)->handles_dynamic_transforming_brush)
{
GimpDynamicsOutput *size_output;
size_output = gimp_dynamics_get_output (core->dynamics,
GIMP_DYNAMICS_OUTPUT_SIZE);
fade_point = gimp_paint_options_get_fade (paint_options, image,
paint_core->pixel_dist);
scale = paint_options->brush_size /
MAX (gimp_temp_buf_get_width (core->main_brush->mask),
gimp_temp_buf_get_height (core->main_brush->mask)) *
gimp_dynamics_output_get_linear_value (size_output,
&current_coords,
paint_options,
fade_point);
gimp_dynamics_get_linear_value (core->dynamics,
GIMP_DYNAMICS_OUTPUT_SIZE,
&current_coords,
paint_options,
fade_point);
if (scale < 0.0000001)
return FALSE;
@ -735,19 +730,16 @@ gimp_brush_core_interpolate (GimpPaintCore *paint_core,
if (core->jitter > 0.0)
{
GimpDynamicsOutput *jitter_output;
gdouble dyn_jitter;
gdouble jitter_dist;
gint32 jitter_angle;
jitter_output = gimp_dynamics_get_output (core->dynamics,
GIMP_DYNAMICS_OUTPUT_JITTER);
gdouble dyn_jitter;
gdouble jitter_dist;
gint32 jitter_angle;
dyn_jitter = (core->jitter *
gimp_dynamics_output_get_linear_value (jitter_output,
&current_coords,
paint_options,
fade_point));
gimp_dynamics_get_linear_value (core->dynamics,
GIMP_DYNAMICS_OUTPUT_JITTER,
&current_coords,
paint_options,
fade_point));
jitter_dist = g_rand_double_range (core->rand, 0, dyn_jitter);
jitter_angle = g_rand_int_range (core->rand,
@ -769,7 +761,6 @@ gimp_brush_core_interpolate (GimpPaintCore *paint_core,
gimp_paint_core_paint (paint_core, drawable, paint_options,
GIMP_PAINT_STATE_MOTION, time);
}
current_coords.x = last_coords.x + delta_vec.x;
@ -1319,7 +1310,6 @@ gimp_brush_core_solidify_mask (GimpBrushCore *core,
gint dest_offset_y = 0;
gint brush_mask_width = gimp_temp_buf_get_width (brush_mask);
gint brush_mask_height = gimp_temp_buf_get_height (brush_mask);
gint i, j;
if ((brush_mask_width % 2) == 0)
@ -1504,26 +1494,23 @@ gimp_brush_core_eval_transform_dynamics (GimpBrushCore *core,
paint_core->pixel_dist);
}
output = gimp_dynamics_get_output (core->dynamics,
GIMP_DYNAMICS_OUTPUT_SIZE);
core->scale *= gimp_dynamics_output_get_linear_value (output,
coords,
paint_options,
fade_point);
core->scale *= gimp_dynamics_get_linear_value (core->dynamics,
GIMP_DYNAMICS_OUTPUT_SIZE,
coords,
paint_options,
fade_point);
output = gimp_dynamics_get_output (core->dynamics,
GIMP_DYNAMICS_OUTPUT_ANGLE);
core->angle += gimp_dynamics_output_get_angular_value (output,
coords,
paint_options,
fade_point);
core->angle += gimp_dynamics_get_angular_value (core->dynamics,
GIMP_DYNAMICS_OUTPUT_ANGLE,
coords,
paint_options,
fade_point);
output = gimp_dynamics_get_output (core->dynamics,
GIMP_DYNAMICS_OUTPUT_HARDNESS);
core->hardness = gimp_dynamics_output_get_linear_value (output,
coords,
paint_options,
fade_point);
core->hardness = gimp_dynamics_get_linear_value (core->dynamics,
GIMP_DYNAMICS_OUTPUT_HARDNESS,
coords,
paint_options,
fade_point);
output = gimp_dynamics_get_output (core->dynamics,
GIMP_DYNAMICS_OUTPUT_ASPECT_RATIO);
@ -1699,7 +1686,7 @@ gimp_brush_core_paint_line_pixmap_mask (GimpDrawable *drawable,
fish = babl_fish (pixmap_format,
gimp_drawable_get_format_with_alpha (drawable));
/* put the source pixmap's pixels, into one line, so we can use
/* put the source pixmap's pixels into one line, so we can use
* one single call to babl_process() to convert the entire line
*/
for (i = 0; i < width; i++)

View File

@ -31,7 +31,6 @@
#include "core/gimp.h"
#include "core/gimpdrawable.h"
#include "core/gimpdynamics.h"
#include "core/gimpdynamicsoutput.h"
#include "core/gimperror.h"
#include "core/gimpimage.h"
#include "core/gimppattern.h"
@ -149,14 +148,13 @@ gimp_clone_motion (GimpSourceCore *source_core,
gint paint_area_width,
gint paint_area_height)
{
GimpPaintCore *paint_core = GIMP_PAINT_CORE (source_core);
GimpCloneOptions *options = GIMP_CLONE_OPTIONS (paint_options);
GimpSourceOptions *source_options = GIMP_SOURCE_OPTIONS (paint_options);
GimpContext *context = GIMP_CONTEXT (paint_options);
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GimpDynamicsOutput *force_output;
gdouble fade_point;
gdouble force;
GimpPaintCore *paint_core = GIMP_PAINT_CORE (source_core);
GimpCloneOptions *options = GIMP_CLONE_OPTIONS (paint_options);
GimpSourceOptions *source_options = GIMP_SOURCE_OPTIONS (paint_options);
GimpContext *context = GIMP_CONTEXT (paint_options);
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
gdouble fade_point;
gdouble force;
switch (options->clone_type)
{
@ -195,16 +193,14 @@ gimp_clone_motion (GimpSourceCore *source_core,
break;
}
force_output = gimp_dynamics_get_output (GIMP_BRUSH_CORE (paint_core)->dynamics,
GIMP_DYNAMICS_OUTPUT_FORCE);
fade_point = gimp_paint_options_get_fade (paint_options, image,
paint_core->pixel_dist);
force = gimp_dynamics_output_get_linear_value (force_output,
coords,
paint_options,
fade_point);
force = gimp_dynamics_get_linear_value (GIMP_BRUSH_CORE (paint_core)->dynamics,
GIMP_DYNAMICS_OUTPUT_FORCE,
coords,
paint_options,
fade_point);
gimp_brush_core_paste_canvas (GIMP_BRUSH_CORE (paint_core), drawable,
coords,

View File

@ -28,7 +28,6 @@
#include "core/gimpbrush.h"
#include "core/gimpdrawable.h"
#include "core/gimpdynamics.h"
#include "core/gimpdynamicsoutput.h"
#include "core/gimpimage.h"
#include "core/gimppickable.h"
#include "core/gimptempbuf.h"
@ -129,8 +128,6 @@ gimp_convolve_motion (GimpPaintCore *paint_core,
GimpConvolveOptions *options = GIMP_CONVOLVE_OPTIONS (paint_options);
GimpContext *context = GIMP_CONTEXT (paint_options);
GimpDynamics *dynamics = GIMP_BRUSH_CORE (paint_core)->dynamics;
GimpDynamicsOutput *opacity_output;
GimpDynamicsOutput *rate_output;
GimpImage *image;
GeglBuffer *paint_buffer;
gint paint_buffer_x;
@ -143,16 +140,14 @@ gimp_convolve_motion (GimpPaintCore *paint_core,
image = gimp_item_get_image (GIMP_ITEM (drawable));
opacity_output = gimp_dynamics_get_output (dynamics,
GIMP_DYNAMICS_OUTPUT_OPACITY);
fade_point = gimp_paint_options_get_fade (paint_options, image,
paint_core->pixel_dist);
opacity = gimp_dynamics_output_get_linear_value (opacity_output,
coords,
paint_options,
fade_point);
opacity = gimp_dynamics_get_linear_value (dynamics,
GIMP_DYNAMICS_OUTPUT_OPACITY,
coords,
paint_options,
fade_point);
if (opacity == 0.0)
return;
@ -163,14 +158,12 @@ gimp_convolve_motion (GimpPaintCore *paint_core,
if (! paint_buffer)
return;
rate_output = gimp_dynamics_get_output (dynamics,
GIMP_DYNAMICS_OUTPUT_RATE);
rate = (options->rate *
gimp_dynamics_output_get_linear_value (rate_output,
coords,
paint_options,
fade_point));
gimp_dynamics_get_linear_value (dynamics,
GIMP_DYNAMICS_OUTPUT_RATE,
coords,
paint_options,
fade_point));
gimp_convolve_calculate_matrix (convolve, options->type,
gimp_temp_buf_get_width (brush_core->brush->mask) / 2,

View File

@ -30,7 +30,6 @@
#include "core/gimp.h"
#include "core/gimpdrawable.h"
#include "core/gimpdynamics.h"
#include "core/gimpdynamicsoutput.h"
#include "core/gimpimage.h"
#include "gimpdodgeburn.h"
@ -115,9 +114,7 @@ gimp_dodge_burn_motion (GimpPaintCore *paint_core,
GimpDodgeBurnOptions *options = GIMP_DODGE_BURN_OPTIONS (paint_options);
GimpContext *context = GIMP_CONTEXT (paint_options);
GimpDynamics *dynamics = GIMP_BRUSH_CORE (paint_core)->dynamics;
GimpDynamicsOutput *opacity_output;
GimpDynamicsOutput *hardness_output;
GimpImage *image;
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GeglBuffer *paint_buffer;
gint paint_buffer_x;
gint paint_buffer_y;
@ -125,18 +122,14 @@ gimp_dodge_burn_motion (GimpPaintCore *paint_core,
gdouble opacity;
gdouble hardness;
image = gimp_item_get_image (GIMP_ITEM (drawable));
opacity_output = gimp_dynamics_get_output (dynamics,
GIMP_DYNAMICS_OUTPUT_OPACITY);
fade_point = gimp_paint_options_get_fade (paint_options, image,
paint_core->pixel_dist);
opacity = gimp_dynamics_output_get_linear_value (opacity_output,
coords,
paint_options,
fade_point);
opacity = gimp_dynamics_get_linear_value (dynamics,
GIMP_DYNAMICS_OUTPUT_OPACITY,
coords,
paint_options,
fade_point);
if (opacity == 0.0)
return;
@ -159,13 +152,11 @@ gimp_dodge_burn_motion (GimpPaintCore *paint_core,
options->type,
options->mode);
hardness_output = gimp_dynamics_get_output (dynamics,
GIMP_DYNAMICS_OUTPUT_HARDNESS);
hardness = gimp_dynamics_output_get_linear_value (hardness_output,
coords,
paint_options,
fade_point);
hardness = gimp_dynamics_get_linear_value (dynamics,
GIMP_DYNAMICS_OUTPUT_HARDNESS,
coords,
paint_options,
fade_point);
/* Replace the newly dodgedburned area (paint_area) to the image */
gimp_brush_core_replace_canvas (GIMP_BRUSH_CORE (paint_core), drawable,

View File

@ -26,7 +26,6 @@
#include "core/gimp.h"
#include "core/gimpdrawable.h"
#include "core/gimpdynamics.h"
#include "core/gimpdynamicsoutput.h"
#include "core/gimpimage.h"
#include "gimperaser.h"
@ -103,31 +102,27 @@ gimp_eraser_motion (GimpPaintCore *paint_core,
GimpPaintOptions *paint_options,
const GimpCoords *coords)
{
GimpEraserOptions *options = GIMP_ERASER_OPTIONS (paint_options);
GimpContext *context = GIMP_CONTEXT (paint_options);
GimpDynamics *dynamics = GIMP_BRUSH_CORE (paint_core)->dynamics;
GimpDynamicsOutput *opacity_output;
GimpDynamicsOutput *force_output;
gdouble fade_point;
gdouble opacity;
GeglBuffer *paint_buffer;
gint paint_buffer_x;
gint paint_buffer_y;
GimpRGB background;
GeglColor *color;
gdouble force;
GimpEraserOptions *options = GIMP_ERASER_OPTIONS (paint_options);
GimpContext *context = GIMP_CONTEXT (paint_options);
GimpDynamics *dynamics = GIMP_BRUSH_CORE (paint_core)->dynamics;
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
gdouble fade_point;
gdouble opacity;
GeglBuffer *paint_buffer;
gint paint_buffer_x;
gint paint_buffer_y;
GimpRGB background;
GeglColor *color;
gdouble force;
opacity_output = gimp_dynamics_get_output (dynamics,
GIMP_DYNAMICS_OUTPUT_OPACITY);
fade_point = gimp_paint_options_get_fade (paint_options,
gimp_item_get_image (GIMP_ITEM (drawable)),
fade_point = gimp_paint_options_get_fade (paint_options, image,
paint_core->pixel_dist);
opacity = gimp_dynamics_output_get_linear_value (opacity_output,
coords,
paint_options,
fade_point);
opacity = gimp_dynamics_get_linear_value (dynamics,
GIMP_DYNAMICS_OUTPUT_OPACITY,
coords,
paint_options,
fade_point);
if (opacity == 0.0)
return;
@ -144,13 +139,11 @@ gimp_eraser_motion (GimpPaintCore *paint_core,
gegl_buffer_set_color (paint_buffer, NULL, color);
g_object_unref (color);
force_output = gimp_dynamics_get_output (dynamics,
GIMP_DYNAMICS_OUTPUT_FORCE);
force = gimp_dynamics_output_get_linear_value (force_output,
coords,
paint_options,
fade_point);
force = gimp_dynamics_get_linear_value (dynamics,
GIMP_DYNAMICS_OUTPUT_FORCE,
coords,
paint_options,
fade_point);
gimp_brush_core_paste_canvas (GIMP_BRUSH_CORE (paint_core), drawable,
coords,

View File

@ -31,7 +31,6 @@
#include "core/gimpbrush.h"
#include "core/gimpdrawable.h"
#include "core/gimpdynamics.h"
#include "core/gimpdynamicsoutput.h"
#include "core/gimperror.h"
#include "core/gimpimage.h"
#include "core/gimppickable.h"
@ -475,27 +474,24 @@ gimp_heal_motion (GimpSourceCore *source_core,
gint paint_area_width,
gint paint_area_height)
{
GimpPaintCore *paint_core = GIMP_PAINT_CORE (source_core);
GimpContext *context = GIMP_CONTEXT (paint_options);
GimpDynamics *dynamics = GIMP_BRUSH_CORE (paint_core)->dynamics;
GimpDynamicsOutput *hardness_output;
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GeglBuffer *src_copy;
GeglBuffer *mask_buffer;
const GimpTempBuf *mask_buf;
gdouble fade_point;
gdouble hardness;
hardness_output = gimp_dynamics_get_output (dynamics,
GIMP_DYNAMICS_OUTPUT_HARDNESS);
GimpPaintCore *paint_core = GIMP_PAINT_CORE (source_core);
GimpContext *context = GIMP_CONTEXT (paint_options);
GimpDynamics *dynamics = GIMP_BRUSH_CORE (paint_core)->dynamics;
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GeglBuffer *src_copy;
GeglBuffer *mask_buffer;
const GimpTempBuf *mask_buf;
gdouble fade_point;
gdouble hardness;
fade_point = gimp_paint_options_get_fade (paint_options, image,
paint_core->pixel_dist);
hardness = gimp_dynamics_output_get_linear_value (hardness_output,
coords,
paint_options,
fade_point);
hardness = gimp_dynamics_get_linear_value (dynamics,
GIMP_DYNAMICS_OUTPUT_HARDNESS,
coords,
paint_options,
fade_point);
mask_buf = gimp_brush_core_get_brush_mask (GIMP_BRUSH_CORE (source_core),
coords,

View File

@ -32,7 +32,6 @@
#include "core/gimpbrush.h"
#include "core/gimpdrawable.h"
#include "core/gimpdynamics.h"
#include "core/gimpdynamicsoutput.h"
#include "core/gimpgradient.h"
#include "core/gimpimage.h"
#include "core/gimptempbuf.h"
@ -112,9 +111,6 @@ _gimp_paintbrush_motion (GimpPaintCore *paint_core,
GimpBrushCore *brush_core = GIMP_BRUSH_CORE (paint_core);
GimpContext *context = GIMP_CONTEXT (paint_options);
GimpDynamics *dynamics = brush_core->dynamics;
GimpDynamicsOutput *opacity_output;
GimpDynamicsOutput *color_output;
GimpDynamicsOutput *force_output;
GimpImage *image;
GimpRGB gradient_color;
GeglBuffer *paint_buffer;
@ -127,16 +123,14 @@ _gimp_paintbrush_motion (GimpPaintCore *paint_core,
image = gimp_item_get_image (GIMP_ITEM (drawable));
opacity_output = gimp_dynamics_get_output (dynamics,
GIMP_DYNAMICS_OUTPUT_OPACITY);
fade_point = gimp_paint_options_get_fade (paint_options, image,
paint_core->pixel_dist);
opacity *= gimp_dynamics_output_get_linear_value (opacity_output,
coords,
paint_options,
fade_point);
opacity *= gimp_dynamics_get_linear_value (dynamics,
GIMP_DYNAMICS_OUTPUT_OPACITY,
coords,
paint_options,
fade_point);
if (opacity == 0.0)
return;
@ -149,13 +143,11 @@ _gimp_paintbrush_motion (GimpPaintCore *paint_core,
paint_appl_mode = paint_options->application_mode;
color_output = gimp_dynamics_get_output (dynamics,
GIMP_DYNAMICS_OUTPUT_COLOR);
grad_point = gimp_dynamics_output_get_linear_value (color_output,
coords,
paint_options,
fade_point);
grad_point = gimp_dynamics_get_linear_value (dynamics,
GIMP_DYNAMICS_OUTPUT_COLOR,
coords,
paint_options,
fade_point);
if (gimp_paint_options_get_gradient_color (paint_options, image,
grad_point,
@ -204,13 +196,11 @@ _gimp_paintbrush_motion (GimpPaintCore *paint_core,
g_object_unref (color);
}
force_output = gimp_dynamics_get_output (dynamics,
GIMP_DYNAMICS_OUTPUT_FORCE);
force = gimp_dynamics_output_get_linear_value (force_output,
coords,
paint_options,
fade_point);
force = gimp_dynamics_get_linear_value (dynamics,
GIMP_DYNAMICS_OUTPUT_FORCE,
coords,
paint_options,
fade_point);
/* finally, let the brush core paste the colored area on the canvas */
gimp_brush_core_paste_canvas (brush_core, drawable,

View File

@ -911,7 +911,8 @@ gimp_paint_core_smooth_coords (GimpPaintCore *core,
{
/* We use gaussian function with velocity as a window function */
velocity_sum += next_coords->velocity * 100;
rate = gaussian_weight * exp (-velocity_sum*velocity_sum / (2 * gaussian_weight2));
rate = gaussian_weight * exp (-velocity_sum * velocity_sum /
(2 * gaussian_weight2));
}
scale_sum += rate;
@ -924,7 +925,5 @@ gimp_paint_core_smooth_coords (GimpPaintCore *core,
coords->x /= scale_sum;
coords->y /= scale_sum;
}
}
}

View File

@ -29,7 +29,6 @@
#include "core/gimpbrush.h"
#include "core/gimpdrawable.h"
#include "core/gimpdynamics.h"
#include "core/gimpdynamicsoutput.h"
#include "core/gimpimage.h"
#include "core/gimppickable.h"
#include "core/gimptempbuf.h"
@ -232,38 +231,31 @@ gimp_smudge_motion (GimpPaintCore *paint_core,
GimpPaintOptions *paint_options,
const GimpCoords *coords)
{
GimpSmudge *smudge = GIMP_SMUDGE (paint_core);
GimpSmudgeOptions *options = GIMP_SMUDGE_OPTIONS (paint_options);
GimpContext *context = GIMP_CONTEXT (paint_options);
GimpDynamics *dynamics = GIMP_BRUSH_CORE (paint_core)->dynamics;
GimpDynamicsOutput *opacity_output;
GimpDynamicsOutput *rate_output;
GimpDynamicsOutput *hardness_output;
GimpImage *image;
GeglBuffer *paint_buffer;
gint paint_buffer_x;
gint paint_buffer_y;
gint paint_buffer_width;
gint paint_buffer_height;
gdouble fade_point;
gdouble opacity;
gdouble rate;
gdouble dynamic_rate;
gint x, y;
gdouble hardness;
image = gimp_item_get_image (GIMP_ITEM (drawable));
opacity_output = gimp_dynamics_get_output (dynamics,
GIMP_DYNAMICS_OUTPUT_OPACITY);
GimpSmudge *smudge = GIMP_SMUDGE (paint_core);
GimpSmudgeOptions *options = GIMP_SMUDGE_OPTIONS (paint_options);
GimpContext *context = GIMP_CONTEXT (paint_options);
GimpDynamics *dynamics = GIMP_BRUSH_CORE (paint_core)->dynamics;
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GeglBuffer *paint_buffer;
gint paint_buffer_x;
gint paint_buffer_y;
gint paint_buffer_width;
gint paint_buffer_height;
gdouble fade_point;
gdouble opacity;
gdouble rate;
gdouble dynamic_rate;
gint x, y;
gdouble hardness;
fade_point = gimp_paint_options_get_fade (paint_options, image,
paint_core->pixel_dist);
opacity = gimp_dynamics_output_get_linear_value (opacity_output,
coords,
paint_options,
fade_point);
opacity = gimp_dynamics_get_linear_value (dynamics,
GIMP_DYNAMICS_OUTPUT_OPACITY,
coords,
paint_options,
fade_point);
if (opacity == 0.0)
return;
@ -281,13 +273,11 @@ gimp_smudge_motion (GimpPaintCore *paint_core,
gimp_smudge_accumulator_coords (paint_core, coords, &x, &y);
/* Enable dynamic rate */
rate_output = gimp_dynamics_get_output (dynamics,
GIMP_DYNAMICS_OUTPUT_RATE);
dynamic_rate = gimp_dynamics_output_get_linear_value (rate_output,
coords,
paint_options,
fade_point);
dynamic_rate = gimp_dynamics_get_linear_value (dynamics,
GIMP_DYNAMICS_OUTPUT_RATE,
coords,
paint_options,
fade_point);
rate = (options->rate / 100.0) * dynamic_rate;
@ -324,13 +314,11 @@ gimp_smudge_motion (GimpPaintCore *paint_core,
paint_buffer,
GEGL_RECTANGLE (0, 0, 0, 0));
hardness_output = gimp_dynamics_get_output (dynamics,
GIMP_DYNAMICS_OUTPUT_HARDNESS);
hardness = gimp_dynamics_output_get_linear_value (hardness_output,
coords,
paint_options,
fade_point);
hardness = gimp_dynamics_get_linear_value (dynamics,
GIMP_DYNAMICS_OUTPUT_HARDNESS,
coords,
paint_options,
fade_point);
gimp_brush_core_replace_canvas (GIMP_BRUSH_CORE (paint_core), drawable,
coords,

View File

@ -28,7 +28,6 @@
#include "core/gimp.h"
#include "core/gimpdrawable.h"
#include "core/gimpdynamics.h"
#include "core/gimpdynamicsoutput.h"
#include "core/gimperror.h"
#include "core/gimpimage.h"
#include "core/gimppickable.h"
@ -346,36 +345,33 @@ gimp_source_core_motion (GimpSourceCore *source_core,
const GimpCoords *coords)
{
GimpPaintCore *paint_core = GIMP_PAINT_CORE (source_core);
GimpSourceOptions *options = GIMP_SOURCE_OPTIONS (paint_options);
GimpDynamics *dynamics = GIMP_BRUSH_CORE (paint_core)->dynamics;
GimpDynamicsOutput *opacity_output;
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GimpPickable *src_pickable = NULL;
GeglBuffer *src_buffer = NULL;
GeglRectangle src_rect;
gint src_offset_x;
gint src_offset_y;
GeglBuffer *paint_buffer;
gint paint_buffer_x;
gint paint_buffer_y;
gint paint_area_offset_x;
gint paint_area_offset_y;
gint paint_area_width;
gint paint_area_height;
gdouble fade_point;
gdouble opacity;
opacity_output = gimp_dynamics_get_output (dynamics,
GIMP_DYNAMICS_OUTPUT_OPACITY);
GimpPaintCore *paint_core = GIMP_PAINT_CORE (source_core);
GimpSourceOptions *options = GIMP_SOURCE_OPTIONS (paint_options);
GimpDynamics *dynamics = GIMP_BRUSH_CORE (paint_core)->dynamics;
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GimpPickable *src_pickable = NULL;
GeglBuffer *src_buffer = NULL;
GeglRectangle src_rect;
gint src_offset_x;
gint src_offset_y;
GeglBuffer *paint_buffer;
gint paint_buffer_x;
gint paint_buffer_y;
gint paint_area_offset_x;
gint paint_area_offset_y;
gint paint_area_width;
gint paint_area_height;
gdouble fade_point;
gdouble opacity;
fade_point = gimp_paint_options_get_fade (paint_options, image,
paint_core->pixel_dist);
opacity = gimp_dynamics_output_get_linear_value (opacity_output,
coords,
paint_options,
fade_point);
opacity = gimp_dynamics_get_linear_value (dynamics,
GIMP_DYNAMICS_OUTPUT_OPACITY,
coords,
paint_options,
fade_point);
if (opacity == 0.0)
return;