diff --git a/ChangeLog b/ChangeLog index 2f961df971..5ba91344f5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2000-02-14 Michael Natterer + + * app/Makefile.am + * app/vector2d.[ch]: removed. + + * app/gimpbrush.h + * app/paint_core.c: use the vectors from libgimp. + Mon Feb 14 18:53:23 CET 2000 Sven Neumann * plug-ins/common/winclipboard.c: typo @@ -56,7 +64,7 @@ Mon Feb 14 18:53:23 CET 2000 Sven Neumann adjustment returned by gimp_scale_entry_new(). * plug-ins/common/film.c: set reasonable climb_rate's for the - advanced options's spinbuttons. + advanced options' spinbuttons. Mon Feb 14 12:22:06 CET 2000 Sven Neumann diff --git a/app/Makefile.am b/app/Makefile.am index ddb146bf6b..f9ec5bfcb0 100644 --- a/app/Makefile.am +++ b/app/Makefile.am @@ -433,8 +433,6 @@ gimp_SOURCES = \ unitrc.h \ unit_cmds.c \ wilber.h \ - vector2d.c \ - vector2d.h \ xcf.c \ xcf.h \ xinput_airbrush.c \ diff --git a/app/core/gimpbrush.h b/app/core/gimpbrush.h index 93ab48e11a..e059978cfa 100644 --- a/app/core/gimpbrush.h +++ b/app/core/gimpbrush.h @@ -24,18 +24,19 @@ #include "gimpobjectP.h" #include "paint_core.h" #include "temp_buf.h" -#include "vector2d.h" + +#include "libgimp/gimpvector.h" struct _GimpBrush { GimpObject gobject; - gchar *filename; /* actual filename--brush's location on disk */ - gchar *name; /* brush's name--for brush selection dialog */ - gint spacing; /* brush's spacing */ - vector2d x_axis; /* for calculating brush spacing */ - vector2d y_axis; /* for calculating brush spacing */ - TempBuf *mask; /* the actual mask... */ + gchar *filename; /* actual filename--brush's location on disk */ + gchar *name; /* brush's name--for brush selection dialog */ + gint spacing; /* brush's spacing */ + GimpVector2 x_axis; /* for calculating brush spacing */ + GimpVector2 y_axis; /* for calculating brush spacing */ + TempBuf *mask; /* the actual mask... */ }; struct _GimpBrushClass diff --git a/app/gimpbrush.h b/app/gimpbrush.h index 93ab48e11a..e059978cfa 100644 --- a/app/gimpbrush.h +++ b/app/gimpbrush.h @@ -24,18 +24,19 @@ #include "gimpobjectP.h" #include "paint_core.h" #include "temp_buf.h" -#include "vector2d.h" + +#include "libgimp/gimpvector.h" struct _GimpBrush { GimpObject gobject; - gchar *filename; /* actual filename--brush's location on disk */ - gchar *name; /* brush's name--for brush selection dialog */ - gint spacing; /* brush's spacing */ - vector2d x_axis; /* for calculating brush spacing */ - vector2d y_axis; /* for calculating brush spacing */ - TempBuf *mask; /* the actual mask... */ + gchar *filename; /* actual filename--brush's location on disk */ + gchar *name; /* brush's name--for brush selection dialog */ + gint spacing; /* brush's spacing */ + GimpVector2 x_axis; /* for calculating brush spacing */ + GimpVector2 y_axis; /* for calculating brush spacing */ + TempBuf *mask; /* the actual mask... */ }; struct _GimpBrushClass diff --git a/app/paint_core.c b/app/paint_core.c index c7e103c5d9..e3491e102b 100644 --- a/app/paint_core.c +++ b/app/paint_core.c @@ -778,24 +778,25 @@ void paint_core_interpolate (PaintCore *paint_core, GimpDrawable *drawable) { - double n; - vector2d delta; + gdouble n; + GimpVector2 delta; #ifdef GTK_HAVE_SIX_VALUATORS - double dpressure, dxtilt, dytilt, dwheel; + gdouble dpressure, dxtilt, dytilt, dwheel; #else /* !GTK_HAVE_SIX_VALUATORS */ - double dpressure, dxtilt, dytilt; + gdouble dpressure, dxtilt, dytilt; #endif /* GTK_HAVE_SIX_VALUATORS */ /* double spacing; */ /* double lastscale, curscale; */ - double left; - double t; - double initial; - double dist; - double total; - double pixel_dist; - double pixel_initial; - double xd, yd; - double mag; + gdouble left; + gdouble t; + gdouble initial; + gdouble dist; + gdouble total; + gdouble pixel_dist; + gdouble pixel_initial; + gdouble xd, yd; + gdouble mag; + delta.x = paint_core->curx - paint_core->lastx; delta.y = paint_core->cury - paint_core->lasty; dpressure = paint_core->curpressure - paint_core->lastpressure; @@ -814,17 +815,19 @@ paint_core_interpolate (PaintCore *paint_core, return; /* calculate the distance traveled in the coordinate space of the brush */ - mag = vector2d_magnitude (&(paint_core->brush->x_axis)); - xd = vector2d_dot_product(&delta, &(paint_core->brush->x_axis)) / (mag*mag); + mag = gimp_vector2_length (&(paint_core->brush->x_axis)); + xd = gimp_vector2_inner_product (&delta, + &(paint_core->brush->x_axis)) / (mag*mag); - mag = vector2d_magnitude (&(paint_core->brush->y_axis)); - yd = vector2d_dot_product(&delta, &(paint_core->brush->y_axis)) / (mag*mag); + mag = gimp_vector2_length (&(paint_core->brush->y_axis)); + yd = gimp_vector2_inner_product (&delta, + &(paint_core->brush->y_axis)) / (mag*mag); dist = 0.5 * sqrt (xd*xd + yd*yd); total = dist + paint_core->distance; initial = paint_core->distance; - pixel_dist = vector2d_magnitude (&delta); + pixel_dist = gimp_vector2_length (&delta); pixel_initial = paint_core->pixel_dist; /* FIXME: need to adapt the spacing to the size */ diff --git a/app/tools/paint_core.c b/app/tools/paint_core.c index c7e103c5d9..e3491e102b 100644 --- a/app/tools/paint_core.c +++ b/app/tools/paint_core.c @@ -778,24 +778,25 @@ void paint_core_interpolate (PaintCore *paint_core, GimpDrawable *drawable) { - double n; - vector2d delta; + gdouble n; + GimpVector2 delta; #ifdef GTK_HAVE_SIX_VALUATORS - double dpressure, dxtilt, dytilt, dwheel; + gdouble dpressure, dxtilt, dytilt, dwheel; #else /* !GTK_HAVE_SIX_VALUATORS */ - double dpressure, dxtilt, dytilt; + gdouble dpressure, dxtilt, dytilt; #endif /* GTK_HAVE_SIX_VALUATORS */ /* double spacing; */ /* double lastscale, curscale; */ - double left; - double t; - double initial; - double dist; - double total; - double pixel_dist; - double pixel_initial; - double xd, yd; - double mag; + gdouble left; + gdouble t; + gdouble initial; + gdouble dist; + gdouble total; + gdouble pixel_dist; + gdouble pixel_initial; + gdouble xd, yd; + gdouble mag; + delta.x = paint_core->curx - paint_core->lastx; delta.y = paint_core->cury - paint_core->lasty; dpressure = paint_core->curpressure - paint_core->lastpressure; @@ -814,17 +815,19 @@ paint_core_interpolate (PaintCore *paint_core, return; /* calculate the distance traveled in the coordinate space of the brush */ - mag = vector2d_magnitude (&(paint_core->brush->x_axis)); - xd = vector2d_dot_product(&delta, &(paint_core->brush->x_axis)) / (mag*mag); + mag = gimp_vector2_length (&(paint_core->brush->x_axis)); + xd = gimp_vector2_inner_product (&delta, + &(paint_core->brush->x_axis)) / (mag*mag); - mag = vector2d_magnitude (&(paint_core->brush->y_axis)); - yd = vector2d_dot_product(&delta, &(paint_core->brush->y_axis)) / (mag*mag); + mag = gimp_vector2_length (&(paint_core->brush->y_axis)); + yd = gimp_vector2_inner_product (&delta, + &(paint_core->brush->y_axis)) / (mag*mag); dist = 0.5 * sqrt (xd*xd + yd*yd); total = dist + paint_core->distance; initial = paint_core->distance; - pixel_dist = vector2d_magnitude (&delta); + pixel_dist = gimp_vector2_length (&delta); pixel_initial = paint_core->pixel_dist; /* FIXME: need to adapt the spacing to the size */ diff --git a/app/vector2d.c b/app/vector2d.c deleted file mode 100644 index ba5b910f8c..0000000000 --- a/app/vector2d.c +++ /dev/null @@ -1,39 +0,0 @@ -/* vector2d - * Copyright (C) 1998 Jay Cox - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#include "vector2d.h" -#include - -double -vector2d_dot_product (vector2d *v1, vector2d *v2) -{ - return ((v1->x * v2->x) + (v1->y * v2->y)); -} - -double -vector2d_magnitude (vector2d *v) -{ - return (sqrt((v->x*v->x) + (v->y*v->y))); -} - -void -vector2d_set (vector2d *v, double x, double y) -{ - v->x = x; v->y = y; -} - diff --git a/app/vector2d.h b/app/vector2d.h deleted file mode 100644 index d04ffc24f7..0000000000 --- a/app/vector2d.h +++ /dev/null @@ -1,31 +0,0 @@ -/* vector2d - * Copyright (C) 1998 Jay Cox - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef __VECTOR2D_H__ -#define __VECTOR2D_H__ - -typedef struct _vector2d -{ - double x, y; -} vector2d; - -void vector2d_set (vector2d *v, double x, double y); -double vector2d_dot_product (vector2d *v1, vector2d *v2); -double vector2d_magnitude (vector2d *v); - -#endif /* __VECTOR2D_H__ */