2006-12-09 21:33:38 +00:00
/* GIMP - The GNU Image Manipulation Program
2005-04-14 02:32:23 +00:00
* Copyright ( C ) 1995 - 2003 Spencer Kimball and Peter Mattis
*
2009-01-17 22:28:01 +00:00
* This program is free software : you can redistribute it and / or modify
2005-04-14 02:32:23 +00:00
* it under the terms of the GNU General Public License as published by
2009-01-17 22:28:01 +00:00
* the Free Software Foundation ; either version 3 of the License , or
2005-04-14 02:32:23 +00:00
* ( 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
2018-07-11 23:27:07 +02:00
* along with this program . If not , see < https : //www.gnu.org/licenses/>.
2005-04-14 02:32:23 +00:00
*/
2007-01-09 10:52:47 +00:00
/* NOTE: This file is auto-generated by pdbgen.pl. */
2005-04-14 02:32:23 +00:00
# include "config.h"
2022-03-28 15:13:17 +02:00
# include "stamp-pdbgen.h"
2005-04-14 02:32:23 +00:00
# include <string.h>
2008-10-09 20:24:04 +00:00
# include <gegl.h>
2005-04-14 02:32:23 +00:00
2012-05-03 03:36:22 +02:00
# include <gdk-pixbuf/gdk-pixbuf.h>
2012-05-04 00:50:23 +02:00
# include "libgimpbase/gimpbase.h"
2005-04-14 02:32:23 +00:00
# include "pdb-types.h"
2009-08-21 17:57:56 +02:00
# include "core/gimpimage-undo-push.h"
2005-12-28 21:24:12 +00:00
# include "core/gimpimage.h"
2008-04-04 14:50:42 +00:00
# include "core/gimplayer.h"
2005-04-14 02:32:23 +00:00
# include "core/gimplist.h"
2008-02-07 17:08:54 +00:00
# include "core/gimpparamspecs.h"
2024-07-13 05:07:57 +00:00
# include "text/gimptext-path.h"
2008-04-04 14:50:42 +00:00
# include "text/gimptextlayer.h"
2005-04-14 02:32:23 +00:00
# include "vectors/gimpanchor.h"
# include "vectors/gimpbezierstroke.h"
2024-07-12 06:16:25 +00:00
# include "vectors/gimppath.h"
2006-10-26 17:23:41 +00:00
# include "vectors/gimpstroke-new.h"
2005-04-14 02:32:23 +00:00
2008-02-07 17:08:54 +00:00
# include "gimppdb.h"
2008-03-06 18:39:07 +00:00
# include "gimppdb-utils.h"
2008-02-07 17:08:54 +00:00
# include "gimpprocedure.h"
2008-04-04 11:15:55 +00:00
# include "internal-procs.h"
2006-10-31 19:02:56 +00:00
2008-02-07 17:08:54 +00:00
# include "gimp-intl.h"
2005-04-14 02:32:23 +00:00
2012-05-04 00:50:23 +02:00
static GimpValueArray *
2024-07-08 23:39:51 +00:00
path_new_invoker ( GimpProcedure * procedure ,
Gimp * gimp ,
GimpContext * context ,
GimpProgress * progress ,
const GimpValueArray * args ,
GError * * error )
2005-04-14 02:32:23 +00:00
{
2006-04-04 21:11:45 +00:00
gboolean success = TRUE ;
2012-05-04 00:50:23 +02:00
GimpValueArray * return_vals ;
2006-04-04 21:11:45 +00:00
GimpImage * image ;
const gchar * name ;
2024-07-12 06:16:25 +00:00
GimpPath * path = NULL ;
2006-03-28 19:58:00 +00:00
2019-08-29 11:25:35 +02:00
image = g_value_get_object ( gimp_value_array_index ( args , 0 ) ) ;
2012-05-04 00:50:23 +02:00
name = g_value_get_string ( gimp_value_array_index ( args , 1 ) ) ;
2006-03-28 19:58:00 +00:00
2006-04-04 21:11:45 +00:00
if ( success )
{
2024-07-13 05:07:57 +00:00
path = gimp_path_new ( image , name ) ;
2006-04-04 21:11:45 +00:00
}
2006-03-28 19:58:00 +00:00
2008-08-16 13:57:57 +00:00
return_vals = gimp_procedure_get_return_values ( procedure , success ,
error ? * error : NULL ) ;
2006-03-28 19:58:00 +00:00
2006-04-04 21:11:45 +00:00
if ( success )
2024-07-08 23:39:51 +00:00
g_value_set_object ( gimp_value_array_index ( return_vals , 1 ) , path ) ;
2006-03-28 19:58:00 +00:00
2006-04-04 21:11:45 +00:00
return return_vals ;
}
2006-03-28 19:58:00 +00:00
2012-05-04 00:50:23 +02:00
static GimpValueArray *
2024-07-08 23:39:51 +00:00
path_new_from_text_layer_invoker ( GimpProcedure * procedure ,
Gimp * gimp ,
GimpContext * context ,
GimpProgress * progress ,
const GimpValueArray * args ,
GError * * error )
2008-04-04 14:50:42 +00:00
{
gboolean success = TRUE ;
2012-05-04 00:50:23 +02:00
GimpValueArray * return_vals ;
2008-04-04 14:50:42 +00:00
GimpImage * image ;
GimpLayer * layer ;
2024-07-12 06:16:25 +00:00
GimpPath * path = NULL ;
2008-04-04 14:50:42 +00:00
2019-08-29 11:25:35 +02:00
image = g_value_get_object ( gimp_value_array_index ( args , 0 ) ) ;
layer = g_value_get_object ( gimp_value_array_index ( args , 1 ) ) ;
2008-04-04 14:50:42 +00:00
if ( success )
{
2012-11-09 11:17:25 +01:00
if ( gimp_pdb_layer_is_text_layer ( layer , 0 , error ) )
2008-04-04 14:50:42 +00:00
{
gint x , y ;
2024-07-13 05:07:57 +00:00
path = gimp_text_path_new ( image ,
2008-04-04 14:50:42 +00:00
gimp_text_layer_get_text ( GIMP_TEXT_LAYER ( layer ) ) ) ;
2008-11-02 23:03:29 +00:00
gimp_item_get_offset ( GIMP_ITEM ( layer ) , & x , & y ) ;
2024-07-08 23:39:51 +00:00
gimp_item_translate ( GIMP_ITEM ( path ) , x , y , FALSE ) ;
2008-04-04 14:50:42 +00:00
}
else
{
success = FALSE ;
}
}
2008-08-16 13:57:57 +00:00
return_vals = gimp_procedure_get_return_values ( procedure , success ,
error ? * error : NULL ) ;
2008-04-04 14:50:42 +00:00
if ( success )
2024-07-08 23:39:51 +00:00
g_value_set_object ( gimp_value_array_index ( return_vals , 1 ) , path ) ;
2008-04-04 14:50:42 +00:00
return return_vals ;
}
2012-05-04 00:50:23 +02:00
static GimpValueArray *
2024-07-08 23:39:51 +00:00
path_copy_invoker ( GimpProcedure * procedure ,
Gimp * gimp ,
GimpContext * context ,
GimpProgress * progress ,
const GimpValueArray * args ,
GError * * error )
2008-07-28 14:13:18 +00:00
{
gboolean success = TRUE ;
2012-05-04 00:50:23 +02:00
GimpValueArray * return_vals ;
2024-07-12 06:16:25 +00:00
GimpPath * path ;
GimpPath * path_copy = NULL ;
2008-07-28 14:13:18 +00:00
2024-07-08 23:39:51 +00:00
path = g_value_get_object ( gimp_value_array_index ( args , 0 ) ) ;
2008-07-28 14:13:18 +00:00
if ( success )
{
2024-07-12 06:16:25 +00:00
path_copy = GIMP_PATH ( gimp_item_duplicate ( GIMP_ITEM ( path ) ,
G_TYPE_FROM_INSTANCE ( path ) ) ) ;
2008-07-28 14:13:18 +00:00
2024-07-08 23:39:51 +00:00
if ( ! path_copy )
2008-07-28 14:13:18 +00:00
success = FALSE ;
}
2008-08-16 13:57:57 +00:00
return_vals = gimp_procedure_get_return_values ( procedure , success ,
error ? * error : NULL ) ;
2008-07-28 14:13:18 +00:00
if ( success )
2024-07-08 23:39:51 +00:00
g_value_set_object ( gimp_value_array_index ( return_vals , 1 ) , path_copy ) ;
2008-07-28 14:13:18 +00:00
return return_vals ;
}
2012-05-04 00:50:23 +02:00
static GimpValueArray *
2024-07-08 23:39:51 +00:00
path_get_strokes_invoker ( GimpProcedure * procedure ,
Gimp * gimp ,
GimpContext * context ,
GimpProgress * progress ,
const GimpValueArray * args ,
GError * * error )
2006-03-23 21:17:16 +00:00
{
gboolean success = TRUE ;
2012-05-04 00:50:23 +02:00
GimpValueArray * return_vals ;
2024-07-12 06:16:25 +00:00
GimpPath * path ;
2024-10-25 02:10:57 +02:00
gsize num_strokes = 0 ;
2006-03-23 21:17:16 +00:00
gint32 * stroke_ids = NULL ;
2024-07-08 23:39:51 +00:00
path = g_value_get_object ( gimp_value_array_index ( args , 0 ) ) ;
2006-03-23 21:17:16 +00:00
if ( success )
{
2024-07-13 05:07:57 +00:00
num_strokes = gimp_path_get_n_strokes ( path ) ;
2006-03-23 21:17:16 +00:00
if ( num_strokes )
{
GimpStroke * cur_stroke ;
gint i = 0 ;
stroke_ids = g_new ( gint32 , num_strokes ) ;
2024-07-13 05:07:57 +00:00
for ( cur_stroke = gimp_path_stroke_get_next ( path , NULL ) ;
2006-03-23 21:17:16 +00:00
cur_stroke ;
2024-07-13 05:07:57 +00:00
cur_stroke = gimp_path_stroke_get_next ( path , cur_stroke ) )
2006-03-23 21:17:16 +00:00
{
2019-08-23 22:23:23 +02:00
stroke_ids [ i ] = gimp_stroke_get_id ( cur_stroke ) ;
2006-03-23 21:17:16 +00:00
i + + ;
}
}
}
2008-08-16 13:57:57 +00:00
return_vals = gimp_procedure_get_return_values ( procedure , success ,
error ? * error : NULL ) ;
2006-03-23 21:17:16 +00:00
if ( success )
2024-10-25 01:31:30 +02:00
gimp_value_take_int32_array ( gimp_value_array_index ( return_vals , 1 ) , stroke_ids , num_strokes ) ;
2006-03-23 21:17:16 +00:00
2006-03-27 21:09:32 +00:00
return return_vals ;
2006-03-23 21:17:16 +00:00
}
2012-05-04 00:50:23 +02:00
static GimpValueArray *
2024-07-08 23:39:51 +00:00
path_stroke_get_length_invoker ( GimpProcedure * procedure ,
Gimp * gimp ,
GimpContext * context ,
GimpProgress * progress ,
const GimpValueArray * args ,
GError * * error )
2005-12-28 21:24:12 +00:00
{
gboolean success = TRUE ;
2012-05-04 00:50:23 +02:00
GimpValueArray * return_vals ;
2024-07-12 06:16:25 +00:00
GimpPath * path ;
2019-08-15 14:04:56 +02:00
gint stroke_id ;
2006-10-24 08:30:55 +00:00
gdouble precision ;
2006-03-15 15:32:39 +00:00
gdouble length = 0.0 ;
2005-12-28 21:24:12 +00:00
2024-07-08 23:39:51 +00:00
path = g_value_get_object ( gimp_value_array_index ( args , 0 ) ) ;
2012-05-04 00:50:23 +02:00
stroke_id = g_value_get_int ( gimp_value_array_index ( args , 1 ) ) ;
precision = g_value_get_double ( gimp_value_array_index ( args , 2 ) ) ;
2005-12-28 21:24:12 +00:00
if ( success )
{
2024-07-08 23:39:51 +00:00
GimpStroke * stroke = gimp_pdb_get_path_stroke ( path , stroke_id , 0 , error ) ;
2005-12-28 21:24:12 +00:00
2006-03-14 21:35:50 +00:00
if ( stroke )
2006-10-24 08:30:55 +00:00
length = gimp_stroke_get_length ( stroke , precision ) ;
2005-12-28 21:24:12 +00:00
else
2006-03-14 21:35:50 +00:00
success = FALSE ;
2005-12-28 21:24:12 +00:00
}
2008-08-16 13:57:57 +00:00
return_vals = gimp_procedure_get_return_values ( procedure , success ,
error ? * error : NULL ) ;
2005-12-28 21:24:12 +00:00
if ( success )
2012-05-04 00:50:23 +02:00
g_value_set_double ( gimp_value_array_index ( return_vals , 1 ) , length ) ;
2005-12-28 21:24:12 +00:00
2006-03-27 21:09:32 +00:00
return return_vals ;
2005-12-28 21:24:12 +00:00
}
2012-05-04 00:50:23 +02:00
static GimpValueArray *
2024-07-08 23:39:51 +00:00
path_stroke_get_point_at_dist_invoker ( GimpProcedure * procedure ,
Gimp * gimp ,
GimpContext * context ,
GimpProgress * progress ,
const GimpValueArray * args ,
GError * * error )
2005-12-29 20:55:07 +00:00
{
gboolean success = TRUE ;
2012-05-04 00:50:23 +02:00
GimpValueArray * return_vals ;
2024-07-12 06:16:25 +00:00
GimpPath * path ;
2019-08-15 14:04:56 +02:00
gint stroke_id ;
2005-12-29 20:55:07 +00:00
gdouble dist ;
2006-10-24 08:30:55 +00:00
gdouble precision ;
2006-03-15 15:32:39 +00:00
gdouble x_point = 0.0 ;
gdouble y_point = 0.0 ;
gdouble slope = 0.0 ;
2005-12-29 20:55:07 +00:00
gboolean valid = FALSE ;
2024-07-08 23:39:51 +00:00
path = g_value_get_object ( gimp_value_array_index ( args , 0 ) ) ;
2012-05-04 00:50:23 +02:00
stroke_id = g_value_get_int ( gimp_value_array_index ( args , 1 ) ) ;
dist = g_value_get_double ( gimp_value_array_index ( args , 2 ) ) ;
precision = g_value_get_double ( gimp_value_array_index ( args , 3 ) ) ;
2005-12-29 20:55:07 +00:00
if ( success )
{
2024-07-08 23:39:51 +00:00
GimpStroke * stroke = gimp_pdb_get_path_stroke ( path , stroke_id , 0 , error ) ;
2005-12-29 20:55:07 +00:00
if ( stroke )
{
2006-03-14 21:35:50 +00:00
GimpCoords coord ;
2006-10-24 08:30:55 +00:00
valid = gimp_stroke_get_point_at_dist ( stroke , dist , precision ,
2005-12-29 20:55:07 +00:00
& coord , & slope ) ;
x_point = valid ? coord . x : 0 ;
y_point = valid ? coord . y : 0 ;
}
else
2006-03-24 21:57:47 +00:00
success = FALSE ;
2005-12-29 20:55:07 +00:00
}
2008-08-16 13:57:57 +00:00
return_vals = gimp_procedure_get_return_values ( procedure , success ,
error ? * error : NULL ) ;
2005-12-29 20:55:07 +00:00
if ( success )
{
2012-05-04 00:50:23 +02:00
g_value_set_double ( gimp_value_array_index ( return_vals , 1 ) , x_point ) ;
g_value_set_double ( gimp_value_array_index ( return_vals , 2 ) , y_point ) ;
g_value_set_double ( gimp_value_array_index ( return_vals , 3 ) , slope ) ;
g_value_set_boolean ( gimp_value_array_index ( return_vals , 4 ) , valid ) ;
2005-12-29 20:55:07 +00:00
}
2006-03-27 21:09:32 +00:00
return return_vals ;
2005-12-29 20:55:07 +00:00
}
2012-05-04 00:50:23 +02:00
static GimpValueArray *
2024-07-08 23:39:51 +00:00
path_remove_stroke_invoker ( GimpProcedure * procedure ,
Gimp * gimp ,
GimpContext * context ,
GimpProgress * progress ,
const GimpValueArray * args ,
GError * * error )
2005-06-01 16:20:46 +00:00
{
gboolean success = TRUE ;
2024-07-12 06:16:25 +00:00
GimpPath * path ;
2019-08-15 14:04:56 +02:00
gint stroke_id ;
2005-06-01 16:20:46 +00:00
2024-07-08 23:39:51 +00:00
path = g_value_get_object ( gimp_value_array_index ( args , 0 ) ) ;
2012-05-04 00:50:23 +02:00
stroke_id = g_value_get_int ( gimp_value_array_index ( args , 1 ) ) ;
2005-06-01 16:20:46 +00:00
if ( success )
{
2024-07-08 23:39:51 +00:00
GimpStroke * stroke = gimp_pdb_get_path_stroke ( path , stroke_id ,
GIMP_PDB_ITEM_CONTENT , error ) ;
2005-06-01 16:20:46 +00:00
if ( stroke )
2009-08-21 17:57:56 +02:00
{
2024-07-08 23:39:51 +00:00
if ( gimp_item_is_attached ( GIMP_ITEM ( path ) ) )
2024-07-11 00:07:44 +00:00
gimp_image_undo_push_path_mod ( gimp_item_get_image ( GIMP_ITEM ( path ) ) ,
_ ( " Remove path stroke " ) ,
path ) ;
2009-08-21 17:57:56 +02:00
2024-07-13 05:07:57 +00:00
gimp_path_stroke_remove ( path , stroke ) ;
2009-08-21 17:57:56 +02:00
}
2005-06-01 16:20:46 +00:00
else
success = FALSE ;
}
2008-08-16 13:57:57 +00:00
return gimp_procedure_get_return_values ( procedure , success ,
error ? * error : NULL ) ;
2005-06-01 16:20:46 +00:00
}
2012-05-04 00:50:23 +02:00
static GimpValueArray *
2024-07-08 23:39:51 +00:00
path_stroke_close_invoker ( GimpProcedure * procedure ,
Gimp * gimp ,
GimpContext * context ,
GimpProgress * progress ,
const GimpValueArray * args ,
GError * * error )
2005-12-29 20:55:07 +00:00
{
gboolean success = TRUE ;
2024-07-12 06:16:25 +00:00
GimpPath * path ;
2019-08-15 14:04:56 +02:00
gint stroke_id ;
2005-12-29 20:55:07 +00:00
2024-07-08 23:39:51 +00:00
path = g_value_get_object ( gimp_value_array_index ( args , 0 ) ) ;
2012-05-04 00:50:23 +02:00
stroke_id = g_value_get_int ( gimp_value_array_index ( args , 1 ) ) ;
2005-12-29 20:55:07 +00:00
if ( success )
{
2024-07-08 23:39:51 +00:00
GimpStroke * stroke = gimp_pdb_get_path_stroke ( path , stroke_id ,
GIMP_PDB_ITEM_CONTENT , error ) ;
2005-12-29 20:55:07 +00:00
if ( stroke )
2009-08-21 17:57:56 +02:00
{
2024-07-08 23:39:51 +00:00
if ( gimp_item_is_attached ( GIMP_ITEM ( path ) ) )
2024-07-11 00:07:44 +00:00
gimp_image_undo_push_path_mod ( gimp_item_get_image ( GIMP_ITEM ( path ) ) ,
_ ( " Close path stroke " ) ,
path ) ;
2009-08-21 17:57:56 +02:00
2024-07-13 05:07:57 +00:00
gimp_path_freeze ( path ) ;
2009-08-21 17:57:56 +02:00
gimp_stroke_close ( stroke ) ;
2024-07-13 05:07:57 +00:00
gimp_path_thaw ( path ) ;
2009-08-21 17:57:56 +02:00
}
2005-12-29 20:55:07 +00:00
else
success = FALSE ;
}
2008-08-16 13:57:57 +00:00
return gimp_procedure_get_return_values ( procedure , success ,
error ? * error : NULL ) ;
2005-12-29 20:55:07 +00:00
}
2020-05-25 22:55:01 +02:00
static GimpValueArray *
2024-07-08 23:39:51 +00:00
path_stroke_reverse_invoker ( GimpProcedure * procedure ,
Gimp * gimp ,
GimpContext * context ,
GimpProgress * progress ,
const GimpValueArray * args ,
GError * * error )
2020-05-25 22:55:01 +02:00
{
gboolean success = TRUE ;
2024-07-12 06:16:25 +00:00
GimpPath * path ;
2020-05-25 22:55:01 +02:00
gint stroke_id ;
2024-07-08 23:39:51 +00:00
path = g_value_get_object ( gimp_value_array_index ( args , 0 ) ) ;
2020-05-25 22:55:01 +02:00
stroke_id = g_value_get_int ( gimp_value_array_index ( args , 1 ) ) ;
if ( success )
{
2024-07-08 23:39:51 +00:00
GimpStroke * stroke = gimp_pdb_get_path_stroke ( path , stroke_id ,
GIMP_PDB_ITEM_CONTENT , error ) ;
2020-05-25 22:55:01 +02:00
if ( stroke )
{
2024-07-08 23:39:51 +00:00
if ( gimp_item_is_attached ( GIMP_ITEM ( path ) ) )
2024-07-11 00:07:44 +00:00
gimp_image_undo_push_path_mod ( gimp_item_get_image ( GIMP_ITEM ( path ) ) ,
_ ( " Reverse path stroke " ) ,
path ) ;
2020-05-25 22:55:01 +02:00
2024-07-13 05:07:57 +00:00
gimp_path_freeze ( path ) ;
2020-05-25 22:55:01 +02:00
gimp_stroke_reverse ( stroke ) ;
2024-07-13 05:07:57 +00:00
gimp_path_thaw ( path ) ;
2020-05-25 22:55:01 +02:00
}
else
success = FALSE ;
}
return gimp_procedure_get_return_values ( procedure , success ,
error ? * error : NULL ) ;
}
2012-05-04 00:50:23 +02:00
static GimpValueArray *
2024-07-08 23:39:51 +00:00
path_stroke_translate_invoker ( GimpProcedure * procedure ,
Gimp * gimp ,
GimpContext * context ,
GimpProgress * progress ,
const GimpValueArray * args ,
GError * * error )
2005-05-17 01:20:03 +00:00
{
gboolean success = TRUE ;
2024-07-12 06:16:25 +00:00
GimpPath * path ;
2019-08-15 14:04:56 +02:00
gint stroke_id ;
2022-10-07 01:40:26 +00:00
gdouble off_x ;
gdouble off_y ;
2005-05-17 01:20:03 +00:00
2024-07-08 23:39:51 +00:00
path = g_value_get_object ( gimp_value_array_index ( args , 0 ) ) ;
2012-05-04 00:50:23 +02:00
stroke_id = g_value_get_int ( gimp_value_array_index ( args , 1 ) ) ;
2022-10-07 01:40:26 +00:00
off_x = g_value_get_double ( gimp_value_array_index ( args , 2 ) ) ;
off_y = g_value_get_double ( gimp_value_array_index ( args , 3 ) ) ;
2005-05-17 01:20:03 +00:00
if ( success )
{
2024-07-08 23:39:51 +00:00
GimpStroke * stroke = gimp_pdb_get_path_stroke ( path , stroke_id ,
GIMP_PDB_ITEM_CONTENT |
GIMP_PDB_ITEM_POSITION ,
error ) ;
2005-05-17 01:20:03 +00:00
2005-12-29 20:55:07 +00:00
if ( stroke )
2009-08-21 17:57:56 +02:00
{
2024-07-08 23:39:51 +00:00
if ( gimp_item_is_attached ( GIMP_ITEM ( path ) ) )
2024-07-11 00:07:44 +00:00
gimp_image_undo_push_path_mod ( gimp_item_get_image ( GIMP_ITEM ( path ) ) ,
_ ( " Translate path stroke " ) ,
path ) ;
2009-08-21 17:57:56 +02:00
2024-07-13 05:07:57 +00:00
gimp_path_freeze ( path ) ;
2009-08-21 17:57:56 +02:00
gimp_stroke_translate ( stroke , off_x , off_y ) ;
2024-07-13 05:07:57 +00:00
gimp_path_thaw ( path ) ;
2009-08-21 17:57:56 +02:00
}
2005-05-17 01:20:03 +00:00
else
2005-12-29 20:55:07 +00:00
success = FALSE ;
2005-05-17 01:20:03 +00:00
}
2008-08-16 13:57:57 +00:00
return gimp_procedure_get_return_values ( procedure , success ,
error ? * error : NULL ) ;
2005-05-17 01:20:03 +00:00
}
2012-05-04 00:50:23 +02:00
static GimpValueArray *
2024-07-08 23:39:51 +00:00
path_stroke_scale_invoker ( GimpProcedure * procedure ,
Gimp * gimp ,
GimpContext * context ,
GimpProgress * progress ,
const GimpValueArray * args ,
GError * * error )
2005-12-28 21:24:12 +00:00
{
gboolean success = TRUE ;
2024-07-12 06:16:25 +00:00
GimpPath * path ;
2019-08-15 14:04:56 +02:00
gint stroke_id ;
2005-12-28 21:24:12 +00:00
gdouble scale_x ;
gdouble scale_y ;
2024-07-08 23:39:51 +00:00
path = g_value_get_object ( gimp_value_array_index ( args , 0 ) ) ;
2012-05-04 00:50:23 +02:00
stroke_id = g_value_get_int ( gimp_value_array_index ( args , 1 ) ) ;
scale_x = g_value_get_double ( gimp_value_array_index ( args , 2 ) ) ;
scale_y = g_value_get_double ( gimp_value_array_index ( args , 3 ) ) ;
2005-12-28 21:24:12 +00:00
if ( success )
{
2024-07-08 23:39:51 +00:00
GimpStroke * stroke = gimp_pdb_get_path_stroke ( path , stroke_id ,
GIMP_PDB_ITEM_CONTENT |
GIMP_PDB_ITEM_POSITION ,
error ) ;
2005-12-28 21:24:12 +00:00
2005-12-29 20:55:07 +00:00
if ( stroke )
2009-08-21 17:57:56 +02:00
{
2024-07-08 23:39:51 +00:00
if ( gimp_item_is_attached ( GIMP_ITEM ( path ) ) )
2024-07-11 00:07:44 +00:00
gimp_image_undo_push_path_mod ( gimp_item_get_image ( GIMP_ITEM ( path ) ) ,
_ ( " Scale path stroke " ) ,
path ) ;
2009-08-21 17:57:56 +02:00
2024-07-13 05:07:57 +00:00
gimp_path_freeze ( path ) ;
2009-08-21 17:57:56 +02:00
gimp_stroke_scale ( stroke , scale_x , scale_y ) ;
2024-07-13 05:07:57 +00:00
gimp_path_thaw ( path ) ;
2009-08-21 17:57:56 +02:00
}
2005-12-28 21:24:12 +00:00
else
2005-12-29 20:55:07 +00:00
success = FALSE ;
2005-12-28 21:24:12 +00:00
}
2008-08-16 13:57:57 +00:00
return gimp_procedure_get_return_values ( procedure , success ,
error ? * error : NULL ) ;
2005-12-28 21:24:12 +00:00
}
2012-05-04 00:50:23 +02:00
static GimpValueArray *
2024-07-08 23:39:51 +00:00
path_stroke_rotate_invoker ( GimpProcedure * procedure ,
Gimp * gimp ,
GimpContext * context ,
GimpProgress * progress ,
const GimpValueArray * args ,
GError * * error )
2006-11-20 15:34:30 +00:00
{
gboolean success = TRUE ;
2024-07-12 06:16:25 +00:00
GimpPath * path ;
2019-08-15 14:04:56 +02:00
gint stroke_id ;
2006-11-20 15:34:30 +00:00
gdouble center_x ;
gdouble center_y ;
gdouble angle ;
2024-07-08 23:39:51 +00:00
path = g_value_get_object ( gimp_value_array_index ( args , 0 ) ) ;
2012-05-04 00:50:23 +02:00
stroke_id = g_value_get_int ( gimp_value_array_index ( args , 1 ) ) ;
center_x = g_value_get_double ( gimp_value_array_index ( args , 2 ) ) ;
center_y = g_value_get_double ( gimp_value_array_index ( args , 3 ) ) ;
angle = g_value_get_double ( gimp_value_array_index ( args , 4 ) ) ;
2006-11-20 15:34:30 +00:00
if ( success )
{
2024-07-08 23:39:51 +00:00
GimpStroke * stroke = gimp_pdb_get_path_stroke ( path , stroke_id ,
GIMP_PDB_ITEM_CONTENT |
GIMP_PDB_ITEM_POSITION ,
error ) ;
2006-11-20 15:34:30 +00:00
if ( stroke )
2009-08-21 17:57:56 +02:00
{
2024-07-08 23:39:51 +00:00
if ( gimp_item_is_attached ( GIMP_ITEM ( path ) ) )
2024-07-11 00:07:44 +00:00
gimp_image_undo_push_path_mod ( gimp_item_get_image ( GIMP_ITEM ( path ) ) ,
_ ( " Rotate path stroke " ) ,
path ) ;
2009-08-21 17:57:56 +02:00
2024-07-13 05:07:57 +00:00
gimp_path_freeze ( path ) ;
2009-08-21 17:57:56 +02:00
gimp_stroke_rotate ( stroke , center_x , center_y , angle ) ;
2024-07-13 05:07:57 +00:00
gimp_path_thaw ( path ) ;
2009-08-21 17:57:56 +02:00
}
2006-11-20 15:34:30 +00:00
else
success = FALSE ;
}
2008-08-16 13:57:57 +00:00
return gimp_procedure_get_return_values ( procedure , success ,
error ? * error : NULL ) ;
2006-11-20 15:34:30 +00:00
}
2012-05-04 00:50:23 +02:00
static GimpValueArray *
2024-07-08 23:39:51 +00:00
path_stroke_flip_invoker ( GimpProcedure * procedure ,
Gimp * gimp ,
GimpContext * context ,
GimpProgress * progress ,
const GimpValueArray * args ,
GError * * error )
2006-11-20 15:34:30 +00:00
{
gboolean success = TRUE ;
2024-07-12 06:16:25 +00:00
GimpPath * path ;
2019-08-15 14:04:56 +02:00
gint stroke_id ;
gint flip_type ;
2006-11-20 15:34:30 +00:00
gdouble axis ;
2024-07-08 23:39:51 +00:00
path = g_value_get_object ( gimp_value_array_index ( args , 0 ) ) ;
2012-05-04 00:50:23 +02:00
stroke_id = g_value_get_int ( gimp_value_array_index ( args , 1 ) ) ;
flip_type = g_value_get_enum ( gimp_value_array_index ( args , 2 ) ) ;
axis = g_value_get_double ( gimp_value_array_index ( args , 3 ) ) ;
2006-11-20 15:34:30 +00:00
if ( success )
{
2024-07-08 23:39:51 +00:00
GimpStroke * stroke = gimp_pdb_get_path_stroke ( path , stroke_id ,
GIMP_PDB_ITEM_CONTENT |
GIMP_PDB_ITEM_POSITION ,
error ) ;
2006-11-20 15:34:30 +00:00
if ( stroke )
2009-08-21 17:57:56 +02:00
{
2024-07-08 23:39:51 +00:00
if ( gimp_item_is_attached ( GIMP_ITEM ( path ) ) )
2024-07-11 00:07:44 +00:00
gimp_image_undo_push_path_mod ( gimp_item_get_image ( GIMP_ITEM ( path ) ) ,
_ ( " Flip path stroke " ) ,
path ) ;
2009-08-21 17:57:56 +02:00
2024-07-13 05:07:57 +00:00
gimp_path_freeze ( path ) ;
2009-08-21 17:57:56 +02:00
gimp_stroke_flip ( stroke , flip_type , axis ) ;
2024-07-13 05:07:57 +00:00
gimp_path_thaw ( path ) ;
2009-08-21 17:57:56 +02:00
}
2006-11-20 15:34:30 +00:00
else
success = FALSE ;
}
2008-08-16 13:57:57 +00:00
return gimp_procedure_get_return_values ( procedure , success ,
error ? * error : NULL ) ;
2006-11-20 15:34:30 +00:00
}
2012-05-04 00:50:23 +02:00
static GimpValueArray *
2024-07-08 23:39:51 +00:00
path_stroke_flip_free_invoker ( GimpProcedure * procedure ,
Gimp * gimp ,
GimpContext * context ,
GimpProgress * progress ,
const GimpValueArray * args ,
GError * * error )
2006-11-20 15:34:30 +00:00
{
gboolean success = TRUE ;
2024-07-12 06:16:25 +00:00
GimpPath * path ;
2019-08-15 14:04:56 +02:00
gint stroke_id ;
2006-11-20 15:34:30 +00:00
gdouble x1 ;
gdouble y1 ;
gdouble x2 ;
gdouble y2 ;
2024-07-08 23:39:51 +00:00
path = g_value_get_object ( gimp_value_array_index ( args , 0 ) ) ;
2012-05-04 00:50:23 +02:00
stroke_id = g_value_get_int ( gimp_value_array_index ( args , 1 ) ) ;
x1 = g_value_get_double ( gimp_value_array_index ( args , 2 ) ) ;
y1 = g_value_get_double ( gimp_value_array_index ( args , 3 ) ) ;
x2 = g_value_get_double ( gimp_value_array_index ( args , 4 ) ) ;
y2 = g_value_get_double ( gimp_value_array_index ( args , 5 ) ) ;
2006-11-20 15:34:30 +00:00
if ( success )
{
2024-07-08 23:39:51 +00:00
GimpStroke * stroke = gimp_pdb_get_path_stroke ( path , stroke_id ,
GIMP_PDB_ITEM_CONTENT |
GIMP_PDB_ITEM_POSITION ,
error ) ;
2006-11-20 15:34:30 +00:00
if ( stroke )
2009-08-21 17:57:56 +02:00
{
2024-07-08 23:39:51 +00:00
if ( gimp_item_is_attached ( GIMP_ITEM ( path ) ) )
2024-07-11 00:07:44 +00:00
gimp_image_undo_push_path_mod ( gimp_item_get_image ( GIMP_ITEM ( path ) ) ,
_ ( " Flip path stroke " ) ,
path ) ;
2009-08-21 17:57:56 +02:00
2024-07-13 05:07:57 +00:00
gimp_path_freeze ( path ) ;
2009-08-21 17:57:56 +02:00
gimp_stroke_flip_free ( stroke , x1 , y1 , x2 , y2 ) ;
2024-07-13 05:07:57 +00:00
gimp_path_thaw ( path ) ;
2009-08-21 17:57:56 +02:00
}
2006-11-20 15:34:30 +00:00
else
success = FALSE ;
}
2008-08-16 13:57:57 +00:00
return gimp_procedure_get_return_values ( procedure , success ,
error ? * error : NULL ) ;
2006-11-20 15:34:30 +00:00
}
2012-05-04 00:50:23 +02:00
static GimpValueArray *
2024-07-08 23:39:51 +00:00
path_stroke_get_points_invoker ( GimpProcedure * procedure ,
Gimp * gimp ,
GimpContext * context ,
GimpProgress * progress ,
const GimpValueArray * args ,
GError * * error )
2006-10-24 14:23:29 +00:00
{
gboolean success = TRUE ;
2012-05-04 00:50:23 +02:00
GimpValueArray * return_vals ;
2024-07-12 06:16:25 +00:00
GimpPath * path ;
2019-08-15 14:04:56 +02:00
gint stroke_id ;
gint type = 0 ;
2024-10-25 02:10:57 +02:00
gsize num_points = 0 ;
2006-10-24 14:23:29 +00:00
gdouble * controlpoints = NULL ;
gboolean closed = FALSE ;
2024-07-08 23:39:51 +00:00
path = g_value_get_object ( gimp_value_array_index ( args , 0 ) ) ;
2012-05-04 00:50:23 +02:00
stroke_id = g_value_get_int ( gimp_value_array_index ( args , 1 ) ) ;
2006-10-24 14:23:29 +00:00
if ( success )
{
2024-07-08 23:39:51 +00:00
GimpStroke * stroke = gimp_pdb_get_path_stroke ( path , stroke_id , 0 , error ) ;
2006-10-24 14:23:29 +00:00
2008-03-06 18:39:07 +00:00
if ( GIMP_IS_BEZIER_STROKE ( stroke ) )
2006-10-24 14:23:29 +00:00
{
GArray * points_array ;
gint i ;
points_array = gimp_stroke_control_points_get ( stroke , & closed ) ;
if ( points_array )
{
num_points = points_array - > len ;
controlpoints = g_new ( gdouble , num_points * 2 ) ;
2024-07-19 15:07:43 +00:00
type = GIMP_PATH_STROKE_TYPE_BEZIER ;
2006-10-24 14:23:29 +00:00
for ( i = 0 ; i < num_points ; i + + )
{
controlpoints [ 2 * i ] = g_array_index ( points_array ,
GimpAnchor , i ) . position . x ;
controlpoints [ 2 * i + 1 ] = g_array_index ( points_array ,
GimpAnchor , i ) . position . y ;
}
g_array_free ( points_array , TRUE ) ;
num_points * = 2 ;
}
else
success = FALSE ;
}
else
success = FALSE ;
}
2008-08-16 13:57:57 +00:00
return_vals = gimp_procedure_get_return_values ( procedure , success ,
error ? * error : NULL ) ;
2006-10-24 14:23:29 +00:00
if ( success )
{
2012-05-04 00:50:23 +02:00
g_value_set_enum ( gimp_value_array_index ( return_vals , 1 ) , type ) ;
2024-10-25 01:31:30 +02:00
gimp_value_take_float_array ( gimp_value_array_index ( return_vals , 2 ) , controlpoints , num_points ) ;
g_value_set_boolean ( gimp_value_array_index ( return_vals , 3 ) , closed ) ;
2006-10-24 14:23:29 +00:00
}
return return_vals ;
}
2012-05-04 00:50:23 +02:00
static GimpValueArray *
2024-07-08 23:39:51 +00:00
path_stroke_new_from_points_invoker ( GimpProcedure * procedure ,
Gimp * gimp ,
GimpContext * context ,
GimpProgress * progress ,
const GimpValueArray * args ,
GError * * error )
2006-10-26 15:36:45 +00:00
{
gboolean success = TRUE ;
2012-05-04 00:50:23 +02:00
GimpValueArray * return_vals ;
2024-07-12 06:16:25 +00:00
GimpPath * path ;
2019-08-15 14:04:56 +02:00
gint type ;
2024-10-25 02:10:57 +02:00
gsize num_points ;
2006-10-26 15:36:45 +00:00
const gdouble * controlpoints ;
gboolean closed ;
2019-08-15 14:04:56 +02:00
gint stroke_id = 0 ;
2006-10-26 15:36:45 +00:00
2024-07-08 23:39:51 +00:00
path = g_value_get_object ( gimp_value_array_index ( args , 0 ) ) ;
2012-05-04 00:50:23 +02:00
type = g_value_get_enum ( gimp_value_array_index ( args , 1 ) ) ;
2024-10-28 10:46:17 +01:00
controlpoints = gimp_value_get_float_array ( gimp_value_array_index ( args , 2 ) , & num_points ) ;
2024-10-25 01:31:30 +02:00
closed = g_value_get_boolean ( gimp_value_array_index ( args , 3 ) ) ;
2006-10-26 15:36:45 +00:00
if ( success )
{
GimpStroke * stroke ;
GimpCoords * coords ;
GimpCoords default_coords = GIMP_COORDS_DEFAULT_VALUES ;
gint i ;
success = FALSE ;
2024-07-19 15:07:43 +00:00
if ( type = = GIMP_PATH_STROKE_TYPE_BEZIER & &
2006-10-26 15:36:45 +00:00
num_points % 6 = = 0 )
{
2007-09-24 16:57:19 +00:00
coords = g_new ( GimpCoords , num_points / 2 ) ;
for ( i = 0 ; i < num_points / 2 ; i + + )
2006-10-26 15:36:45 +00:00
{
coords [ i ] = default_coords ;
coords [ i ] . x = controlpoints [ i * 2 ] ;
coords [ i ] . y = controlpoints [ i * 2 + 1 ] ;
}
stroke = gimp_stroke_new_from_coords ( type , coords , num_points / 2 , closed ) ;
if ( stroke )
{
2024-07-08 23:39:51 +00:00
if ( gimp_item_is_attached ( GIMP_ITEM ( path ) ) )
2024-07-11 00:07:44 +00:00
gimp_image_undo_push_path_mod ( gimp_item_get_image ( GIMP_ITEM ( path ) ) ,
_ ( " Add path stroke " ) ,
path ) ;
2009-08-21 17:57:56 +02:00
2024-07-13 05:07:57 +00:00
gimp_path_stroke_add ( path , stroke ) ;
2012-02-07 14:06:12 +01:00
g_object_unref ( stroke ) ;
2009-08-21 17:57:56 +02:00
2019-08-23 22:23:23 +02:00
stroke_id = gimp_stroke_get_id ( stroke ) ;
2006-10-26 17:23:41 +00:00
success = TRUE ;
2006-10-26 15:36:45 +00:00
}
g_free ( coords ) ;
}
}
2008-08-16 13:57:57 +00:00
return_vals = gimp_procedure_get_return_values ( procedure , success ,
error ? * error : NULL ) ;
2006-10-26 15:36:45 +00:00
if ( success )
2012-05-04 00:50:23 +02:00
g_value_set_int ( gimp_value_array_index ( return_vals , 1 ) , stroke_id ) ;
2006-10-26 15:36:45 +00:00
return return_vals ;
}
2012-05-04 00:50:23 +02:00
static GimpValueArray *
2024-07-08 23:39:51 +00:00
path_stroke_interpolate_invoker ( GimpProcedure * procedure ,
Gimp * gimp ,
GimpContext * context ,
GimpProgress * progress ,
const GimpValueArray * args ,
GError * * error )
2005-06-01 16:20:46 +00:00
{
gboolean success = TRUE ;
2012-05-04 00:50:23 +02:00
GimpValueArray * return_vals ;
2024-07-12 06:16:25 +00:00
GimpPath * path ;
2019-08-15 14:04:56 +02:00
gint stroke_id ;
2006-10-24 08:30:55 +00:00
gdouble precision ;
2024-10-25 02:10:57 +02:00
gsize num_coords = 0 ;
2005-06-01 16:20:46 +00:00
gdouble * coords = NULL ;
2006-10-24 08:30:55 +00:00
gboolean closed = FALSE ;
2005-06-01 16:20:46 +00:00
2024-07-08 23:39:51 +00:00
path = g_value_get_object ( gimp_value_array_index ( args , 0 ) ) ;
2012-05-04 00:50:23 +02:00
stroke_id = g_value_get_int ( gimp_value_array_index ( args , 1 ) ) ;
precision = g_value_get_double ( gimp_value_array_index ( args , 2 ) ) ;
2005-06-01 16:20:46 +00:00
if ( success )
{
2024-07-08 23:39:51 +00:00
GimpStroke * stroke = gimp_pdb_get_path_stroke ( path , stroke_id , 0 , error ) ;
2005-06-01 16:20:46 +00:00
if ( stroke )
{
2006-03-14 21:35:50 +00:00
GArray * coords_array ;
gint i ;
2006-10-24 08:30:55 +00:00
coords_array = gimp_stroke_interpolate ( stroke , precision , & closed ) ;
2006-03-14 21:35:50 +00:00
2005-06-01 16:20:46 +00:00
if ( coords_array )
{
num_coords = coords_array - > len ;
coords = g_new ( gdouble , num_coords * 2 ) ;
for ( i = 0 ; i < num_coords ; i + + )
{
coords [ 2 * i ] = g_array_index ( coords_array , GimpCoords , i ) . x ;
coords [ 2 * i + 1 ] = g_array_index ( coords_array , GimpCoords , i ) . y ;
}
g_array_free ( coords_array , TRUE ) ;
num_coords * = 2 ;
}
else
2006-03-24 21:57:47 +00:00
success = FALSE ;
2005-06-01 16:20:46 +00:00
}
else
2006-03-24 21:57:47 +00:00
success = FALSE ;
2005-06-01 16:20:46 +00:00
}
2008-08-16 13:57:57 +00:00
return_vals = gimp_procedure_get_return_values ( procedure , success ,
error ? * error : NULL ) ;
2005-06-01 16:20:46 +00:00
if ( success )
{
2024-10-25 01:31:30 +02:00
gimp_value_take_float_array ( gimp_value_array_index ( return_vals , 1 ) , coords , num_coords ) ;
g_value_set_boolean ( gimp_value_array_index ( return_vals , 2 ) , closed ) ;
2005-06-01 16:20:46 +00:00
}
2006-04-04 21:11:45 +00:00
return return_vals ;
}
2012-05-04 00:50:23 +02:00
static GimpValueArray *
2024-07-08 23:39:51 +00:00
path_bezier_stroke_new_moveto_invoker ( GimpProcedure * procedure ,
Gimp * gimp ,
GimpContext * context ,
GimpProgress * progress ,
const GimpValueArray * args ,
GError * * error )
2006-04-04 21:11:45 +00:00
{
gboolean success = TRUE ;
2012-05-04 00:50:23 +02:00
GimpValueArray * return_vals ;
2024-07-12 06:16:25 +00:00
GimpPath * path ;
2006-04-04 21:11:45 +00:00
gdouble x0 ;
gdouble y0 ;
2019-08-15 14:04:56 +02:00
gint stroke_id = 0 ;
2006-04-04 21:11:45 +00:00
2024-07-08 23:39:51 +00:00
path = g_value_get_object ( gimp_value_array_index ( args , 0 ) ) ;
2012-05-04 00:50:23 +02:00
x0 = g_value_get_double ( gimp_value_array_index ( args , 1 ) ) ;
y0 = g_value_get_double ( gimp_value_array_index ( args , 2 ) ) ;
2006-04-04 21:11:45 +00:00
if ( success )
{
2024-07-08 23:39:51 +00:00
if ( gimp_pdb_item_is_modifiable ( GIMP_ITEM ( path ) ,
2012-11-08 20:46:18 +01:00
GIMP_PDB_ITEM_CONTENT , error ) & &
2024-07-08 23:39:51 +00:00
gimp_pdb_item_is_not_group ( GIMP_ITEM ( path ) , error ) )
2009-08-21 18:06:58 +02:00
{
GimpStroke * stroke ;
GimpCoords coord0 = GIMP_COORDS_DEFAULT_VALUES ;
2006-04-04 21:11:45 +00:00
2009-08-21 18:06:58 +02:00
coord0 . x = x0 ;
coord0 . y = y0 ;
2006-04-04 21:11:45 +00:00
2009-08-21 18:06:58 +02:00
stroke = gimp_bezier_stroke_new_moveto ( & coord0 ) ;
2009-08-21 17:57:56 +02:00
2024-07-08 23:39:51 +00:00
if ( gimp_item_is_attached ( GIMP_ITEM ( path ) ) )
2024-07-11 00:07:44 +00:00
gimp_image_undo_push_path_mod ( gimp_item_get_image ( GIMP_ITEM ( path ) ) ,
_ ( " Add path stroke " ) ,
path ) ;
2009-08-21 17:57:56 +02:00
2024-07-13 05:07:57 +00:00
gimp_path_stroke_add ( path , stroke ) ;
2012-02-07 14:06:12 +01:00
g_object_unref ( stroke ) ;
2009-08-21 17:57:56 +02:00
2019-08-23 22:23:23 +02:00
stroke_id = gimp_stroke_get_id ( stroke ) ;
2009-08-21 18:06:58 +02:00
}
else
success = FALSE ;
2006-04-04 21:11:45 +00:00
}
2008-08-16 13:57:57 +00:00
return_vals = gimp_procedure_get_return_values ( procedure , success ,
error ? * error : NULL ) ;
2006-04-04 21:11:45 +00:00
if ( success )
2012-05-04 00:50:23 +02:00
g_value_set_int ( gimp_value_array_index ( return_vals , 1 ) , stroke_id ) ;
2006-04-04 21:11:45 +00:00
return return_vals ;
}
2012-05-04 00:50:23 +02:00
static GimpValueArray *
2024-07-08 23:39:51 +00:00
path_bezier_stroke_lineto_invoker ( GimpProcedure * procedure ,
Gimp * gimp ,
GimpContext * context ,
GimpProgress * progress ,
const GimpValueArray * args ,
GError * * error )
2006-04-04 21:11:45 +00:00
{
gboolean success = TRUE ;
2024-07-12 06:16:25 +00:00
GimpPath * path ;
2019-08-15 14:04:56 +02:00
gint stroke_id ;
2006-04-04 21:11:45 +00:00
gdouble x0 ;
gdouble y0 ;
2024-07-08 23:39:51 +00:00
path = g_value_get_object ( gimp_value_array_index ( args , 0 ) ) ;
2012-05-04 00:50:23 +02:00
stroke_id = g_value_get_int ( gimp_value_array_index ( args , 1 ) ) ;
x0 = g_value_get_double ( gimp_value_array_index ( args , 2 ) ) ;
y0 = g_value_get_double ( gimp_value_array_index ( args , 3 ) ) ;
2006-04-04 21:11:45 +00:00
if ( success )
{
2024-07-08 23:39:51 +00:00
GimpStroke * stroke = gimp_pdb_get_path_stroke ( path , stroke_id ,
GIMP_PDB_ITEM_CONTENT , error ) ;
2006-04-04 21:11:45 +00:00
if ( stroke )
{
GimpCoords coord0 = GIMP_COORDS_DEFAULT_VALUES ;
coord0 . x = x0 ;
coord0 . y = y0 ;
2024-07-08 23:39:51 +00:00
if ( gimp_item_is_attached ( GIMP_ITEM ( path ) ) )
2024-07-11 00:07:44 +00:00
gimp_image_undo_push_path_mod ( gimp_item_get_image ( GIMP_ITEM ( path ) ) ,
_ ( " Extend path stroke " ) ,
path ) ;
2009-08-21 17:57:56 +02:00
2024-07-13 05:07:57 +00:00
gimp_path_freeze ( path ) ;
2006-04-04 21:11:45 +00:00
gimp_bezier_stroke_lineto ( stroke , & coord0 ) ;
2024-07-13 05:07:57 +00:00
gimp_path_thaw ( path ) ;
2006-04-04 21:11:45 +00:00
}
else
success = FALSE ;
}
2008-08-16 13:57:57 +00:00
return gimp_procedure_get_return_values ( procedure , success ,
error ? * error : NULL ) ;
2006-04-04 21:11:45 +00:00
}
2012-05-04 00:50:23 +02:00
static GimpValueArray *
2024-07-08 23:39:51 +00:00
path_bezier_stroke_conicto_invoker ( GimpProcedure * procedure ,
Gimp * gimp ,
GimpContext * context ,
GimpProgress * progress ,
const GimpValueArray * args ,
GError * * error )
2006-04-04 21:11:45 +00:00
{
gboolean success = TRUE ;
2024-07-12 06:16:25 +00:00
GimpPath * path ;
2019-08-15 14:04:56 +02:00
gint stroke_id ;
2006-04-04 21:11:45 +00:00
gdouble x0 ;
gdouble y0 ;
gdouble x1 ;
gdouble y1 ;
2024-07-08 23:39:51 +00:00
path = g_value_get_object ( gimp_value_array_index ( args , 0 ) ) ;
2012-05-04 00:50:23 +02:00
stroke_id = g_value_get_int ( gimp_value_array_index ( args , 1 ) ) ;
x0 = g_value_get_double ( gimp_value_array_index ( args , 2 ) ) ;
y0 = g_value_get_double ( gimp_value_array_index ( args , 3 ) ) ;
x1 = g_value_get_double ( gimp_value_array_index ( args , 4 ) ) ;
y1 = g_value_get_double ( gimp_value_array_index ( args , 5 ) ) ;
2006-04-04 21:11:45 +00:00
if ( success )
{
2024-07-08 23:39:51 +00:00
GimpStroke * stroke = gimp_pdb_get_path_stroke ( path , stroke_id ,
GIMP_PDB_ITEM_CONTENT , error ) ;
2006-04-04 21:11:45 +00:00
if ( stroke )
{
GimpCoords coord0 = GIMP_COORDS_DEFAULT_VALUES ;
GimpCoords coord1 = GIMP_COORDS_DEFAULT_VALUES ;
coord0 . x = x0 ;
coord0 . y = y0 ;
coord1 . x = x1 ;
coord1 . y = y1 ;
2024-07-08 23:39:51 +00:00
if ( gimp_item_is_attached ( GIMP_ITEM ( path ) ) )
2024-07-11 00:07:44 +00:00
gimp_image_undo_push_path_mod ( gimp_item_get_image ( GIMP_ITEM ( path ) ) ,
_ ( " Extend path stroke " ) ,
path ) ;
2009-08-21 17:57:56 +02:00
2024-07-13 05:07:57 +00:00
gimp_path_freeze ( path ) ;
2006-04-04 21:11:45 +00:00
gimp_bezier_stroke_conicto ( stroke , & coord0 , & coord1 ) ;
2024-07-13 05:07:57 +00:00
gimp_path_thaw ( path ) ;
2006-04-04 21:11:45 +00:00
}
else
success = FALSE ;
}
2008-08-16 13:57:57 +00:00
return gimp_procedure_get_return_values ( procedure , success ,
error ? * error : NULL ) ;
2006-04-04 21:11:45 +00:00
}
2012-05-04 00:50:23 +02:00
static GimpValueArray *
2024-07-08 23:39:51 +00:00
path_bezier_stroke_cubicto_invoker ( GimpProcedure * procedure ,
Gimp * gimp ,
GimpContext * context ,
GimpProgress * progress ,
const GimpValueArray * args ,
GError * * error )
2006-04-04 21:11:45 +00:00
{
gboolean success = TRUE ;
2024-07-12 06:16:25 +00:00
GimpPath * path ;
2019-08-15 14:04:56 +02:00
gint stroke_id ;
2006-04-04 21:11:45 +00:00
gdouble x0 ;
gdouble y0 ;
gdouble x1 ;
gdouble y1 ;
gdouble x2 ;
gdouble y2 ;
2024-07-08 23:39:51 +00:00
path = g_value_get_object ( gimp_value_array_index ( args , 0 ) ) ;
2012-05-04 00:50:23 +02:00
stroke_id = g_value_get_int ( gimp_value_array_index ( args , 1 ) ) ;
x0 = g_value_get_double ( gimp_value_array_index ( args , 2 ) ) ;
y0 = g_value_get_double ( gimp_value_array_index ( args , 3 ) ) ;
x1 = g_value_get_double ( gimp_value_array_index ( args , 4 ) ) ;
y1 = g_value_get_double ( gimp_value_array_index ( args , 5 ) ) ;
x2 = g_value_get_double ( gimp_value_array_index ( args , 6 ) ) ;
y2 = g_value_get_double ( gimp_value_array_index ( args , 7 ) ) ;
2006-04-04 21:11:45 +00:00
if ( success )
{
2024-07-08 23:39:51 +00:00
GimpStroke * stroke = gimp_pdb_get_path_stroke ( path , stroke_id ,
GIMP_PDB_ITEM_CONTENT , error ) ;
2006-04-04 21:11:45 +00:00
if ( stroke )
{
GimpCoords coord0 = GIMP_COORDS_DEFAULT_VALUES ;
GimpCoords coord1 = GIMP_COORDS_DEFAULT_VALUES ;
GimpCoords coord2 = GIMP_COORDS_DEFAULT_VALUES ;
coord0 . x = x0 ;
coord0 . y = y0 ;
coord1 . x = x1 ;
coord1 . y = y1 ;
coord2 . x = x2 ;
coord2 . y = y2 ;
2024-07-08 23:39:51 +00:00
if ( gimp_item_is_attached ( GIMP_ITEM ( path ) ) )
2024-07-11 00:07:44 +00:00
gimp_image_undo_push_path_mod ( gimp_item_get_image ( GIMP_ITEM ( path ) ) ,
_ ( " Extend path stroke " ) ,
path ) ;
2009-08-21 17:57:56 +02:00
2024-07-13 05:07:57 +00:00
gimp_path_freeze ( path ) ;
2006-04-04 21:11:45 +00:00
gimp_bezier_stroke_cubicto ( stroke , & coord0 , & coord1 , & coord2 ) ;
2024-07-13 05:07:57 +00:00
gimp_path_thaw ( path ) ;
2006-04-04 21:11:45 +00:00
}
else
success = FALSE ;
}
2008-08-16 13:57:57 +00:00
return gimp_procedure_get_return_values ( procedure , success ,
error ? * error : NULL ) ;
2005-06-01 16:20:46 +00:00
}
2012-05-04 00:50:23 +02:00
static GimpValueArray *
2024-07-08 23:39:51 +00:00
path_bezier_stroke_new_ellipse_invoker ( GimpProcedure * procedure ,
Gimp * gimp ,
GimpContext * context ,
GimpProgress * progress ,
const GimpValueArray * args ,
GError * * error )
2005-12-29 16:05:31 +00:00
{
gboolean success = TRUE ;
2012-05-04 00:50:23 +02:00
GimpValueArray * return_vals ;
2024-07-12 06:16:25 +00:00
GimpPath * path ;
2006-03-15 15:32:39 +00:00
gdouble x0 ;
gdouble y0 ;
2006-04-04 21:11:45 +00:00
gdouble radius_x ;
gdouble radius_y ;
gdouble angle ;
2019-08-15 14:04:56 +02:00
gint stroke_id = 0 ;
2005-12-29 16:05:31 +00:00
2024-07-08 23:39:51 +00:00
path = g_value_get_object ( gimp_value_array_index ( args , 0 ) ) ;
2012-05-04 00:50:23 +02:00
x0 = g_value_get_double ( gimp_value_array_index ( args , 1 ) ) ;
y0 = g_value_get_double ( gimp_value_array_index ( args , 2 ) ) ;
radius_x = g_value_get_double ( gimp_value_array_index ( args , 3 ) ) ;
radius_y = g_value_get_double ( gimp_value_array_index ( args , 4 ) ) ;
angle = g_value_get_double ( gimp_value_array_index ( args , 5 ) ) ;
2005-12-29 16:05:31 +00:00
if ( success )
{
2024-07-08 23:39:51 +00:00
if ( gimp_pdb_item_is_modifiable ( GIMP_ITEM ( path ) ,
2012-11-08 20:46:18 +01:00
GIMP_PDB_ITEM_CONTENT , error ) & &
2024-07-08 23:39:51 +00:00
gimp_pdb_item_is_not_group ( GIMP_ITEM ( path ) , error ) )
2009-08-21 18:06:58 +02:00
{
GimpStroke * stroke ;
GimpCoords coord0 = GIMP_COORDS_DEFAULT_VALUES ;
2006-03-14 21:35:50 +00:00
2009-08-21 18:06:58 +02:00
coord0 . x = x0 ;
coord0 . y = y0 ;
2005-12-29 16:05:31 +00:00
2009-08-21 18:06:58 +02:00
stroke = gimp_bezier_stroke_new_ellipse ( & coord0 , radius_x , radius_y , angle ) ;
2009-08-21 17:57:56 +02:00
2024-07-08 23:39:51 +00:00
if ( gimp_item_is_attached ( GIMP_ITEM ( path ) ) )
2024-07-11 00:07:44 +00:00
gimp_image_undo_push_path_mod ( gimp_item_get_image ( GIMP_ITEM ( path ) ) ,
_ ( " Add path stroke " ) ,
path ) ;
2009-08-21 17:57:56 +02:00
2024-07-13 05:07:57 +00:00
gimp_path_stroke_add ( path , stroke ) ;
2012-02-07 14:06:12 +01:00
g_object_unref ( stroke ) ;
2009-08-21 17:57:56 +02:00
2019-08-23 22:23:23 +02:00
stroke_id = gimp_stroke_get_id ( stroke ) ;
2009-08-21 18:06:58 +02:00
}
else
success = FALSE ;
2005-12-29 16:05:31 +00:00
}
2008-08-16 13:57:57 +00:00
return_vals = gimp_procedure_get_return_values ( procedure , success ,
error ? * error : NULL ) ;
2005-12-29 16:05:31 +00:00
if ( success )
2012-05-04 00:50:23 +02:00
g_value_set_int ( gimp_value_array_index ( return_vals , 1 ) , stroke_id ) ;
2005-12-29 16:05:31 +00:00
2006-03-27 21:09:32 +00:00
return return_vals ;
2005-12-29 16:05:31 +00:00
}
2006-04-04 21:11:45 +00:00
void
2024-07-08 23:39:51 +00:00
register_path_procs ( GimpPDB * pdb )
2005-12-29 16:05:31 +00:00
{
2006-04-04 21:11:45 +00:00
GimpProcedure * procedure ;
2005-12-29 16:05:31 +00:00
2006-04-04 21:11:45 +00:00
/*
2024-07-08 23:39:51 +00:00
* gimp - path - new
2006-04-04 21:11:45 +00:00
*/
2024-07-08 23:39:51 +00:00
procedure = gimp_procedure_new ( path_new_invoker ) ;
2008-04-04 10:58:56 +00:00
gimp_object_set_static_name ( GIMP_OBJECT ( procedure ) ,
2024-07-08 23:39:51 +00:00
" gimp-path-new " ) ;
2019-09-08 23:40:34 +02:00
gimp_procedure_set_static_help ( procedure ,
2024-07-08 23:39:51 +00:00
" Creates a new empty path object. " ,
2024-07-11 00:07:44 +00:00
" Creates a new empty path object. The path object needs to be added to the image using 'gimp-image-insert-path'. " ,
2019-09-08 23:40:34 +02:00
NULL ) ;
gimp_procedure_set_static_attribution ( procedure ,
" Simon Budig " ,
" Simon Budig " ,
" 2005 " ) ;
2006-04-04 21:11:45 +00:00
gimp_procedure_add_argument ( procedure ,
2019-08-29 11:25:35 +02:00
gimp_param_spec_image ( " image " ,
" image " ,
" The image " ,
FALSE ,
GIMP_PARAM_READWRITE ) ) ;
2006-04-04 21:11:45 +00:00
gimp_procedure_add_argument ( procedure ,
gimp_param_spec_string ( " name " ,
" name " ,
2024-07-08 23:39:51 +00:00
" the name of the new path object. " ,
2007-04-25 14:23:05 +00:00
FALSE , FALSE , FALSE ,
2006-04-04 21:11:45 +00:00
NULL ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_return_value ( procedure ,
2024-07-12 06:16:25 +00:00
gimp_param_spec_path ( " path " ,
" path " ,
" the current path object, 0 if no path exists in the image. " ,
FALSE ,
GIMP_PARAM_READWRITE ) ) ;
2006-04-26 09:13:47 +00:00
gimp_pdb_register_procedure ( pdb , procedure ) ;
2006-04-07 08:16:26 +00:00
g_object_unref ( procedure ) ;
2005-12-29 16:05:31 +00:00
2008-04-04 14:50:42 +00:00
/*
2024-07-08 23:39:51 +00:00
* gimp - path - new - from - text - layer
2008-04-04 14:50:42 +00:00
*/
2024-07-08 23:39:51 +00:00
procedure = gimp_procedure_new ( path_new_from_text_layer_invoker ) ;
2008-04-04 14:50:42 +00:00
gimp_object_set_static_name ( GIMP_OBJECT ( procedure ) ,
2024-07-08 23:39:51 +00:00
" gimp-path-new-from-text-layer " ) ;
2019-09-08 23:40:34 +02:00
gimp_procedure_set_static_help ( procedure ,
2024-07-08 23:39:51 +00:00
" Creates a new path object from a text layer. " ,
2024-07-11 00:07:44 +00:00
" Creates a new path object from a text layer. The path object needs to be added to the image using 'gimp-image-insert-path'. " ,
2019-09-08 23:40:34 +02:00
NULL ) ;
gimp_procedure_set_static_attribution ( procedure ,
" Marcus Heese <heese@cip.ifi.lmu.de> " ,
" Marcus Heese " ,
" 2008 " ) ;
2008-04-04 14:50:42 +00:00
gimp_procedure_add_argument ( procedure ,
2019-08-29 11:25:35 +02:00
gimp_param_spec_image ( " image " ,
" image " ,
" The image. " ,
FALSE ,
GIMP_PARAM_READWRITE ) ) ;
2008-04-04 14:50:42 +00:00
gimp_procedure_add_argument ( procedure ,
2019-08-29 11:25:35 +02:00
gimp_param_spec_layer ( " layer " ,
" layer " ,
" The text layer. " ,
FALSE ,
GIMP_PARAM_READWRITE ) ) ;
2008-04-04 14:50:42 +00:00
gimp_procedure_add_return_value ( procedure ,
2024-07-12 06:16:25 +00:00
gimp_param_spec_path ( " path " ,
" path " ,
" The path of the text layer. " ,
FALSE ,
GIMP_PARAM_READWRITE ) ) ;
2008-04-04 14:50:42 +00:00
gimp_pdb_register_procedure ( pdb , procedure ) ;
g_object_unref ( procedure ) ;
2008-07-28 14:13:18 +00:00
/*
2024-07-08 23:39:51 +00:00
* gimp - path - copy
2008-07-28 14:13:18 +00:00
*/
2024-07-08 23:39:51 +00:00
procedure = gimp_procedure_new ( path_copy_invoker ) ;
2008-07-28 14:13:18 +00:00
gimp_object_set_static_name ( GIMP_OBJECT ( procedure ) ,
2024-07-08 23:39:51 +00:00
" gimp-path-copy " ) ;
2019-09-08 23:40:34 +02:00
gimp_procedure_set_static_help ( procedure ,
2024-07-08 23:39:51 +00:00
" Copy a path object. " ,
" This procedure copies the specified path object and returns the copy. " ,
2019-09-08 23:40:34 +02:00
NULL ) ;
gimp_procedure_set_static_attribution ( procedure ,
" Barak Itkin <lightningismyname@gmail.com> " ,
" Barak Itkin " ,
" 2008 " ) ;
2008-07-28 14:13:18 +00:00
gimp_procedure_add_argument ( procedure ,
2024-07-12 06:16:25 +00:00
gimp_param_spec_path ( " path " ,
" path " ,
" The path object to copy " ,
FALSE ,
GIMP_PARAM_READWRITE ) ) ;
2008-07-28 14:13:18 +00:00
gimp_procedure_add_return_value ( procedure ,
2024-07-12 06:16:25 +00:00
gimp_param_spec_path ( " path-copy " ,
" path copy " ,
" The newly copied path object " ,
FALSE ,
GIMP_PARAM_READWRITE ) ) ;
2008-07-28 14:13:18 +00:00
gimp_pdb_register_procedure ( pdb , procedure ) ;
g_object_unref ( procedure ) ;
2006-04-04 21:11:45 +00:00
/*
2024-07-08 23:39:51 +00:00
* gimp - path - get - strokes
2006-04-04 21:11:45 +00:00
*/
2024-07-08 23:39:51 +00:00
procedure = gimp_procedure_new ( path_get_strokes_invoker ) ;
2008-04-04 10:58:56 +00:00
gimp_object_set_static_name ( GIMP_OBJECT ( procedure ) ,
2024-07-08 23:39:51 +00:00
" gimp-path-get-strokes " ) ;
2019-09-08 23:40:34 +02:00
gimp_procedure_set_static_help ( procedure ,
" List the strokes associated with the passed path. " ,
" Returns an Array with the stroke-IDs associated with the passed path. " ,
NULL ) ;
gimp_procedure_set_static_attribution ( procedure ,
" Simon Budig " ,
" Simon Budig " ,
" 2005 " ) ;
2006-04-04 21:11:45 +00:00
gimp_procedure_add_argument ( procedure ,
2024-07-12 06:16:25 +00:00
gimp_param_spec_path ( " path " ,
" path " ,
" The path object " ,
FALSE ,
GIMP_PARAM_READWRITE ) ) ;
2006-04-04 21:11:45 +00:00
gimp_procedure_add_return_value ( procedure ,
gimp_param_spec_int32_array ( " stroke-ids " ,
" stroke ids " ,
" List of the strokes belonging to the path. " ,
GIMP_PARAM_READWRITE ) ) ;
2006-04-26 09:13:47 +00:00
gimp_pdb_register_procedure ( pdb , procedure ) ;
2006-04-07 08:16:26 +00:00
g_object_unref ( procedure ) ;
2005-12-29 16:05:31 +00:00
2006-04-04 21:11:45 +00:00
/*
2024-07-08 23:39:51 +00:00
* gimp - path - stroke - get - length
2006-04-04 21:11:45 +00:00
*/
2024-07-08 23:39:51 +00:00
procedure = gimp_procedure_new ( path_stroke_get_length_invoker ) ;
2008-04-04 10:58:56 +00:00
gimp_object_set_static_name ( GIMP_OBJECT ( procedure ) ,
2024-07-08 23:39:51 +00:00
" gimp-path-stroke-get-length " ) ;
2019-09-08 23:40:34 +02:00
gimp_procedure_set_static_help ( procedure ,
" Measure the length of the given stroke. " ,
" Measure the length of the given stroke. " ,
NULL ) ;
gimp_procedure_set_static_attribution ( procedure ,
" Simon Budig " ,
" Simon Budig " ,
" 2005 " ) ;
2006-04-04 21:11:45 +00:00
gimp_procedure_add_argument ( procedure ,
2024-07-12 06:16:25 +00:00
gimp_param_spec_path ( " path " ,
" path " ,
" The path object " ,
FALSE ,
GIMP_PARAM_READWRITE ) ) ;
2006-04-04 21:11:45 +00:00
gimp_procedure_add_argument ( procedure ,
2019-08-15 14:04:56 +02:00
g_param_spec_int ( " stroke-id " ,
" stroke id " ,
" The stroke ID " ,
G_MININT32 , G_MAXINT32 , 0 ,
GIMP_PARAM_READWRITE ) ) ;
2006-04-04 21:11:45 +00:00
gimp_procedure_add_argument ( procedure ,
2006-10-24 08:30:55 +00:00
g_param_spec_double ( " precision " ,
" precision " ,
2021-01-20 20:33:41 +01:00
" The precision used for approximating straight portions of the stroke " ,
0.0 , G_MAXDOUBLE , 0.1 ,
2006-04-04 21:11:45 +00:00
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_return_value ( procedure ,
g_param_spec_double ( " length " ,
" length " ,
" The length (in pixels) of the given stroke. " ,
- G_MAXDOUBLE , G_MAXDOUBLE , 0 ,
GIMP_PARAM_READWRITE ) ) ;
2006-04-26 09:13:47 +00:00
gimp_pdb_register_procedure ( pdb , procedure ) ;
2006-04-07 08:16:26 +00:00
g_object_unref ( procedure ) ;
2006-03-14 21:35:50 +00:00
2006-04-04 21:11:45 +00:00
/*
2024-07-08 23:39:51 +00:00
* gimp - path - stroke - get - point - at - dist
2006-04-04 21:11:45 +00:00
*/
2024-07-08 23:39:51 +00:00
procedure = gimp_procedure_new ( path_stroke_get_point_at_dist_invoker ) ;
2008-04-04 10:58:56 +00:00
gimp_object_set_static_name ( GIMP_OBJECT ( procedure ) ,
2024-07-08 23:39:51 +00:00
" gimp-path-stroke-get-point-at-dist " ) ;
2019-09-08 23:40:34 +02:00
gimp_procedure_set_static_help ( procedure ,
" Get point at a specified distance along the stroke. " ,
" This will return the x,y position of a point at a given distance along the stroke. The distance will be obtained by first digitizing the curve internally and then walking along the curve. For a closed stroke the start of the path is the first point on the path that was created. This might not be obvious. If the stroke is not long enough, a \" valid \" flag will be FALSE. " ,
NULL ) ;
gimp_procedure_set_static_attribution ( procedure ,
" Simon Budig " ,
" Simon Budig " ,
" 2005 " ) ;
2006-04-04 21:11:45 +00:00
gimp_procedure_add_argument ( procedure ,
2024-07-12 06:16:25 +00:00
gimp_param_spec_path ( " path " ,
" path " ,
" The path object " ,
FALSE ,
GIMP_PARAM_READWRITE ) ) ;
2006-04-04 21:11:45 +00:00
gimp_procedure_add_argument ( procedure ,
2019-08-15 14:04:56 +02:00
g_param_spec_int ( " stroke-id " ,
" stroke id " ,
" The stroke ID " ,
G_MININT32 , G_MAXINT32 , 0 ,
GIMP_PARAM_READWRITE ) ) ;
2006-04-04 21:11:45 +00:00
gimp_procedure_add_argument ( procedure ,
g_param_spec_double ( " dist " ,
" dist " ,
" The given distance. " ,
- G_MAXDOUBLE , G_MAXDOUBLE , 0 ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
2006-10-24 08:30:55 +00:00
g_param_spec_double ( " precision " ,
" precision " ,
" The precision used for the approximation " ,
2006-04-04 21:11:45 +00:00
- G_MAXDOUBLE , G_MAXDOUBLE , 0 ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_return_value ( procedure ,
g_param_spec_double ( " x-point " ,
" x point " ,
" The x position of the point. " ,
- G_MAXDOUBLE , G_MAXDOUBLE , 0 ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_return_value ( procedure ,
g_param_spec_double ( " y-point " ,
" y point " ,
" The y position of the point. " ,
- G_MAXDOUBLE , G_MAXDOUBLE , 0 ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_return_value ( procedure ,
g_param_spec_double ( " slope " ,
" slope " ,
" The slope (dy / dx) at the specified point. " ,
- G_MAXDOUBLE , G_MAXDOUBLE , 0 ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_return_value ( procedure ,
g_param_spec_boolean ( " valid " ,
" valid " ,
" Indicator for the validity of the returned data. " ,
FALSE ,
GIMP_PARAM_READWRITE ) ) ;
2006-04-26 09:13:47 +00:00
gimp_pdb_register_procedure ( pdb , procedure ) ;
2006-04-07 08:16:26 +00:00
g_object_unref ( procedure ) ;
2005-12-29 16:05:31 +00:00
2006-04-04 21:11:45 +00:00
/*
2024-07-08 23:39:51 +00:00
* gimp - path - remove - stroke
2006-04-04 21:11:45 +00:00
*/
2024-07-08 23:39:51 +00:00
procedure = gimp_procedure_new ( path_remove_stroke_invoker ) ;
2008-04-04 10:58:56 +00:00
gimp_object_set_static_name ( GIMP_OBJECT ( procedure ) ,
2024-07-08 23:39:51 +00:00
" gimp-path-remove-stroke " ) ;
2019-09-08 23:40:34 +02:00
gimp_procedure_set_static_help ( procedure ,
2024-07-08 23:39:51 +00:00
" remove the stroke from a path object. " ,
" Remove the stroke from a path object. " ,
2019-09-08 23:40:34 +02:00
NULL ) ;
gimp_procedure_set_static_attribution ( procedure ,
" Simon Budig " ,
" Simon Budig " ,
" 2005 " ) ;
2006-04-04 21:11:45 +00:00
gimp_procedure_add_argument ( procedure ,
2024-07-12 06:16:25 +00:00
gimp_param_spec_path ( " path " ,
" path " ,
" The path object " ,
FALSE ,
GIMP_PARAM_READWRITE ) ) ;
2006-04-04 21:11:45 +00:00
gimp_procedure_add_argument ( procedure ,
2019-08-15 14:04:56 +02:00
g_param_spec_int ( " stroke-id " ,
" stroke id " ,
" The stroke ID " ,
G_MININT32 , G_MAXINT32 , 0 ,
GIMP_PARAM_READWRITE ) ) ;
2006-04-26 09:13:47 +00:00
gimp_pdb_register_procedure ( pdb , procedure ) ;
2006-04-07 08:16:26 +00:00
g_object_unref ( procedure ) ;
2005-12-29 16:05:31 +00:00
2006-04-04 21:11:45 +00:00
/*
2024-07-08 23:39:51 +00:00
* gimp - path - stroke - close
2006-04-04 21:11:45 +00:00
*/
2024-07-08 23:39:51 +00:00
procedure = gimp_procedure_new ( path_stroke_close_invoker ) ;
2008-04-04 10:58:56 +00:00
gimp_object_set_static_name ( GIMP_OBJECT ( procedure ) ,
2024-07-08 23:39:51 +00:00
" gimp-path-stroke-close " ) ;
2019-09-08 23:40:34 +02:00
gimp_procedure_set_static_help ( procedure ,
" closes the specified stroke. " ,
" Closes the specified stroke. " ,
NULL ) ;
gimp_procedure_set_static_attribution ( procedure ,
" Simon Budig " ,
" Simon Budig " ,
" 2005 " ) ;
2006-04-04 21:11:45 +00:00
gimp_procedure_add_argument ( procedure ,
2024-07-12 06:16:25 +00:00
gimp_param_spec_path ( " path " ,
" path " ,
" The path object " ,
FALSE ,
GIMP_PARAM_READWRITE ) ) ;
2020-05-25 22:55:01 +02:00
gimp_procedure_add_argument ( procedure ,
g_param_spec_int ( " stroke-id " ,
" stroke id " ,
" The stroke ID " ,
G_MININT32 , G_MAXINT32 , 0 ,
GIMP_PARAM_READWRITE ) ) ;
gimp_pdb_register_procedure ( pdb , procedure ) ;
g_object_unref ( procedure ) ;
/*
2024-07-08 23:39:51 +00:00
* gimp - path - stroke - reverse
2020-05-25 22:55:01 +02:00
*/
2024-07-08 23:39:51 +00:00
procedure = gimp_procedure_new ( path_stroke_reverse_invoker ) ;
2020-05-25 22:55:01 +02:00
gimp_object_set_static_name ( GIMP_OBJECT ( procedure ) ,
2024-07-08 23:39:51 +00:00
" gimp-path-stroke-reverse " ) ;
2020-05-25 22:55:01 +02:00
gimp_procedure_set_static_help ( procedure ,
" reverses the specified stroke. " ,
" Reverses the specified stroke. " ,
NULL ) ;
gimp_procedure_set_static_attribution ( procedure ,
" Simon Budig " ,
" Simon Budig " ,
" 2020 " ) ;
gimp_procedure_add_argument ( procedure ,
2024-07-12 06:16:25 +00:00
gimp_param_spec_path ( " path " ,
" path " ,
" The path object " ,
FALSE ,
GIMP_PARAM_READWRITE ) ) ;
2006-04-04 21:11:45 +00:00
gimp_procedure_add_argument ( procedure ,
2019-08-15 14:04:56 +02:00
g_param_spec_int ( " stroke-id " ,
" stroke id " ,
" The stroke ID " ,
G_MININT32 , G_MAXINT32 , 0 ,
GIMP_PARAM_READWRITE ) ) ;
2006-04-26 09:13:47 +00:00
gimp_pdb_register_procedure ( pdb , procedure ) ;
2006-04-07 08:16:26 +00:00
g_object_unref ( procedure ) ;
2005-12-29 16:05:31 +00:00
2006-04-04 21:11:45 +00:00
/*
2024-07-08 23:39:51 +00:00
* gimp - path - stroke - translate
2006-04-04 21:11:45 +00:00
*/
2024-07-08 23:39:51 +00:00
procedure = gimp_procedure_new ( path_stroke_translate_invoker ) ;
2008-04-04 10:58:56 +00:00
gimp_object_set_static_name ( GIMP_OBJECT ( procedure ) ,
2024-07-08 23:39:51 +00:00
" gimp-path-stroke-translate " ) ;
2019-09-08 23:40:34 +02:00
gimp_procedure_set_static_help ( procedure ,
" translate the given stroke. " ,
" Translate the given stroke. " ,
NULL ) ;
gimp_procedure_set_static_attribution ( procedure ,
" Simon Budig " ,
" Simon Budig " ,
" 2005 " ) ;
2006-04-04 21:11:45 +00:00
gimp_procedure_add_argument ( procedure ,
2024-07-12 06:16:25 +00:00
gimp_param_spec_path ( " path " ,
" path " ,
" The path object " ,
FALSE ,
GIMP_PARAM_READWRITE ) ) ;
2006-04-04 21:11:45 +00:00
gimp_procedure_add_argument ( procedure ,
2019-08-15 14:04:56 +02:00
g_param_spec_int ( " stroke-id " ,
" stroke id " ,
" The stroke ID " ,
G_MININT32 , G_MAXINT32 , 0 ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
2022-10-07 01:40:26 +00:00
g_param_spec_double ( " off-x " ,
" off x " ,
" Offset in x direction " ,
- G_MAXDOUBLE , G_MAXDOUBLE , 0 ,
GIMP_PARAM_READWRITE ) ) ;
2019-08-15 14:04:56 +02:00
gimp_procedure_add_argument ( procedure ,
2022-10-07 01:40:26 +00:00
g_param_spec_double ( " off-y " ,
" off y " ,
" Offset in y direction " ,
- G_MAXDOUBLE , G_MAXDOUBLE , 0 ,
GIMP_PARAM_READWRITE ) ) ;
2006-04-26 09:13:47 +00:00
gimp_pdb_register_procedure ( pdb , procedure ) ;
2006-04-07 08:16:26 +00:00
g_object_unref ( procedure ) ;
2005-12-29 16:05:31 +00:00
2006-04-04 21:11:45 +00:00
/*
2024-07-08 23:39:51 +00:00
* gimp - path - stroke - scale
2006-04-04 21:11:45 +00:00
*/
2024-07-08 23:39:51 +00:00
procedure = gimp_procedure_new ( path_stroke_scale_invoker ) ;
2008-04-04 10:58:56 +00:00
gimp_object_set_static_name ( GIMP_OBJECT ( procedure ) ,
2024-07-08 23:39:51 +00:00
" gimp-path-stroke-scale " ) ;
2019-09-08 23:40:34 +02:00
gimp_procedure_set_static_help ( procedure ,
" scales the given stroke. " ,
" Scale the given stroke. " ,
NULL ) ;
gimp_procedure_set_static_attribution ( procedure ,
" Simon Budig " ,
" Simon Budig " ,
" 2005 " ) ;
2006-04-04 21:11:45 +00:00
gimp_procedure_add_argument ( procedure ,
2024-07-12 06:16:25 +00:00
gimp_param_spec_path ( " path " ,
" path " ,
" The path object " ,
FALSE ,
GIMP_PARAM_READWRITE ) ) ;
2006-04-04 21:11:45 +00:00
gimp_procedure_add_argument ( procedure ,
2019-08-15 14:04:56 +02:00
g_param_spec_int ( " stroke-id " ,
" stroke id " ,
" The stroke ID " ,
G_MININT32 , G_MAXINT32 , 0 ,
GIMP_PARAM_READWRITE ) ) ;
2006-04-04 21:11:45 +00:00
gimp_procedure_add_argument ( procedure ,
g_param_spec_double ( " scale-x " ,
" scale x " ,
" Scale factor in x direction " ,
- G_MAXDOUBLE , G_MAXDOUBLE , 0 ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
g_param_spec_double ( " scale-y " ,
" scale y " ,
" Scale factor in y direction " ,
- G_MAXDOUBLE , G_MAXDOUBLE , 0 ,
GIMP_PARAM_READWRITE ) ) ;
2006-04-26 09:13:47 +00:00
gimp_pdb_register_procedure ( pdb , procedure ) ;
2006-04-07 08:16:26 +00:00
g_object_unref ( procedure ) ;
2006-03-14 21:35:50 +00:00
2006-11-20 15:34:30 +00:00
/*
2024-07-08 23:39:51 +00:00
* gimp - path - stroke - rotate
2006-11-20 15:34:30 +00:00
*/
2024-07-08 23:39:51 +00:00
procedure = gimp_procedure_new ( path_stroke_rotate_invoker ) ;
2008-04-04 10:58:56 +00:00
gimp_object_set_static_name ( GIMP_OBJECT ( procedure ) ,
2024-07-08 23:39:51 +00:00
" gimp-path-stroke-rotate " ) ;
2019-09-08 23:40:34 +02:00
gimp_procedure_set_static_help ( procedure ,
" rotates the given stroke. " ,
" Rotates the given stroke around given center by angle (in degrees). " ,
NULL ) ;
gimp_procedure_set_static_attribution ( procedure ,
" Jo \xc3 \xa3 o S. O. Bueno " ,
" Jo \xc3 \xa3 o S. O. Bueno " ,
" 2006 " ) ;
2006-11-20 15:34:30 +00:00
gimp_procedure_add_argument ( procedure ,
2024-07-12 06:16:25 +00:00
gimp_param_spec_path ( " path " ,
" path " ,
" The path object " ,
FALSE ,
GIMP_PARAM_READWRITE ) ) ;
2006-11-20 15:34:30 +00:00
gimp_procedure_add_argument ( procedure ,
2019-08-15 14:04:56 +02:00
g_param_spec_int ( " stroke-id " ,
" stroke id " ,
" The stroke ID " ,
G_MININT32 , G_MAXINT32 , 0 ,
GIMP_PARAM_READWRITE ) ) ;
2006-11-20 15:34:30 +00:00
gimp_procedure_add_argument ( procedure ,
g_param_spec_double ( " center-x " ,
" center x " ,
" X coordinate of the rotation center " ,
- G_MAXDOUBLE , G_MAXDOUBLE , 0 ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
g_param_spec_double ( " center-y " ,
" center y " ,
" Y coordinate of the rotation center " ,
- G_MAXDOUBLE , G_MAXDOUBLE , 0 ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
g_param_spec_double ( " angle " ,
" angle " ,
" angle to rotate about " ,
- G_MAXDOUBLE , G_MAXDOUBLE , 0 ,
GIMP_PARAM_READWRITE ) ) ;
gimp_pdb_register_procedure ( pdb , procedure ) ;
g_object_unref ( procedure ) ;
/*
2024-07-08 23:39:51 +00:00
* gimp - path - stroke - flip
2006-11-20 15:34:30 +00:00
*/
2024-07-08 23:39:51 +00:00
procedure = gimp_procedure_new ( path_stroke_flip_invoker ) ;
2008-04-04 10:58:56 +00:00
gimp_object_set_static_name ( GIMP_OBJECT ( procedure ) ,
2024-07-08 23:39:51 +00:00
" gimp-path-stroke-flip " ) ;
2019-09-08 23:40:34 +02:00
gimp_procedure_set_static_help ( procedure ,
" flips the given stroke. " ,
" Rotates the given stroke around given center by angle (in degrees). " ,
NULL ) ;
gimp_procedure_set_static_attribution ( procedure ,
" Jo \xc3 \xa3 o S. O. Bueno " ,
" Jo \xc3 \xa3 o S. O. Bueno " ,
" 2006 " ) ;
2006-11-20 15:34:30 +00:00
gimp_procedure_add_argument ( procedure ,
2024-07-12 06:16:25 +00:00
gimp_param_spec_path ( " path " ,
" path " ,
" The path object " ,
FALSE ,
GIMP_PARAM_READWRITE ) ) ;
2006-11-20 15:34:30 +00:00
gimp_procedure_add_argument ( procedure ,
2019-08-15 14:04:56 +02:00
g_param_spec_int ( " stroke-id " ,
" stroke id " ,
" The stroke ID " ,
G_MININT32 , G_MAXINT32 , 0 ,
GIMP_PARAM_READWRITE ) ) ;
2006-11-20 15:34:30 +00:00
gimp_procedure_add_argument ( procedure ,
gimp_param_spec_enum ( " flip-type " ,
" flip type " ,
" Flip orientation, either vertical or horizontal " ,
GIMP_TYPE_ORIENTATION_TYPE ,
GIMP_ORIENTATION_HORIZONTAL ,
GIMP_PARAM_READWRITE ) ) ;
gimp_param_spec_enum_exclude_value ( GIMP_PARAM_SPEC_ENUM ( procedure - > args [ 2 ] ) ,
GIMP_ORIENTATION_UNKNOWN ) ;
gimp_procedure_add_argument ( procedure ,
g_param_spec_double ( " axis " ,
" axis " ,
" axis coordinate about which to flip, in pixels " ,
- G_MAXDOUBLE , G_MAXDOUBLE , 0 ,
GIMP_PARAM_READWRITE ) ) ;
gimp_pdb_register_procedure ( pdb , procedure ) ;
g_object_unref ( procedure ) ;
/*
2024-07-08 23:39:51 +00:00
* gimp - path - stroke - flip - free
2006-11-20 15:34:30 +00:00
*/
2024-07-08 23:39:51 +00:00
procedure = gimp_procedure_new ( path_stroke_flip_free_invoker ) ;
2008-04-04 10:58:56 +00:00
gimp_object_set_static_name ( GIMP_OBJECT ( procedure ) ,
2024-07-08 23:39:51 +00:00
" gimp-path-stroke-flip-free " ) ;
2019-09-08 23:40:34 +02:00
gimp_procedure_set_static_help ( procedure ,
" flips the given stroke about an arbitrary axis. " ,
" Flips the given stroke about an arbitrary axis. Axis is defined by two coordinates in the image (in pixels), through which the flipping axis passes. " ,
NULL ) ;
gimp_procedure_set_static_attribution ( procedure ,
" Jo \xc3 \xa3 o S. O. Bueno " ,
" Jo \xc3 \xa3 o S. O. Bueno " ,
" 2006 " ) ;
2006-11-20 15:34:30 +00:00
gimp_procedure_add_argument ( procedure ,
2024-07-12 06:16:25 +00:00
gimp_param_spec_path ( " path " ,
" path " ,
" The path object " ,
FALSE ,
GIMP_PARAM_READWRITE ) ) ;
2006-11-20 15:34:30 +00:00
gimp_procedure_add_argument ( procedure ,
2019-08-15 14:04:56 +02:00
g_param_spec_int ( " stroke-id " ,
" stroke id " ,
" The stroke ID " ,
G_MININT32 , G_MAXINT32 , 0 ,
GIMP_PARAM_READWRITE ) ) ;
2006-11-20 15:34:30 +00:00
gimp_procedure_add_argument ( procedure ,
g_param_spec_double ( " x1 " ,
" x1 " ,
" X coordinate of the first point of the flipping axis " ,
- G_MAXDOUBLE , G_MAXDOUBLE , 0 ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
g_param_spec_double ( " y1 " ,
" y1 " ,
" Y coordinate of the first point of the flipping axis " ,
- G_MAXDOUBLE , G_MAXDOUBLE , 0 ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
g_param_spec_double ( " x2 " ,
" x2 " ,
" X coordinate of the second point of the flipping axis " ,
- G_MAXDOUBLE , G_MAXDOUBLE , 0 ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
g_param_spec_double ( " y2 " ,
" y2 " ,
" Y coordinate of the second point of the flipping axis " ,
- G_MAXDOUBLE , G_MAXDOUBLE , 0 ,
GIMP_PARAM_READWRITE ) ) ;
gimp_pdb_register_procedure ( pdb , procedure ) ;
g_object_unref ( procedure ) ;
2006-10-24 14:23:29 +00:00
/*
2024-07-08 23:39:51 +00:00
* gimp - path - stroke - get - points
2006-10-24 14:23:29 +00:00
*/
2024-07-08 23:39:51 +00:00
procedure = gimp_procedure_new ( path_stroke_get_points_invoker ) ;
2008-04-04 10:58:56 +00:00
gimp_object_set_static_name ( GIMP_OBJECT ( procedure ) ,
2024-07-08 23:39:51 +00:00
" gimp-path-stroke-get-points " ) ;
2019-09-08 23:40:34 +02:00
gimp_procedure_set_static_help ( procedure ,
" returns the control points of a stroke. " ,
" returns the control points of a stroke. The interpretation of the coordinates returned depends on the type of the stroke. For Gimp 2.4 this is always a bezier stroke, where the coordinates are the control points. " ,
NULL ) ;
gimp_procedure_set_static_attribution ( procedure ,
" Simon Budig " ,
" Simon Budig " ,
" 2006 " ) ;
2006-10-24 14:23:29 +00:00
gimp_procedure_add_argument ( procedure ,
2024-07-12 06:16:25 +00:00
gimp_param_spec_path ( " path " ,
" path " ,
" The path object " ,
FALSE ,
GIMP_PARAM_READWRITE ) ) ;
2006-10-24 14:23:29 +00:00
gimp_procedure_add_argument ( procedure ,
2019-08-15 14:04:56 +02:00
g_param_spec_int ( " stroke-id " ,
" stroke id " ,
" The stroke ID " ,
G_MININT32 , G_MAXINT32 , 0 ,
GIMP_PARAM_READWRITE ) ) ;
2006-10-24 14:23:29 +00:00
gimp_procedure_add_return_value ( procedure ,
2006-10-26 15:36:45 +00:00
g_param_spec_enum ( " type " ,
" type " ,
2024-07-19 15:07:43 +00:00
" type of the stroke (always GIMP_PATH_STROKE_TYPE_BEZIER for now). " ,
GIMP_TYPE_PATH_STROKE_TYPE ,
GIMP_PATH_STROKE_TYPE_BEZIER ,
2006-10-26 15:36:45 +00:00
GIMP_PARAM_READWRITE ) ) ;
2006-10-24 14:23:29 +00:00
gimp_procedure_add_return_value ( procedure ,
gimp_param_spec_float_array ( " controlpoints " ,
" controlpoints " ,
" List of the control points for the stroke (x0, y0, x1, y1, ...). " ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_return_value ( procedure ,
g_param_spec_boolean ( " closed " ,
" closed " ,
" Whether the stroke is closed or not. " ,
FALSE ,
GIMP_PARAM_READWRITE ) ) ;
gimp_pdb_register_procedure ( pdb , procedure ) ;
g_object_unref ( procedure ) ;
2006-10-26 15:36:45 +00:00
/*
2024-07-08 23:39:51 +00:00
* gimp - path - stroke - new - from - points
2006-10-26 15:36:45 +00:00
*/
2024-07-08 23:39:51 +00:00
procedure = gimp_procedure_new ( path_stroke_new_from_points_invoker ) ;
2008-04-04 10:58:56 +00:00
gimp_object_set_static_name ( GIMP_OBJECT ( procedure ) ,
2024-07-08 23:39:51 +00:00
" gimp-path-stroke-new-from-points " ) ;
2019-09-08 23:40:34 +02:00
gimp_procedure_set_static_help ( procedure ,
2024-07-08 23:39:51 +00:00
" Adds a stroke of a given type to the path object. " ,
2024-07-19 15:07:43 +00:00
" Adds a stroke of a given type to the path object. The coordinates of the control points can be specified. For now only strokes of the type GIMP_PATH_STROKE_TYPE_BEZIER are supported. The control points are specified as a pair of float values for the x- and y-coordinate. The Bezier stroke type needs a multiple of three control points. Each Bezier segment endpoint (anchor, A) has two additional control points (C) associated. They are specified in the order CACCACCAC... " ,
2019-09-08 23:40:34 +02:00
NULL ) ;
gimp_procedure_set_static_attribution ( procedure ,
" Simon Budig " ,
" Simon Budig " ,
" 2006 " ) ;
2006-10-26 15:36:45 +00:00
gimp_procedure_add_argument ( procedure ,
2024-07-12 06:16:25 +00:00
gimp_param_spec_path ( " path " ,
" path " ,
" The path object " ,
FALSE ,
GIMP_PARAM_READWRITE ) ) ;
2006-10-26 15:36:45 +00:00
gimp_procedure_add_argument ( procedure ,
g_param_spec_enum ( " type " ,
" type " ,
2024-07-19 15:07:43 +00:00
" type of the stroke (always GIMP_PATH_STROKE_TYPE_BEZIER for now). " ,
GIMP_TYPE_PATH_STROKE_TYPE ,
GIMP_PATH_STROKE_TYPE_BEZIER ,
2006-10-26 15:36:45 +00:00
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
gimp_param_spec_float_array ( " controlpoints " ,
" controlpoints " ,
" List of the x- and y-coordinates of the control points. " ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
g_param_spec_boolean ( " closed " ,
" closed " ,
" Whether the stroke is to be closed or not. " ,
FALSE ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_return_value ( procedure ,
2019-08-15 14:04:56 +02:00
g_param_spec_int ( " stroke-id " ,
" stroke id " ,
" The stroke ID of the newly created stroke. " ,
G_MININT32 , G_MAXINT32 , 0 ,
GIMP_PARAM_READWRITE ) ) ;
2006-10-26 15:36:45 +00:00
gimp_pdb_register_procedure ( pdb , procedure ) ;
g_object_unref ( procedure ) ;
2006-04-04 21:11:45 +00:00
/*
2024-07-08 23:39:51 +00:00
* gimp - path - stroke - interpolate
2006-04-04 21:11:45 +00:00
*/
2024-07-08 23:39:51 +00:00
procedure = gimp_procedure_new ( path_stroke_interpolate_invoker ) ;
2008-04-04 10:58:56 +00:00
gimp_object_set_static_name ( GIMP_OBJECT ( procedure ) ,
2024-07-08 23:39:51 +00:00
" gimp-path-stroke-interpolate " ) ;
2019-09-08 23:40:34 +02:00
gimp_procedure_set_static_help ( procedure ,
" returns polygonal approximation of the stroke. " ,
" returns polygonal approximation of the stroke. " ,
NULL ) ;
gimp_procedure_set_static_attribution ( procedure ,
" Simon Budig " ,
" Simon Budig " ,
" 2005 " ) ;
2006-04-04 21:11:45 +00:00
gimp_procedure_add_argument ( procedure ,
2024-07-12 06:16:25 +00:00
gimp_param_spec_path ( " path " ,
" path " ,
" The path object " ,
FALSE ,
GIMP_PARAM_READWRITE ) ) ;
2006-04-04 21:11:45 +00:00
gimp_procedure_add_argument ( procedure ,
2019-08-15 14:04:56 +02:00
g_param_spec_int ( " stroke-id " ,
" stroke id " ,
" The stroke ID " ,
G_MININT32 , G_MAXINT32 , 0 ,
GIMP_PARAM_READWRITE ) ) ;
2006-04-04 21:11:45 +00:00
gimp_procedure_add_argument ( procedure ,
2006-10-24 08:30:55 +00:00
g_param_spec_double ( " precision " ,
" precision " ,
" The precision used for the approximation " ,
2006-04-04 21:11:45 +00:00
- G_MAXDOUBLE , G_MAXDOUBLE , 0 ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_return_value ( procedure ,
gimp_param_spec_float_array ( " coords " ,
" coords " ,
" List of the coords along the path (x0, y0, x1, y1, ...). " ,
GIMP_PARAM_READWRITE ) ) ;
2006-10-24 08:30:55 +00:00
gimp_procedure_add_return_value ( procedure ,
g_param_spec_boolean ( " closed " ,
" closed " ,
" Whether the stroke is closed or not. " ,
FALSE ,
GIMP_PARAM_READWRITE ) ) ;
2006-04-26 09:13:47 +00:00
gimp_pdb_register_procedure ( pdb , procedure ) ;
2006-04-07 08:16:26 +00:00
g_object_unref ( procedure ) ;
2006-03-14 21:35:50 +00:00
2006-04-04 21:11:45 +00:00
/*
2024-07-08 23:39:51 +00:00
* gimp - path - bezier - stroke - new - moveto
2006-04-04 21:11:45 +00:00
*/
2024-07-08 23:39:51 +00:00
procedure = gimp_procedure_new ( path_bezier_stroke_new_moveto_invoker ) ;
2008-04-04 10:58:56 +00:00
gimp_object_set_static_name ( GIMP_OBJECT ( procedure ) ,
2024-07-08 23:39:51 +00:00
" gimp-path-bezier-stroke-new-moveto " ) ;
2019-09-08 23:40:34 +02:00
gimp_procedure_set_static_help ( procedure ,
2024-07-08 23:39:51 +00:00
" Adds a bezier stroke with a single moveto to the path object. " ,
" Adds a bezier stroke with a single moveto to the path object. " ,
2019-09-08 23:40:34 +02:00
NULL ) ;
gimp_procedure_set_static_attribution ( procedure ,
" Simon Budig " ,
" Simon Budig " ,
" 2005 " ) ;
2006-04-04 21:11:45 +00:00
gimp_procedure_add_argument ( procedure ,
2024-07-12 06:16:25 +00:00
gimp_param_spec_path ( " path " ,
" path " ,
" The path object " ,
FALSE ,
GIMP_PARAM_READWRITE ) ) ;
2006-04-04 21:11:45 +00:00
gimp_procedure_add_argument ( procedure ,
g_param_spec_double ( " x0 " ,
" x0 " ,
" The x-coordinate of the moveto " ,
- G_MAXDOUBLE , G_MAXDOUBLE , 0 ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
g_param_spec_double ( " y0 " ,
" y0 " ,
" The y-coordinate of the moveto " ,
- G_MAXDOUBLE , G_MAXDOUBLE , 0 ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_return_value ( procedure ,
2019-08-15 14:04:56 +02:00
g_param_spec_int ( " stroke-id " ,
" stroke id " ,
" The resulting stroke " ,
G_MININT32 , G_MAXINT32 , 0 ,
GIMP_PARAM_READWRITE ) ) ;
2006-04-26 09:13:47 +00:00
gimp_pdb_register_procedure ( pdb , procedure ) ;
2006-04-07 08:16:26 +00:00
g_object_unref ( procedure ) ;
2005-12-29 16:05:31 +00:00
2006-04-04 21:11:45 +00:00
/*
2024-07-08 23:39:51 +00:00
* gimp - path - bezier - stroke - lineto
2006-04-04 21:11:45 +00:00
*/
2024-07-08 23:39:51 +00:00
procedure = gimp_procedure_new ( path_bezier_stroke_lineto_invoker ) ;
2008-04-04 10:58:56 +00:00
gimp_object_set_static_name ( GIMP_OBJECT ( procedure ) ,
2024-07-08 23:39:51 +00:00
" gimp-path-bezier-stroke-lineto " ) ;
2019-09-08 23:40:34 +02:00
gimp_procedure_set_static_help ( procedure ,
" Extends a bezier stroke with a lineto. " ,
" Extends a bezier stroke with a lineto. " ,
NULL ) ;
gimp_procedure_set_static_attribution ( procedure ,
" Simon Budig " ,
" Simon Budig " ,
" 2005 " ) ;
2006-04-04 21:11:45 +00:00
gimp_procedure_add_argument ( procedure ,
2024-07-12 06:16:25 +00:00
gimp_param_spec_path ( " path " ,
" path " ,
" The path object " ,
FALSE ,
GIMP_PARAM_READWRITE ) ) ;
2006-04-04 21:11:45 +00:00
gimp_procedure_add_argument ( procedure ,
2019-08-15 14:04:56 +02:00
g_param_spec_int ( " stroke-id " ,
" stroke id " ,
" The stroke ID " ,
G_MININT32 , G_MAXINT32 , 0 ,
GIMP_PARAM_READWRITE ) ) ;
2006-04-04 21:11:45 +00:00
gimp_procedure_add_argument ( procedure ,
g_param_spec_double ( " x0 " ,
" x0 " ,
" The x-coordinate of the lineto " ,
- G_MAXDOUBLE , G_MAXDOUBLE , 0 ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
g_param_spec_double ( " y0 " ,
" y0 " ,
" The y-coordinate of the lineto " ,
- G_MAXDOUBLE , G_MAXDOUBLE , 0 ,
GIMP_PARAM_READWRITE ) ) ;
2006-04-26 09:13:47 +00:00
gimp_pdb_register_procedure ( pdb , procedure ) ;
2006-04-07 08:16:26 +00:00
g_object_unref ( procedure ) ;
2005-12-29 16:05:31 +00:00
2006-04-04 21:11:45 +00:00
/*
2024-07-08 23:39:51 +00:00
* gimp - path - bezier - stroke - conicto
2006-04-04 21:11:45 +00:00
*/
2024-07-08 23:39:51 +00:00
procedure = gimp_procedure_new ( path_bezier_stroke_conicto_invoker ) ;
2008-04-04 10:58:56 +00:00
gimp_object_set_static_name ( GIMP_OBJECT ( procedure ) ,
2024-07-08 23:39:51 +00:00
" gimp-path-bezier-stroke-conicto " ) ;
2019-09-08 23:40:34 +02:00
gimp_procedure_set_static_help ( procedure ,
" Extends a bezier stroke with a conic bezier spline. " ,
" Extends a bezier stroke with a conic bezier spline. Actually a cubic bezier spline gets added that realizes the shape of a conic bezier spline. " ,
NULL ) ;
gimp_procedure_set_static_attribution ( procedure ,
" Simon Budig " ,
" Simon Budig " ,
" 2005 " ) ;
2006-04-04 21:11:45 +00:00
gimp_procedure_add_argument ( procedure ,
2024-07-12 06:16:25 +00:00
gimp_param_spec_path ( " path " ,
" path " ,
" The path object " ,
FALSE ,
GIMP_PARAM_READWRITE ) ) ;
2006-04-04 21:11:45 +00:00
gimp_procedure_add_argument ( procedure ,
2019-08-15 14:04:56 +02:00
g_param_spec_int ( " stroke-id " ,
" stroke id " ,
" The stroke ID " ,
G_MININT32 , G_MAXINT32 , 0 ,
GIMP_PARAM_READWRITE ) ) ;
2006-04-04 21:11:45 +00:00
gimp_procedure_add_argument ( procedure ,
g_param_spec_double ( " x0 " ,
" x0 " ,
" The x-coordinate of the control point " ,
- G_MAXDOUBLE , G_MAXDOUBLE , 0 ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
g_param_spec_double ( " y0 " ,
" y0 " ,
" The y-coordinate of the control point " ,
- G_MAXDOUBLE , G_MAXDOUBLE , 0 ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
g_param_spec_double ( " x1 " ,
" x1 " ,
" The x-coordinate of the end point " ,
- G_MAXDOUBLE , G_MAXDOUBLE , 0 ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
g_param_spec_double ( " y1 " ,
" y1 " ,
" The y-coordinate of the end point " ,
- G_MAXDOUBLE , G_MAXDOUBLE , 0 ,
GIMP_PARAM_READWRITE ) ) ;
2006-04-26 09:13:47 +00:00
gimp_pdb_register_procedure ( pdb , procedure ) ;
2006-04-07 08:16:26 +00:00
g_object_unref ( procedure ) ;
2006-03-19 13:39:10 +00:00
2006-04-04 21:11:45 +00:00
/*
2024-07-08 23:39:51 +00:00
* gimp - path - bezier - stroke - cubicto
2006-04-04 21:11:45 +00:00
*/
2024-07-08 23:39:51 +00:00
procedure = gimp_procedure_new ( path_bezier_stroke_cubicto_invoker ) ;
2008-04-04 10:58:56 +00:00
gimp_object_set_static_name ( GIMP_OBJECT ( procedure ) ,
2024-07-08 23:39:51 +00:00
" gimp-path-bezier-stroke-cubicto " ) ;
2019-09-08 23:40:34 +02:00
gimp_procedure_set_static_help ( procedure ,
" Extends a bezier stroke with a cubic bezier spline. " ,
" Extends a bezier stroke with a cubic bezier spline. " ,
NULL ) ;
gimp_procedure_set_static_attribution ( procedure ,
" Simon Budig " ,
" Simon Budig " ,
" 2005 " ) ;
2006-04-04 21:11:45 +00:00
gimp_procedure_add_argument ( procedure ,
2024-07-12 06:16:25 +00:00
gimp_param_spec_path ( " path " ,
" path " ,
" The path object " ,
FALSE ,
GIMP_PARAM_READWRITE ) ) ;
2006-04-04 21:11:45 +00:00
gimp_procedure_add_argument ( procedure ,
2019-08-15 14:04:56 +02:00
g_param_spec_int ( " stroke-id " ,
" stroke id " ,
" The stroke ID " ,
G_MININT32 , G_MAXINT32 , 0 ,
GIMP_PARAM_READWRITE ) ) ;
2006-04-04 21:11:45 +00:00
gimp_procedure_add_argument ( procedure ,
g_param_spec_double ( " x0 " ,
" x0 " ,
" The x-coordinate of the first control point " ,
- G_MAXDOUBLE , G_MAXDOUBLE , 0 ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
g_param_spec_double ( " y0 " ,
" y0 " ,
" The y-coordinate of the first control point " ,
- G_MAXDOUBLE , G_MAXDOUBLE , 0 ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
g_param_spec_double ( " x1 " ,
" x1 " ,
" The x-coordinate of the second control point " ,
- G_MAXDOUBLE , G_MAXDOUBLE , 0 ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
g_param_spec_double ( " y1 " ,
" y1 " ,
" The y-coordinate of the second control point " ,
- G_MAXDOUBLE , G_MAXDOUBLE , 0 ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
g_param_spec_double ( " x2 " ,
" x2 " ,
" The x-coordinate of the end point " ,
- G_MAXDOUBLE , G_MAXDOUBLE , 0 ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
g_param_spec_double ( " y2 " ,
" y2 " ,
" The y-coordinate of the end point " ,
- G_MAXDOUBLE , G_MAXDOUBLE , 0 ,
GIMP_PARAM_READWRITE ) ) ;
2006-04-26 09:13:47 +00:00
gimp_pdb_register_procedure ( pdb , procedure ) ;
2006-04-07 08:16:26 +00:00
g_object_unref ( procedure ) ;
2005-12-29 16:05:31 +00:00
2006-04-04 21:11:45 +00:00
/*
2024-07-08 23:39:51 +00:00
* gimp - path - bezier - stroke - new - ellipse
2006-04-04 21:11:45 +00:00
*/
2024-07-08 23:39:51 +00:00
procedure = gimp_procedure_new ( path_bezier_stroke_new_ellipse_invoker ) ;
2008-04-04 10:58:56 +00:00
gimp_object_set_static_name ( GIMP_OBJECT ( procedure ) ,
2024-07-08 23:39:51 +00:00
" gimp-path-bezier-stroke-new-ellipse " ) ;
2019-09-08 23:40:34 +02:00
gimp_procedure_set_static_help ( procedure ,
2024-07-08 23:39:51 +00:00
" Adds a bezier stroke describing an ellipse the path object. " ,
" Adds a bezier stroke describing an ellipse on the path object. " ,
2019-09-08 23:40:34 +02:00
NULL ) ;
gimp_procedure_set_static_attribution ( procedure ,
" Simon Budig " ,
" Simon Budig " ,
" 2005 " ) ;
2006-04-04 21:11:45 +00:00
gimp_procedure_add_argument ( procedure ,
2024-07-12 06:16:25 +00:00
gimp_param_spec_path ( " path " ,
" path " ,
" The path object " ,
FALSE ,
GIMP_PARAM_READWRITE ) ) ;
2006-04-04 21:11:45 +00:00
gimp_procedure_add_argument ( procedure ,
g_param_spec_double ( " x0 " ,
" x0 " ,
" The x-coordinate of the center " ,
- G_MAXDOUBLE , G_MAXDOUBLE , 0 ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
g_param_spec_double ( " y0 " ,
" y0 " ,
" The y-coordinate of the center " ,
- G_MAXDOUBLE , G_MAXDOUBLE , 0 ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
g_param_spec_double ( " radius-x " ,
" radius x " ,
" The radius in x direction " ,
- G_MAXDOUBLE , G_MAXDOUBLE , 0 ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
g_param_spec_double ( " radius-y " ,
" radius y " ,
" The radius in y direction " ,
- G_MAXDOUBLE , G_MAXDOUBLE , 0 ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
g_param_spec_double ( " angle " ,
" angle " ,
" The angle the x-axis of the ellipse (radians, counterclockwise) " ,
- G_MAXDOUBLE , G_MAXDOUBLE , 0 ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_return_value ( procedure ,
2019-08-15 14:04:56 +02:00
g_param_spec_int ( " stroke-id " ,
" stroke id " ,
" The resulting stroke " ,
G_MININT32 , G_MAXINT32 , 0 ,
GIMP_PARAM_READWRITE ) ) ;
2006-04-26 09:13:47 +00:00
gimp_pdb_register_procedure ( pdb , procedure ) ;
2006-04-07 08:16:26 +00:00
g_object_unref ( procedure ) ;
2005-12-29 16:05:31 +00:00
}