mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-07-04 09:53:25 +00:00
use ABS instead of fabs.
2005-10-02 Simon Budig <simon@gimp.org> * app/core/gimpcoords.c: use ABS instead of fabs. * app/core/gimpimage-snap.c: Use proper default values for the coordinates. * app/vectors/gimpbezierstroke.c: Fix a bug plus add some debug output. For some reason does not snap yet.
This commit is contained in:
parent
ee64ca3c90
commit
5a43a464d2
4 changed files with 31 additions and 9 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
2005-10-02 Simon Budig <simon@gimp.org>
|
||||||
|
|
||||||
|
* app/core/gimpcoords.c: use ABS instead of fabs.
|
||||||
|
|
||||||
|
* app/core/gimpimage-snap.c: Use proper default values for the
|
||||||
|
coordinates.
|
||||||
|
|
||||||
|
* app/vectors/gimpbezierstroke.c: Fix a bug plus add some debug
|
||||||
|
output. For some reason does not snap yet.
|
||||||
|
|
||||||
2005-10-02 Sven Neumann <sven@gimp.org>
|
2005-10-02 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
* app/file/file-utils.[ch]: introduced variants of
|
* app/file/file-utils.[ch]: introduced variants of
|
||||||
|
|
|
@ -159,15 +159,15 @@ gimp_coords_manhattan_dist (const GimpCoords *a,
|
||||||
{
|
{
|
||||||
gdouble dist = 0;
|
gdouble dist = 0;
|
||||||
|
|
||||||
dist += fabs (a->pressure - b->pressure);
|
dist += ABS (a->pressure - b->pressure);
|
||||||
dist += fabs (a->xtilt - b->xtilt);
|
dist += ABS (a->xtilt - b->xtilt);
|
||||||
dist += fabs (a->ytilt - b->ytilt);
|
dist += ABS (a->ytilt - b->ytilt);
|
||||||
dist += fabs (a->wheel - b->wheel);
|
dist += ABS (a->wheel - b->wheel);
|
||||||
|
|
||||||
dist *= INPUT_RESOLUTION;
|
dist *= INPUT_RESOLUTION;
|
||||||
|
|
||||||
dist += fabs (a->x - b->x);
|
dist += ABS (a->x - b->x);
|
||||||
dist += fabs (a->y - b->y);
|
dist += ABS (a->y - b->y);
|
||||||
|
|
||||||
return dist;
|
return dist;
|
||||||
}
|
}
|
||||||
|
|
|
@ -535,8 +535,12 @@ gimp_image_snap_rectangle (GimpImage *gimage,
|
||||||
{
|
{
|
||||||
GimpVectors *vectors = gimp_image_get_active_vectors (gimage);
|
GimpVectors *vectors = gimp_image_get_active_vectors (gimage);
|
||||||
GimpStroke *stroke = NULL;
|
GimpStroke *stroke = NULL;
|
||||||
GimpCoords coords1 = { 0, 0, 0, 0, 0 };
|
GimpCoords coords1 = { 0, 0,
|
||||||
GimpCoords coords2 = { 0, 0, 0, 0, 0 };
|
GIMP_COORDS_DEFAULT_PRESSURE,
|
||||||
|
GIMP_COORDS_DEFAULT_TILT,
|
||||||
|
GIMP_COORDS_DEFAULT_TILT,
|
||||||
|
GIMP_COORDS_DEFAULT_WHEEL };
|
||||||
|
GimpCoords coords2 = coords1;
|
||||||
|
|
||||||
while ((stroke = gimp_vectors_stroke_get_next (vectors, stroke)))
|
while ((stroke = gimp_vectors_stroke_get_next (vectors, stroke)))
|
||||||
{
|
{
|
||||||
|
|
|
@ -950,6 +950,9 @@ gimp_bezier_stroke_segment_nearest_tangent_get (const GimpCoords *beziercoords,
|
||||||
ret_coords = g_array_new (FALSE, FALSE, sizeof (GimpCoords));
|
ret_coords = g_array_new (FALSE, FALSE, sizeof (GimpCoords));
|
||||||
ret_params = g_array_new (FALSE, FALSE, sizeof (gdouble));
|
ret_params = g_array_new (FALSE, FALSE, sizeof (gdouble));
|
||||||
|
|
||||||
|
g_printerr ("(%.2f, %.2f)-(%.2f,%.2f): ", coord1->x, coord1->y,
|
||||||
|
coord2->x, coord2->y);
|
||||||
|
|
||||||
gimp_bezier_coords_subdivide (beziercoords, precision,
|
gimp_bezier_coords_subdivide (beziercoords, precision,
|
||||||
&ret_coords, &ret_params);
|
&ret_coords, &ret_params);
|
||||||
|
|
||||||
|
@ -999,7 +1002,7 @@ gimp_bezier_stroke_segment_nearest_tangent_get (const GimpCoords *beziercoords,
|
||||||
if (dist < min_dist || min_dist < 0)
|
if (dist < min_dist || min_dist < 0)
|
||||||
{
|
{
|
||||||
min_dist = dist;
|
min_dist = dist;
|
||||||
*ret_point = min_point;
|
*ret_point = g_array_index (ret_coords, GimpCoords, i);
|
||||||
*ret_pos = g_array_index (ret_params, gdouble, i);
|
*ret_pos = g_array_index (ret_params, gdouble, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1007,6 +1010,11 @@ gimp_bezier_stroke_segment_nearest_tangent_get (const GimpCoords *beziercoords,
|
||||||
ori = ori2;
|
ori = ori2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (min_dist < 0)
|
||||||
|
g_printerr ("-\n");
|
||||||
|
else
|
||||||
|
g_printerr ("%f: (%.2f, %.2f) /%.3f/\n", min_dist,
|
||||||
|
(*ret_point).x, (*ret_point).y, *ret_pos);
|
||||||
return min_dist;
|
return min_dist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue