Cleaned up the Path header mess.

--Sven
This commit is contained in:
Sven Neumann 2000-02-16 13:52:33 +00:00
parent 84dccbc7bb
commit fde312118a
45 changed files with 514 additions and 504 deletions

View File

@ -1,3 +1,29 @@
Wed Feb 16 14:46:14 CET 2000 Sven Neumann <sven@gimp.org>
* app/pathsP.h: removed
* app/path.h
* app/pathP.h
* app/path_transform.h: new header files. Only files that absolutely
need to access the Path structures internally need to include pathP.h.
All other functionality is described in the other header files.
* app/Makefile.am
* app/bezier_select.h
* app/bezier_selectP.h
* app/edit_selection.c
* app/flip_tool.c
* app/gimpimage.c
* app/gimpimage.h
* app/gimpimageP.h
* app/path.c
* app/paths_cmds.c
* app/paths_dialog.c
* app/transform_core.c
* app/undo.c
* app/xcf.c
* tools/pdbgen/pdb/paths.pdb: Changed according to the changes
described above.
2000-02-16 Tuomas Kuosmanen <tigert@gimp.org>
* gimp1_1_splash.ppm: New splash, valentine is over.

View File

@ -329,11 +329,13 @@ gimp_SOURCES = \
parasitelistF.h \
parasitelistP.h \
path.c \
path.h \
pathP.h \
path_transform.h \
paths_cmds.c \
paths_dialog.c \
paths_dialog.h \
paths_dialogP.h \
pathsP.h \
pattern_header.h \
pattern_select.c \
pattern_select.h \

View File

@ -18,7 +18,10 @@
#ifndef __BEZIER_SELECT_H__
#define __BEZIER_SELECT_H__
#include "tools.h"
#include "toolsF.h"
typedef struct _bezier_point BezierPoint;
typedef struct _bezier_select BezierSelect;
/* bezier select functions */

View File

