2006-12-10 05:33:38 +08:00
/* GIMP - The GNU Image Manipulation Program
2005-04-14 10:32:23 +08:00
* Copyright ( C ) 1995 - 2003 Spencer Kimball and Peter Mattis
*
2009-01-18 06:28:01 +08:00
* This program is free software : you can redistribute it and / or modify
2005-04-14 10:32:23 +08:00
* it under the terms of the GNU General Public License as published by
2009-01-18 06:28:01 +08:00
* the Free Software Foundation ; either version 3 of the License , or
2005-04-14 10:32:23 +08: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
2009-01-18 06:28:01 +08:00
* along with this program . If not , see < http : //www.gnu.org/licenses/>.
2005-04-14 10:32:23 +08:00
*/
2007-01-09 18:52:47 +08:00
/* NOTE: This file is auto-generated by pdbgen.pl. */
2005-04-14 10:32:23 +08:00
# include "config.h"
# include <string.h>
2008-10-10 04:24:04 +08:00
# include <gegl.h>
2005-04-14 10:32:23 +08:00
# include "pdb-types.h"
2009-08-21 23:57:56 +08:00
# include "core/gimpimage-undo-push.h"
2005-12-29 05:24:12 +08:00
# include "core/gimpimage.h"
2008-04-04 22:50:42 +08:00
# include "core/gimplayer.h"
2005-04-14 10:32:23 +08:00
# include "core/gimplist.h"
2008-02-08 01:08:54 +08:00
# include "core/gimpparamspecs.h"
2008-04-04 22:50:42 +08:00
# include "text/gimptext-vectors.h"
# include "text/gimptextlayer.h"
2005-04-14 10:32:23 +08:00
# include "vectors/gimpanchor.h"
# include "vectors/gimpbezierstroke.h"
2006-10-27 01:23:41 +08:00
# include "vectors/gimpstroke-new.h"
2007-11-19 02:51:54 +08:00
# include "vectors/gimpvectors-export.h"
2006-10-25 23:14:03 +08:00
# include "vectors/gimpvectors-import.h"
2005-04-14 10:32:23 +08:00
# include "vectors/gimpvectors.h"
2008-02-08 01:08:54 +08:00
# include "gimppdb.h"
2008-03-07 02:39:07 +08:00
# include "gimppdb-utils.h"
2008-02-08 01:08:54 +08:00
# include "gimpprocedure.h"
2008-04-04 19:15:55 +08:00
# include "internal-procs.h"
2006-11-01 03:02:56 +08:00
2008-02-08 01:08:54 +08:00
# include "gimp-intl.h"
2005-04-14 10:32:23 +08:00
2006-04-05 05:11:45 +08:00
static GValueArray *
2007-12-03 02:05:54 +08:00
vectors_new_invoker ( GimpProcedure * procedure ,
Gimp * gimp ,
GimpContext * context ,
GimpProgress * progress ,
const GValueArray * args ,
GError * * error )
2005-04-14 10:32:23 +08:00
{
2006-04-05 05:11:45 +08:00
gboolean success = TRUE ;
GValueArray * return_vals ;
GimpImage * image ;
const gchar * name ;
GimpVectors * vectors = NULL ;
2006-03-29 03:58:00 +08:00
2006-04-05 05:11:45 +08:00
image = gimp_value_get_image ( & args - > values [ 0 ] , gimp ) ;
name = g_value_get_string ( & args - > values [ 1 ] ) ;
2006-03-29 03:58:00 +08:00
2006-04-05 05:11:45 +08:00
if ( success )
{
vectors = gimp_vectors_new ( image , name ) ;
}
2006-03-29 03:58:00 +08:00
2008-08-16 21:57:57 +08:00
return_vals = gimp_procedure_get_return_values ( procedure , success ,
error ? * error : NULL ) ;
2006-03-29 03:58:00 +08:00
2006-04-05 05:11:45 +08:00
if ( success )
gimp_value_set_vectors ( & return_vals - > values [ 1 ] , vectors ) ;
2006-03-29 03:58:00 +08:00
2006-04-05 05:11:45 +08:00
return return_vals ;
}
2006-03-29 03:58:00 +08:00
2008-04-04 22:50:42 +08:00
static GValueArray *
vectors_new_from_text_layer_invoker ( GimpProcedure * procedure ,
Gimp * gimp ,
GimpContext * context ,
GimpProgress * progress ,
const GValueArray * args ,
GError * * error )
{
gboolean success = TRUE ;
GValueArray * return_vals ;
GimpImage * image ;
GimpLayer * layer ;
GimpVectors * vectors = NULL ;
image = gimp_value_get_image ( & args - > values [ 0 ] , gimp ) ;
layer = gimp_value_get_layer ( & args - > values [ 1 ] , gimp ) ;
if ( success )
{
2009-08-21 20:33:12 +08:00
if ( gimp_pdb_layer_is_text_layer ( layer , FALSE , error ) )
2008-04-04 22:50:42 +08:00
{
gint x , y ;
vectors = gimp_text_vectors_new ( image ,
gimp_text_layer_get_text ( GIMP_TEXT_LAYER ( layer ) ) ) ;
2008-11-03 07:03:29 +08:00
gimp_item_get_offset ( GIMP_ITEM ( layer ) , & x , & y ) ;
2008-04-04 22:50:42 +08:00
gimp_item_translate ( GIMP_ITEM ( vectors ) , x , y , FALSE ) ;
}
else
{
success = FALSE ;
}
}
2008-08-16 21:57:57 +08:00
return_vals = gimp_procedure_get_return_values ( procedure , success ,
error ? * error : NULL ) ;
2008-04-04 22:50:42 +08:00
if ( success )
gimp_value_set_vectors ( & return_vals - > values [ 1 ] , vectors ) ;
return return_vals ;
}
2008-07-28 22:13:18 +08:00
static GValueArray *
vectors_copy_invoker ( GimpProcedure * procedure ,
Gimp * gimp ,
GimpContext * context ,
GimpProgress * progress ,
const GValueArray * args ,
GError * * error )
{
gboolean success = TRUE ;
GValueArray * return_vals ;
GimpVectors * vectors ;
GimpVectors * vectors_copy = NULL ;
vectors = gimp_value_get_vectors ( & args - > values [ 0 ] , gimp ) ;
if ( success )
{
vectors_copy = GIMP_VECTORS ( gimp_item_duplicate ( GIMP_ITEM ( vectors ) ,
G_TYPE_FROM_INSTANCE ( vectors ) ) ) ;
if ( ! vectors_copy )
success = FALSE ;
}
2008-08-16 21:57:57 +08:00
return_vals = gimp_procedure_get_return_values ( procedure , success ,
error ? * error : NULL ) ;
2008-07-28 22:13:18 +08:00
if ( success )
gimp_value_set_vectors ( & return_vals - > values [ 1 ] , vectors_copy ) ;
return return_vals ;
}
2006-04-04 18:30:58 +08:00
static GValueArray *
2007-12-03 02:05:54 +08:00
vectors_get_strokes_invoker ( GimpProcedure * procedure ,
Gimp * gimp ,
GimpContext * context ,
GimpProgress * progress ,
const GValueArray * args ,
GError * * error )
2006-03-24 05:17:16 +08:00
{
gboolean success = TRUE ;
2006-04-04 18:30:58 +08:00
GValueArray * return_vals ;
2006-03-24 05:17:16 +08:00
GimpVectors * vectors ;
gint32 num_strokes = 0 ;
gint32 * stroke_ids = NULL ;
2006-04-04 18:30:58 +08:00
vectors = gimp_value_get_vectors ( & args - > values [ 0 ] , gimp ) ;
2006-03-24 05:17:16 +08:00
if ( success )
{
num_strokes = gimp_vectors_get_n_strokes ( vectors ) ;
if ( num_strokes )
{
GimpStroke * cur_stroke ;
gint i = 0 ;
stroke_ids = g_new ( gint32 , num_strokes ) ;
for ( cur_stroke = gimp_vectors_stroke_get_next ( vectors , NULL ) ;
cur_stroke ;
cur_stroke = gimp_vectors_stroke_get_next ( vectors , cur_stroke ) )
{
stroke_ids [ i ] = gimp_stroke_get_ID ( cur_stroke ) ;
i + + ;
}
}
}
2008-08-16 21:57:57 +08:00
return_vals = gimp_procedure_get_return_values ( procedure , success ,
error ? * error : NULL ) ;
2006-03-24 05:17:16 +08:00
if ( success )
{
2006-04-04 18:30:58 +08:00
g_value_set_int ( & return_vals - > values [ 1 ] , num_strokes ) ;
gimp_value_take_int32array ( & return_vals - > values [ 2 ] , stroke_ids , num_strokes ) ;
2006-03-24 05:17:16 +08:00
}
2006-03-28 05:09:32 +08:00
return return_vals ;
2006-03-24 05:17:16 +08:00
}
2006-04-04 18:30:58 +08:00
static GValueArray *
2007-12-03 02:05:54 +08:00
vectors_stroke_get_length_invoker ( GimpProcedure * procedure ,
Gimp * gimp ,
GimpContext * context ,
GimpProgress * progress ,
const GValueArray * args ,
GError * * error )
2005-12-29 05:24:12 +08:00
{
gboolean success = TRUE ;
2006-04-04 18:30:58 +08:00
GValueArray * return_vals ;
2005-12-29 05:24:12 +08:00
GimpVectors * vectors ;
gint32 stroke_id ;
2006-10-24 16:30:55 +08:00
gdouble precision ;
2006-03-15 23:32:39 +08:00
gdouble length = 0.0 ;
2005-12-29 05:24:12 +08:00
2006-04-04 18:30:58 +08:00
vectors = gimp_value_get_vectors ( & args - > values [ 0 ] , gimp ) ;
stroke_id = g_value_get_int ( & args - > values [ 1 ] ) ;
2006-10-24 16:30:55 +08:00
precision = g_value_get_double ( & args - > values [ 2 ] ) ;
2005-12-29 05:24:12 +08:00
if ( success )
{
2009-08-22 00:06:58 +08:00
GimpStroke * stroke = gimp_pdb_get_vectors_stroke ( vectors , stroke_id , FALSE , error ) ;
2005-12-29 05:24:12 +08:00
2006-03-15 05:35:50 +08:00
if ( stroke )
2006-10-24 16:30:55 +08:00
length = gimp_stroke_get_length ( stroke , precision ) ;
2005-12-29 05:24:12 +08:00
else
2006-03-15 05:35:50 +08:00
success = FALSE ;
2005-12-29 05:24:12 +08:00
}
2008-08-16 21:57:57 +08:00
return_vals = gimp_procedure_get_return_values ( procedure , success ,
error ? * error : NULL ) ;
2005-12-29 05:24:12 +08:00
if ( success )
2006-04-04 18:30:58 +08:00
g_value_set_double ( & return_vals - > values [ 1 ] , length ) ;
2005-12-29 05:24:12 +08:00
2006-03-28 05:09:32 +08:00
return return_vals ;
2005-12-29 05:24:12 +08:00
}
2006-04-04 18:30:58 +08:00
static GValueArray *
2007-12-03 02:05:54 +08:00
vectors_stroke_get_point_at_dist_invoker ( GimpProcedure * procedure ,
Gimp * gimp ,
GimpContext * context ,
GimpProgress * progress ,
const GValueArray * args ,
GError * * error )
2005-12-30 04:55:07 +08:00
{
gboolean success = TRUE ;
2006-04-04 18:30:58 +08:00
GValueArray * return_vals ;
2005-12-30 04:55:07 +08:00
GimpVectors * vectors ;
gint32 stroke_id ;
gdouble dist ;
2006-10-24 16:30:55 +08:00
gdouble precision ;
2006-03-15 23:32:39 +08:00
gdouble x_point = 0.0 ;
gdouble y_point = 0.0 ;
gdouble slope = 0.0 ;
2005-12-30 04:55:07 +08:00
gboolean valid = FALSE ;
2006-04-04 18:30:58 +08:00
vectors = gimp_value_get_vectors ( & args - > values [ 0 ] , gimp ) ;
stroke_id = g_value_get_int ( & args - > values [ 1 ] ) ;
dist = g_value_get_double ( & args - > values [ 2 ] ) ;
2006-10-24 16:30:55 +08:00
precision = g_value_get_double ( & args - > values [ 3 ] ) ;
2005-12-30 04:55:07 +08:00
if ( success )
{
2009-08-22 00:06:58 +08:00
GimpStroke * stroke = gimp_pdb_get_vectors_stroke ( vectors , stroke_id , FALSE , error ) ;
2005-12-30 04:55:07 +08:00
if ( stroke )
{
2006-03-15 05:35:50 +08:00
GimpCoords coord ;
2006-10-24 16:30:55 +08:00
valid = gimp_stroke_get_point_at_dist ( stroke , dist , precision ,
2005-12-30 04:55:07 +08:00
& coord , & slope ) ;
x_point = valid ? coord . x : 0 ;
y_point = valid ? coord . y : 0 ;
}
else
2006-03-25 05:57:47 +08:00
success = FALSE ;
2005-12-30 04:55:07 +08:00
}
2008-08-16 21:57:57 +08:00
return_vals = gimp_procedure_get_return_values ( procedure , success ,
error ? * error : NULL ) ;
2005-12-30 04:55:07 +08:00
if ( success )
{
2006-04-04 18:30:58 +08:00
g_value_set_double ( & return_vals - > values [ 1 ] , x_point ) ;
g_value_set_double ( & return_vals - > values [ 2 ] , y_point ) ;
g_value_set_double ( & return_vals - > values [ 3 ] , slope ) ;
g_value_set_boolean ( & return_vals - > values [ 4 ] , valid ) ;
2005-12-30 04:55:07 +08:00
}
2006-03-28 05:09:32 +08:00
return return_vals ;
2005-12-30 04:55:07 +08:00
}
2006-04-04 18:30:58 +08:00
static GValueArray *
2007-12-03 02:05:54 +08:00
vectors_remove_stroke_invoker ( GimpProcedure * procedure ,
Gimp * gimp ,
GimpContext * context ,
GimpProgress * progress ,
const GValueArray * args ,
GError * * error )
2005-06-02 00:20:46 +08:00
{
gboolean success = TRUE ;
GimpVectors * vectors ;
gint32 stroke_id ;
2006-04-04 18:30:58 +08:00
vectors = gimp_value_get_vectors ( & args - > values [ 0 ] , gimp ) ;
stroke_id = g_value_get_int ( & args - > values [ 1 ] ) ;
2005-06-02 00:20:46 +08:00
if ( success )
{
2009-08-22 00:06:58 +08:00
GimpStroke * stroke = gimp_pdb_get_vectors_stroke ( vectors , stroke_id , TRUE , error ) ;
2005-06-02 00:20:46 +08:00
if ( stroke )
2009-08-21 23:57:56 +08:00
{
if ( gimp_item_is_attached ( GIMP_ITEM ( vectors ) ) )
gimp_image_undo_push_vectors_mod ( gimp_item_get_image ( GIMP_ITEM ( vectors ) ) ,
_ ( " Remove path stroke " ) ,
vectors ) ;
gimp_vectors_stroke_remove ( vectors , stroke ) ;
}
2005-06-02 00:20:46 +08:00
else
success = FALSE ;
}
2008-08-16 21:57:57 +08:00
return gimp_procedure_get_return_values ( procedure , success ,
error ? * error : NULL ) ;
2005-06-02 00:20:46 +08:00
}
2006-04-04 18:30:58 +08:00
static GValueArray *
2007-12-03 02:05:54 +08:00
vectors_stroke_close_invoker ( GimpProcedure * procedure ,
Gimp * gimp ,
GimpContext * context ,
GimpProgress * progress ,
const GValueArray * args ,
GError * * error )
2005-12-30 04:55:07 +08:00
{
gboolean success = TRUE ;
GimpVectors * vectors ;
gint32 stroke_id ;
2006-04-04 18:30:58 +08:00
vectors = gimp_value_get_vectors ( & args - > values [ 0 ] , gimp ) ;
stroke_id = g_value_get_int ( & args - > values [ 1 ] ) ;
2005-12-30 04:55:07 +08:00
if ( success )
{
2009-08-22 00:06:58 +08:00
GimpStroke * stroke = gimp_pdb_get_vectors_stroke ( vectors , stroke_id , TRUE , error ) ;
2005-12-30 04:55:07 +08:00
if ( stroke )
2009-08-21 23:57:56 +08:00
{
if ( gimp_item_is_attached ( GIMP_ITEM ( vectors ) ) )
gimp_image_undo_push_vectors_mod ( gimp_item_get_image ( GIMP_ITEM ( vectors ) ) ,
_ ( " Close path stroke " ) ,
vectors ) ;
gimp_stroke_close ( stroke ) ;
}
2005-12-30 04:55:07 +08:00
else
success = FALSE ;
}
2008-08-16 21:57:57 +08:00
return gimp_procedure_get_return_values ( procedure , success ,
error ? * error : NULL ) ;
2005-12-30 04:55:07 +08:00
}
2006-04-04 18:30:58 +08:00
static GValueArray *
2007-12-03 02:05:54 +08:00
vectors_stroke_translate_invoker ( GimpProcedure * procedure ,
Gimp * gimp ,
GimpContext * context ,
GimpProgress * progress ,
const GValueArray * args ,
GError * * error )
2005-05-17 09:20:03 +08:00
{
gboolean success = TRUE ;
GimpVectors * vectors ;
gint32 stroke_id ;
2005-12-29 05:24:12 +08:00
gint32 off_x ;
gint32 off_y ;
2005-05-17 09:20:03 +08:00
2006-04-04 18:30:58 +08:00
vectors = gimp_value_get_vectors ( & args - > values [ 0 ] , gimp ) ;
stroke_id = g_value_get_int ( & args - > values [ 1 ] ) ;
off_x = g_value_get_int ( & args - > values [ 2 ] ) ;
off_y = g_value_get_int ( & args - > values [ 3 ] ) ;
2005-05-17 09:20:03 +08:00
if ( success )
{
2009-08-22 00:06:58 +08:00
GimpStroke * stroke = gimp_pdb_get_vectors_stroke ( vectors , stroke_id , TRUE , error ) ;
2005-05-17 09:20:03 +08:00
2005-12-30 04:55:07 +08:00
if ( stroke )
2009-08-21 23:57:56 +08:00
{
if ( gimp_item_is_attached ( GIMP_ITEM ( vectors ) ) )
gimp_image_undo_push_vectors_mod ( gimp_item_get_image ( GIMP_ITEM ( vectors ) ) ,
_ ( " Translate path stroke " ) ,
vectors ) ;
gimp_stroke_translate ( stroke , off_x , off_y ) ;
}
2005-05-17 09:20:03 +08:00
else
2005-12-30 04:55:07 +08:00
success = FALSE ;
2005-05-17 09:20:03 +08:00
}
2008-08-16 21:57:57 +08:00
return gimp_procedure_get_return_values ( procedure , success ,
error ? * error : NULL ) ;
2005-05-17 09:20:03 +08:00
}
2006-04-04 18:30:58 +08:00
static GValueArray *
2007-12-03 02:05:54 +08:00
vectors_stroke_scale_invoker ( GimpProcedure * procedure ,
Gimp * gimp ,
GimpContext * context ,
GimpProgress * progress ,
const GValueArray * args ,
GError * * error )
2005-12-29 05:24:12 +08:00
{
gboolean success = TRUE ;
GimpVectors * vectors ;
gint32 stroke_id ;
gdouble scale_x ;
gdouble scale_y ;
2006-04-04 18:30:58 +08:00
vectors = gimp_value_get_vectors ( & args - > values [ 0 ] , gimp ) ;
stroke_id = g_value_get_int ( & args - > values [ 1 ] ) ;
scale_x = g_value_get_double ( & args - > values [ 2 ] ) ;
scale_y = g_value_get_double ( & args - > values [ 3 ] ) ;
2005-12-29 05:24:12 +08:00
if ( success )
{
2009-08-22 00:06:58 +08:00
GimpStroke * stroke = gimp_pdb_get_vectors_stroke ( vectors , stroke_id , TRUE , error ) ;
2005-12-29 05:24:12 +08:00
2005-12-30 04:55:07 +08:00
if ( stroke )
2009-08-21 23:57:56 +08:00
{
if ( gimp_item_is_attached ( GIMP_ITEM ( vectors ) ) )
gimp_image_undo_push_vectors_mod ( gimp_item_get_image ( GIMP_ITEM ( vectors ) ) ,
_ ( " Scale path stroke " ) ,
vectors ) ;
gimp_stroke_scale ( stroke , scale_x , scale_y ) ;
}
2005-12-29 05:24:12 +08:00
else
2005-12-30 04:55:07 +08:00
success = FALSE ;
2005-12-29 05:24:12 +08:00
}
2008-08-16 21:57:57 +08:00
return gimp_procedure_get_return_values ( procedure , success ,
error ? * error : NULL ) ;
2005-12-29 05:24:12 +08:00
}
2006-11-20 23:34:30 +08:00
static GValueArray *
2007-12-03 02:05:54 +08:00
vectors_stroke_rotate_invoker ( GimpProcedure * procedure ,
Gimp * gimp ,
GimpContext * context ,
GimpProgress * progress ,
const GValueArray * args ,
GError * * error )
2006-11-20 23:34:30 +08:00
{
gboolean success = TRUE ;
GimpVectors * vectors ;
gint32 stroke_id ;
gdouble center_x ;
gdouble center_y ;
gdouble angle ;
vectors = gimp_value_get_vectors ( & args - > values [ 0 ] , gimp ) ;
stroke_id = g_value_get_int ( & args - > values [ 1 ] ) ;
center_x = g_value_get_double ( & args - > values [ 2 ] ) ;
center_y = g_value_get_double ( & args - > values [ 3 ] ) ;
angle = g_value_get_double ( & args - > values [ 4 ] ) ;
if ( success )
{
2009-08-22 00:06:58 +08:00
GimpStroke * stroke = gimp_pdb_get_vectors_stroke ( vectors , stroke_id , TRUE , error ) ;
2006-11-20 23:34:30 +08:00
if ( stroke )
2009-08-21 23:57:56 +08:00
{
if ( gimp_item_is_attached ( GIMP_ITEM ( vectors ) ) )
gimp_image_undo_push_vectors_mod ( gimp_item_get_image ( GIMP_ITEM ( vectors ) ) ,
_ ( " Rotate path stroke " ) ,
vectors ) ;
gimp_stroke_rotate ( stroke , center_x , center_y , angle ) ;
}
2006-11-20 23:34:30 +08:00
else
success = FALSE ;
}
2008-08-16 21:57:57 +08:00
return gimp_procedure_get_return_values ( procedure , success ,
error ? * error : NULL ) ;
2006-11-20 23:34:30 +08:00
}
static GValueArray *
2007-12-03 02:05:54 +08:00
vectors_stroke_flip_invoker ( GimpProcedure * procedure ,
Gimp * gimp ,
GimpContext * context ,
GimpProgress * progress ,
const GValueArray * args ,
GError * * error )
2006-11-20 23:34:30 +08:00
{
gboolean success = TRUE ;
GimpVectors * vectors ;
gint32 stroke_id ;
gint32 flip_type ;
gdouble axis ;
vectors = gimp_value_get_vectors ( & args - > values [ 0 ] , gimp ) ;
stroke_id = g_value_get_int ( & args - > values [ 1 ] ) ;
flip_type = g_value_get_enum ( & args - > values [ 2 ] ) ;
axis = g_value_get_double ( & args - > values [ 3 ] ) ;
if ( success )
{
2009-08-22 00:06:58 +08:00
GimpStroke * stroke = gimp_pdb_get_vectors_stroke ( vectors , stroke_id , TRUE , error ) ;
2006-11-20 23:34:30 +08:00
if ( stroke )
2009-08-21 23:57:56 +08:00
{
if ( gimp_item_is_attached ( GIMP_ITEM ( vectors ) ) )
gimp_image_undo_push_vectors_mod ( gimp_item_get_image ( GIMP_ITEM ( vectors ) ) ,
_ ( " Flip path stroke " ) ,
vectors ) ;
gimp_stroke_flip ( stroke , flip_type , axis ) ;
}
2006-11-20 23:34:30 +08:00
else
success = FALSE ;
}
2008-08-16 21:57:57 +08:00
return gimp_procedure_get_return_values ( procedure , success ,
error ? * error : NULL ) ;
2006-11-20 23:34:30 +08:00
}
static GValueArray *
2007-12-03 02:05:54 +08:00
vectors_stroke_flip_free_invoker ( GimpProcedure * procedure ,
Gimp * gimp ,
GimpContext * context ,
GimpProgress * progress ,
const GValueArray * args ,
GError * * error )
2006-11-20 23:34:30 +08:00
{
gboolean success = TRUE ;
GimpVectors * vectors ;
gint32 stroke_id ;
gdouble x1 ;
gdouble y1 ;
gdouble x2 ;
gdouble y2 ;
vectors = gimp_value_get_vectors ( & args - > values [ 0 ] , gimp ) ;
stroke_id = g_value_get_int ( & args - > values [ 1 ] ) ;
x1 = g_value_get_double ( & args - > values [ 2 ] ) ;
y1 = g_value_get_double ( & args - > values [ 3 ] ) ;
x2 = g_value_get_double ( & args - > values [ 4 ] ) ;
y2 = g_value_get_double ( & args - > values [ 5 ] ) ;
if ( success )
{
2009-08-22 00:06:58 +08:00
GimpStroke * stroke = gimp_pdb_get_vectors_stroke ( vectors , stroke_id , TRUE , error ) ;
2006-11-20 23:34:30 +08:00
if ( stroke )
2009-08-21 23:57:56 +08:00
{
if ( gimp_item_is_attached ( GIMP_ITEM ( vectors ) ) )
gimp_image_undo_push_vectors_mod ( gimp_item_get_image ( GIMP_ITEM ( vectors ) ) ,
_ ( " Flip path stroke " ) ,
vectors ) ;
gimp_stroke_flip_free ( stroke , x1 , y1 , x2 , y2 ) ;
}
2006-11-20 23:34:30 +08:00
else
success = FALSE ;
}
2008-08-16 21:57:57 +08:00
return gimp_procedure_get_return_values ( procedure , success ,
error ? * error : NULL ) ;
2006-11-20 23:34:30 +08:00
}
2006-10-24 22:23:29 +08:00
static GValueArray *
2007-12-03 02:05:54 +08:00
vectors_stroke_get_points_invoker ( GimpProcedure * procedure ,
Gimp * gimp ,
GimpContext * context ,
GimpProgress * progress ,
const GValueArray * args ,
GError * * error )
2006-10-24 22:23:29 +08:00
{
gboolean success = TRUE ;
GValueArray * return_vals ;
GimpVectors * vectors ;
gint32 stroke_id ;
gint32 type = 0 ;
gint32 num_points = 0 ;
gdouble * controlpoints = NULL ;
gboolean closed = FALSE ;
vectors = gimp_value_get_vectors ( & args - > values [ 0 ] , gimp ) ;
2006-10-26 23:36:45 +08:00
stroke_id = g_value_get_int ( & args - > values [ 1 ] ) ;
2006-10-24 22:23:29 +08:00
if ( success )
{
2009-08-22 00:06:58 +08:00
GimpStroke * stroke = gimp_pdb_get_vectors_stroke ( vectors , stroke_id , FALSE , error ) ;
2006-10-24 22:23:29 +08:00
2008-03-07 02:39:07 +08:00
if ( GIMP_IS_BEZIER_STROKE ( stroke ) )
2006-10-24 22:23:29 +08: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 ) ;
type = GIMP_VECTORS_STROKE_TYPE_BEZIER ;
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 21:57:57 +08:00
return_vals = gimp_procedure_get_return_values ( procedure , success ,
error ? * error : NULL ) ;
2006-10-24 22:23:29 +08:00
if ( success )
{
2006-10-26 23:36:45 +08:00
g_value_set_enum ( & return_vals - > values [ 1 ] , type ) ;
2006-10-24 22:23:29 +08:00
g_value_set_int ( & return_vals - > values [ 2 ] , num_points ) ;
gimp_value_take_floatarray ( & return_vals - > values [ 3 ] , controlpoints , num_points ) ;
g_value_set_boolean ( & return_vals - > values [ 4 ] , closed ) ;
}
return return_vals ;
}
2006-10-26 23:36:45 +08:00
static GValueArray *
2007-12-03 02:05:54 +08:00
vectors_stroke_new_from_points_invoker ( GimpProcedure * procedure ,
Gimp * gimp ,
GimpContext * context ,
GimpProgress * progress ,
const GValueArray * args ,
GError * * error )
2006-10-26 23:36:45 +08:00
{
gboolean success = TRUE ;
GValueArray * return_vals ;
GimpVectors * vectors ;
gint32 type ;
gint32 num_points ;
const gdouble * controlpoints ;
gboolean closed ;
gint32 stroke_id = 0 ;
vectors = gimp_value_get_vectors ( & args - > values [ 0 ] , gimp ) ;
type = g_value_get_enum ( & args - > values [ 1 ] ) ;
num_points = g_value_get_int ( & args - > values [ 2 ] ) ;
controlpoints = gimp_value_get_floatarray ( & args - > values [ 3 ] ) ;
closed = g_value_get_boolean ( & args - > values [ 4 ] ) ;
if ( success )
{
GimpStroke * stroke ;
GimpCoords * coords ;
GimpCoords default_coords = GIMP_COORDS_DEFAULT_VALUES ;
gint i ;
success = FALSE ;
if ( type = = GIMP_VECTORS_STROKE_TYPE_BEZIER & &
num_points % 6 = = 0 )
{
2007-09-25 00:57:19 +08:00
coords = g_new ( GimpCoords , num_points / 2 ) ;
for ( i = 0 ; i < num_points / 2 ; i + + )
2006-10-26 23:36:45 +08: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 )
{
2009-08-21 23:57:56 +08:00
if ( gimp_item_is_attached ( GIMP_ITEM ( vectors ) ) )
gimp_image_undo_push_vectors_mod ( gimp_item_get_image ( GIMP_ITEM ( vectors ) ) ,
_ ( " Add path stroke " ) ,
vectors ) ;
2006-10-26 23:36:45 +08:00
gimp_vectors_stroke_add ( vectors , stroke ) ;
2009-08-21 23:57:56 +08:00
2006-10-26 23:36:45 +08:00
stroke_id = gimp_stroke_get_ID ( stroke ) ;
2006-10-27 01:23:41 +08:00
success = TRUE ;
2006-10-26 23:36:45 +08:00
}
g_free ( coords ) ;
}
}
2008-08-16 21:57:57 +08:00
return_vals = gimp_procedure_get_return_values ( procedure , success ,
error ? * error : NULL ) ;
2006-10-26 23:36:45 +08:00
if ( success )
g_value_set_int ( & return_vals - > values [ 1 ] , stroke_id ) ;
return return_vals ;
}
2006-04-04 18:30:58 +08:00
static GValueArray *
2007-12-03 02:05:54 +08:00
vectors_stroke_interpolate_invoker ( GimpProcedure * procedure ,
Gimp * gimp ,
GimpContext * context ,
GimpProgress * progress ,
const GValueArray * args ,
GError * * error )
2005-06-02 00:20:46 +08:00
{
gboolean success = TRUE ;
2006-04-04 18:30:58 +08:00
GValueArray * return_vals ;
2005-06-02 00:20:46 +08:00
GimpVectors * vectors ;
gint32 stroke_id ;
2006-10-24 16:30:55 +08:00
gdouble precision ;
2005-06-02 00:20:46 +08:00
gint32 num_coords = 0 ;
gdouble * coords = NULL ;
2006-10-24 16:30:55 +08:00
gboolean closed = FALSE ;
2005-06-02 00:20:46 +08:00
2006-04-04 18:30:58 +08:00
vectors = gimp_value_get_vectors ( & args - > values [ 0 ] , gimp ) ;
stroke_id = g_value_get_int ( & args - > values [ 1 ] ) ;
2006-10-24 16:30:55 +08:00
precision = g_value_get_double ( & args - > values [ 2 ] ) ;
2005-06-02 00:20:46 +08:00
if ( success )
{
2009-08-22 00:06:58 +08:00
GimpStroke * stroke = gimp_pdb_get_vectors_stroke ( vectors , stroke_id , FALSE , error ) ;
2005-06-02 00:20:46 +08:00
if ( stroke )
{
2006-03-15 05:35:50 +08:00
GArray * coords_array ;
gint i ;
2006-10-24 16:30:55 +08:00
coords_array = gimp_stroke_interpolate ( stroke , precision , & closed ) ;
2006-03-15 05:35:50 +08:00
2005-06-02 00:20:46 +08: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-25 05:57:47 +08:00
success = FALSE ;
2005-06-02 00:20:46 +08:00
}
else
2006-03-25 05:57:47 +08:00
success = FALSE ;
2005-06-02 00:20:46 +08:00
}
2008-08-16 21:57:57 +08:00
return_vals = gimp_procedure_get_return_values ( procedure , success ,
error ? * error : NULL ) ;
2005-06-02 00:20:46 +08:00
if ( success )
{
2006-10-24 16:30:55 +08:00
g_value_set_int ( & return_vals - > values [ 1 ] , num_coords ) ;
gimp_value_take_floatarray ( & return_vals - > values [ 2 ] , coords , num_coords ) ;
g_value_set_boolean ( & return_vals - > values [ 3 ] , closed ) ;
2005-06-02 00:20:46 +08:00
}
2006-04-05 05:11:45 +08:00
return return_vals ;
}
static GValueArray *
2007-12-03 02:05:54 +08:00
vectors_bezier_stroke_new_moveto_invoker ( GimpProcedure * procedure ,
Gimp * gimp ,
GimpContext * context ,
GimpProgress * progress ,
const GValueArray * args ,
GError * * error )
2006-04-05 05:11:45 +08:00
{
gboolean success = TRUE ;
GValueArray * return_vals ;
GimpVectors * vectors ;
gdouble x0 ;
gdouble y0 ;
gint32 stroke_id = 0 ;
vectors = gimp_value_get_vectors ( & args - > values [ 0 ] , gimp ) ;
x0 = g_value_get_double ( & args - > values [ 1 ] ) ;
y0 = g_value_get_double ( & args - > values [ 2 ] ) ;
if ( success )
{
2009-08-29 15:16:35 +08:00
if ( gimp_pdb_item_is_writable ( GIMP_ITEM ( vectors ) , error ) & &
gimp_pdb_item_is_not_group ( GIMP_ITEM ( vectors ) , error ) )
2009-08-22 00:06:58 +08:00
{
GimpStroke * stroke ;
GimpCoords coord0 = GIMP_COORDS_DEFAULT_VALUES ;
2006-04-05 05:11:45 +08:00
2009-08-22 00:06:58 +08:00
coord0 . x = x0 ;
coord0 . y = y0 ;
2006-04-05 05:11:45 +08:00
2009-08-22 00:06:58 +08:00
stroke = gimp_bezier_stroke_new_moveto ( & coord0 ) ;
2009-08-21 23:57:56 +08:00
2009-08-22 00:06:58 +08:00
if ( gimp_item_is_attached ( GIMP_ITEM ( vectors ) ) )
gimp_image_undo_push_vectors_mod ( gimp_item_get_image ( GIMP_ITEM ( vectors ) ) ,
_ ( " Add path stroke " ) ,
vectors ) ;
2009-08-21 23:57:56 +08:00
2009-08-22 00:06:58 +08:00
gimp_vectors_stroke_add ( vectors , stroke ) ;
2009-08-21 23:57:56 +08:00
2009-08-22 00:06:58 +08:00
stroke_id = gimp_stroke_get_ID ( stroke ) ;
}
else
success = FALSE ;
2006-04-05 05:11:45 +08:00
}
2008-08-16 21:57:57 +08:00
return_vals = gimp_procedure_get_return_values ( procedure , success ,
error ? * error : NULL ) ;
2006-04-05 05:11:45 +08:00
if ( success )
g_value_set_int ( & return_vals - > values [ 1 ] , stroke_id ) ;
return return_vals ;
}
static GValueArray *
2007-12-03 02:05:54 +08:00
vectors_bezier_stroke_lineto_invoker ( GimpProcedure * procedure ,
Gimp * gimp ,
GimpContext * context ,
GimpProgress * progress ,
const GValueArray * args ,
GError * * error )
2006-04-05 05:11:45 +08:00
{
gboolean success = TRUE ;
GimpVectors * vectors ;
gint32 stroke_id ;
gdouble x0 ;
gdouble y0 ;
vectors = gimp_value_get_vectors ( & args - > values [ 0 ] , gimp ) ;
stroke_id = g_value_get_int ( & args - > values [ 1 ] ) ;
x0 = g_value_get_double ( & args - > values [ 2 ] ) ;
y0 = g_value_get_double ( & args - > values [ 3 ] ) ;
if ( success )
{
2009-08-22 00:06:58 +08:00
GimpStroke * stroke = gimp_pdb_get_vectors_stroke ( vectors , stroke_id , TRUE , error ) ;
2006-04-05 05:11:45 +08:00
if ( stroke )
{
GimpCoords coord0 = GIMP_COORDS_DEFAULT_VALUES ;
coord0 . x = x0 ;
coord0 . y = y0 ;
2009-08-21 23:57:56 +08:00
if ( gimp_item_is_attached ( GIMP_ITEM ( vectors ) ) )
gimp_image_undo_push_vectors_mod ( gimp_item_get_image ( GIMP_ITEM ( vectors ) ) ,
_ ( " Extend path stroke " ) ,
vectors ) ;
2006-04-05 05:11:45 +08:00
gimp_bezier_stroke_lineto ( stroke , & coord0 ) ;
}
else
success = FALSE ;
}
2008-08-16 21:57:57 +08:00
return gimp_procedure_get_return_values ( procedure , success ,
error ? * error : NULL ) ;
2006-04-05 05:11:45 +08:00
}
static GValueArray *
2007-12-03 02:05:54 +08:00
vectors_bezier_stroke_conicto_invoker ( GimpProcedure * procedure ,
Gimp * gimp ,
GimpContext * context ,
GimpProgress * progress ,
const GValueArray * args ,
GError * * error )
2006-04-05 05:11:45 +08:00
{
gboolean success = TRUE ;
GimpVectors * vectors ;
gint32 stroke_id ;
gdouble x0 ;
gdouble y0 ;
gdouble x1 ;
gdouble y1 ;
vectors = gimp_value_get_vectors ( & args - > values [ 0 ] , gimp ) ;
stroke_id = g_value_get_int ( & args - > values [ 1 ] ) ;
x0 = g_value_get_double ( & args - > values [ 2 ] ) ;
y0 = g_value_get_double ( & args - > values [ 3 ] ) ;
x1 = g_value_get_double ( & args - > values [ 4 ] ) ;
y1 = g_value_get_double ( & args - > values [ 5 ] ) ;
if ( success )
{
2009-08-22 00:06:58 +08:00
GimpStroke * stroke = gimp_pdb_get_vectors_stroke ( vectors , stroke_id , TRUE , error ) ;
2006-04-05 05:11:45 +08: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 ;
2009-08-21 23:57:56 +08:00
if ( gimp_item_is_attached ( GIMP_ITEM ( vectors ) ) )
gimp_image_undo_push_vectors_mod ( gimp_item_get_image ( GIMP_ITEM ( vectors ) ) ,
_ ( " Extend path stroke " ) ,
vectors ) ;
2006-04-05 05:11:45 +08:00
gimp_bezier_stroke_conicto ( stroke , & coord0 , & coord1 ) ;
}
else
success = FALSE ;
}
2008-08-16 21:57:57 +08:00
return gimp_procedure_get_return_values ( procedure , success ,
error ? * error : NULL ) ;
2006-04-05 05:11:45 +08:00
}
static GValueArray *
2007-12-03 02:05:54 +08:00
vectors_bezier_stroke_cubicto_invoker ( GimpProcedure * procedure ,
Gimp * gimp ,
GimpContext * context ,
GimpProgress * progress ,
const GValueArray * args ,
GError * * error )
2006-04-05 05:11:45 +08:00
{
gboolean success = TRUE ;
GimpVectors * vectors ;
gint32 stroke_id ;
gdouble x0 ;
gdouble y0 ;
gdouble x1 ;
gdouble y1 ;
gdouble x2 ;
gdouble y2 ;
vectors = gimp_value_get_vectors ( & args - > values [ 0 ] , gimp ) ;
stroke_id = g_value_get_int ( & args - > values [ 1 ] ) ;
x0 = g_value_get_double ( & args - > values [ 2 ] ) ;
y0 = g_value_get_double ( & args - > values [ 3 ] ) ;
x1 = g_value_get_double ( & args - > values [ 4 ] ) ;
y1 = g_value_get_double ( & args - > values [ 5 ] ) ;
x2 = g_value_get_double ( & args - > values [ 6 ] ) ;
y2 = g_value_get_double ( & args - > values [ 7 ] ) ;
if ( success )
{
2009-08-22 00:06:58 +08:00
GimpStroke * stroke = gimp_pdb_get_vectors_stroke ( vectors , stroke_id , TRUE , error ) ;
2006-04-05 05:11:45 +08: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 ;
2009-08-21 23:57:56 +08:00
if ( gimp_item_is_attached ( GIMP_ITEM ( vectors ) ) )
gimp_image_undo_push_vectors_mod ( gimp_item_get_image ( GIMP_ITEM ( vectors ) ) ,
_ ( " Extend path stroke " ) ,
vectors ) ;
2006-04-05 05:11:45 +08:00
gimp_bezier_stroke_cubicto ( stroke , & coord0 , & coord1 , & coord2 ) ;
}
else
success = FALSE ;
}
2008-08-16 21:57:57 +08:00
return gimp_procedure_get_return_values ( procedure , success ,
error ? * error : NULL ) ;
2005-06-02 00:20:46 +08:00
}
2006-04-04 18:30:58 +08:00
static GValueArray *
2007-12-03 02:05:54 +08:00
vectors_bezier_stroke_new_ellipse_invoker ( GimpProcedure * procedure ,
Gimp * gimp ,
GimpContext * context ,
GimpProgress * progress ,
const GValueArray * args ,
GError * * error )
2005-12-30 00:05:31 +08:00
{
gboolean success = TRUE ;
2006-04-04 18:30:58 +08:00
GValueArray * return_vals ;
2005-12-30 00:05:31 +08:00
GimpVectors * vectors ;
2006-03-15 23:32:39 +08:00
gdouble x0 ;
gdouble y0 ;
2006-04-05 05:11:45 +08:00
gdouble radius_x ;
gdouble radius_y ;
gdouble angle ;
2005-12-30 00:05:31 +08:00
gint32 stroke_id = 0 ;
2006-04-04 18:30:58 +08:00
vectors = gimp_value_get_vectors ( & args - > values [ 0 ] , gimp ) ;
x0 = g_value_get_double ( & args - > values [ 1 ] ) ;
y0 = g_value_get_double ( & args - > values [ 2 ] ) ;
2006-04-05 05:11:45 +08:00
radius_x = g_value_get_double ( & args - > values [ 3 ] ) ;
radius_y = g_value_get_double ( & args - > values [ 4 ] ) ;
angle = g_value_get_double ( & args - > values [ 5 ] ) ;
2005-12-30 00:05:31 +08:00
if ( success )
{
2009-08-29 15:16:35 +08:00
if ( gimp_pdb_item_is_writable ( GIMP_ITEM ( vectors ) , error ) & &
gimp_pdb_item_is_not_group ( GIMP_ITEM ( vectors ) , error ) )
2009-08-22 00:06:58 +08:00
{
GimpStroke * stroke ;
GimpCoords coord0 = GIMP_COORDS_DEFAULT_VALUES ;
2006-03-15 05:35:50 +08:00
2009-08-22 00:06:58 +08:00
coord0 . x = x0 ;
coord0 . y = y0 ;
2005-12-30 00:05:31 +08:00
2009-08-22 00:06:58 +08:00
stroke = gimp_bezier_stroke_new_ellipse ( & coord0 , radius_x , radius_y , angle ) ;
2009-08-21 23:57:56 +08:00
2009-08-22 00:06:58 +08:00
if ( gimp_item_is_attached ( GIMP_ITEM ( vectors ) ) )
gimp_image_undo_push_vectors_mod ( gimp_item_get_image ( GIMP_ITEM ( vectors ) ) ,
_ ( " Add path stroke " ) ,
vectors ) ;
2009-08-21 23:57:56 +08:00
2009-08-22 00:06:58 +08:00
gimp_vectors_stroke_add ( vectors , stroke ) ;
2009-08-21 23:57:56 +08:00
2009-08-22 00:06:58 +08:00
stroke_id = gimp_stroke_get_ID ( stroke ) ;
}
else
success = FALSE ;
2005-12-30 00:05:31 +08:00
}
2008-08-16 21:57:57 +08:00
return_vals = gimp_procedure_get_return_values ( procedure , success ,
error ? * error : NULL ) ;
2005-12-30 00:05:31 +08:00
if ( success )
2006-04-04 18:30:58 +08:00
g_value_set_int ( & return_vals - > values [ 1 ] , stroke_id ) ;
2005-12-30 00:05:31 +08:00
2006-03-28 05:09:32 +08:00
return return_vals ;
2005-12-30 00:05:31 +08:00
}
2006-07-28 22:54:31 +08:00
static GValueArray *
2007-12-03 02:05:54 +08:00
vectors_to_selection_invoker ( GimpProcedure * procedure ,
Gimp * gimp ,
GimpContext * context ,
GimpProgress * progress ,
const GValueArray * args ,
GError * * error )
2006-07-28 22:54:31 +08:00
{
gboolean success = TRUE ;
GimpVectors * vectors ;
2006-07-29 01:34:50 +08:00
gint32 operation ;
2006-07-28 22:54:31 +08:00
gboolean antialias ;
gboolean feather ;
gdouble feather_radius_x ;
gdouble feather_radius_y ;
vectors = gimp_value_get_vectors ( & args - > values [ 0 ] , gimp ) ;
2006-07-29 01:34:50 +08:00
operation = g_value_get_enum ( & args - > values [ 1 ] ) ;
2006-07-28 22:54:31 +08:00
antialias = g_value_get_boolean ( & args - > values [ 2 ] ) ;
feather = g_value_get_boolean ( & args - > values [ 3 ] ) ;
feather_radius_x = g_value_get_double ( & args - > values [ 4 ] ) ;
feather_radius_y = g_value_get_double ( & args - > values [ 5 ] ) ;
if ( success )
{
2010-07-21 05:09:19 +08:00
if ( gimp_pdb_item_is_attached ( GIMP_ITEM ( vectors ) , NULL , FALSE , error ) )
gimp_item_to_selection ( GIMP_ITEM ( vectors ) ,
operation ,
antialias ,
feather ,
feather_radius_x ,
feather_radius_y ) ;
2006-07-28 22:54:31 +08:00
else
success = FALSE ;
}
2008-08-16 21:57:57 +08:00
return gimp_procedure_get_return_values ( procedure , success ,
error ? * error : NULL ) ;
2006-07-28 22:54:31 +08:00
}
2006-10-25 23:14:03 +08:00
static GValueArray *
2007-12-03 02:05:54 +08:00
vectors_import_from_file_invoker ( GimpProcedure * procedure ,
Gimp * gimp ,
GimpContext * context ,
GimpProgress * progress ,
const GValueArray * args ,
GError * * error )
2006-10-25 23:14:03 +08:00
{
gboolean success = TRUE ;
GValueArray * return_vals ;
GimpImage * image ;
const gchar * filename ;
gboolean merge ;
gboolean scale ;
gint32 num_vectors = 0 ;
gint32 * vectors_ids = NULL ;
image = gimp_value_get_image ( & args - > values [ 0 ] , gimp ) ;
filename = g_value_get_string ( & args - > values [ 1 ] ) ;
merge = g_value_get_boolean ( & args - > values [ 2 ] ) ;
scale = g_value_get_boolean ( & args - > values [ 3 ] ) ;
if ( success )
{
GList * list , * vectors_list = NULL ;
2009-08-04 01:21:51 +08:00
/* FIXME tree */
2006-10-25 23:14:03 +08:00
success = gimp_vectors_import_file ( image , filename ,
2009-08-04 01:21:51 +08:00
merge , scale , NULL , - 1 ,
& vectors_list , error ) ;
2006-10-25 23:14:03 +08:00
if ( success )
{
num_vectors = g_list_length ( vectors_list ) ;
if ( num_vectors )
{
gint i ;
vectors_ids = g_new ( gint32 , num_vectors ) ;
list = vectors_list ;
for ( i = 0 ; i < num_vectors ; i + + , list = g_list_next ( list ) )
vectors_ids [ i ] = gimp_item_get_ID ( GIMP_ITEM ( list - > data ) ) ;
g_list_free ( vectors_list ) ;
}
}
}
2008-08-16 21:57:57 +08:00
return_vals = gimp_procedure_get_return_values ( procedure , success ,
error ? * error : NULL ) ;
2006-10-25 23:14:03 +08:00
if ( success )
{
g_value_set_int ( & return_vals - > values [ 1 ] , num_vectors ) ;
gimp_value_take_int32array ( & return_vals - > values [ 2 ] , vectors_ids , num_vectors ) ;
}
return return_vals ;
}
static GValueArray *
2007-12-03 02:05:54 +08:00
vectors_import_from_string_invoker ( GimpProcedure * procedure ,
Gimp * gimp ,
GimpContext * context ,
GimpProgress * progress ,
const GValueArray * args ,
GError * * error )
2006-10-25 23:14:03 +08:00
{
gboolean success = TRUE ;
GValueArray * return_vals ;
GimpImage * image ;
const gchar * string ;
gint32 length ;
gboolean merge ;
gboolean scale ;
gint32 num_vectors = 0 ;
gint32 * vectors_ids = NULL ;
image = gimp_value_get_image ( & args - > values [ 0 ] , gimp ) ;
string = g_value_get_string ( & args - > values [ 1 ] ) ;
length = g_value_get_int ( & args - > values [ 2 ] ) ;
merge = g_value_get_boolean ( & args - > values [ 3 ] ) ;
scale = g_value_get_boolean ( & args - > values [ 4 ] ) ;
if ( success )
{
GList * list , * vectors_list = NULL ;
2009-08-04 01:21:51 +08:00
/* FIXME tree */
2006-10-25 23:14:03 +08:00
success = gimp_vectors_import_buffer ( image , string , length ,
2009-08-04 01:21:51 +08:00
merge , scale , NULL , - 1 ,
& vectors_list , error ) ;
2006-10-25 23:14:03 +08:00
if ( success )
{
num_vectors = g_list_length ( vectors_list ) ;
if ( num_vectors )
{
gint i ;
vectors_ids = g_new ( gint32 , num_vectors ) ;
list = vectors_list ;
for ( i = 0 ; i < num_vectors ; i + + , list = g_list_next ( list ) )
vectors_ids [ i ] = gimp_item_get_ID ( GIMP_ITEM ( list - > data ) ) ;
g_list_free ( vectors_list ) ;
}
}
}
2008-08-16 21:57:57 +08:00
return_vals = gimp_procedure_get_return_values ( procedure , success ,
error ? * error : NULL ) ;
2006-10-25 23:14:03 +08:00
if ( success )
{
g_value_set_int ( & return_vals - > values [ 1 ] , num_vectors ) ;
gimp_value_take_int32array ( & return_vals - > values [ 2 ] , vectors_ids , num_vectors ) ;
}
return return_vals ;
}
2007-11-19 02:51:54 +08:00
static GValueArray *
2007-12-03 02:05:54 +08:00
vectors_export_to_file_invoker ( GimpProcedure * procedure ,
Gimp * gimp ,
GimpContext * context ,
GimpProgress * progress ,
const GValueArray * args ,
GError * * error )
2007-11-19 02:51:54 +08:00
{
gboolean success = TRUE ;
GimpImage * image ;
const gchar * filename ;
GimpVectors * vectors ;
image = gimp_value_get_image ( & args - > values [ 0 ] , gimp ) ;
filename = g_value_get_string ( & args - > values [ 1 ] ) ;
vectors = gimp_value_get_vectors ( & args - > values [ 2 ] , gimp ) ;
if ( success )
{
2007-12-03 02:05:54 +08:00
success = gimp_vectors_export_file ( image , vectors , filename , error ) ;
2007-11-19 02:51:54 +08:00
}
2008-08-16 21:57:57 +08:00
return gimp_procedure_get_return_values ( procedure , success ,
error ? * error : NULL ) ;
2007-11-19 02:51:54 +08:00
}
static GValueArray *
2007-12-03 02:05:54 +08:00
vectors_export_to_string_invoker ( GimpProcedure * procedure ,
Gimp * gimp ,
GimpContext * context ,
GimpProgress * progress ,
const GValueArray * args ,
GError * * error )
2007-11-19 02:51:54 +08:00
{
gboolean success = TRUE ;
GValueArray * return_vals ;
GimpImage * image ;
GimpVectors * vectors ;
gchar * string = NULL ;
image = gimp_value_get_image ( & args - > values [ 0 ] , gimp ) ;
vectors = gimp_value_get_vectors ( & args - > values [ 1 ] , gimp ) ;
if ( success )
{
2007-12-03 02:05:54 +08:00
string = gimp_vectors_export_string ( image , vectors ) ;
2007-11-19 02:51:54 +08:00
success = ( string ! = NULL ) ;
}
2008-08-16 21:57:57 +08:00
return_vals = gimp_procedure_get_return_values ( procedure , success ,
error ? * error : NULL ) ;
2007-11-19 02:51:54 +08:00
if ( success )
g_value_take_string ( & return_vals - > values [ 1 ] , string ) ;
return return_vals ;
}
2006-04-05 05:11:45 +08:00
void
2006-04-26 17:13:47 +08:00
register_vectors_procs ( GimpPDB * pdb )
2005-12-30 00:05:31 +08:00
{
2006-04-05 05:11:45 +08:00
GimpProcedure * procedure ;
2005-12-30 00:05:31 +08:00
2006-04-05 05:11:45 +08:00
/*
* gimp - vectors - new
*/
2006-04-06 18:01:30 +08:00
procedure = gimp_procedure_new ( vectors_new_invoker ) ;
2008-04-04 18:58:56 +08:00
gimp_object_set_static_name ( GIMP_OBJECT ( procedure ) ,
" gimp-vectors-new " ) ;
2006-04-05 05:11:45 +08:00
gimp_procedure_set_static_strings ( procedure ,
" gimp-vectors-new " ,
" Creates a new empty vectors object. " ,
2010-09-06 06:03:29 +08:00
" Creates a new empty vectors object. The vectors object needs to be added to the image using 'gimp-image-insert-vectors'. " ,
2006-04-05 05:11:45 +08:00
" Simon Budig " ,
" Simon Budig " ,
" 2005 " ,
NULL ) ;
gimp_procedure_add_argument ( procedure ,
gimp_param_spec_image_id ( " image " ,
" image " ,
" The image " ,
2006-05-07 02:57:51 +08:00
pdb - > gimp , FALSE ,
2006-04-05 05:11:45 +08:00
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
gimp_param_spec_string ( " name " ,
" name " ,
" the name of the new vector object. " ,
2007-04-25 22:23:05 +08:00
FALSE , FALSE , FALSE ,
2006-04-05 05:11:45 +08:00
NULL ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_return_value ( procedure ,
gimp_param_spec_vectors_id ( " vectors " ,
" vectors " ,
" the current vector object, 0 if no vector exists in the image. " ,
2006-05-07 02:57:51 +08:00
pdb - > gimp , FALSE ,
2006-04-05 05:11:45 +08:00
GIMP_PARAM_READWRITE ) ) ;
2006-04-26 17:13:47 +08:00
gimp_pdb_register_procedure ( pdb , procedure ) ;
2006-04-07 16:16:26 +08:00
g_object_unref ( procedure ) ;
2005-12-30 00:05:31 +08:00
2008-04-04 22:50:42 +08:00
/*
* gimp - vectors - new - from - text - layer
*/
procedure = gimp_procedure_new ( vectors_new_from_text_layer_invoker ) ;
gimp_object_set_static_name ( GIMP_OBJECT ( procedure ) ,
" gimp-vectors-new-from-text-layer " ) ;
gimp_procedure_set_static_strings ( procedure ,
" gimp-vectors-new-from-text-layer " ,
" Creates a new vectors object from a text layer. " ,
2010-09-06 06:03:29 +08:00
" Creates a new vectors object from a text layer. The vectors object needs to be added to the image using 'gimp-image-insert-vectors'. " ,
2008-04-04 22:50:42 +08:00
" Marcus Heese <heese@cip.ifi.lmu.de> " ,
" Marcus Heese " ,
" 2008 " ,
NULL ) ;
gimp_procedure_add_argument ( procedure ,
gimp_param_spec_image_id ( " image " ,
" image " ,
" The image. " ,
pdb - > gimp , FALSE ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
gimp_param_spec_layer_id ( " layer " ,
" layer " ,
" The text layer. " ,
pdb - > gimp , FALSE ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_return_value ( procedure ,
gimp_param_spec_vectors_id ( " vectors " ,
" vectors " ,
" The vectors of the text layer. " ,
pdb - > gimp , FALSE ,
GIMP_PARAM_READWRITE ) ) ;
gimp_pdb_register_procedure ( pdb , procedure ) ;
g_object_unref ( procedure ) ;
2008-07-28 22:13:18 +08:00
/*
* gimp - vectors - copy
*/
procedure = gimp_procedure_new ( vectors_copy_invoker ) ;
gimp_object_set_static_name ( GIMP_OBJECT ( procedure ) ,
" gimp-vectors-copy " ) ;
gimp_procedure_set_static_strings ( procedure ,
" gimp-vectors-copy " ,
" Copy a vectors object. " ,
" This procedure copies the specified vectors object and returns the copy. " ,
2008-07-29 15:27:40 +08:00
" Barak Itkin <lightningismyname@gmail.com> " ,
" Barak Itkin " ,
2008-07-28 22:13:18 +08:00
" 2008 " ,
NULL ) ;
gimp_procedure_add_argument ( procedure ,
gimp_param_spec_vectors_id ( " vectors " ,
" vectors " ,
" The vectors object to copy " ,
pdb - > gimp , FALSE ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_return_value ( procedure ,
gimp_param_spec_vectors_id ( " vectors-copy " ,
" vectors copy " ,
" The newly copied vectors object " ,
pdb - > gimp , FALSE ,
GIMP_PARAM_READWRITE ) ) ;
gimp_pdb_register_procedure ( pdb , procedure ) ;
g_object_unref ( procedure ) ;
2006-04-05 05:11:45 +08:00
/*
* gimp - vectors - get - strokes
*/
2006-04-06 18:01:30 +08:00
procedure = gimp_procedure_new ( vectors_get_strokes_invoker ) ;
2008-04-04 18:58:56 +08:00
gimp_object_set_static_name ( GIMP_OBJECT ( procedure ) ,
" gimp-vectors-get-strokes " ) ;
2006-04-05 05:11:45 +08:00
gimp_procedure_set_static_strings ( procedure ,
" gimp-vectors-get-strokes " ,
" List the strokes associated with the passed path. " ,
" Returns an Array with the stroke-IDs associated with the passed path. " ,
" Simon Budig " ,
" Simon Budig " ,
" 2005 " ,
NULL ) ;
gimp_procedure_add_argument ( procedure ,
gimp_param_spec_vectors_id ( " vectors " ,
" vectors " ,
" The vectors object " ,
2006-05-07 02:57:51 +08:00
pdb - > gimp , FALSE ,
2006-04-05 05:11:45 +08:00
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_return_value ( procedure ,
gimp_param_spec_int32 ( " num-strokes " ,
" num strokes " ,
" The number of strokes returned. " ,
0 , G_MAXINT32 , 0 ,
GIMP_PARAM_READWRITE ) ) ;
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 17:13:47 +08:00
gimp_pdb_register_procedure ( pdb , procedure ) ;
2006-04-07 16:16:26 +08:00
g_object_unref ( procedure ) ;
2005-12-30 00:05:31 +08:00
2006-04-05 05:11:45 +08:00
/*
* gimp - vectors - stroke - get - length
*/
2006-04-06 18:01:30 +08:00
procedure = gimp_procedure_new ( vectors_stroke_get_length_invoker ) ;
2008-04-04 18:58:56 +08:00
gimp_object_set_static_name ( GIMP_OBJECT ( procedure ) ,
" gimp-vectors-stroke-get-length " ) ;
2006-04-05 05:11:45 +08:00
gimp_procedure_set_static_strings ( procedure ,
" gimp-vectors-stroke-get-length " ,
" Measure the length of the given stroke. " ,
" Measure the length of the given stroke. " ,
" Simon Budig " ,
" Simon Budig " ,
" 2005 " ,
NULL ) ;
gimp_procedure_add_argument ( procedure ,
gimp_param_spec_vectors_id ( " vectors " ,
" vectors " ,
" The vectors object " ,
2006-05-07 02:57:51 +08:00
pdb - > gimp , FALSE ,
2006-04-05 05:11:45 +08:00
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
gimp_param_spec_int32 ( " stroke-id " ,
" stroke id " ,
" The stroke ID " ,
G_MININT32 , G_MAXINT32 , 0 ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
2006-10-24 16:30:55 +08:00
g_param_spec_double ( " precision " ,
" precision " ,
" The precision used for the approximation " ,
2006-04-05 05:11:45 +08:00
- G_MAXDOUBLE , G_MAXDOUBLE , 0 ,
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 17:13:47 +08:00
gimp_pdb_register_procedure ( pdb , procedure ) ;
2006-04-07 16:16:26 +08:00
g_object_unref ( procedure ) ;
2006-03-15 05:35:50 +08:00
2006-04-05 05:11:45 +08:00
/*
* gimp - vectors - stroke - get - point - at - dist
*/
2006-04-06 18:01:30 +08:00
procedure = gimp_procedure_new ( vectors_stroke_get_point_at_dist_invoker ) ;
2008-04-04 18:58:56 +08:00
gimp_object_set_static_name ( GIMP_OBJECT ( procedure ) ,
" gimp-vectors-stroke-get-point-at-dist " ) ;
2006-04-05 05:11:45 +08:00
gimp_procedure_set_static_strings ( procedure ,
" gimp-vectors-stroke-get-point-at-dist " ,
" 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. " ,
" Simon Budig " ,
" Simon Budig " ,
" 2005 " ,
NULL ) ;
gimp_procedure_add_argument ( procedure ,
gimp_param_spec_vectors_id ( " vectors " ,
" vectors " ,
" The vectors object " ,
2006-05-07 02:57:51 +08:00
pdb - > gimp , FALSE ,
2006-04-05 05:11:45 +08:00
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
gimp_param_spec_int32 ( " stroke-id " ,
" stroke id " ,
" The stroke ID " ,
G_MININT32 , G_MAXINT32 , 0 ,
GIMP_PARAM_READWRITE ) ) ;
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 16:30:55 +08:00
g_param_spec_double ( " precision " ,
" precision " ,
" The precision used for the approximation " ,
2006-04-05 05:11:45 +08: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 17:13:47 +08:00
gimp_pdb_register_procedure ( pdb , procedure ) ;
2006-04-07 16:16:26 +08:00
g_object_unref ( procedure ) ;
2005-12-30 00:05:31 +08:00
2006-04-05 05:11:45 +08:00
/*
2006-10-24 22:23:29 +08:00
* gimp - vectors - remove - stroke
2006-04-05 05:11:45 +08:00
*/
2006-10-24 22:23:29 +08:00
procedure = gimp_procedure_new ( vectors_remove_stroke_invoker ) ;
2008-04-04 18:58:56 +08:00
gimp_object_set_static_name ( GIMP_OBJECT ( procedure ) ,
" gimp-vectors-remove-stroke " ) ;
2006-04-05 05:11:45 +08:00
gimp_procedure_set_static_strings ( procedure ,
2006-10-24 22:23:29 +08:00
" gimp-vectors-remove-stroke " ,
2006-04-05 05:11:45 +08:00
" remove the stroke from a vectors object. " ,
" Remove the stroke from a vectors object. " ,
" Simon Budig " ,
" Simon Budig " ,
" 2005 " ,
NULL ) ;
gimp_procedure_add_argument ( procedure ,
gimp_param_spec_vectors_id ( " vectors " ,
" vectors " ,
" The vectors object " ,
2006-05-07 02:57:51 +08:00
pdb - > gimp , FALSE ,
2006-04-05 05:11:45 +08:00
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
gimp_param_spec_int32 ( " stroke-id " ,
" stroke id " ,
" The stroke ID " ,
G_MININT32 , G_MAXINT32 , 0 ,
GIMP_PARAM_READWRITE ) ) ;
2006-04-26 17:13:47 +08:00
gimp_pdb_register_procedure ( pdb , procedure ) ;
2006-04-07 16:16:26 +08:00
g_object_unref ( procedure ) ;
2005-12-30 00:05:31 +08:00
2006-04-05 05:11:45 +08:00
/*
* gimp - vectors - stroke - close
*/
2006-04-06 18:01:30 +08:00
procedure = gimp_procedure_new ( vectors_stroke_close_invoker ) ;
2008-04-04 18:58:56 +08:00
gimp_object_set_static_name ( GIMP_OBJECT ( procedure ) ,
" gimp-vectors-stroke-close " ) ;
2006-04-05 05:11:45 +08:00
gimp_procedure_set_static_strings ( procedure ,
" gimp-vectors-stroke-close " ,
" closes the specified stroke. " ,
" Closes the specified stroke. " ,
" Simon Budig " ,
" Simon Budig " ,
" 2005 " ,
NULL ) ;
gimp_procedure_add_argument ( procedure ,
gimp_param_spec_vectors_id ( " vectors " ,
" vectors " ,
" The vectors object " ,
2006-05-07 02:57:51 +08:00
pdb - > gimp , FALSE ,
2006-04-05 05:11:45 +08:00
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
gimp_param_spec_int32 ( " stroke-id " ,
" stroke id " ,
" The stroke ID " ,
G_MININT32 , G_MAXINT32 , 0 ,
GIMP_PARAM_READWRITE ) ) ;
2006-04-26 17:13:47 +08:00
gimp_pdb_register_procedure ( pdb , procedure ) ;
2006-04-07 16:16:26 +08:00
g_object_unref ( procedure ) ;
2005-12-30 00:05:31 +08:00
2006-04-05 05:11:45 +08:00
/*
* gimp - vectors - stroke - translate
*/
2006-04-06 18:01:30 +08:00
procedure = gimp_procedure_new ( vectors_stroke_translate_invoker ) ;
2008-04-04 18:58:56 +08:00
gimp_object_set_static_name ( GIMP_OBJECT ( procedure ) ,
" gimp-vectors-stroke-translate " ) ;
2006-04-05 05:11:45 +08:00
gimp_procedure_set_static_strings ( procedure ,
" gimp-vectors-stroke-translate " ,
" translate the given stroke. " ,
" Translate the given stroke. " ,
" Simon Budig " ,
" Simon Budig " ,
" 2005 " ,
NULL ) ;
gimp_procedure_add_argument ( procedure ,
gimp_param_spec_vectors_id ( " vectors " ,
" vectors " ,
" The vectors object " ,
2006-05-07 02:57:51 +08:00
pdb - > gimp , FALSE ,
2006-04-05 05:11:45 +08:00
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
gimp_param_spec_int32 ( " stroke-id " ,
" stroke id " ,
" The stroke ID " ,
G_MININT32 , G_MAXINT32 , 0 ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
gimp_param_spec_int32 ( " off-x " ,
" off x " ,
" Offset in x direction " ,
G_MININT32 , G_MAXINT32 , 0 ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
gimp_param_spec_int32 ( " off-y " ,
" off y " ,
" Offset in y direction " ,
G_MININT32 , G_MAXINT32 , 0 ,
GIMP_PARAM_READWRITE ) ) ;
2006-04-26 17:13:47 +08:00
gimp_pdb_register_procedure ( pdb , procedure ) ;
2006-04-07 16:16:26 +08:00
g_object_unref ( procedure ) ;
2005-12-30 00:05:31 +08:00
2006-04-05 05:11:45 +08:00
/*
* gimp - vectors - stroke - scale
*/
2006-04-06 18:01:30 +08:00
procedure = gimp_procedure_new ( vectors_stroke_scale_invoker ) ;
2008-04-04 18:58:56 +08:00
gimp_object_set_static_name ( GIMP_OBJECT ( procedure ) ,
" gimp-vectors-stroke-scale " ) ;
2006-04-05 05:11:45 +08:00
gimp_procedure_set_static_strings ( procedure ,
" gimp-vectors-stroke-scale " ,
" scales the given stroke. " ,
" Scale the given stroke. " ,
" Simon Budig " ,
" Simon Budig " ,
" 2005 " ,
NULL ) ;
gimp_procedure_add_argument ( procedure ,
gimp_param_spec_vectors_id ( " vectors " ,
" vectors " ,
" The vectors object " ,
2006-05-07 02:57:51 +08:00
pdb - > gimp , FALSE ,
2006-04-05 05:11:45 +08:00
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
gimp_param_spec_int32 ( " stroke-id " ,
" stroke id " ,
" The stroke ID " ,
G_MININT32 , G_MAXINT32 , 0 ,
GIMP_PARAM_READWRITE ) ) ;
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 17:13:47 +08:00
gimp_pdb_register_procedure ( pdb , procedure ) ;
2006-04-07 16:16:26 +08:00
g_object_unref ( procedure ) ;
2006-03-15 05:35:50 +08:00
2006-11-20 23:34:30 +08:00
/*
* gimp - vectors - stroke - rotate
*/
procedure = gimp_procedure_new ( vectors_stroke_rotate_invoker ) ;
2008-04-04 18:58:56 +08:00
gimp_object_set_static_name ( GIMP_OBJECT ( procedure ) ,
" gimp-vectors-stroke-rotate " ) ;
2006-11-20 23:34:30 +08:00
gimp_procedure_set_static_strings ( procedure ,
" gimp-vectors-stroke-rotate " ,
" rotates the given stroke. " ,
" Rotates the given stroke around given center by angle (in degrees). " ,
2008-04-29 05:02:29 +08:00
" Jo \xc3 \xa3 o S. O. Bueno " ,
" Jo \xc3 \xa3 o S. O. Bueno " ,
2006-11-20 23:34:30 +08:00
" 2006 " ,
NULL ) ;
gimp_procedure_add_argument ( procedure ,
gimp_param_spec_vectors_id ( " vectors " ,
" vectors " ,
" The vectors object " ,
pdb - > gimp , FALSE ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
gimp_param_spec_int32 ( " stroke-id " ,
" stroke id " ,
" The stroke ID " ,
G_MININT32 , G_MAXINT32 , 0 ,
GIMP_PARAM_READWRITE ) ) ;
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 ) ;
/*
* gimp - vectors - stroke - flip
*/
procedure = gimp_procedure_new ( vectors_stroke_flip_invoker ) ;
2008-04-04 18:58:56 +08:00
gimp_object_set_static_name ( GIMP_OBJECT ( procedure ) ,
" gimp-vectors-stroke-flip " ) ;
2006-11-20 23:34:30 +08:00
gimp_procedure_set_static_strings ( procedure ,
" gimp-vectors-stroke-flip " ,
" flips the given stroke. " ,
" Rotates the given stroke around given center by angle (in degrees). " ,
2008-04-29 05:02:29 +08:00
" Jo \xc3 \xa3 o S. O. Bueno " ,
" Jo \xc3 \xa3 o S. O. Bueno " ,
2006-11-20 23:34:30 +08:00
" 2006 " ,
NULL ) ;
gimp_procedure_add_argument ( procedure ,
gimp_param_spec_vectors_id ( " vectors " ,
" vectors " ,
" The vectors object " ,
pdb - > gimp , FALSE ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
gimp_param_spec_int32 ( " stroke-id " ,
" stroke id " ,
" The stroke ID " ,
G_MININT32 , G_MAXINT32 , 0 ,
GIMP_PARAM_READWRITE ) ) ;
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 ) ;
/*
* gimp - vectors - stroke - flip - free
*/
procedure = gimp_procedure_new ( vectors_stroke_flip_free_invoker ) ;
2008-04-04 18:58:56 +08:00
gimp_object_set_static_name ( GIMP_OBJECT ( procedure ) ,
" gimp-vectors-stroke-flip-free " ) ;
2006-11-20 23:34:30 +08:00
gimp_procedure_set_static_strings ( procedure ,
" gimp-vectors-stroke-flip-free " ,
" 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. " ,
2008-04-29 05:02:29 +08:00
" Jo \xc3 \xa3 o S. O. Bueno " ,
" Jo \xc3 \xa3 o S. O. Bueno " ,
2006-11-20 23:34:30 +08:00
" 2006 " ,
NULL ) ;
gimp_procedure_add_argument ( procedure ,
gimp_param_spec_vectors_id ( " vectors " ,
" vectors " ,
" The vectors object " ,
pdb - > gimp , FALSE ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
gimp_param_spec_int32 ( " stroke-id " ,
" stroke id " ,
" The stroke ID " ,
G_MININT32 , G_MAXINT32 , 0 ,
GIMP_PARAM_READWRITE ) ) ;
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 22:23:29 +08:00
/*
* gimp - vectors - stroke - get - points
*/
procedure = gimp_procedure_new ( vectors_stroke_get_points_invoker ) ;
2008-04-04 18:58:56 +08:00
gimp_object_set_static_name ( GIMP_OBJECT ( procedure ) ,
" gimp-vectors-stroke-get-points " ) ;
2006-10-24 22:23:29 +08:00
gimp_procedure_set_static_strings ( procedure ,
" gimp-vectors-stroke-get-points " ,
" 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. " ,
" Simon Budig " ,
" Simon Budig " ,
" 2006 " ,
NULL ) ;
gimp_procedure_add_argument ( procedure ,
gimp_param_spec_vectors_id ( " vectors " ,
" vectors " ,
" The vectors object " ,
pdb - > gimp , FALSE ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
2006-10-26 23:36:45 +08:00
gimp_param_spec_int32 ( " stroke-id " ,
" stroke id " ,
" The stroke ID " ,
G_MININT32 , G_MAXINT32 , 0 ,
GIMP_PARAM_READWRITE ) ) ;
2006-10-24 22:23:29 +08:00
gimp_procedure_add_return_value ( procedure ,
2006-10-26 23:36:45 +08:00
g_param_spec_enum ( " type " ,
" type " ,
" type of the stroke (always GIMP_VECTORS_STROKE_TYPE_BEZIER for now). " ,
GIMP_TYPE_VECTORS_STROKE_TYPE ,
GIMP_VECTORS_STROKE_TYPE_BEZIER ,
GIMP_PARAM_READWRITE ) ) ;
2006-10-24 22:23:29 +08:00
gimp_procedure_add_return_value ( procedure ,
gimp_param_spec_int32 ( " num-points " ,
" num points " ,
" The number of floats returned. " ,
0 , G_MAXINT32 , 0 ,
GIMP_PARAM_READWRITE ) ) ;
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 23:36:45 +08:00
/*
* gimp - vectors - stroke - new - from - points
*/
procedure = gimp_procedure_new ( vectors_stroke_new_from_points_invoker ) ;
2008-04-04 18:58:56 +08:00
gimp_object_set_static_name ( GIMP_OBJECT ( procedure ) ,
" gimp-vectors-stroke-new-from-points " ) ;
2006-10-26 23:36:45 +08:00
gimp_procedure_set_static_strings ( procedure ,
" gimp-vectors-stroke-new-from-points " ,
" Adds a stroke of a given type to the vectors object. " ,
" Adds a stroke of a given type to the vectors object. The coordinates of the control points can be specified. For now only strokes of the type GIMP_VECTORS_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... " ,
" Simon Budig " ,
" Simon Budig " ,
" 2006 " ,
NULL ) ;
gimp_procedure_add_argument ( procedure ,
gimp_param_spec_vectors_id ( " vectors " ,
" vectors " ,
" The vectors object " ,
pdb - > gimp , FALSE ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
g_param_spec_enum ( " type " ,
" type " ,
" type of the stroke (always GIMP_VECTORS_STROKE_TYPE_BEZIER for now). " ,
GIMP_TYPE_VECTORS_STROKE_TYPE ,
GIMP_VECTORS_STROKE_TYPE_BEZIER ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
gimp_param_spec_int32 ( " num-points " ,
" num points " ,
" The number of elements in the array, i.e. the number of controlpoints in the stroke * 2 (x- and y-coordinate). " ,
0 , G_MAXINT32 , 0 ,
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 ,
gimp_param_spec_int32 ( " stroke-id " ,
" stroke id " ,
" The stroke ID of the newly created stroke. " ,
G_MININT32 , G_MAXINT32 , 0 ,
GIMP_PARAM_READWRITE ) ) ;
gimp_pdb_register_procedure ( pdb , procedure ) ;
g_object_unref ( procedure ) ;
2006-04-05 05:11:45 +08:00
/*
* gimp - vectors - stroke - interpolate
*/
2006-04-06 18:01:30 +08:00
procedure = gimp_procedure_new ( vectors_stroke_interpolate_invoker ) ;
2008-04-04 18:58:56 +08:00
gimp_object_set_static_name ( GIMP_OBJECT ( procedure ) ,
" gimp-vectors-stroke-interpolate " ) ;
2006-04-05 05:11:45 +08:00
gimp_procedure_set_static_strings ( procedure ,
" gimp-vectors-stroke-interpolate " ,
" returns polygonal approximation of the stroke. " ,
" returns polygonal approximation of the stroke. " ,
" Simon Budig " ,
" Simon Budig " ,
" 2005 " ,
NULL ) ;
gimp_procedure_add_argument ( procedure ,
gimp_param_spec_vectors_id ( " vectors " ,
" vectors " ,
" The vectors object " ,
2006-05-07 02:57:51 +08:00
pdb - > gimp , FALSE ,
2006-04-05 05:11:45 +08:00
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
gimp_param_spec_int32 ( " stroke-id " ,
" stroke id " ,
" The stroke ID " ,
G_MININT32 , G_MAXINT32 , 0 ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
2006-10-24 16:30:55 +08:00
g_param_spec_double ( " precision " ,
" precision " ,
" The precision used for the approximation " ,
2006-04-05 05:11:45 +08:00
- G_MAXDOUBLE , G_MAXDOUBLE , 0 ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_return_value ( procedure ,
gimp_param_spec_int32 ( " num-coords " ,
" num coords " ,
" The number of floats returned. " ,
0 , G_MAXINT32 , 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 16:30:55 +08: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 17:13:47 +08:00
gimp_pdb_register_procedure ( pdb , procedure ) ;
2006-04-07 16:16:26 +08:00
g_object_unref ( procedure ) ;
2006-03-15 05:35:50 +08:00
2006-04-05 05:11:45 +08:00
/*
* gimp - vectors - bezier - stroke - new - moveto
*/
2006-04-06 18:01:30 +08:00
procedure = gimp_procedure_new ( vectors_bezier_stroke_new_moveto_invoker ) ;
2008-04-04 18:58:56 +08:00
gimp_object_set_static_name ( GIMP_OBJECT ( procedure ) ,
" gimp-vectors-bezier-stroke-new-moveto " ) ;
2006-04-05 05:11:45 +08:00
gimp_procedure_set_static_strings ( procedure ,
" gimp-vectors-bezier-stroke-new-moveto " ,
" Adds a bezier stroke with a single moveto to the vectors object. " ,
" Adds a bezier stroke with a single moveto to the vectors object. " ,
" Simon Budig " ,
" Simon Budig " ,
" 2005 " ,
NULL ) ;
gimp_procedure_add_argument ( procedure ,
gimp_param_spec_vectors_id ( " vectors " ,
" vectors " ,
" The vectors object " ,
2006-05-07 02:57:51 +08:00
pdb - > gimp , FALSE ,
2006-04-05 05:11:45 +08:00
GIMP_PARAM_READWRITE ) ) ;
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 ,
gimp_param_spec_int32 ( " stroke-id " ,
" stroke id " ,
" The resulting stroke " ,
G_MININT32 , G_MAXINT32 , 0 ,
GIMP_PARAM_READWRITE ) ) ;
2006-04-26 17:13:47 +08:00
gimp_pdb_register_procedure ( pdb , procedure ) ;
2006-04-07 16:16:26 +08:00
g_object_unref ( procedure ) ;
2005-12-30 00:05:31 +08:00
2006-04-05 05:11:45 +08:00
/*
* gimp - vectors - bezier - stroke - lineto
*/
2006-04-06 18:01:30 +08:00
procedure = gimp_procedure_new ( vectors_bezier_stroke_lineto_invoker ) ;
2008-04-04 18:58:56 +08:00
gimp_object_set_static_name ( GIMP_OBJECT ( procedure ) ,
" gimp-vectors-bezier-stroke-lineto " ) ;
2006-04-05 05:11:45 +08:00
gimp_procedure_set_static_strings ( procedure ,
" gimp-vectors-bezier-stroke-lineto " ,
" Extends a bezier stroke with a lineto. " ,
" Extends a bezier stroke with a lineto. " ,
" Simon Budig " ,
" Simon Budig " ,
" 2005 " ,
NULL ) ;
gimp_procedure_add_argument ( procedure ,
gimp_param_spec_vectors_id ( " vectors " ,
" vectors " ,
" The vectors object " ,
2006-05-07 02:57:51 +08:00
pdb - > gimp , FALSE ,
2006-04-05 05:11:45 +08:00
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
gimp_param_spec_int32 ( " stroke-id " ,
" stroke id " ,
" The stroke ID " ,
G_MININT32 , G_MAXINT32 , 0 ,
GIMP_PARAM_READWRITE ) ) ;
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 17:13:47 +08:00
gimp_pdb_register_procedure ( pdb , procedure ) ;
2006-04-07 16:16:26 +08:00
g_object_unref ( procedure ) ;
2005-12-30 00:05:31 +08:00
2006-04-05 05:11:45 +08:00
/*
* gimp - vectors - bezier - stroke - conicto
*/
2006-04-06 18:01:30 +08:00
procedure = gimp_procedure_new ( vectors_bezier_stroke_conicto_invoker ) ;
2008-04-04 18:58:56 +08:00
gimp_object_set_static_name ( GIMP_OBJECT ( procedure ) ,
" gimp-vectors-bezier-stroke-conicto " ) ;
2006-04-05 05:11:45 +08:00
gimp_procedure_set_static_strings ( procedure ,
" gimp-vectors-bezier-stroke-conicto " ,
" 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. " ,
" Simon Budig " ,
" Simon Budig " ,
" 2005 " ,
NULL ) ;
gimp_procedure_add_argument ( procedure ,
gimp_param_spec_vectors_id ( " vectors " ,
" vectors " ,
" The vectors object " ,
2006-05-07 02:57:51 +08:00
pdb - > gimp , FALSE ,
2006-04-05 05:11:45 +08:00
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
gimp_param_spec_int32 ( " stroke-id " ,
" stroke id " ,
" The stroke ID " ,
G_MININT32 , G_MAXINT32 , 0 ,
GIMP_PARAM_READWRITE ) ) ;
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 17:13:47 +08:00
gimp_pdb_register_procedure ( pdb , procedure ) ;
2006-04-07 16:16:26 +08:00
g_object_unref ( procedure ) ;
2006-03-19 21:39:10 +08:00
2006-04-05 05:11:45 +08:00
/*
* gimp - vectors - bezier - stroke - cubicto
*/
2006-04-06 18:01:30 +08:00
procedure = gimp_procedure_new ( vectors_bezier_stroke_cubicto_invoker ) ;
2008-04-04 18:58:56 +08:00
gimp_object_set_static_name ( GIMP_OBJECT ( procedure ) ,
" gimp-vectors-bezier-stroke-cubicto " ) ;
2006-04-05 05:11:45 +08:00
gimp_procedure_set_static_strings ( procedure ,
" gimp-vectors-bezier-stroke-cubicto " ,
" Extends a bezier stroke with a cubic bezier spline. " ,
" Extends a bezier stroke with a cubic bezier spline. " ,
" Simon Budig " ,
" Simon Budig " ,
" 2005 " ,
NULL ) ;
gimp_procedure_add_argument ( procedure ,
gimp_param_spec_vectors_id ( " vectors " ,
" vectors " ,
" The vectors object " ,
2006-05-07 02:57:51 +08:00
pdb - > gimp , FALSE ,
2006-04-05 05:11:45 +08:00
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
gimp_param_spec_int32 ( " stroke-id " ,
" stroke id " ,
" The stroke ID " ,
G_MININT32 , G_MAXINT32 , 0 ,
GIMP_PARAM_READWRITE ) ) ;
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 17:13:47 +08:00
gimp_pdb_register_procedure ( pdb , procedure ) ;
2006-04-07 16:16:26 +08:00
g_object_unref ( procedure ) ;
2005-12-30 00:05:31 +08:00
2006-04-05 05:11:45 +08:00
/*
* gimp - vectors - bezier - stroke - new - ellipse
*/
2006-04-06 18:01:30 +08:00
procedure = gimp_procedure_new ( vectors_bezier_stroke_new_ellipse_invoker ) ;
2008-04-04 18:58:56 +08:00
gimp_object_set_static_name ( GIMP_OBJECT ( procedure ) ,
" gimp-vectors-bezier-stroke-new-ellipse " ) ;
2006-04-05 05:11:45 +08:00
gimp_procedure_set_static_strings ( procedure ,
" gimp-vectors-bezier-stroke-new-ellipse " ,
" Adds a bezier stroke describing an ellipse the vectors object. " ,
" Adds a bezier stroke describing an ellipse the vectors object. " ,
" Simon Budig " ,
" Simon Budig " ,
" 2005 " ,
NULL ) ;
gimp_procedure_add_argument ( procedure ,
gimp_param_spec_vectors_id ( " vectors " ,
" vectors " ,
" The vectors object " ,
2006-05-07 02:57:51 +08:00
pdb - > gimp , FALSE ,
2006-04-05 05:11:45 +08:00
GIMP_PARAM_READWRITE ) ) ;
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 ,
gimp_param_spec_int32 ( " stroke-id " ,
" stroke id " ,
" The resulting stroke " ,
G_MININT32 , G_MAXINT32 , 0 ,
GIMP_PARAM_READWRITE ) ) ;
2006-04-26 17:13:47 +08:00
gimp_pdb_register_procedure ( pdb , procedure ) ;
2006-04-07 16:16:26 +08:00
g_object_unref ( procedure ) ;
2006-07-28 22:54:31 +08:00
/*
* gimp - vectors - to - selection
*/
procedure = gimp_procedure_new ( vectors_to_selection_invoker ) ;
2008-04-04 18:58:56 +08:00
gimp_object_set_static_name ( GIMP_OBJECT ( procedure ) ,
" gimp-vectors-to-selection " ) ;
2006-07-28 22:54:31 +08:00
gimp_procedure_set_static_strings ( procedure ,
" gimp-vectors-to-selection " ,
2011-02-14 01:31:14 +08:00
" Deprecated: Use 'gimp-image-select-item' instead. " ,
" Deprecated: Use 'gimp-image-select-item' instead. " ,
2006-07-28 22:54:31 +08:00
" Simon Budig " ,
" Simon Budig " ,
" 2006 " ,
2011-02-14 01:31:14 +08:00
" gimp-image-select-item " ) ;
2006-07-28 22:54:31 +08:00
gimp_procedure_add_argument ( procedure ,
gimp_param_spec_vectors_id ( " vectors " ,
" vectors " ,
" The vectors object to render to the selection " ,
pdb - > gimp , FALSE ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
2006-07-29 01:34:50 +08:00
g_param_spec_enum ( " operation " ,
" operation " ,
2006-07-28 22:54:31 +08:00
" The desired operation with current selection " ,
GIMP_TYPE_CHANNEL_OPS ,
GIMP_CHANNEL_OP_ADD ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
g_param_spec_boolean ( " antialias " ,
" antialias " ,
" Antialias selection. " ,
FALSE ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
g_param_spec_boolean ( " feather " ,
" feather " ,
" Feather selection. " ,
FALSE ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
g_param_spec_double ( " feather-radius-x " ,
" feather radius x " ,
" Feather radius x. " ,
- G_MAXDOUBLE , G_MAXDOUBLE , 0 ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
g_param_spec_double ( " feather-radius-y " ,
" feather radius y " ,
" Feather radius y. " ,
- G_MAXDOUBLE , G_MAXDOUBLE , 0 ,
GIMP_PARAM_READWRITE ) ) ;
gimp_pdb_register_procedure ( pdb , procedure ) ;
g_object_unref ( procedure ) ;
2006-10-25 23:14:03 +08:00
/*
2006-11-24 05:45:54 +08:00
* gimp - vectors - import - from - file
2006-10-25 23:14:03 +08:00
*/
2006-11-24 05:45:54 +08:00
procedure = gimp_procedure_new ( vectors_import_from_file_invoker ) ;
2008-04-04 18:58:56 +08:00
gimp_object_set_static_name ( GIMP_OBJECT ( procedure ) ,
" gimp-vectors-import-from-file " ) ;
2006-10-25 23:14:03 +08:00
gimp_procedure_set_static_strings ( procedure ,
2006-11-24 05:45:54 +08:00
" gimp-vectors-import-from-file " ,
2006-10-25 23:14:03 +08:00
" Import paths from an SVG file. " ,
" This procedure imports paths from an SVG file. SVG elements other than paths and basic shapes are ignored. " ,
" Simon Budig " ,
" Simon Budig " ,
" 2006 " ,
NULL ) ;
gimp_procedure_add_argument ( procedure ,
gimp_param_spec_image_id ( " image " ,
" image " ,
" The image " ,
pdb - > gimp , FALSE ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
gimp_param_spec_string ( " filename " ,
" filename " ,
" The name of the SVG file to import. " ,
2007-04-25 22:23:05 +08:00
TRUE , FALSE , TRUE ,
2006-10-25 23:14:03 +08:00
NULL ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
g_param_spec_boolean ( " merge " ,
" merge " ,
" Merge paths into a single vectors object. " ,
FALSE ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
g_param_spec_boolean ( " scale " ,
" scale " ,
" Scale the SVG to image dimensions. " ,
FALSE ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_return_value ( procedure ,
gimp_param_spec_int32 ( " num-vectors " ,
" num vectors " ,
" The number of newly created vectors " ,
0 , G_MAXINT32 , 0 ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_return_value ( procedure ,
gimp_param_spec_int32_array ( " vectors-ids " ,
" vectors ids " ,
" The list of newly created vectors " ,
GIMP_PARAM_READWRITE ) ) ;
gimp_pdb_register_procedure ( pdb , procedure ) ;
g_object_unref ( procedure ) ;
/*
2006-11-24 05:45:54 +08:00
* gimp - vectors - import - from - string
2006-10-25 23:14:03 +08:00
*/
2006-11-24 05:45:54 +08:00
procedure = gimp_procedure_new ( vectors_import_from_string_invoker ) ;
2008-04-04 18:58:56 +08:00
gimp_object_set_static_name ( GIMP_OBJECT ( procedure ) ,
" gimp-vectors-import-from-string " ) ;
2006-10-25 23:14:03 +08:00
gimp_procedure_set_static_strings ( procedure ,
2006-11-24 05:45:54 +08:00
" gimp-vectors-import-from-string " ,
2006-10-25 23:14:03 +08:00
" Import paths from an SVG string. " ,
2006-11-24 06:26:58 +08:00
" This procedure works like 'gimp-vectors-import-from-file' but takes a string rather than reading the SVG from a file. This allows you to write scripts that generate SVG and feed it to GIMP. " ,
2006-10-25 23:14:03 +08:00
" Simon Budig " ,
" Simon Budig " ,
" 2006 " ,
NULL ) ;
gimp_procedure_add_argument ( procedure ,
gimp_param_spec_image_id ( " image " ,
" image " ,
" The image " ,
pdb - > gimp , FALSE ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
gimp_param_spec_string ( " string " ,
" string " ,
" A string that must be a complete and valid SVG document. " ,
2007-04-25 22:23:05 +08:00
TRUE , FALSE , FALSE ,
2006-10-25 23:14:03 +08:00
NULL ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
gimp_param_spec_int32 ( " length " ,
" length " ,
" Number of bytes in string or -1 if the string is NULL terminated. " ,
G_MININT32 , G_MAXINT32 , 0 ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
g_param_spec_boolean ( " merge " ,
" merge " ,
" Merge paths into a single vectors object. " ,
FALSE ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
g_param_spec_boolean ( " scale " ,
" scale " ,
" Scale the SVG to image dimensions. " ,
FALSE ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_return_value ( procedure ,
gimp_param_spec_int32 ( " num-vectors " ,
" num vectors " ,
" The number of newly created vectors " ,
0 , G_MAXINT32 , 0 ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_return_value ( procedure ,
gimp_param_spec_int32_array ( " vectors-ids " ,
" vectors ids " ,
" The list of newly created vectors " ,
GIMP_PARAM_READWRITE ) ) ;
gimp_pdb_register_procedure ( pdb , procedure ) ;
g_object_unref ( procedure ) ;
2007-11-19 02:51:54 +08:00
/*
* gimp - vectors - export - to - file
*/
procedure = gimp_procedure_new ( vectors_export_to_file_invoker ) ;
2008-04-04 18:58:56 +08:00
gimp_object_set_static_name ( GIMP_OBJECT ( procedure ) ,
" gimp-vectors-export-to-file " ) ;
2007-11-19 02:51:54 +08:00
gimp_procedure_set_static_strings ( procedure ,
" gimp-vectors-export-to-file " ,
" save a path as an SVG file. " ,
" This procedure creates an SVG file to save a Vectors object, that is, a path. The resulting file can be edited using a vector graphics application, or later reloaded into GIMP. If you pass 0 as the 'vectors' argument, then all paths in the image will be exported. " ,
" Bill Skaggs <weskaggs@primate.ucdavis.edu> " ,
" Bill Skaggs " ,
" 2007 " ,
NULL ) ;
gimp_procedure_add_argument ( procedure ,
gimp_param_spec_image_id ( " image " ,
" image " ,
" The image " ,
pdb - > gimp , FALSE ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
gimp_param_spec_string ( " filename " ,
" filename " ,
" The name of the SVG file to create. " ,
TRUE , FALSE , TRUE ,
NULL ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
gimp_param_spec_vectors_id ( " vectors " ,
" vectors " ,
" The vectors object to be saved, or 0 for all in the image " ,
pdb - > gimp , FALSE ,
GIMP_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE ) ) ;
gimp_pdb_register_procedure ( pdb , procedure ) ;
g_object_unref ( procedure ) ;
/*
* gimp - vectors - export - to - string
*/
procedure = gimp_procedure_new ( vectors_export_to_string_invoker ) ;
2008-04-04 18:58:56 +08:00
gimp_object_set_static_name ( GIMP_OBJECT ( procedure ) ,
" gimp-vectors-export-to-string " ) ;
2007-11-19 02:51:54 +08:00
gimp_procedure_set_static_strings ( procedure ,
" gimp-vectors-export-to-string " ,
" Save a path as an SVG string. " ,
2010-07-07 17:46:58 +08:00
" This procedure works like 'gimp-vectors-export-to-file' but creates a string rather than a file. The contents are a NUL-terminated string that holds a complete XML document. If you pass 0 as the 'vectors' argument, then all paths in the image will be exported. " ,
2007-11-19 02:51:54 +08:00
" Bill Skaggs <weskaggs@primate.ucdavis.edu> " ,
" Bill Skaggs " ,
" 2007 " ,
NULL ) ;
gimp_procedure_add_argument ( procedure ,
gimp_param_spec_image_id ( " image " ,
" image " ,
" The image " ,
pdb - > gimp , FALSE ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
gimp_param_spec_vectors_id ( " vectors " ,
" vectors " ,
" The vectors object to save, or 0 for all in the image " ,
pdb - > gimp , FALSE ,
GIMP_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE ) ) ;
gimp_procedure_add_return_value ( procedure ,
gimp_param_spec_string ( " string " ,
" string " ,
" A string whose contents are a complete SVG document. " ,
FALSE , FALSE , FALSE ,
NULL ,
GIMP_PARAM_READWRITE ) ) ;
gimp_pdb_register_procedure ( pdb , procedure ) ;
g_object_unref ( procedure ) ;
2005-12-30 00:05:31 +08:00
}