1999-03-22 08:51:30 +08:00
/* The GIMP -- an image manipulation program
1999-03-28 14:55:29 +08:00
* Copyright ( C ) 1995 - 1999 Spencer Kimball and Peter Mattis
1999-03-22 08:51:30 +08:00
*
* 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 .
*/
1999-03-28 14:55:29 +08:00
/* NOTE: This file is autogenerated by pdbgen.pl. */
1999-03-22 08:51:30 +08:00
1999-03-28 14:55:29 +08:00
# include "procedural_db.h"
1999-03-22 08:51:30 +08:00
Win32 portability changes:
* config.h.win32, README.win32: Small changes.
* tools/pdbgen/pdb/*.pdb: Include <string.h>.
* app/*_cmds.c: Autogenerated files reflect above changes.
* libgimp/makefile.msc app/makefile.msc: Various updates,
including new object files. Gtk+ directory now should be called
gtk+ (not gtk-plus). Use win32-specific gdk subdir. Glib directory
now should be called just glib.
* libgimp/gimp.def: Updates.
* libgimp/gimpfeatures.h.win32: Made current with
gimpfeatures.h.in.
* libgimp/gimpfileselection.c: Define S_ISDIR and S_ISREG if
necessary.
* tools/pdbgen/pdb/fileops.pdb: Must have a
statement (even an empty one) after a label.
* app/fileops_cmds.c: Autogenerated file reflects above changes.
* app/crop.c: Include <string.h>.
* app/{app_procs,batch,fileops,datafiles,errorconsole,general,
plug_in,temp_buf,tile_swap}.c: Test NATIVE_WIN32, not
_MSC_VER. (NATIVE_WIN32 means we are using the Microsoft C
runtime, even if we might be compiling with gcc.)
* app/fileops.c: Don't include <process.h> here.
* app/fileops.h: Do include <process.h> here.
* app/gimpparasite.c: Include config.h, guard inclusion of
<unistd.h>. (Is the inclusion of unistd.h in source files all over
the place really necessary?)
* app/ink.c: MSC doesn't handle conversion from unsigned __int64
to double, so cast to signed.
* app/lut_funcs.c: Include config.h, and define rint() if necessary.
* app/pixel_processor.c: Include config.h without "..", like in
all the other places. Include <string.h>
* app/text_tool.c: Guard the "POINTS" identifier that clashes with
<windows.h>, sigh.
1999-05-05 05:32:17 +08:00
# include <string.h>
1999-03-28 14:55:29 +08:00
# include "gimage.h"
# include "pathsP.h"
1999-03-22 08:51:30 +08:00
1999-03-28 14:55:29 +08:00
static ProcRecord path_list_proc ;
static ProcRecord path_get_points_proc ;
static ProcRecord path_get_current_proc ;
static ProcRecord path_set_current_proc ;
static ProcRecord path_set_points_proc ;
static ProcRecord path_stroke_current_proc ;
1999-04-06 07:33:50 +08:00
static ProcRecord path_get_point_at_dist_proc ;
static ProcRecord path_get_tattoo_proc ;
static ProcRecord get_path_by_tattoo_proc ;
1999-07-07 05:19:34 +08:00
static ProcRecord path_delete_proc ;
1999-03-22 08:51:30 +08:00
1999-03-28 14:55:29 +08:00
void
register_paths_procs ( void )
{
procedural_db_register ( & path_list_proc ) ;
procedural_db_register ( & path_get_points_proc ) ;
procedural_db_register ( & path_get_current_proc ) ;
procedural_db_register ( & path_set_current_proc ) ;
procedural_db_register ( & path_set_points_proc ) ;
procedural_db_register ( & path_stroke_current_proc ) ;
1999-04-06 07:33:50 +08:00
procedural_db_register ( & path_get_point_at_dist_proc ) ;
procedural_db_register ( & path_get_tattoo_proc ) ;
procedural_db_register ( & get_path_by_tattoo_proc ) ;
1999-07-07 05:19:34 +08:00
procedural_db_register ( & path_delete_proc ) ;
1999-03-28 14:55:29 +08:00
}
1999-03-22 08:51:30 +08:00
static Argument *
path_list_invoker ( Argument * args )
{
1999-03-28 14:55:29 +08:00
gboolean success = TRUE ;
1999-03-22 08:51:30 +08:00
Argument * return_args ;
1999-03-28 14:55:29 +08:00
GimpImage * gimage ;
gint32 num_paths = 0 ;
gchar * * paths_list = NULL ;
PathsList * plist ;
1999-03-22 08:51:30 +08:00
1999-03-28 14:55:29 +08:00
gimage = pdb_id_to_image ( args [ 0 ] . value . pdb_int ) ;
if ( gimage = = NULL )
success = FALSE ;
1999-03-22 08:51:30 +08:00
if ( success )
{
1999-03-28 14:55:29 +08:00
plist = gimage - > paths ;
if ( plist & & plist - > bz_paths )
1999-03-22 08:51:30 +08:00
{
gint count = 0 ;
GSList * pl = plist - > bz_paths ;
1999-03-28 14:55:29 +08:00
num_paths = g_slist_length ( pl ) ;
paths_list = g_new ( gchar * , num_paths ) ;
while ( pl )
1999-03-22 08:51:30 +08:00
{
PATHP pptr = pl - > data ;
1999-03-28 14:55:29 +08:00
paths_list [ count + + ] = g_strdup ( pptr - > name - > str ) ;
pl = pl - > next ;
1999-03-22 08:51:30 +08:00
}
}
}
1999-03-28 14:55:29 +08:00
return_args = procedural_db_return_args ( & path_list_proc , success ) ;
if ( success )
{
return_args [ 1 ] . value . pdb_int = num_paths ;
return_args [ 2 ] . value . pdb_pointer = paths_list ;
}
1999-03-22 08:51:30 +08:00
return return_args ;
}
1999-03-28 14:55:29 +08:00
static ProcArg path_list_inargs [ ] =
1999-03-22 08:51:30 +08:00
{
1999-03-28 14:55:29 +08:00
{
PDB_IMAGE ,
1999-03-22 08:51:30 +08:00
" image " ,
1999-03-28 14:55:29 +08:00
" The ID of the image to list the paths from "
}
1999-03-22 08:51:30 +08:00
} ;
1999-03-28 14:55:29 +08:00
static ProcArg path_list_outargs [ ] =
1999-03-22 08:51:30 +08:00
{
1999-03-28 14:55:29 +08:00
{
PDB_INT32 ,
1999-03-22 08:51:30 +08:00
" num_paths " ,
" The number of paths returned "
} ,
1999-03-28 14:55:29 +08:00
{
PDB_STRINGARRAY ,
1999-03-22 08:51:30 +08:00
" paths_list " ,
1999-03-28 14:55:29 +08:00
" List of the paths belonging to this image "
1999-03-22 08:51:30 +08:00
}
} ;
1999-03-28 14:55:29 +08:00
static ProcRecord path_list_proc =
1999-03-22 08:51:30 +08:00
{
" gimp_path_list " ,
1999-03-28 14:55:29 +08:00
" List the paths associated with the passed image. " ,
" List the paths associated with the passed image. " ,
1999-03-22 08:51:30 +08:00
" Andy Thomas " ,
" Andy Thomas " ,
" 1999 " ,
PDB_INTERNAL ,
1999-03-28 14:55:29 +08:00
1 ,
path_list_inargs ,
2 ,
path_list_outargs ,
{ { path_list_invoker } }
1999-03-22 08:51:30 +08:00
} ;
static Argument *
path_get_points_invoker ( Argument * args )
{
1999-03-28 14:55:29 +08:00
gboolean success = TRUE ;
Argument * return_args ;
GimpImage * gimage ;
gchar * pname ;
gint32 num_pdetails = 0 ;
gdouble * pnts = NULL ;
PathsList * plist ;
PATHP pptr = NULL ;
gimage = pdb_id_to_image ( args [ 0 ] . value . pdb_int ) ;
if ( gimage = = NULL )
1999-03-22 08:51:30 +08:00
success = FALSE ;
1999-04-04 15:12:22 +08:00
pname = ( gchar * ) args [ 1 ] . value . pdb_pointer ;
if ( pname = = NULL )
success = FALSE ;
1999-03-28 14:55:29 +08:00
1999-03-22 08:51:30 +08:00
if ( success )
{
/* Get the path with the given name */
1999-03-28 14:55:29 +08:00
plist = gimage - > paths ;
if ( plist & & plist - > bz_paths )
1999-03-22 08:51:30 +08:00
{
1999-03-28 14:55:29 +08:00
GSList * pl = plist - > bz_paths ;
while ( pl )
1999-03-22 08:51:30 +08:00
{
pptr = pl - > data ;
1999-03-28 14:55:29 +08:00
1999-04-10 12:54:34 +08:00
if ( ! strcmp ( pname , pptr - > name - > str ) )
1999-04-25 04:33:31 +08:00
break ; /* Found the path */
1999-03-28 14:55:29 +08:00
pl = pl - > next ;
1999-03-22 08:51:30 +08:00
pptr = NULL ;
}
1999-03-28 14:55:29 +08:00
if ( pl & & pptr )
1999-03-22 08:51:30 +08:00
{
GSList * points_list ;
gint pcount = 0 ;
1999-03-28 14:55:29 +08:00
1999-03-22 08:51:30 +08:00
points_list = pptr - > path_details ;
1999-03-28 14:55:29 +08:00
if ( points_list )
1999-04-25 04:33:31 +08:00
{
num_pdetails = g_slist_length ( points_list ) * 3 ;
1999-03-28 14:55:29 +08:00
1999-04-25 04:33:31 +08:00
pnts = g_new ( gdouble , num_pdetails ) ;
1999-03-28 14:55:29 +08:00
1999-04-25 04:33:31 +08:00
/* fill points and types in */
while ( points_list )
{
PATHPOINTP ppoint = points_list - > data ;
pnts [ pcount ] = ppoint - > x ;
pnts [ pcount + 1 ] = ppoint - > y ;
pnts [ pcount + 2 ] = ( gfloat ) ppoint - > type ; /* Bit of fiddle but should be understandable why it was done */
pcount + = 3 ;
points_list = points_list - > next ;
}
}
1999-03-22 08:51:30 +08:00
else
1999-04-25 04:33:31 +08:00
success = FALSE ;
1999-03-22 08:51:30 +08:00
}
else
1999-03-28 14:55:29 +08:00
success = FALSE ;
1999-03-22 08:51:30 +08:00
}
}
1999-03-28 14:55:29 +08:00
return_args = procedural_db_return_args ( & path_get_points_proc , success ) ;
if ( success )
1999-03-22 08:51:30 +08:00
{
1999-03-28 14:55:29 +08:00
return_args [ 1 ] . value . pdb_int = pptr - > pathtype ;
return_args [ 2 ] . value . pdb_int = pptr - > closed ;
return_args [ 3 ] . value . pdb_int = num_pdetails ;
return_args [ 4 ] . value . pdb_pointer = pnts ;
1999-03-22 08:51:30 +08:00
}
return return_args ;
}
1999-03-28 14:55:29 +08:00
static ProcArg path_get_points_inargs [ ] =
1999-03-22 08:51:30 +08:00
{
1999-03-28 14:55:29 +08:00
{
PDB_IMAGE ,
1999-03-22 08:51:30 +08:00
" image " ,
1999-03-28 14:55:29 +08:00
" The ID of the image to list the paths from "
1999-03-22 08:51:30 +08:00
} ,
1999-03-28 14:55:29 +08:00
{
PDB_STRING ,
1999-03-22 08:51:30 +08:00
" pathname " ,
" the name of the path whose points should be listed "
1999-03-28 14:55:29 +08:00
}
1999-03-22 08:51:30 +08:00
} ;
1999-03-28 14:55:29 +08:00
static ProcArg path_get_points_outargs [ ] =
1999-03-22 08:51:30 +08:00
{
1999-03-28 14:55:29 +08:00
{
PDB_INT32 ,
1999-03-22 08:51:30 +08:00
" paths_type " ,
" The type of the path. Currently only one type (1 = Bezier) is supported "
} ,
1999-03-28 14:55:29 +08:00
{
PDB_INT32 ,
" path_closed " ,
1999-03-22 08:51:30 +08:00
" Return if the path is closed. {0=path open, 1= path closed} "
} ,
1999-03-28 14:55:29 +08:00
{
PDB_INT32 ,
1999-03-22 08:51:30 +08:00
" num_path_point_details " ,
1999-03-28 14:55:29 +08:00
" The number of points returned. Each point is made up of (x,y,pnt_type) of floats "
1999-03-22 08:51:30 +08:00
} ,
1999-03-28 14:55:29 +08:00
{
PDB_FLOATARRAY ,
1999-03-22 08:51:30 +08:00
" points_pairs " ,
" The points in the path represented as 3 floats. The first is the x pos, next is the y pos, last is the type of the pnt. The type field is dependant on the path type. For beziers (type 1 paths) the type can either be {1.0= BEZIER_ANCHOR, 2.0= BEZIER_CONTROL}. Note all points are returned in pixel resolution "
}
} ;
1999-03-28 14:55:29 +08:00
static ProcRecord path_get_points_proc =
1999-03-22 08:51:30 +08:00
{
" gimp_path_get_points " ,
1999-03-28 14:55:29 +08:00
" List the points associated with the named path. " ,
" List the points associated with the named path. " ,
1999-03-22 08:51:30 +08:00
" Andy Thomas " ,
" Andy Thomas " ,
" 1999 " ,
PDB_INTERNAL ,
1999-03-28 14:55:29 +08:00
2 ,
path_get_points_inargs ,
4 ,
path_get_points_outargs ,
{ { path_get_points_invoker } }
1999-03-22 08:51:30 +08:00
} ;
static Argument *
path_get_current_invoker ( Argument * args )
{
1999-03-28 14:55:29 +08:00
gboolean success = TRUE ;
Argument * return_args ;
GimpImage * gimage ;
PathsList * plist ;
PATHP pptr = NULL ;
1999-03-22 08:51:30 +08:00
1999-03-28 14:55:29 +08:00
gimage = pdb_id_to_image ( args [ 0 ] . value . pdb_int ) ;
if ( gimage = = NULL )
1999-03-22 08:51:30 +08:00
success = FALSE ;
if ( success )
{
/* Get the path with the given name */
1999-03-28 14:55:29 +08:00
plist = gimage - > paths ;
if ( plist & & plist - > bz_paths & & plist - > last_selected_row > = 0 )
pptr = ( PATHP ) g_slist_nth_data ( plist - > bz_paths , plist - > last_selected_row ) ;
1999-03-22 08:51:30 +08:00
else
1999-03-28 14:55:29 +08:00
success = FALSE ;
1999-03-22 08:51:30 +08:00
}
1999-03-28 14:55:29 +08:00
return_args = procedural_db_return_args ( & path_get_current_proc , success ) ;
if ( success )
return_args [ 1 ] . value . pdb_pointer = g_strdup ( pptr - > name - > str ) ;
1999-03-22 08:51:30 +08:00
return return_args ;
}
1999-03-28 14:55:29 +08:00
static ProcArg path_get_current_inargs [ ] =
1999-03-22 08:51:30 +08:00
{
1999-03-28 14:55:29 +08:00
{
PDB_IMAGE ,
1999-03-22 08:51:30 +08:00
" image " ,
1999-03-28 14:55:29 +08:00
" The ID of the image to get the current paths from "
1999-03-22 08:51:30 +08:00
}
} ;
1999-03-28 14:55:29 +08:00
static ProcArg path_get_current_outargs [ ] =
1999-03-22 08:51:30 +08:00
{
1999-03-28 14:55:29 +08:00
{
PDB_STRING ,
1999-03-22 08:51:30 +08:00
" current_path_name " ,
" The name of the current path "
}
} ;
1999-03-28 14:55:29 +08:00
static ProcRecord path_get_current_proc =
1999-03-22 08:51:30 +08:00
{
" gimp_path_get_current " ,
1999-03-28 14:55:29 +08:00
" The name of the current path. Error if no paths. " ,
" The name of the current path. Error if no paths. " ,
1999-03-22 08:51:30 +08:00
" Andy Thomas " ,
" Andy Thomas " ,
" 1999 " ,
PDB_INTERNAL ,
1999-03-28 14:55:29 +08:00
1 ,
path_get_current_inargs ,
1 ,
path_get_current_outargs ,
{ { path_get_current_invoker } }
1999-03-22 08:51:30 +08:00
} ;
static Argument *
path_set_current_invoker ( Argument * args )
{
1999-03-28 14:55:29 +08:00
gboolean success = TRUE ;
GimpImage * gimage ;
gchar * pname ;
1999-03-22 08:51:30 +08:00
1999-03-28 14:55:29 +08:00
gimage = pdb_id_to_image ( args [ 0 ] . value . pdb_int ) ;
if ( gimage = = NULL )
1999-03-22 08:51:30 +08:00
success = FALSE ;
1999-04-04 15:12:22 +08:00
pname = ( gchar * ) args [ 1 ] . value . pdb_pointer ;
if ( pname = = NULL )
success = FALSE ;
1999-03-22 08:51:30 +08:00
1999-03-28 14:55:29 +08:00
if ( success )
success = paths_set_path ( gimage , pname ) ;
return procedural_db_return_args ( & path_set_current_proc , success ) ;
1999-03-22 08:51:30 +08:00
}
1999-03-28 14:55:29 +08:00
static ProcArg path_set_current_inargs [ ] =
1999-03-22 08:51:30 +08:00
{
1999-03-28 14:55:29 +08:00
{
PDB_IMAGE ,
1999-03-22 08:51:30 +08:00
" image " ,
1999-03-28 14:55:29 +08:00
" The ID of the image to list set the paths in "
1999-03-22 08:51:30 +08:00
} ,
1999-03-28 14:55:29 +08:00
{
PDB_STRING ,
1999-03-22 08:51:30 +08:00
" set_current_path_name " ,
" The name of the path to set the current path to "
}
} ;
1999-03-28 14:55:29 +08:00
static ProcRecord path_set_current_proc =
1999-03-22 08:51:30 +08:00
{
" gimp_path_set_current " ,
1999-03-28 14:55:29 +08:00
" List the paths associated with the passed image. " ,
" List the paths associated with the passed image. " ,
1999-03-22 08:51:30 +08:00
" Andy Thomas " ,
" Andy Thomas " ,
" 1999 " ,
PDB_INTERNAL ,
1999-03-28 14:55:29 +08:00
2 ,
path_set_current_inargs ,
1999-03-22 08:51:30 +08:00
0 ,
NULL ,
1999-03-28 14:55:29 +08:00
{ { path_set_current_invoker } }
1999-03-22 08:51:30 +08:00
} ;
static Argument *
path_set_points_invoker ( Argument * args )
{
1999-03-28 14:55:29 +08:00
gboolean success = TRUE ;
GimpImage * gimage ;
gchar * pname = NULL ;
gint32 ptype ;
gint32 numpoints = 0 ;
1999-03-22 08:51:30 +08:00
gdouble * pnts ;
1999-03-28 14:55:29 +08:00
gboolean pclosed = FALSE ;
1999-03-22 08:51:30 +08:00
1999-03-28 14:55:29 +08:00
gimage = pdb_id_to_image ( args [ 0 ] . value . pdb_int ) ;
if ( gimage = = NULL )
1999-03-22 08:51:30 +08:00
success = FALSE ;
1999-04-04 15:12:22 +08:00
pname = ( gchar * ) args [ 1 ] . value . pdb_pointer ;
if ( pname = = NULL )
success = FALSE ;
1999-03-22 08:51:30 +08:00
1999-03-28 14:55:29 +08:00
ptype = args [ 2 ] . value . pdb_int ;
1999-03-22 08:51:30 +08:00
1999-04-04 15:12:22 +08:00
numpoints = args [ 3 ] . value . pdb_int ;
if ( numpoints < = 0 )
success = FALSE ;
1999-03-22 08:51:30 +08:00
1999-03-28 14:55:29 +08:00
pnts = ( gdouble * ) args [ 4 ] . value . pdb_pointer ;
if ( success )
1999-03-22 08:51:30 +08:00
{
1999-07-07 05:19:34 +08:00
if ( ( numpoints / 3 ) % 3 = = 0 )
1999-03-28 14:55:29 +08:00
pclosed = TRUE ;
1999-07-07 05:19:34 +08:00
else if ( ( numpoints / 3 ) % 3 ! = 2 )
1999-03-28 14:55:29 +08:00
success = FALSE ;
if ( success & & ! paths_set_path_points ( gimage , pname , ptype , pclosed ,
1999-04-25 04:33:31 +08:00
numpoints , pnts ) )
1999-03-28 14:55:29 +08:00
success = FALSE ;
1999-03-22 08:51:30 +08:00
}
1999-03-28 14:55:29 +08:00
return procedural_db_return_args ( & path_set_points_proc , success ) ;
1999-03-22 08:51:30 +08:00
}
1999-03-28 14:55:29 +08:00
static ProcArg path_set_points_inargs [ ] =
1999-03-22 08:51:30 +08:00
{
1999-03-28 14:55:29 +08:00
{
PDB_IMAGE ,
1999-03-22 08:51:30 +08:00
" image " ,
1999-03-28 14:55:29 +08:00
" The ID of the image to set the paths in "
1999-03-22 08:51:30 +08:00
} ,
1999-03-28 14:55:29 +08:00
{
PDB_STRING ,
1999-03-22 08:51:30 +08:00
" pathname " ,
1999-07-14 05:55:39 +08:00
" The name of the path to create (if it exists then a unique name will be created - query the list of paths if you want to make sure that the name of the path you create is unique. This will be set as the current path. "
1999-03-22 08:51:30 +08:00
} ,
1999-03-28 14:55:29 +08:00
{
PDB_INT32 ,
" ptype " ,
1999-03-22 08:51:30 +08:00
" The type of the path. Currently only one type (1 = Bezier) is supported "
} ,
1999-03-28 14:55:29 +08:00
{
PDB_INT32 ,
1999-03-22 08:51:30 +08:00
" num_path_points " ,
1999-07-07 05:19:34 +08:00
" The number of points in the path. Each point is made up of (x,y,type) of floats. Currently only the creation of bezier curves is allowed. The type parameter must be set to (1) to indicate a BEZIER type curve. For BEZIERS. Note the that points must be given in the following order... ACCACCAC ... If the path is not closed the last control point is missed off. Points consist of three control points (control/anchor/control) so for a curve that is not closed there must be at least two points passed (2 x,y pairs). If num_path_pnts % 3 = 0 then the path is assumed to be closed and the points are ACCACCACCACC. "
1999-03-22 08:51:30 +08:00
} ,
1999-03-28 14:55:29 +08:00
{
PDB_FLOATARRAY ,
1999-03-22 08:51:30 +08:00
" points_pairs " ,
1999-03-28 14:55:29 +08:00
" The points in the path represented as 3 floats. The first is the x pos, next is the y pos, last is the type of the pnt. The type field is dependant on the path type. For beziers (type 1 paths) the type can either be {1.0= BEZIER_ANCHOR, 2.0= BEZIER_CONTROL}. Note all points are returned in pixel resolution "
1999-03-22 08:51:30 +08:00
}
} ;
1999-03-28 14:55:29 +08:00
static ProcRecord path_set_points_proc =
1999-03-22 08:51:30 +08:00
{
" gimp_path_set_points " ,
1999-03-28 14:55:29 +08:00
" Set the points associated with the named path. " ,
" Set the points associated with the named path. " ,
1999-03-22 08:51:30 +08:00
" Andy Thomas " ,
" Andy Thomas " ,
" 1999 " ,
PDB_INTERNAL ,
1999-03-28 14:55:29 +08:00
5 ,
path_set_points_inargs ,
1999-03-22 08:51:30 +08:00
0 ,
NULL ,
1999-03-28 14:55:29 +08:00
{ { path_set_points_invoker } }
1999-03-22 08:51:30 +08:00
} ;
static Argument *
path_stroke_current_invoker ( Argument * args )
{
1999-03-28 14:55:29 +08:00
gboolean success = TRUE ;
GimpImage * gimage ;
PathsList * plist ;
PATHP pptr = NULL ;
1999-03-22 08:51:30 +08:00
1999-03-28 14:55:29 +08:00
gimage = pdb_id_to_image ( args [ 0 ] . value . pdb_int ) ;
if ( gimage = = NULL )
1999-03-22 08:51:30 +08:00
success = FALSE ;
if ( success )
{
/* Get the path with the given name */
1999-03-28 14:55:29 +08:00
plist = gimage - > paths ;
if ( plist & & plist - > bz_paths & & plist - > last_selected_row > = 0 )
1999-03-22 08:51:30 +08:00
{
1999-03-28 14:55:29 +08:00
if ( ( pptr = ( PATHP ) g_slist_nth_data ( plist - > bz_paths ,
1999-04-25 04:33:31 +08:00
plist - > last_selected_row ) ) )
1999-03-28 14:55:29 +08:00
paths_stroke ( gimage , plist , pptr ) ; /* Found the path to stroke.. */
1999-03-22 08:51:30 +08:00
else
1999-03-28 14:55:29 +08:00
success = FALSE ;
1999-03-22 08:51:30 +08:00
}
else
1999-03-28 14:55:29 +08:00
success = FALSE ;
1999-03-22 08:51:30 +08:00
}
1999-03-28 14:55:29 +08:00
return procedural_db_return_args ( & path_stroke_current_proc , success ) ;
1999-03-22 08:51:30 +08:00
}
1999-03-28 14:55:29 +08:00
static ProcArg path_stroke_current_inargs [ ] =
1999-03-22 08:51:30 +08:00
{
1999-03-28 14:55:29 +08:00
{
PDB_IMAGE ,
1999-03-22 08:51:30 +08:00
" image " ,
1999-03-28 14:55:29 +08:00
" The ID of the image which contains the path to stroke "
}
1999-03-22 08:51:30 +08:00
} ;
1999-03-28 14:55:29 +08:00
static ProcRecord path_stroke_current_proc =
1999-03-22 08:51:30 +08:00
{
" gimp_path_stroke_current " ,
1999-03-28 14:55:29 +08:00
" Stroke the current path in the passed image. " ,
" Stroke the current path in the passed image. " ,
1999-03-22 08:51:30 +08:00
" Andy Thomas " ,
" Andy Thomas " ,
" 1999 " ,
PDB_INTERNAL ,
1999-03-28 14:55:29 +08:00
1 ,
path_stroke_current_inargs ,
1999-03-22 08:51:30 +08:00
0 ,
NULL ,
1999-03-28 14:55:29 +08:00
{ { path_stroke_current_invoker } }
1999-03-22 08:51:30 +08:00
} ;
1999-04-06 07:33:50 +08:00
static Argument *
path_get_point_at_dist_invoker ( Argument * args )
{
gboolean success = TRUE ;
Argument * return_args ;
GimpImage * gimage ;
gdouble distance ;
gint32 x_point = 0 ;
gint32 y_point = 0 ;
gdouble gradient = 0 ;
1999-04-10 12:54:34 +08:00
PathsList * plist ;
PATHP pptr = NULL ;
1999-04-06 07:33:50 +08:00
gimage = pdb_id_to_image ( args [ 0 ] . value . pdb_int ) ;
if ( gimage = = NULL )
success = FALSE ;
distance = args [ 1 ] . value . pdb_float ;
if ( success )
{
1999-04-10 12:54:34 +08:00
/* Get the path with the given name */
plist = gimage - > paths ;
if ( plist & & plist - > bz_paths & & plist - > last_selected_row > = 0 )
{
pptr = ( PATHP ) g_slist_nth_data ( plist - > bz_paths ,
1999-04-25 04:33:31 +08:00
plist - > last_selected_row ) ;
1999-04-10 12:54:34 +08:00
success = paths_distance ( pptr , distance , & x_point , & y_point ,
1999-04-25 04:33:31 +08:00
& gradient ) ;
1999-04-10 12:54:34 +08:00
}
else
success = FALSE ;
1999-04-06 07:33:50 +08:00
}
return_args = procedural_db_return_args ( & path_get_point_at_dist_proc , success ) ;
if ( success )
{
return_args [ 1 ] . value . pdb_int = x_point ;
return_args [ 2 ] . value . pdb_int = y_point ;
return_args [ 3 ] . value . pdb_float = gradient ;
}
return return_args ;
}
static ProcArg path_get_point_at_dist_inargs [ ] =
{
{
PDB_IMAGE ,
" image " ,
" The ID of the image the paths belongs to "
} ,
{
PDB_FLOAT ,
" distance " ,
" The distance along the path "
}
} ;
static ProcArg path_get_point_at_dist_outargs [ ] =
{
{
PDB_INT32 ,
" x_point " ,
" The x position of the point "
} ,
{
PDB_INT32 ,
" y_point " ,
" The y position of the point "
} ,
{
PDB_FLOAT ,
" gradient " ,
" The gradient at the specified point "
}
} ;
static ProcRecord path_get_point_at_dist_proc =
{
" gimp_path_get_point_at_dist " ,
1999-04-10 12:54:34 +08:00
" Get point on a path at a specified distance along the path. " ,
1999-04-06 07:33:50 +08:00
" This will return the x,y position of a point at a given distance along the bezier curve. The distance will the obtained by first digitizing the curve internally an then walking along the curve. For a closed curve the start of the path is the first point on the path that was created. This might not be obvious. Note the current path is used. " ,
" Andy Thomas " ,
" Andy Thomas " ,
" 1999 " ,
PDB_INTERNAL ,
2 ,
path_get_point_at_dist_inargs ,
3 ,
path_get_point_at_dist_outargs ,
{ { path_get_point_at_dist_invoker } }
} ;
static Argument *
path_get_tattoo_invoker ( Argument * args )
{
gboolean success = TRUE ;
Argument * return_args ;
GimpImage * gimage ;
gchar * pname ;
gint32 tattoo = 0 ;
PathsList * plist ;
1999-04-10 12:54:34 +08:00
PATHP pptr = NULL ;
1999-04-06 07:33:50 +08:00
gimage = pdb_id_to_image ( args [ 0 ] . value . pdb_int ) ;
if ( gimage = = NULL )
success = FALSE ;
pname = ( gchar * ) args [ 1 ] . value . pdb_pointer ;
if ( pname = = NULL )
success = FALSE ;
if ( success )
{
/* Get the path with the given name */
plist = gimage - > paths ;
if ( plist & & plist - > bz_paths )
{
GSList * pl = plist - > bz_paths ;
while ( pl )
{
pptr = pl - > data ;
1999-04-10 12:54:34 +08:00
if ( ! strcmp ( pname , pptr - > name - > str ) )
1999-04-25 04:33:31 +08:00
break ; /* Found the path */
1999-04-06 07:33:50 +08:00
pl = pl - > next ;
pptr = NULL ;
}
if ( pl & & pptr )
1999-04-10 12:54:34 +08:00
tattoo = paths_get_tattoo ( pptr ) ;
1999-04-06 07:33:50 +08:00
else
success = FALSE ;
1999-04-10 12:54:34 +08:00
}
else
success = FALSE ;
1999-04-06 07:33:50 +08:00
}
return_args = procedural_db_return_args ( & path_get_tattoo_proc , success ) ;
if ( success )
return_args [ 1 ] . value . pdb_int = tattoo ;
return return_args ;
}
static ProcArg path_get_tattoo_inargs [ ] =
{
{
PDB_IMAGE ,
" image " ,
1999-04-10 12:54:34 +08:00
" The image "
1999-04-06 07:33:50 +08:00
} ,
{
PDB_STRING ,
" pathname " ,
" the name of the path whose tattoo should be obtained "
}
} ;
static ProcArg path_get_tattoo_outargs [ ] =
{
{
PDB_INT32 ,
" tattoo " ,
" The tattoo associated with the name path "
}
} ;
static ProcRecord path_get_tattoo_proc =
{
" gimp_path_get_tattoo " ,
1999-04-10 12:54:34 +08:00
" Returns the tattoo associated with the name path. " ,
1999-04-06 07:33:50 +08:00
" This procedure returns the tattoo associated with the specified path. A tattoo is a unique and permenant identifier attached to a path that can be used to uniquely identify a path within an image even between sessions. " ,
" Andy Thomas " ,
" Andy Thomas " ,
" 1999 " ,
PDB_INTERNAL ,
2 ,
path_get_tattoo_inargs ,
1 ,
path_get_tattoo_outargs ,
{ { path_get_tattoo_invoker } }
} ;
static Argument *
get_path_by_tattoo_invoker ( Argument * args )
{
gboolean success = TRUE ;
Argument * return_args ;
GimpImage * gimage ;
gint32 tattoo ;
PathsList * plist ;
PATHP pptr = NULL ;
gimage = pdb_id_to_image ( args [ 0 ] . value . pdb_int ) ;
if ( gimage = = NULL )
success = FALSE ;
tattoo = args [ 1 ] . value . pdb_int ;
if ( success )
{
/* Get the path with the given name */
plist = gimage - > paths ;
if ( plist & & plist - > bz_paths )
1999-04-10 12:54:34 +08:00
{
if ( ( pptr = paths_get_path_by_tattoo ( gimage , tattoo ) ) = = NULL )
success = FALSE ;
}
1999-04-06 07:33:50 +08:00
else
success = FALSE ;
}
return_args = procedural_db_return_args ( & get_path_by_tattoo_proc , success ) ;
if ( success )
return_args [ 1 ] . value . pdb_pointer = g_strdup ( pptr - > name - > str ) ;
return return_args ;
}
static ProcArg get_path_by_tattoo_inargs [ ] =
{
{
PDB_IMAGE ,
" image " ,
1999-04-10 12:54:34 +08:00
" The image "
1999-04-06 07:33:50 +08:00
} ,
{
PDB_INT32 ,
" tattoo " ,
" The tattoo of the required path "
}
} ;
static ProcArg get_path_by_tattoo_outargs [ ] =
{
{
PDB_STRING ,
" path_name " ,
" The name of the path with the specified tattoo "
}
} ;
static ProcRecord get_path_by_tattoo_proc =
{
" gimp_get_path_by_tattoo " ,
1999-04-10 12:54:34 +08:00
" Return the name of the path with the given tattoo. " ,
1999-04-06 07:33:50 +08:00
" The procedure returns the name of the path in the specified image which has the passed tattoo. The tattoos are unique within the image and will be preserved across sessions and through renaming of the path. An error is returned if no path woth the specified tattoo can be found. " ,
" Andy Thomas " ,
" Andy Thomas " ,
" 1999 " ,
PDB_INTERNAL ,
2 ,
get_path_by_tattoo_inargs ,
1 ,
get_path_by_tattoo_outargs ,
{ { get_path_by_tattoo_invoker } }
} ;
1999-07-07 05:19:34 +08:00
static Argument *
path_delete_invoker ( Argument * args )
{
gboolean success = TRUE ;
GimpImage * gimage ;
gchar * pname ;
gimage = pdb_id_to_image ( args [ 0 ] . value . pdb_int ) ;
if ( gimage = = NULL )
success = FALSE ;
pname = ( gchar * ) args [ 1 ] . value . pdb_pointer ;
if ( pname = = NULL )
success = FALSE ;
if ( success )
success = paths_delete_path ( gimage , pname ) ;
return procedural_db_return_args ( & path_delete_proc , success ) ;
}
static ProcArg path_delete_inargs [ ] =
{
{
PDB_IMAGE ,
" image " ,
" The ID of the image to list delete the paths from "
} ,
{
PDB_STRING ,
" path_name_to_del " ,
" The name of the path to delete "
}
} ;
static ProcRecord path_delete_proc =
{
" gimp_path_delete " ,
" Delete the named paths associated with the passed image. " ,
" Delete the named path. " ,
" Andy Thomas " ,
" Andy Thomas " ,
" 1999 " ,
PDB_INTERNAL ,
2 ,
path_delete_inargs ,
0 ,
NULL ,
{ { path_delete_invoker } }
} ;