@ -37,8 +37,6 @@
enum { EXTEND_EDIT, EXTEND_ADD, EXTEND_REMOVE, EXTEND_NEW };
typedef struct _bezier_point BezierPoint;
struct _bezier_point
{
int type; /* type of point (anchor/control/move) */
@ -52,8 +50,6 @@ struct _bezier_point
*/
};
typedef struct _bezier_select BezierSelect;
struct _bezier_select
{
int state; /* start, add, edit or drag */

View File

@ -30,7 +30,7 @@
#include "undo.h"
#include "gimpsignal.h"
#include "gimpparasite.h"
#include "pathsP.h"
#include "path.h"
#include "gimprc.h"
#include "config.h"

View File

@ -30,7 +30,7 @@
#include "plug_in.h"
#include "temp_buf.h"
#include "tile_manager.h"
#include "pathsP.h"
#include "path.h"
#define GIMP_TYPE_IMAGE gimp_image_get_type()

View File

@ -30,7 +30,7 @@
#include "undo.h"
#include "gimpsignal.h"
#include "gimpparasite.h"
#include "pathsP.h"
#include "path.h"
#include "gimprc.h"
#include "config.h"

View File

@ -30,7 +30,7 @@
#include "plug_in.h"
#include "temp_buf.h"
#include "tile_manager.h"
#include "pathsP.h"
#include "path.h"
#define GIMP_TYPE_IMAGE gimp_image_get_type()

View File

@ -30,7 +30,7 @@
#include "undo.h"
#include "gimpsignal.h"
#include "gimpparasite.h"
#include "pathsP.h"
#include "path.h"
#include "gimprc.h"
#include "config.h"

View File

@ -30,7 +30,7 @@
#include "plug_in.h"
#include "temp_buf.h"
#include "tile_manager.h"
#include "pathsP.h"
#include "path.h"
#define GIMP_TYPE_IMAGE gimp_image_get_type()

View File

@ -30,7 +30,7 @@
#include "undo.h"
#include "gimpsignal.h"
#include "gimpparasite.h"
#include "pathsP.h"
#include "path.h"
#include "gimprc.h"
#include "config.h"

View File

@ -30,7 +30,7 @@
#include "plug_in.h"
#include "temp_buf.h"
#include "tile_manager.h"
#include "pathsP.h"
#include "path.h"
#define GIMP_TYPE_IMAGE gimp_image_get_type()

View File

@ -30,7 +30,7 @@
#include "undo.h"
#include "gimpsignal.h"
#include "gimpparasite.h"
#include "pathsP.h"
#include "path.h"
#include "gimprc.h"
#include "config.h"

View File

@ -30,7 +30,7 @@
#include "plug_in.h"
#include "temp_buf.h"
#include "tile_manager.h"
#include "pathsP.h"
#include "path.h"
#define GIMP_TYPE_IMAGE gimp_image_get_type()

View File

@ -34,6 +34,7 @@
#include "paint_core.h"
#include "paint_funcs.h"
#include "parasitelist.h"
#include "path_transform.h"
#include "tools.h"
#include "transform_core.h"
#include "undo.h"
@ -1069,8 +1070,8 @@ typedef struct _layer_display_undo LayerDisplaceUndo;
struct _layer_display_undo
{
int info[3];
void * path_undo;
int info[3];
PathUndo *path_undo;
};
int
@ -1082,15 +1083,15 @@ undo_push_layer_displace (GImage *gimage,
if ((new = undo_push (gimage, 12, LAYER_DISPLACE_UNDO, TRUE)))
{
new->data = (void *) g_malloc (sizeof(LayerDisplaceUndo));
new->data = (void *) g_malloc (sizeof (LayerDisplaceUndo));
new->pop_func = undo_pop_layer_displace;
new->free_func = undo_free_layer_displace;
ldu = (LayerDisplaceUndo *) new->data;
ldu->info[0] = drawable_ID(GIMP_DRAWABLE(layer));
ldu->info[1] = GIMP_DRAWABLE(layer)->offset_x;
ldu->info[2] = GIMP_DRAWABLE(layer)->offset_y;
ldu->path_undo = paths_transform_start_undo(gimage);
ldu->info[0] = drawable_ID (GIMP_DRAWABLE (layer));
ldu->info[1] = GIMP_DRAWABLE (layer)->offset_x;
ldu->info[2] = GIMP_DRAWABLE (layer)->offset_y;
ldu->path_undo = path_transform_start_undo (gimage);
return TRUE;
}
@ -1142,8 +1143,8 @@ undo_pop_layer_displace (GImage *gimage,
ldu->info[2] = old_offsets[1];
/* Now undo paths bits */
if(ldu->path_undo)
paths_transform_do_undo(gimage,ldu->path_undo);
if (ldu->path_undo)
path_transform_do_undo (gimage, ldu->path_undo);
return TRUE;
}
@ -1162,8 +1163,8 @@ undo_free_layer_displace (UndoState state,
ldu = (LayerDisplaceUndo *) info_ptr;
/* Free mem held for paths undo stuff */
if(ldu->path_undo)
paths_transform_free_undo(ldu->path_undo);
if (ldu->path_undo)
path_transform_free_undo (ldu->path_undo);
g_free (info_ptr);
}
@ -1216,7 +1217,7 @@ undo_pop_transform (GImage *gimage,
tc = (TransformCore *) active_tool->private;
tu = (TransformUndo *) tu_ptr;
paths_transform_do_undo(gimage,tu->path_undo);
path_transform_do_undo (gimage,tu->path_undo);
/* only pop if the active tool is the tool that pushed this undo */
if (tu->tool_ID != active_tool->ID)
@ -1257,7 +1258,7 @@ undo_free_transform (UndoState state,
tu = (TransformUndo *) tu_ptr;
if (tu->original)
tile_manager_destroy (tu->original);
paths_transform_free_undo(tu->path_undo);
path_transform_free_undo (tu->path_undo);
g_free (tu);
}

View File

@ -30,7 +30,7 @@
#include "undo.h"
#include "gimpsignal.h"
#include "gimpparasite.h"
#include "pathsP.h"
#include "path.h"
#include "gimprc.h"
#include "config.h"

View File

@ -30,7 +30,7 @@
#include "plug_in.h"
#include "temp_buf.h"
#include "tile_manager.h"
#include "pathsP.h"
#include "path.h"
#define GIMP_TYPE_IMAGE gimp_image_get_type()

View File

@ -30,7 +30,7 @@
#include "undo.h"
#include "gimpsignal.h"
#include "gimpparasite.h"
#include "pathsP.h"
#include "path.h"
#include "gimprc.h"
#include "config.h"

View File

@ -30,7 +30,7 @@
#include "plug_in.h"
#include "temp_buf.h"
#include "tile_manager.h"
#include "pathsP.h"
#include "path.h"
#define GIMP_TYPE_IMAGE gimp_image_get_type()

View File

@ -15,6 +15,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <stdlib.h>
#include <stdarg.h>
#include "gdk/gdkkeysyms.h"
@ -28,9 +30,8 @@
#include "gdisplay.h"
#include "undo.h"
#include "gimprc.h"
#include "paths_dialogP.h"
#include "path_transform.h"
#include "config.h"
#include "libgimp/gimpintl.h"
#include "libgimp/gimpmath.h"
@ -259,7 +260,7 @@ edit_selection_button_release (Tool *tool,
}
else
{
paths_transform_xy (gdisp->gimage, edit_select.cumlx, edit_select.cumly);
path_transform_xy (gdisp->gimage, edit_select.cumlx, edit_select.cumly);
}
undo_push_group_end (gdisp->gimage);

View File

@ -27,7 +27,7 @@
#include "gimage_mask.h"
#include "gimpui.h"
#include "temp_buf.h"
#include "paths_dialogP.h"
#include "path_transform.h"
#include "undo.h"
#include "gimage.h"
@ -282,9 +282,9 @@ flip_tool_flip (GimpImage *gimage,
* function.
*/
if (type == ORIENTATION_HORIZONTAL)
paths_transform_flip_horz (gimage);
path_transform_flip_horz (gimage);
else
paths_transform_flip_vert (gimage);
path_transform_flip_vert (gimage);
}
return new;

View File

@ -30,7 +30,7 @@
#include "undo.h"
#include "gimpsignal.h"
#include "gimpparasite.h"
#include "pathsP.h"
#include "path.h"
#include "gimprc.h"
#include "config.h"

View File

@ -30,7 +30,7 @@
#include "plug_in.h"
#include "temp_buf.h"
#include "tile_manager.h"
#include "pathsP.h"
#include "path.h"
#define GIMP_TYPE_IMAGE gimp_image_get_type()

View File

@ -26,7 +26,7 @@
#include "channel.h"
#include "layer.h"
#include "parasitelistF.h"
#include "pathsP.h"
#include "path.h"
#include "undo_types.h"

View File

@ -43,7 +43,9 @@
#include "ops_buttons.h"
#include "bezier_select.h"
#include "bezier_selectP.h"
#include "pathsP.h"
#include "path.h"
#include "pathP.h"
#include "path_transform.h"
#include "paths_dialog.h"
#include "paths_dialogP.h"
#include "session.h"
@ -104,7 +106,7 @@ struct _PathWidget
{
GdkPixmap *paths_pixmap;
GString *text;
Path* bzp;
Path *bzp;
};
typedef struct _PathCounts PathCounts;
@ -477,62 +479,6 @@ path_close (Path *bzp)
bzp->state = BEZIER_EDIT;
}
static BezierSelect *
path_to_beziersel (Path *bzp)
{
BezierSelect *bezier_sel;
BezierPoint *bpnt = NULL;
GSList *list;
if (!bzp)
{
g_warning ("path_to_beziersel:: NULL bzp");
}
list = bzp->path_details;
bezier_sel = g_new0 (BezierSelect, 1);
bezier_sel->num_points = 0;
bezier_sel->mask = NULL;
bezier_sel->core = NULL; /* not required will be reset in bezier code */
bezier_select_reset (bezier_sel);
bezier_sel->closed = bzp->closed;
/* bezier_sel->state = BEZIER_ADD; */
bezier_sel->state = bzp->state;
while (list)
{
PathPoint* pdata;
pdata = (PathPoint*)list->data;
if (pdata->type == BEZIER_MOVE)
{
/* printf("Close last curve off\n"); */
bezier_sel->last_point->next = bpnt;
bpnt->prev = bezier_sel->last_point;
bezier_sel->cur_anchor = NULL;
bezier_sel->cur_control = NULL;
bpnt = NULL;
}
bezier_add_point (bezier_sel,
(gint) pdata->type,
RINT(pdata->x), /* ALT add rint() */
RINT(pdata->y));
if (bpnt == NULL)
bpnt = bezier_sel->last_point;
list = g_slist_next (list);
}
if ( bezier_sel->closed )
{
bezier_sel->last_point->next = bpnt;
bpnt->prev = bezier_sel->last_point;
bezier_sel->cur_anchor = bezier_sel->points;
bezier_sel->cur_control = bezier_sel-> points->next;
}
return bezier_sel;
}
static void
bz_change_name_row_to (gint row,
gchar *text)
@ -1126,10 +1072,10 @@ paths_list_events (GtkWidget *widget,
}
static PathList*
path_add_to_current (PathList* pip,
Path* bzp,
GimpImage *gimage,
gint pos)
path_add_to_current (PathList *pip,
Path *bzp,
GimpImage *gimage,
gint pos)
{
/* add bzp to current list */
if (!pip)
@ -1150,10 +1096,10 @@ path_add_to_current (PathList* pip,
}
static Path*
paths_dialog_new_path (PathList* *plp,
gpointer points,
GimpImage *gimage,
gint pos)
paths_dialog_new_path (PathList **plp,
gpointer points,
GimpImage *gimage,
gint pos)
{
static gint nseed = 0;
Path* bzp;
@ -1625,7 +1571,7 @@ pathpoints_create (BezierSelect *sel)
pts = pts->next;
}
}
return(list);
return (list);
}
GSList *
@ -1658,8 +1604,8 @@ pathpoints_free (GSList *list)
}
static void
paths_update_bzpath (PathList* plp,
BezierSelect *bezier_sel)
paths_update_bzpath (PathList *plp,
BezierSelect *bezier_sel)
{
Path* p;
@ -1674,8 +1620,8 @@ paths_update_bzpath (PathList* plp,
}
static gboolean
paths_replaced_current (PathList* plp,
BezierSelect *bezier_sel)
paths_replaced_current (PathList *plp,
BezierSelect *bezier_sel)
{
/* Is there a currently selected path in this image? */
/* ALT if(paths_dialog && plp && */
@ -2210,61 +2156,60 @@ paths_dialog_export_path_callback (GtkWidget *widget,
* undo buffer. So deleted paths will not suddenly reappear. (I did say
* generally paths are not part of the undo structures).
*/
void *
paths_transform_start_undo (GimpImage *gimage)
PathUndo *
path_transform_start_undo (GimpImage *gimage)
{
/* Save only the locked paths away */
PathList* plp;
GSList *plist;
Path* p;
Path* p_copy;
GSList *undo_list = NULL;
PathList *plp;
GSList *plist;
Path* p;
Path* p_copy;
GSList *undo_list = NULL;
/* Get bzpath structure */
plp = (PathList*)gimp_image_get_paths(gimage);
plp = (PathList*) gimp_image_get_paths (gimage);
if(!plp)
if (!plp)
return NULL;
plist = plp->bz_paths;
while(plist)
for (plist = plp->bz_paths; plist; plist = g_slist_next (plist))
{
p = (Path*)plist->data;
if(p->locked)
if (p->locked)
{
/* save away for a rainly day */
p_copy = path_copy(NULL,p); /* NULL means dont want new tattoo */
undo_list = g_slist_append(undo_list,p_copy);
/* save away for a rainy day */
p_copy = path_copy (NULL, p); /* NULL means dont want new tattoo */
undo_list = g_slist_append (undo_list, p_copy);
}
plist = g_slist_next(plist);
}
return undo_list;
return (PathUndo*)undo_list;
}
void
paths_transform_free_undo (void *data)
path_transform_free_undo (PathUndo *pundo)
{
GSList *pundolist = data;
Path* p;
GSList *pundolist = (GSList*)pundo;
Path *p;
/* free data associated with the transform path undo */
while(pundolist)
while (pundolist)
{
p = (Path*)pundolist->data;
path_free (p);
pundolist = g_slist_next(pundolist);
pundolist = g_slist_next (pundolist);
}
g_slist_free((GSList *)data);
g_slist_free (pundolist);
}
void
paths_transform_do_undo (GimpImage *gimage,
void *data)
path_transform_do_undo (GimpImage *gimage,
PathUndo *pundo)
{
GSList *pundolist = data;
GSList *pundolist = (GSList*)pundo;
/* Restore the paths as they were before this transform took place. */
Path *p_undo;
Path *p;
@ -2333,9 +2278,9 @@ transform_func (GimpImage *gimage,
gdouble x,
gdouble y)
{
PathList* plp;
Path* p;
Path* p_copy;
PathList *plp;
Path *p;
Path *p_copy;
GSList *points_list;
BezierSelect *bezier_sel;
GSList *plist;
@ -2410,19 +2355,19 @@ transform_func (GimpImage *gimage,
}
void
paths_transform_flip_horz (GimpImage *gimage)
path_transform_flip_horz (GimpImage *gimage)
{
transform_func(gimage,TRUE,0.0,0);
}
void
paths_transform_flip_vert (GimpImage *gimage)
path_transform_flip_vert (GimpImage *gimage)
{
transform_func(gimage,TRUE,1.0,0);
}
void
paths_transform_xy (GimpImage *gimage,
path_transform_xy (GimpImage *gimage,
gint x,
gint y)
{
@ -2430,13 +2375,13 @@ paths_transform_xy (GimpImage *gimage,
}
void
paths_transform_current_path (GimpImage *gimage,
GimpMatrix3 transform,
gboolean forpreview)
path_transform_current_path (GimpImage *gimage,
GimpMatrix3 transform,
gboolean forpreview)
{
PathList* plp;
Path* p;
Path* p_copy;
PathList *plp;
Path *p;
Path *p_copy;
GSList *points_list;
BezierSelect *bezier_sel;
GSList *plist;
@ -2512,16 +2457,16 @@ paths_transform_current_path (GimpImage *gimage,
}
void
paths_draw_current (GDisplay *gdisp,
DrawCore *core,
GimpMatrix3 transform)
path_transform_draw_current (GDisplay *gdisp,
DrawCore *core,
GimpMatrix3 transform)
{
PathList* plp;
Path* bzp;
BezierSelect * bezier_sel;
Path* p_copy;
GSList * points_list;
GSList * plist;
PathList *plp;
Path *bzp;
BezierSelect *bezier_sel;
Path *p_copy;
GSList *points_list;
GSList *plist;
/* Get bzpath structure */
plp = (PathList*)gimp_image_get_paths(gdisp->gimage);
@ -2578,13 +2523,13 @@ paths_draw_current (GDisplay *gdisp,
/* Return TRUE if setting the path worked, else false */
gboolean
paths_set_path (GimpImage *gimage,
gchar *pname)
path_set_path (GimpImage *gimage,
gchar *pname)
{
gint row = 0;
gboolean found = FALSE;
GSList *tlist;
PathList* plp;
gint row = 0;
gboolean found = FALSE;
GSList *tlist;
PathList *plp;
/* Get bzpath structure */
plp = (PathList*)gimp_image_get_paths(gimage);
@ -2628,19 +2573,19 @@ paths_set_path (GimpImage *gimage,
/* Return TRUE if path created OK. */
gboolean
paths_set_path_points (GimpImage *gimage,
gchar *pname,
gint ptype,
gint pclosed,
gint num_pnts,
gdouble *pnts)
path_set_path_points (GimpImage *gimage,
gchar *pname,
gint ptype,
gint pclosed,
gint num_pnts,
gdouble *pnts)
{
PathList *plist = gimp_image_get_paths(gimage);
GSList *pts_list = NULL;
Path* bzpath;
BezierSelect *bezier_sel;
gint pcount = 0;
gint this_path_count = 0;
PathList *plist = gimp_image_get_paths(gimage);
GSList *pts_list = NULL;
Path *bzpath;
BezierSelect *bezier_sel;
gint pcount = 0;
gint this_path_count = 0;
if(num_pnts < 6 ||
(pclosed && ((num_pnts/3) % 3)) ||
@ -2770,12 +2715,12 @@ paths_set_path_points (GimpImage *gimage,
}
gboolean
paths_delete_path (GimpImage *gimage,
gchar *pname)
path_delete_path (GimpImage *gimage,
gchar *pname)
{
gint row = 0;
gboolean found = FALSE;
GSList *tlist;
gint row = 0;
gboolean found = FALSE;
GSList *tlist;
PathList *plp;
if(!pname || !gimage)

View File

@ -24,14 +24,13 @@
#include "bezier_selectP.h"
#include "gimpimage.h"
#include "pathsP.h"
#include "path.h"
#include "pathP.h"
#include "paths_dialog.h"
#include "libgimp/gimpmath.h"
static BezierSelect *path_to_beziersel (Path *bzp);
static gchar * unique_name (GimpImage *, gchar *);
@ -104,9 +103,9 @@ path_free (Path *path)
PathPoint*
path_point_new (gint type,
gdouble x,
gdouble y)
path_point_new (guint type,
gdouble x,
gdouble y)
{
PathPoint* pathpoint = g_new0 (PathPoint,1);
@ -130,7 +129,7 @@ path_stroke (GimpImage *gimage,
BezierSelect * bezier_sel;
GDisplay * gdisp;
gdisp = gdisplays_check_valid (pl->gdisp,gimage);
gdisp = gdisplays_check_valid (pl->gdisp, gimage);
bezier_sel = path_to_beziersel (bzp);
bezier_stroke (bezier_sel, gdisp, SUBDIVIDE, !bzp->closed);
bezier_select_free (bezier_sel);
@ -225,7 +224,7 @@ path_list_free (PathList* iml)
g_free (iml);
}
static BezierSelect *
BezierSelect *
path_to_beziersel (Path *bzp)
{
BezierSelect *bezier_sel;
@ -233,9 +232,7 @@ path_to_beziersel (Path *bzp)
GSList *list;
if (!bzp)
{
g_warning ("path_to_beziersel:: NULL bzp");
}
g_warning ("path_to_beziersel: NULL bzp");
list = bzp->path_details;
bezier_sel = g_new0 (BezierSelect, 1);

88
app/path.h Normal file
View File

@ -0,0 +1,88 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1999 Andy Thomas alt@picnic.demon.co.uk
*
* 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 __PATH_H__
#define __PATH_H__
#include "bezier_select.h"
typedef struct _Path Path;
typedef struct _PathPoint PathPoint;
typedef GSList PathUndo;
typedef struct
{
GimpImage *gimage;
GDisplay *gdisp; /* This is a hack.. Needed so we can get back to
* the same display that these curves were added
* too. That way when an entry in the paths dialog
* is clicked the bezier tool can be targeted at
* correct display. Note this display could have been
* deleted (ie different view), but gdisplays_check_valid()
* function will take care of that.. In this case we just
* pick a display that the gimage is rendered in.
*/
GSList *bz_paths; /* list of BZPATHP */
guint sig_id;
gint32 last_selected_row;
} PathList;
typedef enum
{
BEZIER = 1
} PathType;
Path* path_new (GimpImage *gimage,
PathType ptype,
GSList *path_details,
gint closed,
gint state,
gint locked,
gint tattoo,
gchar *name);
Path* path_copy (GimpImage *gimage,
Path *path);
void path_free (Path *path);
Tattoo path_get_tattoo (Path *path);
Path* path_get_path_by_tattoo (GimpImage *gimage,
Tattoo tattoo);
void path_stroke (GimpImage *gimage,
PathList *pl,
Path *bzp);
gint path_distance (Path *bzp,
gdouble dist,
gint *x,
gint *y,
gdouble *grad);
PathPoint* path_point_new (guint type,
gdouble x,
gdouble y);
void path_point_free (PathPoint *pathpoint);
PathList* path_list_new (GimpImage *gimage,
gint last_selected_row,
GSList *bz_paths);
void path_list_free (PathList *plist);
BezierSelect* path_to_beziersel (Path *path);
#endif /* __PATH_H__ */

59
app/pathP.h Normal file
View File

@ -0,0 +1,59 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1999 Andy Thomas alt@picnic.demon.co.uk
*
* 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 __PATHP_H__
#define __PATHP_H__
#include "gimpimageF.h" /* Tattoo */
struct _PathPoint
{
guint32 type;
gdouble x;
gdouble y;
};
struct _Path
{
GSList *path_details;
gint pathtype; /* Only beziers to start with */
gboolean closed;
guint32 state;
guint32 locked; /* Only bottom bit used */
Tattoo tattoo; /* The tattoo for the path */
gchar *name;
};
gboolean path_set_path (GimpImage *gimage,
gchar *pname);
gboolean path_set_path_points (GimpImage *gimage,
gchar *pname,
gint ptype,
gint pclosed,
gint num_pnts,
gdouble *pnts);
gboolean path_delete_path (GimpImage *gimage,
gchar *pname);
GSList* pathpoints_copy (GSList *list);
void pathpoints_free (GSList *list);
#endif /* __PATHP_H__ */

47
app/path_transform.h Normal file
View File

@ -0,0 +1,47 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1999 Andy Thomas alt@picnic.demon.co.uk
*
* 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 __PATH_TRANSFORM_H__
#define __PATH_TRANSFORM_H__
#include "draw_core.h"
#include "gdisplayF.h"
#include "path.h"
#include "libgimp/gimpmatrix.h"
PathUndo* path_transform_start_undo (GimpImage *gimage);
void path_transform_free_undo (PathUndo *pundo);
void path_transform_do_undo (GimpImage *gimage,
PathUndo *pundo);
void path_transform_current_path (GimpImage *gimage,
GimpMatrix3 transform,
gboolean forpreview);
void path_transform_draw_current (GDisplay *gimage,
DrawCore *core,
GimpMatrix3 transform);
void path_transform_flip_horz (GimpImage *gimage);
void path_transform_flip_vert (GimpImage *gimage);
void path_transform_xy (GimpImage *gimage, gint x, gint y);
#endif /* __PATH_TRANSFORM_H__ */

View File

@ -1,100 +0,0 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1999 Andy Thomas alt@picnic.demon.co.uk
*
* 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 __PATHSP_H__
#define __PATHSP_H__
#include "libgimp/gimpmatrix.h"
#include "gdisplayF.h" /* GDisplay */
#include "gimpimageF.h" /* Tattoo */
typedef struct
{
guint32 type;
gdouble x;
gdouble y;
} PathPoint;
typedef struct
{
GSList *path_details;
guint32 pathtype; /* Only beziers to start with */
gboolean closed;
guint32 state;
guint32 locked; /* Only bottom bit used */
Tattoo tattoo; /* The tattoo for the path */
gchar *name;
} Path;
typedef struct
{
GimpImage *gimage;
GDisplay *gdisp; /* This is a hack.. Needed so we can get back to
* the same display that these curves were added
* too. That way when an entry in the paths dialog
* is clicked the bezier tool can be targeted at
* correct display. Note this display could have been
* deleted (ie different view), but gdisplays_check_valid()
* function will take care of that.. In this case we just
* pick a display that the gimage is rendered in.
*/
GSList *bz_paths; /* list of BZPATHP */
guint sig_id;
gint32 last_selected_row;
} PathList;
typedef enum
{
BEZIER = 1
} PathType;
PathPoint * path_point_new (gint, gdouble, gdouble);
void path_point_free (PathPoint *pathpoint);
Path * path_new (GimpImage *, PathType, GSList *,
gint, gint, gint, gint, gchar *);
Path* path_copy (GimpImage *gimage, Path* p);
void path_free (Path *path);
Tattoo path_get_tattoo (Path*);
Path * path_get_path_by_tattoo (GimpImage *, Tattoo);
void path_stroke (GimpImage *, PathList *, Path *);
gint path_distance (Path *, gdouble, gint *, gint *, gdouble *);
PathList * path_list_new (GimpImage *, gint, GSList *);
void path_list_free (PathList *);
gboolean paths_set_path (GimpImage *, gchar *);
gboolean paths_set_path_points (GimpImage *, gchar *, gint, gint, gint, gdouble *);
void * paths_transform_start_undo (GimpImage *);
void paths_transform_free_undo (void *);
void paths_transform_do_undo (GimpImage *,void *);
void paths_transform_current_path (GimpImage *, GimpMatrix3, gboolean);
gboolean paths_delete_path (GimpImage *, gchar *);
GSList * pathpoints_copy (GSList *list);
void pathpoints_free (GSList *list);
#endif /* __PATHSP_H__ */

View File

@ -23,7 +23,8 @@
#include <string.h>
#include "gimage.h"
#include "pathsP.h"
#include "path.h"
#include "pathP.h"
static ProcRecord path_list_proc;
static ProcRecord path_get_points_proc;
@ -362,7 +363,7 @@ path_set_current_invoker (Argument *args)
success = FALSE;
if (success)
success = paths_set_path (gimage, pname);
success = path_set_path (gimage, pname);
return procedural_db_return_args (&path_set_current_proc, success);
}
@ -431,8 +432,8 @@ path_set_points_invoker (Argument *args)
else if ((numpoints / 3) % 3 != 2)
success = FALSE;
if (success && !paths_set_path_points (gimage, pname, ptype, pclosed,
numpoints, pnts))
if (success && !path_set_path_points (gimage, pname, ptype, pclosed,
numpoints, pnts))
success = FALSE;
}
@ -826,7 +827,7 @@ path_delete_invoker (Argument *args)
success = FALSE;
if (success)
success = paths_delete_path (gimage, pname);
success = path_delete_path (gimage, pname);
return procedural_db_return_args (&path_delete_proc, success);
}

View File

@ -43,7 +43,9 @@
#include "ops_buttons.h"
#include "bezier_select.h"
#include "bezier_selectP.h"
#include "pathsP.h"
#include "path.h"
#include "pathP.h"
#include "path_transform.h"
#include "paths_dialog.h"
#include "paths_dialogP.h"
#include "session.h"
@ -104,7 +106,7 @@ struct _PathWidget
{
GdkPixmap *paths_pixmap;
GString *text;
Path* bzp;
Path *bzp;
};
typedef struct _PathCounts PathCounts;
@ -477,62 +479,6 @@ path_close (Path *bzp)
bzp->state = BEZIER_EDIT;
}
static BezierSelect *
path_to_beziersel (Path *bzp)
{
BezierSelect *bezier_sel;
BezierPoint *bpnt = NULL;
GSList *list;
if (!bzp)
{
g_warning ("path_to_beziersel:: NULL bzp");
}
list = bzp->path_details;
bezier_sel = g_new0 (BezierSelect, 1);
bezier_sel->num_points = 0;
bezier_sel->mask = NULL;
bezier_sel->core = NULL; /* not required will be reset in bezier code */
bezier_select_reset (bezier_sel);
bezier_sel->closed = bzp->closed;
/* bezier_sel->state = BEZIER_ADD; */
bezier_sel->state = bzp->state;
while (list)
{
PathPoint* pdata;
pdata = (PathPoint*)list->data;
if (pdata->type == BEZIER_MOVE)
{
/* printf("Close last curve off\n"); */
bezier_sel->last_point->next = bpnt;
bpnt->prev = bezier_sel->last_point;
bezier_sel->cur_anchor = NULL;
bezier_sel->cur_control = NULL;
bpnt = NULL;
}
bezier_add_point (bezier_sel,
(gint) pdata->type,
RINT(pdata->x), /* ALT add rint() */
RINT(pdata->y));
if (bpnt == NULL)
bpnt = bezier_sel->last_point;
list = g_slist_next (list);
}
if ( bezier_sel->closed )
{
bezier_sel->last_point->next = bpnt;
bpnt->prev = bezier_sel->last_point;
bezier_sel->cur_anchor = bezier_sel->points;
bezier_sel->cur_control = bezier_sel-> points->next;
}
return bezier_sel;
}
static void
bz_change_name_row_to (gint row,
gchar *text)
@ -1126,10 +1072,10 @@ paths_list_events (GtkWidget *widget,
}
static PathList*
path_add_to_current (PathList* pip,
Path* bzp,
GimpImage *gimage,
gint pos)
path_add_to_current (PathList *pip,
Path *bzp,
GimpImage *gimage,
gint pos)
{
/* add bzp to current list */
if (!pip)
@ -1150,10 +1096,10 @@ path_add_to_current (PathList* pip,
}
static Path*
paths_dialog_new_path (PathList* *plp,
gpointer points,
GimpImage *gimage,
gint pos)
paths_dialog_new_path (PathList **plp,
gpointer points,
GimpImage *gimage,
gint pos)
{
static gint nseed = 0;
Path* bzp;
@ -1625,7 +1571,7 @@ pathpoints_create (BezierSelect *sel)
pts = pts->next;
}
}
return(list);
return (list);
}
GSList *
@ -1658,8 +1604,8 @@ pathpoints_free (GSList *list)
}
static void
paths_update_bzpath (PathList* plp,
BezierSelect *bezier_sel)
paths_update_bzpath (PathList *plp,
BezierSelect *bezier_sel)
{
Path* p;
@ -1674,8 +1620,8 @@ paths_update_bzpath (PathList* plp,
}
static gboolean
paths_replaced_current (PathList* plp,
BezierSelect *bezier_sel)
paths_replaced_current (PathList *plp,
BezierSelect *bezier_sel)
{
/* Is there a currently selected path in this image? */
/* ALT if(paths_dialog && plp && */
@ -2210,61 +2156,60 @@ paths_dialog_export_path_callback (GtkWidget *widget,
* undo buffer. So deleted paths will not suddenly reappear. (I did say
* generally paths are not part of the undo structures).
*/
void *
paths_transform_start_undo (GimpImage *gimage)
PathUndo *
path_transform_start_undo (GimpImage *gimage)
{
/* Save only the locked paths away */
PathList* plp;
GSList *plist;
Path* p;
Path* p_copy;
GSList *undo_list = NULL;
PathList *plp;
GSList *plist;
Path* p;
Path* p_copy;
GSList *undo_list = NULL;
/* Get bzpath structure */
plp = (PathList*)gimp_image_get_paths(gimage);
plp = (PathList*) gimp_image_get_paths (gimage);
if(!plp)
if (!plp)
return NULL;
plist = plp->bz_paths;
while(plist)
for (plist = plp->bz_paths; plist; plist = g_slist_next (plist))
{
p = (Path*)plist->data;
if(p->locked)
if (p->locked)
{
/* save away for a rainly day */
p_copy = path_copy(NULL,p); /* NULL means dont want new tattoo */
undo_list = g_slist_append(undo_list,p_copy);
/* save away for a rainy day */
p_copy = path_copy (NULL, p); /* NULL means dont want new tattoo */
undo_list = g_slist_append (undo_list, p_copy);
}
plist = g_slist_next(plist);
}
return undo_list;
return (PathUndo*)undo_list;
}
void
paths_transform_free_undo (void *data)
path_transform_free_undo (PathUndo *pundo)
{
GSList *pundolist = data;
Path* p;
GSList *pundolist = (GSList*)pundo;
Path *p;
/* free data associated with the transform path undo */
while(pundolist)
while (pundolist)
{
p = (Path*)pundolist->data;
path_free (p);
pundolist = g_slist_next(pundolist);
pundolist = g_slist_next (pundolist);
}
g_slist_free((GSList *)data);
g_slist_free (pundolist);
}
void
paths_transform_do_undo (GimpImage *gimage,
void *data)
path_transform_do_undo (GimpImage *gimage,
PathUndo *pundo)
{
GSList *pundolist = data;
GSList *pundolist = (GSList*)pundo;
/* Restore the paths as they were before this transform took place. */
Path *p_undo;
Path *p;
@ -2333,9 +2278,9 @@ transform_func (GimpImage *gimage,
gdouble x,
gdouble y)
{
PathList* plp;
Path* p;
Path* p_copy;
PathList *plp;
Path *p;
Path *p_copy;
GSList *points_list;
BezierSelect *bezier_sel;
GSList *plist;
@ -2410,19 +2355,19 @@ transform_func (GimpImage *gimage,
}
void
paths_transform_flip_horz (GimpImage *gimage)
path_transform_flip_horz (GimpImage *gimage)
{
transform_func(gimage,TRUE,0.0,0);
}
void
paths_transform_flip_vert (GimpImage *gimage)
path_transform_flip_vert (GimpImage *gimage)
{
transform_func(gimage,TRUE,1.0,0);
}
void
paths_transform_xy (GimpImage *gimage,
path_transform_xy (GimpImage *gimage,
gint x,
gint y)
{
@ -2430,13 +2375,13 @@ paths_transform_xy (GimpImage *gimage,
}
void
paths_transform_current_path (GimpImage *gimage,
GimpMatrix3 transform,
gboolean forpreview)
path_transform_current_path (GimpImage *gimage,
GimpMatrix3 transform,
gboolean forpreview)
{
PathList* plp;
Path* p;
Path* p_copy;
PathList *plp;
Path *p;
Path *p_copy;
GSList *points_list;
BezierSelect *bezier_sel;
GSList *plist;
@ -2512,16 +2457,16 @@ paths_transform_current_path (GimpImage *gimage,
}
void
paths_draw_current (GDisplay *gdisp,
DrawCore *core,
GimpMatrix3 transform)
path_transform_draw_current (GDisplay *gdisp,
DrawCore *core,
GimpMatrix3 transform)
{
PathList* plp;
Path* bzp;
BezierSelect * bezier_sel;
Path* p_copy;
GSList * points_list;
GSList * plist;
PathList *plp;
Path *bzp;
BezierSelect *bezier_sel;
Path *p_copy;
GSList *points_list;
GSList *plist;
/* Get bzpath structure */
plp = (PathList*)gimp_image_get_paths(gdisp->gimage);
@ -2578,13 +2523,13 @@ paths_draw_current (GDisplay *gdisp,
/* Return TRUE if setting the path worked, else false */
gboolean
paths_set_path (GimpImage *gimage,
gchar *pname)
path_set_path (GimpImage *gimage,
gchar *pname)
{
gint row = 0;
gboolean found = FALSE;
GSList *tlist;
PathList* plp;
gint row = 0;
gboolean found = FALSE;
GSList *tlist;
PathList *plp;
/* Get bzpath structure */
plp = (PathList*)gimp_image_get_paths(gimage);
@ -2628,19 +2573,19 @@ paths_set_path (GimpImage *gimage,
/* Return TRUE if path created OK. */
gboolean
paths_set_path_points (GimpImage *gimage,
gchar *pname,
gint ptype,
gint pclosed,
gint num_pnts,
gdouble *pnts)
path_set_path_points (GimpImage *gimage,
gchar *pname,
gint ptype,
gint pclosed,
gint num_pnts,
gdouble *pnts)
{
PathList *plist = gimp_image_get_paths(gimage);
GSList *pts_list = NULL;
Path* bzpath;
BezierSelect *bezier_sel;
gint pcount = 0;
gint this_path_count = 0;
PathList *plist = gimp_image_get_paths(gimage);
GSList *pts_list = NULL;
Path *bzpath;
BezierSelect *bezier_sel;
gint pcount = 0;
gint this_path_count = 0;
if(num_pnts < 6 ||
(pclosed && ((num_pnts/3) % 3)) ||
@ -2770,12 +2715,12 @@ paths_set_path_points (GimpImage *gimage,
}
gboolean
paths_delete_path (GimpImage *gimage,
gchar *pname)
path_delete_path (GimpImage *gimage,
gchar *pname)
{
gint row = 0;
gboolean found = FALSE;
GSList *tlist;
gint row = 0;
gboolean found = FALSE;
GSList *tlist;
PathList *plp;
if(!pname || !gimage)

View File

@ -26,8 +26,5 @@ void paths_new_bezier_select_tool (void);
Path * paths_get_bzpaths (void);
void paths_set_bzpaths (GImage *, Path *);
void paths_dialog_set_default_op (void);
void paths_transform_flip_horz (GImage *);
void paths_transform_flip_vert (GImage *);
void paths_transform_xy (GImage *, gint, gint);
#endif /* __PATHS_DIALOG_P_H__ */

View File

@ -18,7 +18,10 @@
#ifndef __BEZIER_SELECT_H__
#define __BEZIER_SELECT_H__
#include "tools.h"
#include "toolsF.h"
typedef struct _bezier_point BezierPoint;
typedef struct _bezier_select BezierSelect;
/* bezier select functions */

View File

@ -37,8 +37,6 @@
enum { EXTEND_EDIT, EXTEND_ADD, EXTEND_REMOVE, EXTEND_NEW };
typedef struct _bezier_point BezierPoint;
struct _bezier_point
{
int type; /* type of point (anchor/control/move) */
@ -52,8 +50,6 @@ struct _bezier_point
*/
};
typedef struct _bezier_select BezierSelect;
struct _bezier_select
{
int state; /* start, add, edit or drag */

View File

@ -15,6 +15,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <stdlib.h>
#include <stdarg.h>
#include "gdk/gdkkeysyms.h"
@ -28,9 +30,8 @@
#include "gdisplay.h"
#include "undo.h"
#include "gimprc.h"
#include "paths_dialogP.h"
#include "path_transform.h"
#include "config.h"
#include "libgimp/gimpintl.h"
#include "libgimp/gimpmath.h"
@ -259,7 +260,7 @@ edit_selection_button_release (Tool *tool,
}
else
{
paths_transform_xy (gdisp->gimage, edit_select.cumlx, edit_select.cumly);
path_transform_xy (gdisp->gimage, edit_select.cumlx, edit_select.cumly);
}
undo_push_group_end (gdisp->gimage);

View File

@ -27,7 +27,7 @@
#include "gimage_mask.h"
#include "gimpui.h"
#include "temp_buf.h"
#include "paths_dialogP.h"
#include "path_transform.h"
#include "undo.h"
#include "gimage.h"
@ -282,9 +282,9 @@ flip_tool_flip (GimpImage *gimage,
* function.
*/
if (type == ORIENTATION_HORIZONTAL)
paths_transform_flip_horz (gimage);
path_transform_flip_horz (gimage);
else
paths_transform_flip_vert (gimage);
path_transform_flip_vert (gimage);
}
return new;

View File

@ -15,6 +15,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <stdlib.h>
#include <stdarg.h>
#include "gdk/gdkkeysyms.h"
@ -28,9 +30,8 @@
#include "gdisplay.h"
#include "undo.h"
#include "gimprc.h"
#include "paths_dialogP.h"
#include "path_transform.h"
#include "config.h"
#include "libgimp/gimpintl.h"
#include "libgimp/gimpmath.h"
@ -259,7 +260,7 @@ edit_selection_button_release (Tool *tool,
}
else
{
paths_transform_xy (gdisp->gimage, edit_select.cumlx, edit_select.cumly);
path_transform_xy (gdisp->gimage, edit_select.cumlx, edit_select.cumly);
}
undo_push_group_end (gdisp->gimage);

View File

@ -27,7 +27,7 @@
#include "gimage_mask.h"
#include "gimpui.h"
#include "temp_buf.h"
#include "paths_dialogP.h"
#include "path_transform.h"
#include "undo.h"
#include "gimage.h"
@ -282,9 +282,9 @@ flip_tool_flip (GimpImage *gimage,
* function.
*/
if (type == ORIENTATION_HORIZONTAL)
paths_transform_flip_horz (gimage);
path_transform_flip_horz (gimage);
else
paths_transform_flip_vert (gimage);
path_transform_flip_vert (gimage);
}
return new;

View File

@ -30,6 +30,7 @@
#include "gimpui.h"
#include "info_dialog.h"
#include "interface.h"
#include "path_transform.h"
#include "transform_core.h"
#include "transform_tool.h"
#include "temp_buf.h"
@ -60,8 +61,6 @@ static gdouble cubic (gdouble, gint, gint, gint, gint);
static void transform_core_setup_grid (Tool *);
static void transform_core_grid_recalc (TransformCore *);
/* Hmmm... Should be in a headerfile but which? */
void paths_draw_current (GDisplay *, DrawCore *, GimpMatrix3);
#define BILINEAR(jk,j1k,jk1,j1k1,dx,dy) \
((1-dy) * (jk + dx * (j1k - jk)) + \
@ -461,8 +460,8 @@ transform_core_button_release (Tool *tool,
else
{
/* Only update the paths preview */
paths_transform_current_path (gdisp->gimage,
transform_core->transform, TRUE);
path_transform_current_path (gdisp->gimage,
transform_core->transform, TRUE);
}
}
else
@ -481,8 +480,8 @@ transform_core_button_release (Tool *tool,
draw_core_resume (transform_core->core, tool);
/* Update the paths preview */
paths_transform_current_path (gdisp->gimage,
transform_core->transform, TRUE);
path_transform_current_path (gdisp->gimage,
transform_core->transform, TRUE);
}
/* if this tool is non-interactive, make it inactive after use */
@ -498,7 +497,7 @@ transform_core_doit (Tool *tool,
TransformCore *transform_core;
TileManager *new_tiles;
TransformUndo *tu;
void *pundo;
PathUndo *pundo;
gboolean new_layer;
gint i, x, y;
@ -532,7 +531,7 @@ transform_core_doit (Tool *tool,
tool->drawable,
&new_layer);
pundo = paths_transform_start_undo (gdisp->gimage);
pundo = path_transform_start_undo (gdisp->gimage);
/* Send the request for the transformation to the tool...
*/
@ -828,7 +827,7 @@ transform_core_draw (Tool *tool)
gimp_matrix3_duplicate (transform_core->transform, tmp_matrix);
}
paths_draw_current (gdisp, transform_core->core, tmp_matrix);
path_transform_draw_current (gdisp, transform_core->core, tmp_matrix);
}
}
@ -1211,7 +1210,7 @@ transform_core_do (GImage *gimage,
gimp_matrix3_invert (matrix, m);
}
paths_transform_current_path (gimage, matrix, FALSE);
path_transform_current_path (gimage, matrix, FALSE);
x1 = float_tiles->x;
y1 = float_tiles->y;

View File

@ -30,6 +30,7 @@
#include "gimpui.h"
#include "info_dialog.h"
#include "interface.h"
#include "path_transform.h"
#include "transform_core.h"
#include "transform_tool.h"
#include "temp_buf.h"
@ -60,8 +61,6 @@ static gdouble cubic (gdouble, gint, gint, gint, gint);
static void transform_core_setup_grid (Tool *);
static void transform_core_grid_recalc (TransformCore *);
/* Hmmm... Should be in a headerfile but which? */
void paths_draw_current (GDisplay *, DrawCore *, GimpMatrix3);
#define BILINEAR(jk,j1k,jk1,j1k1,dx,dy) \
((1-dy) * (jk + dx * (j1k - jk)) + \
@ -461,8 +460,8 @@ transform_core_button_release (Tool *tool,
else
{
/* Only update the paths preview */
paths_transform_current_path (gdisp->gimage,
transform_core->transform, TRUE);
path_transform_current_path (gdisp->gimage,
transform_core->transform, TRUE);
}
}
else
@ -481,8 +480,8 @@ transform_core_button_release (Tool *tool,
draw_core_resume (transform_core->core, tool);
/* Update the paths preview */
paths_transform_current_path (gdisp->gimage,
transform_core->transform, TRUE);
path_transform_current_path (gdisp->gimage,
transform_core->transform, TRUE);
}
/* if this tool is non-interactive, make it inactive after use */
@ -498,7 +497,7 @@ transform_core_doit (Tool *tool,
TransformCore *transform_core;
TileManager *new_tiles;
TransformUndo *tu;
void *pundo;
PathUndo *pundo;
gboolean new_layer;
gint i, x, y;
@ -532,7 +531,7 @@ transform_core_doit (Tool *tool,
tool->drawable,
&new_layer);
pundo = paths_transform_start_undo (gdisp->gimage);
pundo = path_transform_start_undo (gdisp->gimage);
/* Send the request for the transformation to the tool...
*/
@ -828,7 +827,7 @@ transform_core_draw (Tool *tool)
gimp_matrix3_duplicate (transform_core->transform, tmp_matrix);
}
paths_draw_current (gdisp, transform_core->core, tmp_matrix);
path_transform_draw_current (gdisp, transform_core->core, tmp_matrix);
}
}
@ -1211,7 +1210,7 @@ transform_core_do (GImage *gimage,
gimp_matrix3_invert (matrix, m);
}
paths_transform_current_path (gimage, matrix, FALSE);
path_transform_current_path (gimage, matrix, FALSE);
x1 = float_tiles->x;
y1 = float_tiles->y;

View File

@ -34,6 +34,7 @@
#include "paint_core.h"
#include "paint_funcs.h"
#include "parasitelist.h"
#include "path_transform.h"
#include "tools.h"
#include "transform_core.h"
#include "undo.h"
@ -1069,8 +1070,8 @@ typedef struct _layer_display_undo LayerDisplaceUndo;
struct _layer_display_undo
{
int info[3];
void * path_undo;
int info[3];
PathUndo *path_undo;
};
int
@ -1082,15 +1083,15 @@ undo_push_layer_displace (GImage *gimage,
if ((new = undo_push (gimage, 12, LAYER_DISPLACE_UNDO, TRUE)))
{
new->data = (void *) g_malloc (sizeof(LayerDisplaceUndo));
new->data = (void *) g_malloc (sizeof (LayerDisplaceUndo));
new->pop_func = undo_pop_layer_displace;
new->free_func = undo_free_layer_displace;
ldu = (LayerDisplaceUndo *) new->data;
ldu->info[0] = drawable_ID(GIMP_DRAWABLE(layer));
ldu->info[1] = GIMP_DRAWABLE(layer)->offset_x;
ldu->info[2] = GIMP_DRAWABLE(layer)->offset_y;
ldu->path_undo = paths_transform_start_undo(gimage);
ldu->info[0] = drawable_ID (GIMP_DRAWABLE (layer));
ldu->info[1] = GIMP_DRAWABLE (layer)->offset_x;
ldu->info[2] = GIMP_DRAWABLE (layer)->offset_y;
ldu->path_undo = path_transform_start_undo (gimage);
return TRUE;
}
@ -1142,8 +1143,8 @@ undo_pop_layer_displace (GImage *gimage,
ldu->info[2] = old_offsets[1];
/* Now undo paths bits */
if(ldu->path_undo)
paths_transform_do_undo(gimage,ldu->path_undo);
if (ldu->path_undo)
path_transform_do_undo (gimage, ldu->path_undo);
return TRUE;
}
@ -1162,8 +1163,8 @@ undo_free_layer_displace (UndoState state,
ldu = (LayerDisplaceUndo *) info_ptr;
/* Free mem held for paths undo stuff */
if(ldu->path_undo)
paths_transform_free_undo(ldu->path_undo);
if (ldu->path_undo)
path_transform_free_undo (ldu->path_undo);
g_free (info_ptr);
}
@ -1216,7 +1217,7 @@ undo_pop_transform (GImage *gimage,
tc = (TransformCore *) active_tool->private;
tu = (TransformUndo *) tu_ptr;
paths_transform_do_undo(gimage,tu->path_undo);
path_transform_do_undo (gimage,tu->path_undo);
/* only pop if the active tool is the tool that pushed this undo */
if (tu->tool_ID != active_tool->ID)
@ -1257,7 +1258,7 @@ undo_free_transform (UndoState state,
tu = (TransformUndo *) tu_ptr;
if (tu->original)
tile_manager_destroy (tu->original);
paths_transform_free_undo(tu->path_undo);
path_transform_free_undo (tu->path_undo);
g_free (tu);
}

View File

@ -38,7 +38,8 @@
#include <libgimp/parasiteP.h>
#include <libgimp/parasite.h>
#include "parasitelist.h"
#include "pathsP.h"
#include "path.h"
#include "pathP.h"
#include <libgimp/gimpunit.h>
#include <libgimp/gimplimits.h>
@ -728,7 +729,7 @@ v1read_bz_point(XcfInfo *info)
info->cp += xcf_read_int32(info->fp, (guint32*)&x,1);
info->cp += xcf_read_int32(info->fp, (guint32*)&y,1);
ptr = path_point_new (type,(gdouble)x,(gdouble)y);
ptr = path_point_new (type, (gdouble)x, (gdouble)y);
return (ptr);
}
@ -745,7 +746,7 @@ read_bz_point(XcfInfo *info)
info->cp += xcf_read_float(info->fp, &x,1);
info->cp += xcf_read_float(info->fp, &y,1);
ptr = path_point_new(type,(gdouble)x,(gdouble)y);
ptr = path_point_new (type, (gdouble)x, (gdouble)y);
return (ptr);
}

View File

@ -38,7 +38,8 @@
#include <libgimp/parasiteP.h>
#include <libgimp/parasite.h>
#include "parasitelist.h"
#include "pathsP.h"
#include "path.h"
#include "pathP.h"
#include <libgimp/gimpunit.h>
#include <libgimp/gimplimits.h>
@ -728,7 +729,7 @@ v1read_bz_point(XcfInfo *info)
info->cp += xcf_read_int32(info->fp, (guint32*)&x,1);
info->cp += xcf_read_int32(info->fp, (guint32*)&y,1);
ptr = path_point_new (type,(gdouble)x,(gdouble)y);
ptr = path_point_new (type, (gdouble)x, (gdouble)y);
return (ptr);
}
@ -745,7 +746,7 @@ read_bz_point(XcfInfo *info)
info->cp += xcf_read_float(info->fp, &x,1);
info->cp += xcf_read_float(info->fp, &y,1);
ptr = path_point_new(type,(gdouble)x,(gdouble)y);
ptr = path_point_new (type, (gdouble)x, (gdouble)y);
return (ptr);
}

View File

@ -216,7 +216,7 @@ HELP
);
$inargs[0]->{desc} = 'The ID of the image to list set the paths in';
%invoke = ( code => 'success = paths_set_path (gimage, pname);' );
%invoke = ( code => 'success = path_set_path (gimage, pname);' );
}
sub path_set_points {
@ -273,8 +273,8 @@ HELP
else if ((numpoints / 3) % 3 != 2)
success = FALSE;
if (success && !paths_set_path_points (gimage, pname, ptype, pclosed,
numpoints, pnts))
if (success && !path_set_path_points (gimage, pname, ptype, pclosed,
numpoints, pnts))
success = FALSE;
}
CODE
@ -532,7 +532,7 @@ HELP
);
$inargs[0]->{desc} = 'The ID of the image to list delete the paths from';
%invoke = ( code => 'success = paths_delete_path (gimage, pname);' );
%invoke = ( code => 'success = path_delete_path (gimage, pname);' );
}
sub path_get_locked {
@ -763,7 +763,7 @@ CODE
}
@headers = qw(<string.h> "gimage.h" "pathsP.h");
@headers = qw(<string.h> "gimage.h" "path.h" "pathP.h");
@procs = qw(path_list path_get_points path_get_current path_set_current
path_set_points path_stroke_current path_get_point_at_dist