mirror of
https://gitlab.gnome.org/GNOME/gimp
synced 2024-10-21 03:52:33 +00:00
app/core/gimpcoords-interpolate.c app/core/gimpbrush-transform.c
2009-02-10 Sven Neumann <sven@gimp.org> * app/core/gimpcoords-interpolate.c * app/core/gimpbrush-transform.c * app/paint/gimppaintoptions.c * app/display/gimpdisplayshell-coords.c: applied patch from Alexia Death that fixes the direction of brush rotation (bug #520078). svn path=/trunk/; revision=28010
This commit is contained in:
parent
fd4b557fd7
commit
f64e2a76bf
|
@ -1,3 +1,11 @@
|
||||||
|
2009-02-10 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
|
* app/core/gimpcoords-interpolate.c
|
||||||
|
* app/core/gimpbrush-transform.c
|
||||||
|
* app/paint/gimppaintoptions.c
|
||||||
|
* app/display/gimpdisplayshell-coords.c: applied patch from Alexia
|
||||||
|
Death that fixes the direction of brush rotation (bug #520078).
|
||||||
|
|
||||||
2009-02-10 Sven Neumann <sven@gimp.org>
|
2009-02-10 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
* app/display/gimpdisplayshell-coords.c
|
* app/display/gimpdisplayshell-coords.c
|
||||||
|
|
|
@ -205,7 +205,7 @@ gimp_brush_transform_matrix (GimpBrush *brush,
|
||||||
|
|
||||||
gimp_matrix3_identity (matrix);
|
gimp_matrix3_identity (matrix);
|
||||||
gimp_matrix3_translate (matrix, - center_x, - center_x);
|
gimp_matrix3_translate (matrix, - center_x, - center_x);
|
||||||
gimp_matrix3_rotate (matrix, 2 * G_PI * angle);
|
gimp_matrix3_rotate (matrix, -2 * G_PI * angle);
|
||||||
gimp_matrix3_translate (matrix, center_x, center_y);
|
gimp_matrix3_translate (matrix, center_x, center_y);
|
||||||
gimp_matrix3_scale (matrix, scale, scale);
|
gimp_matrix3_scale (matrix, scale, scale);
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,11 +40,11 @@ static void gimp_coords_interpolate_bezier_internal (const GimpCoords bezie
|
||||||
GArray **ret_coords,
|
GArray **ret_coords,
|
||||||
GArray **ret_params,
|
GArray **ret_params,
|
||||||
gint depth);
|
gint depth);
|
||||||
static gdouble gimp_coords_get_catmull_spline_point (gdouble t,
|
static gdouble gimp_coords_get_catmull_spline_point (const gdouble t,
|
||||||
gdouble p0,
|
const gdouble p0,
|
||||||
gdouble p1,
|
const gdouble p1,
|
||||||
gdouble p2,
|
const gdouble p2,
|
||||||
gdouble p3);
|
const gdouble p3);
|
||||||
|
|
||||||
/* Functions for bezier subdivision */
|
/* Functions for bezier subdivision */
|
||||||
|
|
||||||
|
@ -226,15 +226,15 @@ gimp_coords_interpolate_catmull (const GimpCoords catmul_pt1,
|
||||||
GArray **ret_coords,
|
GArray **ret_coords,
|
||||||
GArray **ret_params)
|
GArray **ret_params)
|
||||||
{
|
{
|
||||||
gdouble delta_x, delta_y;
|
gdouble delta_x, delta_y;
|
||||||
gdouble distance;
|
gdouble distance;
|
||||||
gint num_points;
|
gint num_points;
|
||||||
gint n;
|
gint n;
|
||||||
|
|
||||||
GimpCoords past_coords;
|
GimpCoords past_coords;
|
||||||
GimpCoords start_coords;
|
GimpCoords start_coords;
|
||||||
GimpCoords end_coords;
|
GimpCoords end_coords;
|
||||||
GimpCoords future_coords;
|
GimpCoords future_coords;
|
||||||
|
|
||||||
delta_x = catmul_pt3.x - catmul_pt2.x;
|
delta_x = catmul_pt3.x - catmul_pt2.x;
|
||||||
delta_y = catmul_pt3.y - catmul_pt2.y;
|
delta_y = catmul_pt3.y - catmul_pt2.y;
|
||||||
|
@ -323,7 +323,7 @@ gimp_coords_interpolate_catmull (const GimpCoords catmul_pt1,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
res_coords.direction = atan (delta_y / delta_x) / (2 * G_PI);
|
res_coords.direction = atan ((- delta_y) / delta_x) / (2 * G_PI);
|
||||||
|
|
||||||
if (delta_x > 0.0)
|
if (delta_x > 0.0)
|
||||||
res_coords.direction = res_coords.direction + 0.5;
|
res_coords.direction = res_coords.direction + 0.5;
|
||||||
|
@ -337,11 +337,11 @@ gimp_coords_interpolate_catmull (const GimpCoords catmul_pt1,
|
||||||
}
|
}
|
||||||
|
|
||||||
static gdouble
|
static gdouble
|
||||||
gimp_coords_get_catmull_spline_point (gdouble t,
|
gimp_coords_get_catmull_spline_point (const gdouble t,
|
||||||
gdouble p0,
|
const gdouble p0,
|
||||||
gdouble p1,
|
const gdouble p1,
|
||||||
gdouble p2,
|
const gdouble p2,
|
||||||
gdouble p3)
|
const gdouble p3)
|
||||||
{
|
{
|
||||||
|
|
||||||
return ((((-t + 2.0) * t - 1.0) * t / 2.0) * p0 +
|
return ((((-t + 2.0) * t - 1.0) * t / 2.0) * p0 +
|
||||||
|
|
|
@ -298,12 +298,13 @@ gimp_display_shell_eval_event (GimpDisplayShell *shell,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
coords->direction = atan (delta_y / delta_x) / (2 * G_PI);
|
coords->direction = atan ((- 1.0 * delta_y) / delta_x) / (2 * G_PI);
|
||||||
if (delta_x > 0.0)
|
if (delta_x < 0.0)
|
||||||
coords->direction = coords->direction + 0.5;
|
coords->direction = coords->direction + 0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
delta_dir = coords->direction - shell->last_coords.direction;
|
delta_dir = coords->direction - shell->last_coords.direction;
|
||||||
|
|
||||||
if ((fabs (delta_dir) > 0.5) && (delta_dir < 0.0))
|
if ((fabs (delta_dir) > 0.5) && (delta_dir < 0.0))
|
||||||
coords->direction = 0.3 * coords->direction + 0.7 * (shell->last_coords.direction - 1.0);
|
coords->direction = 0.3 * coords->direction + 0.7 * (shell->last_coords.direction - 1.0);
|
||||||
else if ((fabs (delta_dir) > 0.5) && (delta_dir > 0.0))
|
else if ((fabs (delta_dir) > 0.5) && (delta_dir > 0.0))
|
||||||
|
|
|
@ -503,7 +503,7 @@ gimp_paint_options_set_property (GObject *object,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_BRUSH_ANGLE:
|
case PROP_BRUSH_ANGLE:
|
||||||
options->brush_angle = g_value_get_double (value) / 360.0;
|
options->brush_angle = - 1.0 * g_value_get_double (value) / 360.0; /* let's make the angle mathematically correct */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_APPLICATION_MODE:
|
case PROP_APPLICATION_MODE:
|
||||||
|
@ -742,7 +742,7 @@ gimp_paint_options_get_property (GObject *object,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_BRUSH_ANGLE:
|
case PROP_BRUSH_ANGLE:
|
||||||
g_value_set_double (value, options->brush_angle * 360.0);
|
g_value_set_double (value, - 1.0 * options->brush_angle * 360.0); /* mathematically correct -> intuitively correct */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_APPLICATION_MODE:
|
case PROP_APPLICATION_MODE:
|
||||||
|
|
Loading…
Reference in a new issue