tools/pdbgen/pdb/image.pdb Added new functions for the vectors PDB API.

2005-12-28  Simon Budig  <simon@gimp.org>

	* tools/pdbgen/pdb/image.pdb
	* tools/pdbgen/pdb/vectors.pdb: Added new functions for the vectors
	PDB API. Minor cleanups. Please try to use them and test:

	  gimp_image_get_active_vectors
	  gimp_image_set_active_vectors
	  gimp_image_get_vectors_by_tattoo
	  gimp_image_lower_vectors
	  gimp_image_lower_vectors_to_bottom
	  gimp_image_raise_vectors
	  gimp_image_raise_vectors_to_top
	  gimp_image_remove_vectors

	  gimp_vectors_get_locked
	  gimp_vectors_set_locked
	  gimp_vectors_get_name
	  gimp_vectors_set_name
	  gimp_vectors_get_visible
	  gimp_vectors_set_visible
	  gimp_vectors_stroke_get_length
	  gimp_vectors_stroke_remove
	  gimp_vectors_stroke_scale

	* libgimp/gimp.[ch]: renamed the unused d_path to d_vectors and
	use it. Untabbified.

	* devel-docs/libgimp/tmpl/gimpvectors.sgml
	* app/pdb/image_cmds.c
	* app/pdb/internal_procs.c
	* app/pdb/vectors_cmds.c
	* libgimp/gimpimage_pdb.[ch]
	* libgimp/gimpvectors_pdb.[ch]: Regenerated

	* app/vectors/gimpstroke.h: minor cleanup.
This commit is contained in:
Simon Budig
2005-12-28 21:24:12 +00:00
committed by Simon Budig
parent fa41465e2a
commit cbea67912b
14 changed files with 2313 additions and 326 deletions

View File

@ -1,3 +1,40 @@
2005-12-28 Simon Budig <simon@gimp.org>
* tools/pdbgen/pdb/image.pdb
* tools/pdbgen/pdb/vectors.pdb: Added new functions for the vectors
PDB API. Minor cleanups. Please try to use them and test:
gimp_image_get_active_vectors
gimp_image_set_active_vectors
gimp_image_get_vectors_by_tattoo
gimp_image_lower_vectors
gimp_image_lower_vectors_to_bottom
gimp_image_raise_vectors
gimp_image_raise_vectors_to_top
gimp_image_remove_vectors
gimp_vectors_get_locked
gimp_vectors_set_locked
gimp_vectors_get_name
gimp_vectors_set_name
gimp_vectors_get_visible
gimp_vectors_set_visible
gimp_vectors_stroke_get_length
gimp_vectors_stroke_remove
gimp_vectors_stroke_scale
* libgimp/gimp.[ch]: renamed the unused d_path to d_vectors and
use it. Untabbified.
* devel-docs/libgimp/tmpl/gimpvectors.sgml
* app/pdb/image_cmds.c
* app/pdb/internal_procs.c
* app/pdb/vectors_cmds.c
* libgimp/gimpimage_pdb.[ch]
* libgimp/gimpvectors_pdb.[ch]: Regenerated
* app/vectors/gimpstroke.h: minor cleanup.
2005-12-28 Sven Neumann <sven@gimp.org> 2005-12-28 Sven Neumann <sven@gimp.org>
* menus/image-menu.xml.in: added "Image/Arrange" placeholder. * menus/image-menu.xml.in: added "Image/Arrange" placeholder.

View File

@ -50,6 +50,7 @@
#include "core/gimplist.h" #include "core/gimplist.h"
#include "core/gimpunit.h" #include "core/gimpunit.h"
#include "gimp-intl.h" #include "gimp-intl.h"
#include "vectors/gimpvectors.h"
static ProcRecord image_list_proc; static ProcRecord image_list_proc;
static ProcRecord image_new_proc; static ProcRecord image_new_proc;
@ -80,8 +81,13 @@ static ProcRecord image_raise_layer_proc;
static ProcRecord image_lower_layer_proc; static ProcRecord image_lower_layer_proc;
static ProcRecord image_raise_layer_to_top_proc; static ProcRecord image_raise_layer_to_top_proc;
static ProcRecord image_lower_layer_to_bottom_proc; static ProcRecord image_lower_layer_to_bottom_proc;
static ProcRecord image_raise_vectors_proc;
static ProcRecord image_lower_vectors_proc;
static ProcRecord image_raise_vectors_to_top_proc;
static ProcRecord image_lower_vectors_to_bottom_proc;
static ProcRecord image_add_channel_proc; static ProcRecord image_add_channel_proc;
static ProcRecord image_remove_channel_proc; static ProcRecord image_remove_channel_proc;
static ProcRecord image_remove_vectors_proc;
static ProcRecord image_raise_channel_proc; static ProcRecord image_raise_channel_proc;
static ProcRecord image_lower_channel_proc; static ProcRecord image_lower_channel_proc;
static ProcRecord image_flatten_proc; static ProcRecord image_flatten_proc;
@ -98,6 +104,8 @@ static ProcRecord image_get_active_layer_proc;
static ProcRecord image_set_active_layer_proc; static ProcRecord image_set_active_layer_proc;
static ProcRecord image_get_active_channel_proc; static ProcRecord image_get_active_channel_proc;
static ProcRecord image_set_active_channel_proc; static ProcRecord image_set_active_channel_proc;
static ProcRecord image_get_active_vectors_proc;
static ProcRecord image_set_active_vectors_proc;
static ProcRecord image_get_selection_proc; static ProcRecord image_get_selection_proc;
static ProcRecord image_get_component_active_proc; static ProcRecord image_get_component_active_proc;
static ProcRecord image_set_component_active_proc; static ProcRecord image_set_component_active_proc;
@ -114,6 +122,7 @@ static ProcRecord image_get_tattoo_state_proc;
static ProcRecord image_set_tattoo_state_proc; static ProcRecord image_set_tattoo_state_proc;
static ProcRecord image_get_layer_by_tattoo_proc; static ProcRecord image_get_layer_by_tattoo_proc;
static ProcRecord image_get_channel_by_tattoo_proc; static ProcRecord image_get_channel_by_tattoo_proc;
static ProcRecord image_get_vectors_by_tattoo_proc;
void void
register_image_procs (Gimp *gimp) register_image_procs (Gimp *gimp)
@ -147,8 +156,13 @@ register_image_procs (Gimp *gimp)
procedural_db_register (gimp, &image_lower_layer_proc); procedural_db_register (gimp, &image_lower_layer_proc);
procedural_db_register (gimp, &image_raise_layer_to_top_proc); procedural_db_register (gimp, &image_raise_layer_to_top_proc);
procedural_db_register (gimp, &image_lower_layer_to_bottom_proc); procedural_db_register (gimp, &image_lower_layer_to_bottom_proc);
procedural_db_register (gimp, &image_raise_vectors_proc);
procedural_db_register (gimp, &image_lower_vectors_proc);
procedural_db_register (gimp, &image_raise_vectors_to_top_proc);
procedural_db_register (gimp, &image_lower_vectors_to_bottom_proc);
procedural_db_register (gimp, &image_add_channel_proc); procedural_db_register (gimp, &image_add_channel_proc);
procedural_db_register (gimp, &image_remove_channel_proc); procedural_db_register (gimp, &image_remove_channel_proc);
procedural_db_register (gimp, &image_remove_vectors_proc);
procedural_db_register (gimp, &image_raise_channel_proc); procedural_db_register (gimp, &image_raise_channel_proc);
procedural_db_register (gimp, &image_lower_channel_proc); procedural_db_register (gimp, &image_lower_channel_proc);
procedural_db_register (gimp, &image_flatten_proc); procedural_db_register (gimp, &image_flatten_proc);
@ -165,6 +179,8 @@ register_image_procs (Gimp *gimp)
procedural_db_register (gimp, &image_set_active_layer_proc); procedural_db_register (gimp, &image_set_active_layer_proc);
procedural_db_register (gimp, &image_get_active_channel_proc); procedural_db_register (gimp, &image_get_active_channel_proc);
procedural_db_register (gimp, &image_set_active_channel_proc); procedural_db_register (gimp, &image_set_active_channel_proc);
procedural_db_register (gimp, &image_get_active_vectors_proc);
procedural_db_register (gimp, &image_set_active_vectors_proc);
procedural_db_register (gimp, &image_get_selection_proc); procedural_db_register (gimp, &image_get_selection_proc);
procedural_db_register (gimp, &image_get_component_active_proc); procedural_db_register (gimp, &image_get_component_active_proc);
procedural_db_register (gimp, &image_set_component_active_proc); procedural_db_register (gimp, &image_set_component_active_proc);
@ -181,6 +197,7 @@ register_image_procs (Gimp *gimp)
procedural_db_register (gimp, &image_set_tattoo_state_proc); procedural_db_register (gimp, &image_set_tattoo_state_proc);
procedural_db_register (gimp, &image_get_layer_by_tattoo_proc); procedural_db_register (gimp, &image_get_layer_by_tattoo_proc);
procedural_db_register (gimp, &image_get_channel_by_tattoo_proc); procedural_db_register (gimp, &image_get_channel_by_tattoo_proc);
procedural_db_register (gimp, &image_get_vectors_by_tattoo_proc);
} }
#if defined (HAVE_FINITE) #if defined (HAVE_FINITE)
@ -2141,6 +2158,230 @@ static ProcRecord image_lower_layer_to_bottom_proc =
{ { image_lower_layer_to_bottom_invoker } } { { image_lower_layer_to_bottom_invoker } }
}; };
static Argument *
image_raise_vectors_invoker (Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
GimpImage *gimage;
GimpVectors *vectors;
gimage = gimp_image_get_by_ID (gimp, args[0].value.pdb_int);
if (! GIMP_IS_IMAGE (gimage))
success = FALSE;
vectors = (GimpVectors *) gimp_item_get_by_ID (gimp, args[1].value.pdb_int);
if (! (GIMP_IS_VECTORS (vectors) && ! gimp_item_is_removed (GIMP_ITEM (vectors))))
success = FALSE;
if (success)
success = gimp_image_raise_vectors (gimage, vectors);
return procedural_db_return_args (&image_raise_vectors_proc, success);
}
static ProcArg image_raise_vectors_inargs[] =
{
{
GIMP_PDB_IMAGE,
"image",
"The image"
},
{
GIMP_PDB_PATH,
"vectors",
"The vectors object to raise"
}
};
static ProcRecord image_raise_vectors_proc =
{
"gimp-image-raise-vectors",
"gimp-image-raise-vectors",
"Raise the specified vectors in the image's vectors stack",
"This procedure raises the specified vectors one step in the existing vectors stack. It will not move the vectors if there is no vectors above it.",
"Simon Budig",
"Spencer Kimball & Peter Mattis",
"2005",
NULL,
GIMP_INTERNAL,
2,
image_raise_vectors_inargs,
0,
NULL,
{ { image_raise_vectors_invoker } }
};
static Argument *
image_lower_vectors_invoker (Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
GimpImage *gimage;
GimpVectors *vectors;
gimage = gimp_image_get_by_ID (gimp, args[0].value.pdb_int);
if (! GIMP_IS_IMAGE (gimage))
success = FALSE;
vectors = (GimpVectors *) gimp_item_get_by_ID (gimp, args[1].value.pdb_int);
if (! (GIMP_IS_VECTORS (vectors) && ! gimp_item_is_removed (GIMP_ITEM (vectors))))
success = FALSE;
if (success)
success = gimp_image_lower_vectors (gimage, vectors);
return procedural_db_return_args (&image_lower_vectors_proc, success);
}
static ProcArg image_lower_vectors_inargs[] =
{
{
GIMP_PDB_IMAGE,
"image",
"The image"
},
{
GIMP_PDB_PATH,
"vectors",
"The vectors object to lower"
}
};
static ProcRecord image_lower_vectors_proc =
{
"gimp-image-lower-vectors",
"gimp-image-lower-vectors",
"Lower the specified vectors in the image's vectors stack",
"This procedure lowers the specified vectors one step in the existing vectors stack. It will not move the vectors if there is no vectors below it.",
"Simon Budig",
"Spencer Kimball & Peter Mattis",
"2005",
NULL,
GIMP_INTERNAL,
2,
image_lower_vectors_inargs,
0,
NULL,
{ { image_lower_vectors_invoker } }
};
static Argument *
image_raise_vectors_to_top_invoker (Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
GimpImage *gimage;
GimpVectors *vectors;
gimage = gimp_image_get_by_ID (gimp, args[0].value.pdb_int);
if (! GIMP_IS_IMAGE (gimage))
success = FALSE;
vectors = (GimpVectors *) gimp_item_get_by_ID (gimp, args[1].value.pdb_int);
if (! (GIMP_IS_VECTORS (vectors) && ! gimp_item_is_removed (GIMP_ITEM (vectors))))
success = FALSE;
if (success)
success = gimp_image_raise_vectors_to_top (gimage, vectors);
return procedural_db_return_args (&image_raise_vectors_to_top_proc, success);
}
static ProcArg image_raise_vectors_to_top_inargs[] =
{
{
GIMP_PDB_IMAGE,
"image",
"The image"
},
{
GIMP_PDB_PATH,
"vectors",
"The vectors object to raise to top"
}
};
static ProcRecord image_raise_vectors_to_top_proc =
{
"gimp-image-raise-vectors-to-top",
"gimp-image-raise-vectors-to-top",
"Raise the specified vectors in the image's vectors stack to top of stack",
"This procedure raises the specified vectors to top of the existing vectors stack. It will not move the vectors if there is no vectors above it.",
"Simon Budig",
"Spencer Kimball & Peter Mattis",
"2005",
NULL,
GIMP_INTERNAL,
2,
image_raise_vectors_to_top_inargs,
0,
NULL,
{ { image_raise_vectors_to_top_invoker } }
};
static Argument *
image_lower_vectors_to_bottom_invoker (Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
GimpImage *gimage;
GimpVectors *vectors;
gimage = gimp_image_get_by_ID (gimp, args[0].value.pdb_int);
if (! GIMP_IS_IMAGE (gimage))
success = FALSE;
vectors = (GimpVectors *) gimp_item_get_by_ID (gimp, args[1].value.pdb_int);
if (! (GIMP_IS_VECTORS (vectors) && ! gimp_item_is_removed (GIMP_ITEM (vectors))))
success = FALSE;
if (success)
success = gimp_image_lower_vectors_to_bottom (gimage, vectors);
return procedural_db_return_args (&image_lower_vectors_to_bottom_proc, success);
}
static ProcArg image_lower_vectors_to_bottom_inargs[] =
{
{
GIMP_PDB_IMAGE,
"image",
"The image"
},
{
GIMP_PDB_PATH,
"vectors",
"The vectors object to lower to bottom"
}
};
static ProcRecord image_lower_vectors_to_bottom_proc =
{
"gimp-image-lower-vectors-to-bottom",
"gimp-image-lower-vectors-to-bottom",
"Lower the specified vectors in the image's vectors stack to bottom of stack",
"This procedure lowers the specified vectors to bottom of the existing vectors stack. It will not move the vectors if there is no vectors below it.",
"Simon Budig",
"Spencer Kimball & Peter Mattis",
"2005",
NULL,
GIMP_INTERNAL,
2,
image_lower_vectors_to_bottom_inargs,
0,
NULL,
{ { image_lower_vectors_to_bottom_invoker } }
};
static Argument * static Argument *
image_add_channel_invoker (Gimp *gimp, image_add_channel_invoker (Gimp *gimp,
GimpContext *context, GimpContext *context,
@ -2266,6 +2507,62 @@ static ProcRecord image_remove_channel_proc =
{ { image_remove_channel_invoker } } { { image_remove_channel_invoker } }
}; };
static Argument *
image_remove_vectors_invoker (Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
GimpImage *gimage;
GimpVectors *vectors;
gimage = gimp_image_get_by_ID (gimp, args[0].value.pdb_int);
if (! GIMP_IS_IMAGE (gimage))
success = FALSE;
vectors = (GimpVectors *) gimp_item_get_by_ID (gimp, args[1].value.pdb_int);
if (! (GIMP_IS_VECTORS (vectors) && ! gimp_item_is_removed (GIMP_ITEM (vectors))))
success = FALSE;
if (success)
gimp_image_remove_vectors (gimage, vectors);
return procedural_db_return_args (&image_remove_vectors_proc, success);
}
static ProcArg image_remove_vectors_inargs[] =
{
{
GIMP_PDB_IMAGE,
"image",
"The image"
},
{
GIMP_PDB_PATH,
"vectors",
"The vectors object"
}
};
static ProcRecord image_remove_vectors_proc =
{
"gimp-image-remove-vectors",
"gimp-image-remove-vectors",
"Remove the specified path from the image.",
"This procedure removes the specified path from the image. If the path doesn't exist, an error is returned.",
"Simon Budig",
"Spencer Kimball & Peter Mattis",
"2005",
NULL,
GIMP_INTERNAL,
2,
image_remove_vectors_inargs,
0,
NULL,
{ { image_remove_vectors_invoker } }
};
static Argument * static Argument *
image_raise_channel_invoker (Gimp *gimp, image_raise_channel_invoker (Gimp *gimp,
GimpContext *context, GimpContext *context,
@ -3366,6 +3663,124 @@ static ProcRecord image_set_active_channel_proc =
{ { image_set_active_channel_invoker } } { { image_set_active_channel_invoker } }
}; };
static Argument *
image_get_active_vectors_invoker (Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
Argument *return_args;
GimpImage *gimage;
GimpVectors *active_vectors = NULL;
gimage = gimp_image_get_by_ID (gimp, args[0].value.pdb_int);
if (! GIMP_IS_IMAGE (gimage))
success = FALSE;
if (success)
active_vectors = gimp_image_get_active_vectors (gimage);
return_args = procedural_db_return_args (&image_get_active_vectors_proc, success);
if (success)
return_args[1].value.pdb_int = active_vectors ? gimp_item_get_ID (GIMP_ITEM (active_vectors)) : -1;
return return_args;
}
static ProcArg image_get_active_vectors_inargs[] =
{
{
GIMP_PDB_IMAGE,
"image",
"The image"
}
};
static ProcArg image_get_active_vectors_outargs[] =
{
{
GIMP_PDB_PATH,
"active-vectors",
"The active vectors"
}
};
static ProcRecord image_get_active_vectors_proc =
{
"gimp-image-get-active-vectors",
"gimp-image-get-active-vectors",
"Returns the specified image's active vectors.",
"If there is an active path, its ID will be returned, otherwise, -1.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
NULL,
GIMP_INTERNAL,
1,
image_get_active_vectors_inargs,
1,
image_get_active_vectors_outargs,
{ { image_get_active_vectors_invoker } }
};
static Argument *
image_set_active_vectors_invoker (Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
GimpImage *gimage;
GimpVectors *active_vectors;
gimage = gimp_image_get_by_ID (gimp, args[0].value.pdb_int);
if (! GIMP_IS_IMAGE (gimage))
success = FALSE;
active_vectors = (GimpVectors *) gimp_item_get_by_ID (gimp, args[1].value.pdb_int);
if (! (GIMP_IS_VECTORS (active_vectors) && ! gimp_item_is_removed (GIMP_ITEM (active_vectors))))
success = FALSE;
if (success)
success = (gimp_image_set_active_vectors (gimage, active_vectors) == active_vectors);
return procedural_db_return_args (&image_set_active_vectors_proc, success);
}
static ProcArg image_set_active_vectors_inargs[] =
{
{
GIMP_PDB_IMAGE,
"image",
"The image"
},
{
GIMP_PDB_PATH,
"active-vectors",
"The new image active vectors"
}
};
static ProcRecord image_set_active_vectors_proc =
{
"gimp-image-set-active-vectors",
"gimp-image-set-active-vectors",
"Sets the specified image's active vectors.",
"If the path exists, it is set as the active path in the image.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
NULL,
GIMP_INTERNAL,
2,
image_set_active_vectors_inargs,
0,
NULL,
{ { image_set_active_vectors_invoker } }
};
static Argument * static Argument *
image_get_selection_invoker (Gimp *gimp, image_get_selection_invoker (Gimp *gimp,
GimpContext *context, GimpContext *context,
@ -4453,3 +4868,78 @@ static ProcRecord image_get_channel_by_tattoo_proc =
image_get_channel_by_tattoo_outargs, image_get_channel_by_tattoo_outargs,
{ { image_get_channel_by_tattoo_invoker } } { { image_get_channel_by_tattoo_invoker } }
}; };
static Argument *
image_get_vectors_by_tattoo_invoker (Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
Argument *return_args;
GimpImage *gimage;
gint32 tattoo;
GimpVectors *vectors = NULL;
gimage = gimp_image_get_by_ID (gimp, args[0].value.pdb_int);
if (! GIMP_IS_IMAGE (gimage))
success = FALSE;
tattoo = args[1].value.pdb_int;
if (tattoo == 0)
success = FALSE;
if (success)
{
vectors = gimp_image_get_vectors_by_tattoo (gimage, tattoo);
success = vectors != NULL;
}
return_args = procedural_db_return_args (&image_get_vectors_by_tattoo_proc, success);
if (success)
return_args[1].value.pdb_int = gimp_item_get_ID (GIMP_ITEM (vectors));
return return_args;
}
static ProcArg image_get_vectors_by_tattoo_inargs[] =
{
{
GIMP_PDB_IMAGE,
"image",
"The image"
},
{
GIMP_PDB_INT32,
"tattoo",
"The tattoo of the vectors to find"
}
};
static ProcArg image_get_vectors_by_tattoo_outargs[] =
{
{
GIMP_PDB_PATH,
"vectors",
"The vectors with the specified tattoo"
}
};
static ProcRecord image_get_vectors_by_tattoo_proc =
{
"gimp-image-get-vectors-by-tattoo",
"gimp-image-get-vectors-by-tattoo",
"Find a vectors with a given tattoo in an image.",
"This procedure returns the vectors with the given tattoo in the specified image.",
"Jay Cox",
"Jay Cox",
"1998",
NULL,
GIMP_INTERNAL,
2,
image_get_vectors_by_tattoo_inargs,
1,
image_get_vectors_by_tattoo_outargs,
{ { image_get_vectors_by_tattoo_invoker } }
};

View File

@ -75,7 +75,7 @@ void register_undo_procs (Gimp *gimp);
void register_unit_procs (Gimp *gimp); void register_unit_procs (Gimp *gimp);
void register_vectors_procs (Gimp *gimp); void register_vectors_procs (Gimp *gimp);
/* 493 procedures registered total */ /* 509 procedures registered total */
void void
internal_procs_init (Gimp *gimp) internal_procs_init (Gimp *gimp)

View File

@ -29,6 +29,7 @@
#include "core/gimp.h" #include "core/gimp.h"
#include "core/gimpimage-undo.h" #include "core/gimpimage-undo.h"
#include "core/gimpimage.h"
#include "core/gimplist.h" #include "core/gimplist.h"
#include "gimp-intl.h" #include "gimp-intl.h"
#include "vectors/gimpanchor.h" #include "vectors/gimpanchor.h"
@ -37,16 +38,32 @@
#include "vectors/gimpvectors.h" #include "vectors/gimpvectors.h"
static ProcRecord vectors_get_strokes_proc; static ProcRecord vectors_get_strokes_proc;
static ProcRecord vectors_get_locked_proc;
static ProcRecord vectors_set_locked_proc;
static ProcRecord vectors_get_visible_proc;
static ProcRecord vectors_set_visible_proc;
static ProcRecord vectors_get_name_proc;
static ProcRecord vectors_set_name_proc;
static ProcRecord vectors_stroke_get_length_proc;
static ProcRecord vectors_stroke_remove_proc; static ProcRecord vectors_stroke_remove_proc;
static ProcRecord vectors_stroke_translate_proc; static ProcRecord vectors_stroke_translate_proc;
static ProcRecord vectors_stroke_scale_proc;
static ProcRecord vectors_stroke_interpolate_proc; static ProcRecord vectors_stroke_interpolate_proc;
void void
register_vectors_procs (Gimp *gimp) register_vectors_procs (Gimp *gimp)
{ {
procedural_db_register (gimp, &vectors_get_strokes_proc); procedural_db_register (gimp, &vectors_get_strokes_proc);
procedural_db_register (gimp, &vectors_get_locked_proc);
procedural_db_register (gimp, &vectors_set_locked_proc);
procedural_db_register (gimp, &vectors_get_visible_proc);
procedural_db_register (gimp, &vectors_set_visible_proc);
procedural_db_register (gimp, &vectors_get_name_proc);
procedural_db_register (gimp, &vectors_set_name_proc);
procedural_db_register (gimp, &vectors_stroke_get_length_proc);
procedural_db_register (gimp, &vectors_stroke_remove_proc); procedural_db_register (gimp, &vectors_stroke_remove_proc);
procedural_db_register (gimp, &vectors_stroke_translate_proc); procedural_db_register (gimp, &vectors_stroke_translate_proc);
procedural_db_register (gimp, &vectors_stroke_scale_proc);
procedural_db_register (gimp, &vectors_stroke_interpolate_proc); procedural_db_register (gimp, &vectors_stroke_interpolate_proc);
} }
@ -138,6 +155,459 @@ static ProcRecord vectors_get_strokes_proc =
{ { vectors_get_strokes_invoker } } { { vectors_get_strokes_invoker } }
}; };
static Argument *
vectors_get_locked_invoker (Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
Argument *return_args;
GimpVectors *vectors;
gboolean locked = FALSE;
vectors = (GimpVectors *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
if (! (GIMP_IS_VECTORS (vectors) && ! gimp_item_is_removed (GIMP_ITEM (vectors))))
success = FALSE;
if (success)
{
locked = gimp_item_get_linked (GIMP_ITEM (vectors));
}
return_args = procedural_db_return_args (&vectors_get_locked_proc, success);
if (success)
return_args[1].value.pdb_int = locked;
return return_args;
}
static ProcArg vectors_get_locked_inargs[] =
{
{
GIMP_PDB_PATH,
"vectors",
"The vectors object"
}
};
static ProcArg vectors_get_locked_outargs[] =
{
{
GIMP_PDB_INT32,
"locked",
"TRUE if the path is locked, FALSE otherwise"
}
};
static ProcRecord vectors_get_locked_proc =
{
"gimp-vectors-get-locked",
"gimp-vectors-get-locked",
"Gets the locking state of the vectors object.",
"Gets the locking state of the vectors object.",
"Simon Budig",
"Simon Budig",
"2005",
NULL,
GIMP_INTERNAL,
1,
vectors_get_locked_inargs,
1,
vectors_get_locked_outargs,
{ { vectors_get_locked_invoker } }
};
static Argument *
vectors_set_locked_invoker (Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
GimpVectors *vectors;
gboolean locked = FALSE;
vectors = (GimpVectors *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
if (! (GIMP_IS_VECTORS (vectors) && ! gimp_item_is_removed (GIMP_ITEM (vectors))))
success = FALSE;
locked = args[1].value.pdb_int ? TRUE : FALSE;
if (success)
{
gimp_item_set_linked (GIMP_ITEM (vectors), locked, TRUE);
}
return procedural_db_return_args (&vectors_set_locked_proc, success);
}
static ProcArg vectors_set_locked_inargs[] =
{
{
GIMP_PDB_PATH,
"vectors",
"The vectors object"
},
{
GIMP_PDB_INT32,
"locked",
"Whether the path is locked"
}
};
static ProcRecord vectors_set_locked_proc =
{
"gimp-vectors-set-locked",
"gimp-vectors-set-locked",
"Sets the locking state of the vectors object.",
"Sets the locking state of the vectors object.",
"Simon Budig",
"Simon Budig",
"2005",
NULL,
GIMP_INTERNAL,
2,
vectors_set_locked_inargs,
0,
NULL,
{ { vectors_set_locked_invoker } }
};
static Argument *
vectors_get_visible_invoker (Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
Argument *return_args;
GimpVectors *vectors;
gboolean visible = FALSE;
vectors = (GimpVectors *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
if (! (GIMP_IS_VECTORS (vectors) && ! gimp_item_is_removed (GIMP_ITEM (vectors))))
success = FALSE;
if (success)
{
visible = gimp_item_get_visible (GIMP_ITEM (vectors));
}
return_args = procedural_db_return_args (&vectors_get_visible_proc, success);
if (success)
return_args[1].value.pdb_int = visible;
return return_args;
}
static ProcArg vectors_get_visible_inargs[] =
{
{
GIMP_PDB_PATH,
"vectors",
"The vectors object"
}
};
static ProcArg vectors_get_visible_outargs[] =
{
{
GIMP_PDB_INT32,
"visible",
"TRUE if the path is visible, FALSE otherwise"
}
};
static ProcRecord vectors_get_visible_proc =
{
"gimp-vectors-get-visible",
"gimp-vectors-get-visible",
"Gets the visibility of the vectors object.",
"Gets the visibility of the vectors object.",
"Simon Budig",
"Simon Budig",
"2005",
NULL,
GIMP_INTERNAL,
1,
vectors_get_visible_inargs,
1,
vectors_get_visible_outargs,
{ { vectors_get_visible_invoker } }
};
static Argument *
vectors_set_visible_invoker (Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
GimpVectors *vectors;
gboolean visible = FALSE;
vectors = (GimpVectors *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
if (! (GIMP_IS_VECTORS (vectors) && ! gimp_item_is_removed (GIMP_ITEM (vectors))))
success = FALSE;
visible = args[1].value.pdb_int ? TRUE : FALSE;
if (success)
{
gimp_item_set_visible (GIMP_ITEM (vectors), visible, TRUE);
}
return procedural_db_return_args (&vectors_set_visible_proc, success);
}
static ProcArg vectors_set_visible_inargs[] =
{
{
GIMP_PDB_PATH,
"vectors",
"The vectors object"
},
{
GIMP_PDB_INT32,
"visible",
"Whether the path is visible"
}
};
static ProcRecord vectors_set_visible_proc =
{
"gimp-vectors-set-visible",
"gimp-vectors-set-visible",
"Sets the visibility of the vectors object.",
"Sets the visibility of the vectors object.",
"Simon Budig",
"Simon Budig",
"2005",
NULL,
GIMP_INTERNAL,
2,
vectors_set_visible_inargs,
0,
NULL,
{ { vectors_set_visible_invoker } }
};
static Argument *
vectors_get_name_invoker (Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
Argument *return_args;
GimpVectors *vectors;
gchar *name = NULL;
vectors = (GimpVectors *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
if (! (GIMP_IS_VECTORS (vectors) && ! gimp_item_is_removed (GIMP_ITEM (vectors))))
success = FALSE;
if (success)
{
name = g_strdup (gimp_object_get_name (GIMP_OBJECT (vectors)));
}
return_args = procedural_db_return_args (&vectors_get_name_proc, success);
if (success)
return_args[1].value.pdb_pointer = name;
return return_args;
}
static ProcArg vectors_get_name_inargs[] =
{
{
GIMP_PDB_PATH,
"vectors",
"The vectors object"
}
};
static ProcArg vectors_get_name_outargs[] =
{
{
GIMP_PDB_STRING,
"name",
"The name of the vectors object"
}
};
static ProcRecord vectors_get_name_proc =
{
"gimp-vectors-get-name",
"gimp-vectors-get-name",
"Gets the name of the vectors object.",
"Gets the name of the vectors object.",
"Simon Budig",
"Simon Budig",
"2005",
NULL,
GIMP_INTERNAL,
1,
vectors_get_name_inargs,
1,
vectors_get_name_outargs,
{ { vectors_get_name_invoker } }
};
static Argument *
vectors_set_name_invoker (Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
GimpVectors *vectors;
gchar *name = NULL;
vectors = (GimpVectors *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
if (! (GIMP_IS_VECTORS (vectors) && ! gimp_item_is_removed (GIMP_ITEM (vectors))))
success = FALSE;
name = (gchar *) args[1].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL))
success = FALSE;
if (success)
{
if (!gimp_item_rename (GIMP_ITEM (vectors), name))
success = FALSE;
}
return procedural_db_return_args (&vectors_set_name_proc, success);
}
static ProcArg vectors_set_name_inargs[] =
{
{
GIMP_PDB_PATH,
"vectors",
"The vectors object"
},
{
GIMP_PDB_STRING,
"name",
"the new name of the path"
}
};
static ProcRecord vectors_set_name_proc =
{
"gimp-vectors-set-name",
"gimp-vectors-set-name",
"Sets the name of the vectors object.",
"Sets the name of the vectors object.",
"Simon Budig",
"Simon Budig",
"2005",
NULL,
GIMP_INTERNAL,
2,
vectors_set_name_inargs,
0,
NULL,
{ { vectors_set_name_invoker } }
};
static Argument *
vectors_stroke_get_length_invoker (Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
Argument *return_args;
GimpVectors *vectors;
gint32 stroke_id;
gdouble prescision;
gdouble length;
GimpStroke *stroke;
vectors = (GimpVectors *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
if (! (GIMP_IS_VECTORS (vectors) && ! gimp_item_is_removed (GIMP_ITEM (vectors))))
success = FALSE;
stroke_id = args[1].value.pdb_int;
prescision = args[2].value.pdb_float;
if (success)
{
stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_id);
if (!stroke)
{
success = FALSE;
}
else
{
length = gimp_stroke_get_length (stroke, prescision);
}
}
return_args = procedural_db_return_args (&vectors_stroke_get_length_proc, success);
if (success)
return_args[1].value.pdb_float = length;
return return_args;
}
static ProcArg vectors_stroke_get_length_inargs[] =
{
{
GIMP_PDB_PATH,
"vectors",
"The vectors object"
},
{
GIMP_PDB_INT32,
"stroke-id",
"The stroke ID"
},
{
GIMP_PDB_FLOAT,
"prescision",
"The prescision used for the approximation"
}
};
static ProcArg vectors_stroke_get_length_outargs[] =
{
{
GIMP_PDB_FLOAT,
"length",
"The length (in pixels) of the given stroke."
}
};
static ProcRecord vectors_stroke_get_length_proc =
{
"gimp-vectors-stroke-get-length",
"gimp-vectors-stroke-get-length",
"measures the length of the given stroke.",
"Measure the length of the given stroke.",
"Simon Budig",
"Simon Budig",
"2005",
NULL,
GIMP_INTERNAL,
3,
vectors_stroke_get_length_inargs,
1,
vectors_stroke_get_length_outargs,
{ { vectors_stroke_get_length_invoker } }
};
static Argument * static Argument *
vectors_stroke_remove_invoker (Gimp *gimp, vectors_stroke_remove_invoker (Gimp *gimp,
GimpContext *context, GimpContext *context,
@ -186,8 +656,8 @@ static ProcRecord vectors_stroke_remove_proc =
{ {
"gimp-vectors-stroke-remove", "gimp-vectors-stroke-remove",
"gimp-vectors-stroke-remove", "gimp-vectors-stroke-remove",
"return coordinates along the given stroke.", "remove the stroke from a vectors object.",
"Returns a lot of coordinates along the passed stroke.", "Remove the stroke from a vectors object.",
"Simon Budig", "Simon Budig",
"Simon Budig", "Simon Budig",
"2005", "2005",
@ -209,8 +679,8 @@ vectors_stroke_translate_invoker (Gimp *gimp,
gboolean success = TRUE; gboolean success = TRUE;
GimpVectors *vectors; GimpVectors *vectors;
gint32 stroke_id; gint32 stroke_id;
gint32 offx; gint32 off_x;
gint32 offy; gint32 off_y;
GimpStroke *stroke; GimpStroke *stroke;
vectors = (GimpVectors *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int); vectors = (GimpVectors *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
@ -219,9 +689,9 @@ vectors_stroke_translate_invoker (Gimp *gimp,
stroke_id = args[1].value.pdb_int; stroke_id = args[1].value.pdb_int;
offx = args[2].value.pdb_int; off_x = args[2].value.pdb_int;
offy = args[3].value.pdb_int; off_y = args[3].value.pdb_int;
if (success) if (success)
{ {
@ -239,7 +709,7 @@ vectors_stroke_translate_invoker (Gimp *gimp,
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_ITEM_DISPLACE, gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_ITEM_DISPLACE,
_("Modify Path")); _("Modify Path"));
gimp_vectors_freeze (vectors); gimp_vectors_freeze (vectors);
gimp_stroke_translate (stroke, offx, offy); gimp_stroke_translate (stroke, off_x, off_y);
gimp_vectors_thaw (vectors); gimp_vectors_thaw (vectors);
gimp_image_undo_group_end (gimage); gimp_image_undo_group_end (gimage);
} }
@ -262,12 +732,12 @@ static ProcArg vectors_stroke_translate_inargs[] =
}, },
{ {
GIMP_PDB_INT32, GIMP_PDB_INT32,
"offx", "off-x",
"Offset in x direction" "Offset in x direction"
}, },
{ {
GIMP_PDB_INT32, GIMP_PDB_INT32,
"offy", "off-y",
"Offset in y direction" "Offset in y direction"
} }
}; };
@ -290,6 +760,96 @@ static ProcRecord vectors_stroke_translate_proc =
{ { vectors_stroke_translate_invoker } } { { vectors_stroke_translate_invoker } }
}; };
static Argument *
vectors_stroke_scale_invoker (Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
GimpVectors *vectors;
gint32 stroke_id;
gdouble scale_x;
gdouble scale_y;
GimpStroke *stroke;
vectors = (GimpVectors *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
if (! (GIMP_IS_VECTORS (vectors) && ! gimp_item_is_removed (GIMP_ITEM (vectors))))
success = FALSE;
stroke_id = args[1].value.pdb_int;
scale_x = args[2].value.pdb_float;
scale_y = args[3].value.pdb_float;
if (success)
{
GimpImage *gimage = gimp_item_get_image (GIMP_ITEM (vectors));
stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_id);
if (!stroke)
{
success = FALSE;
}
else
{
/* need to figure out how undo is supposed to work */
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_ITEM_DISPLACE,
_("Modify Path"));
gimp_vectors_freeze (vectors);
gimp_stroke_scale (stroke, scale_x, scale_y);
gimp_vectors_thaw (vectors);
gimp_image_undo_group_end (gimage);
}
}
return procedural_db_return_args (&vectors_stroke_scale_proc, success);
}
static ProcArg vectors_stroke_scale_inargs[] =
{
{
GIMP_PDB_PATH,
"vectors",
"The vectors object"
},
{
GIMP_PDB_INT32,
"stroke-id",
"The stroke ID"
},
{
GIMP_PDB_FLOAT,
"scale-x",
"Scale factor in x direction"
},
{
GIMP_PDB_FLOAT,
"scale-y",
"Scale factor in y direction"
}
};
static ProcRecord vectors_stroke_scale_proc =
{
"gimp-vectors-stroke-scale",
"gimp-vectors-stroke-scale",
"scales the given stroke.",
"Scale the given stroke.",
"Simon Budig",
"Simon Budig",
"2005",
NULL,
GIMP_INTERNAL,
4,
vectors_stroke_scale_inargs,
0,
NULL,
{ { vectors_stroke_scale_invoker } }
};
static Argument * static Argument *
vectors_stroke_interpolate_invoker (Gimp *gimp, vectors_stroke_interpolate_invoker (Gimp *gimp,
GimpContext *context, GimpContext *context,

View File

@ -260,7 +260,7 @@ GimpStroke * gimp_stroke_open (GimpStroke *stroke,
gboolean gimp_stroke_anchor_is_insertable (GimpStroke *stroke, gboolean gimp_stroke_anchor_is_insertable (GimpStroke *stroke,
GimpAnchor *predec, GimpAnchor *predec,
gdouble position); gdouble position);
GimpAnchor * gimp_stroke_anchor_insert (GimpStroke *stroke, GimpAnchor * gimp_stroke_anchor_insert (GimpStroke *stroke,
GimpAnchor *predec, GimpAnchor *predec,
gdouble position); gdouble position);

View File

@ -57,8 +57,8 @@ gimpvectors
@vectors_ID: @vectors_ID:
@stroke_id: @stroke_id:
@offx: @off_x:
@offy: @off_y:
@Returns: @Returns:

View File

@ -126,24 +126,24 @@ typedef enum
#define WRITE_BUFFER_SIZE 1024 #define WRITE_BUFFER_SIZE 1024
void gimp_read_expect_msg (GimpWireMessage *msg, void gimp_read_expect_msg (GimpWireMessage *msg,
gint type); gint type);
static void gimp_close (void); static void gimp_close (void);
static void gimp_debug_stop (void); static void gimp_debug_stop (void);
static void gimp_message_func (const gchar *log_domain, static void gimp_message_func (const gchar *log_domain,
GLogLevelFlags log_level, GLogLevelFlags log_level,
const gchar *message, const gchar *message,
gpointer data); gpointer data);
#ifndef G_OS_WIN32 #ifndef G_OS_WIN32
static void gimp_plugin_sigfatal_handler (gint sig_num); static void gimp_plugin_sigfatal_handler (gint sig_num);
#endif #endif
static gboolean gimp_plugin_io_error_handler (GIOChannel *channel, static gboolean gimp_plugin_io_error_handler (GIOChannel *channel,
GIOCondition cond, GIOCondition cond,
gpointer data); gpointer data);
static gboolean gimp_write (GIOChannel *channel, static gboolean gimp_write (GIOChannel *channel,
guint8 *buf, guint8 *buf,
gulong count, gulong count,
gpointer user_data); gpointer user_data);
static gboolean gimp_flush (GIOChannel *channel, static gboolean gimp_flush (GIOChannel *channel,
gpointer user_data); gpointer user_data);
@ -225,7 +225,7 @@ static GimpPlugInInfo PLUG_IN_INFO;
gint gint
gimp_main (const GimpPlugInInfo *info, gimp_main (const GimpPlugInInfo *info,
gint argc, gint argc,
gchar *argv[]) gchar *argv[])
{ {
gchar *basename; gchar *basename;
const gchar *env_string; const gchar *env_string;
@ -244,33 +244,33 @@ gimp_main (const GimpPlugInInfo *info,
k = strlen (argv[i]); k = strlen (argv[i]);
if (k > 10) if (k > 10)
{ {
if (g_ascii_strcasecmp (argv[i] + k - 4, ".exe") == 0) if (g_ascii_strcasecmp (argv[i] + k - 4, ".exe") == 0)
{ {
/* Found the end of the executable name, most probably. /* Found the end of the executable name, most probably.
* Splice the parts of the name back together. * Splice the parts of the name back together.
*/ */
GString *s; GString *s;
s = g_string_new (argv[0]); s = g_string_new (argv[0]);
for (j = 1; j <= i; j++) for (j = 1; j <= i; j++)
{ {
s = g_string_append_c (s, ' '); s = g_string_append_c (s, ' ');
s = g_string_append (s, argv[j]); s = g_string_append (s, argv[j]);
} }
argv[0] = s->str; argv[0] = s->str;
/* Move rest of argv down */ /* Move rest of argv down */
for (j = 1; j < argc - i; j++) for (j = 1; j < argc - i; j++)
argv[j] = argv[j + i]; argv[j] = argv[j + i];
argv[argc - i] = NULL; argv[argc - i] = NULL;
argc -= i; argc -= i;
break; break;
} }
} }
} }
#endif #endif
@ -304,7 +304,7 @@ gimp_main (const GimpPlugInInfo *info,
{ {
gint len = debug_string - env_string; gint len = debug_string - env_string;
if ((strlen (basename) == len) && if ((strlen (basename) == len) &&
(strncmp (basename, env_string, len) == 0)) (strncmp (basename, env_string, len) == 0))
{ {
gimp_debug_flags = gimp_debug_flags =
@ -322,8 +322,8 @@ gimp_main (const GimpPlugInInfo *info,
g_free (basename); g_free (basename);
stack_trace_mode = (GimpStackTraceMode) CLAMP (atoi (argv[5]), stack_trace_mode = (GimpStackTraceMode) CLAMP (atoi (argv[5]),
GIMP_STACK_TRACE_NEVER, GIMP_STACK_TRACE_NEVER,
GIMP_STACK_TRACE_ALWAYS); GIMP_STACK_TRACE_ALWAYS);
#ifndef G_OS_WIN32 #ifndef G_OS_WIN32
/* No use catching these on Win32, the user won't get any meaningful /* No use catching these on Win32, the user won't get any meaningful
@ -401,13 +401,13 @@ gimp_main (const GimpPlugInInfo *info,
/* set handler both for the "LibGimp" and "" domains */ /* set handler both for the "LibGimp" and "" domains */
g_log_set_handler (G_LOG_DOMAIN, g_log_set_handler (G_LOG_DOMAIN,
G_LOG_LEVEL_MESSAGE, G_LOG_LEVEL_MESSAGE,
gimp_message_func, gimp_message_func,
NULL); NULL);
g_log_set_handler (NULL, g_log_set_handler (NULL,
G_LOG_LEVEL_MESSAGE, G_LOG_LEVEL_MESSAGE,
gimp_message_func, gimp_message_func,
NULL); NULL);
if (gimp_debug_flags & GIMP_DEBUG_FATAL_WARNINGS) if (gimp_debug_flags & GIMP_DEBUG_FATAL_WARNINGS)
{ {
@ -427,7 +427,7 @@ gimp_main (const GimpPlugInInfo *info,
gimp_debug_stop (); gimp_debug_stop ();
if (PLUG_IN_INFO.query_proc) if (PLUG_IN_INFO.query_proc)
(* PLUG_IN_INFO.query_proc) (); (* PLUG_IN_INFO.query_proc) ();
gimp_close (); gimp_close ();
@ -440,7 +440,7 @@ gimp_main (const GimpPlugInInfo *info,
gimp_debug_stop (); gimp_debug_stop ();
if (PLUG_IN_INFO.init_proc) if (PLUG_IN_INFO.init_proc)
(* PLUG_IN_INFO.init_proc) (); (* PLUG_IN_INFO.init_proc) ();
gimp_close (); gimp_close ();
@ -455,9 +455,9 @@ gimp_main (const GimpPlugInInfo *info,
temp_proc_ht = g_hash_table_new (g_str_hash, g_str_equal); temp_proc_ht = g_hash_table_new (g_str_hash, g_str_equal);
g_io_add_watch (_readchannel, g_io_add_watch (_readchannel,
G_IO_ERR | G_IO_HUP, G_IO_ERR | G_IO_HUP,
gimp_plugin_io_error_handler, gimp_plugin_io_error_handler,
NULL); NULL);
gimp_loop (); gimp_loop ();
@ -538,18 +538,18 @@ gimp_quit (void)
**/ **/
void void
gimp_install_procedure (const gchar *name, gimp_install_procedure (const gchar *name,
const gchar *blurb, const gchar *blurb,
const gchar *help, const gchar *help,
const gchar *author, const gchar *author,
const gchar *copyright, const gchar *copyright,
const gchar *date, const gchar *date,
const gchar *menu_label, const gchar *menu_label,
const gchar *image_types, const gchar *image_types,
GimpPDBProcType type, GimpPDBProcType type,
gint n_params, gint n_params,
gint n_return_vals, gint n_return_vals,
const GimpParamDef *params, const GimpParamDef *params,
const GimpParamDef *return_vals) const GimpParamDef *return_vals)
{ {
GPProcInstall proc_install; GPProcInstall proc_install;
@ -619,19 +619,19 @@ gimp_install_procedure (const gchar *name,
**/ **/
void void
gimp_install_temp_proc (const gchar *name, gimp_install_temp_proc (const gchar *name,
const gchar *blurb, const gchar *blurb,
const gchar *help, const gchar *help,
const gchar *author, const gchar *author,
const gchar *copyright, const gchar *copyright,
const gchar *date, const gchar *date,
const gchar *menu_label, const gchar *menu_label,
const gchar *image_types, const gchar *image_types,
GimpPDBProcType type, GimpPDBProcType type,
gint n_params, gint n_params,
gint n_return_vals, gint n_return_vals,
const GimpParamDef *params, const GimpParamDef *params,
const GimpParamDef *return_vals, const GimpParamDef *return_vals,
GimpRunProc run_proc) GimpRunProc run_proc)
{ {
g_return_if_fail (name != NULL); g_return_if_fail (name != NULL);
g_return_if_fail ((n_params == 0 && params == NULL) || g_return_if_fail ((n_params == 0 && params == NULL) ||
@ -642,13 +642,13 @@ gimp_install_temp_proc (const gchar *name,
g_return_if_fail (run_proc != NULL); g_return_if_fail (run_proc != NULL);
gimp_install_procedure (name, gimp_install_procedure (name,
blurb, help, blurb, help,
author, copyright, date, author, copyright, date,
menu_label, menu_label,
image_types, image_types,
type, type,
n_params, n_return_vals, n_params, n_return_vals,
params, return_vals); params, return_vals);
/* Insert the temp proc run function into the hash table */ /* Insert the temp proc run function into the hash table */
g_hash_table_insert (temp_proc_ht, g_strdup (name), (gpointer) run_proc); g_hash_table_insert (temp_proc_ht, g_strdup (name), (gpointer) run_proc);
@ -702,8 +702,8 @@ gimp_uninstall_temp_proc (const gchar *name)
**/ **/
GimpParam * GimpParam *
gimp_run_procedure (const gchar *name, gimp_run_procedure (const gchar *name,
gint *n_return_vals, gint *n_return_vals,
...) ...)
{ {
GimpPDBArgType param_type; GimpPDBArgType param_type;
GimpParam *return_vals; GimpParam *return_vals;
@ -721,8 +721,8 @@ gimp_run_procedure (const gchar *name,
while (param_type != GIMP_PDB_END) while (param_type != GIMP_PDB_END)
{ {
switch (param_type) switch (param_type)
{ {
case GIMP_PDB_INT32: case GIMP_PDB_INT32:
case GIMP_PDB_DISPLAY: case GIMP_PDB_DISPLAY:
case GIMP_PDB_IMAGE: case GIMP_PDB_IMAGE:
case GIMP_PDB_LAYER: case GIMP_PDB_LAYER:
@ -732,14 +732,14 @@ gimp_run_procedure (const gchar *name,
case GIMP_PDB_BOUNDARY: case GIMP_PDB_BOUNDARY:
case GIMP_PDB_PATH: case GIMP_PDB_PATH:
case GIMP_PDB_STATUS: case GIMP_PDB_STATUS:
(void) va_arg (args, gint); (void) va_arg (args, gint);
break; break;
case GIMP_PDB_INT16: case GIMP_PDB_INT16:
(void) va_arg (args, gint); (void) va_arg (args, gint);
break; break;
case GIMP_PDB_INT8: case GIMP_PDB_INT8:
(void) va_arg (args, gint); (void) va_arg (args, gint);
break; break;
case GIMP_PDB_FLOAT: case GIMP_PDB_FLOAT:
(void) va_arg (args, gdouble); (void) va_arg (args, gdouble);
break; break;
@ -762,16 +762,16 @@ gimp_run_procedure (const gchar *name,
(void) va_arg (args, gchar **); (void) va_arg (args, gchar **);
break; break;
case GIMP_PDB_COLOR: case GIMP_PDB_COLOR:
(void) va_arg (args, GimpRGB *); (void) va_arg (args, GimpRGB *);
break; break;
case GIMP_PDB_PARASITE: case GIMP_PDB_PARASITE:
(void) va_arg (args, GimpParasite *); (void) va_arg (args, GimpParasite *);
break; break;
case GIMP_PDB_REGION: case GIMP_PDB_REGION:
break; break;
case GIMP_PDB_END: case GIMP_PDB_END:
break; break;
} }
n_params++; n_params++;
@ -789,16 +789,16 @@ gimp_run_procedure (const gchar *name,
params[i].type = va_arg (args, GimpPDBArgType); params[i].type = va_arg (args, GimpPDBArgType);
switch (params[i].type) switch (params[i].type)
{ {
case GIMP_PDB_INT32: case GIMP_PDB_INT32:
params[i].data.d_int32 = (gint32) va_arg (args, gint); params[i].data.d_int32 = (gint32) va_arg (args, gint);
break; break;
case GIMP_PDB_INT16: case GIMP_PDB_INT16:
params[i].data.d_int16 = (gint16) va_arg (args, gint); params[i].data.d_int16 = (gint16) va_arg (args, gint);
break; break;
case GIMP_PDB_INT8: case GIMP_PDB_INT8:
params[i].data.d_int8 = (gint8) va_arg (args, gint); params[i].data.d_int8 = (gint8) va_arg (args, gint);
break; break;
case GIMP_PDB_FLOAT: case GIMP_PDB_FLOAT:
params[i].data.d_float = (gdouble) va_arg (args, gdouble); params[i].data.d_float = (gdouble) va_arg (args, gdouble);
break; break;
@ -821,33 +821,33 @@ gimp_run_procedure (const gchar *name,
params[i].data.d_stringarray = va_arg (args, gchar **); params[i].data.d_stringarray = va_arg (args, gchar **);
break; break;
case GIMP_PDB_COLOR: case GIMP_PDB_COLOR:
params[i].data.d_color = *va_arg (args, GimpRGB *); params[i].data.d_color = *va_arg (args, GimpRGB *);
break; break;
case GIMP_PDB_REGION: case GIMP_PDB_REGION:
break; break;
case GIMP_PDB_DISPLAY: case GIMP_PDB_DISPLAY:
params[i].data.d_display = va_arg (args, gint32); params[i].data.d_display = va_arg (args, gint32);
break; break;
case GIMP_PDB_IMAGE: case GIMP_PDB_IMAGE:
params[i].data.d_image = va_arg (args, gint32); params[i].data.d_image = va_arg (args, gint32);
break; break;
case GIMP_PDB_LAYER: case GIMP_PDB_LAYER:
params[i].data.d_layer = va_arg (args, gint32); params[i].data.d_layer = va_arg (args, gint32);
break; break;
case GIMP_PDB_CHANNEL: case GIMP_PDB_CHANNEL:
params[i].data.d_channel = va_arg (args, gint32); params[i].data.d_channel = va_arg (args, gint32);
break; break;
case GIMP_PDB_DRAWABLE: case GIMP_PDB_DRAWABLE:
params[i].data.d_drawable = va_arg (args, gint32); params[i].data.d_drawable = va_arg (args, gint32);
break; break;
case GIMP_PDB_SELECTION: case GIMP_PDB_SELECTION:
params[i].data.d_selection = va_arg (args, gint32); params[i].data.d_selection = va_arg (args, gint32);
break; break;
case GIMP_PDB_BOUNDARY: case GIMP_PDB_BOUNDARY:
params[i].data.d_boundary = va_arg (args, gint32); params[i].data.d_boundary = va_arg (args, gint32);
break; break;
case GIMP_PDB_PATH: case GIMP_PDB_PATH:
params[i].data.d_path = va_arg (args, gint32); params[i].data.d_vectors = va_arg (args, gint32);
break; break;
case GIMP_PDB_PARASITE: case GIMP_PDB_PARASITE:
{ {
@ -870,9 +870,9 @@ gimp_run_procedure (const gchar *name,
case GIMP_PDB_STATUS: case GIMP_PDB_STATUS:
params[i].data.d_status = va_arg (args, gint32); params[i].data.d_status = va_arg (args, gint32);
break; break;
case GIMP_PDB_END: case GIMP_PDB_END:
break; break;
} }
} }
va_end (args); va_end (args);
@ -887,15 +887,15 @@ gimp_run_procedure (const gchar *name,
void void
gimp_read_expect_msg (GimpWireMessage *msg, gimp_read_expect_msg (GimpWireMessage *msg,
gint type) gint type)
{ {
while (TRUE) while (TRUE)
{ {
if (! gimp_wire_read_msg (_readchannel, msg, NULL)) if (! gimp_wire_read_msg (_readchannel, msg, NULL))
gimp_quit (); gimp_quit ();
if (msg->type == type) if (msg->type == type)
return; /* up to the caller to call wire_destroy() */ return; /* up to the caller to call wire_destroy() */
if (msg->type == GP_TEMP_PROC_RUN || msg->type == GP_QUIT) if (msg->type == GP_TEMP_PROC_RUN || msg->type == GP_QUIT)
{ {
@ -929,9 +929,9 @@ gimp_read_expect_msg (GimpWireMessage *msg,
**/ **/
GimpParam * GimpParam *
gimp_run_procedure2 (const gchar *name, gimp_run_procedure2 (const gchar *name,
gint *n_return_vals, gint *n_return_vals,
gint n_params, gint n_params,
const GimpParam *params) const GimpParam *params)
{ {
GPProcRun proc_run; GPProcRun proc_run;
GPProcReturn *proc_return; GPProcReturn *proc_return;
@ -984,7 +984,7 @@ gimp_run_procedure2 (const gchar *name,
**/ **/
void void
gimp_destroy_params (GimpParam *params, gimp_destroy_params (GimpParam *params,
gint n_params) gint n_params)
{ {
gp_params_destroy ((GPParam *) params, n_params); gp_params_destroy ((GPParam *) params, n_params);
} }
@ -998,7 +998,7 @@ gimp_destroy_params (GimpParam *params,
**/ **/
void void
gimp_destroy_paramdefs (GimpParamDef *paramdefs, gimp_destroy_paramdefs (GimpParamDef *paramdefs,
gint n_params) gint n_params)
{ {
while (n_params--) while (n_params--)
{ {
@ -1389,9 +1389,9 @@ gimp_extension_process (guint timeout)
*/ */
gboolean gboolean
gimp_attach_new_parasite (const gchar *name, gimp_attach_new_parasite (const gchar *name,
gint flags, gint flags,
gint size, gint size,
gconstpointer data) gconstpointer data)
{ {
GimpParasite *parasite = gimp_parasite_new (name, flags, size, data); GimpParasite *parasite = gimp_parasite_new (name, flags, size, data);
gboolean success; gboolean success;
@ -1448,9 +1448,9 @@ gimp_debug_stop (void)
static void static void
gimp_message_func (const gchar *log_domain, gimp_message_func (const gchar *log_domain,
GLogLevelFlags log_level, GLogLevelFlags log_level,
const gchar *message, const gchar *message,
gpointer data) gpointer data)
{ {
gimp_message ((gchar *) message); gimp_message ((gchar *) message);
} }
@ -1476,30 +1476,30 @@ gimp_plugin_sigfatal_handler (gint sig_num)
default: default:
g_printerr ("%s: fatal error: %s\n", progname, g_strsignal (sig_num)); g_printerr ("%s: fatal error: %s\n", progname, g_strsignal (sig_num));
switch (stack_trace_mode) switch (stack_trace_mode)
{ {
case GIMP_STACK_TRACE_NEVER: case GIMP_STACK_TRACE_NEVER:
break; break;
case GIMP_STACK_TRACE_QUERY: case GIMP_STACK_TRACE_QUERY:
{ {
sigset_t sigset; sigset_t sigset;
sigemptyset (&sigset); sigemptyset (&sigset);
sigprocmask (SIG_SETMASK, &sigset, NULL); sigprocmask (SIG_SETMASK, &sigset, NULL);
g_on_error_query (progname); g_on_error_query (progname);
} }
break; break;
case GIMP_STACK_TRACE_ALWAYS: case GIMP_STACK_TRACE_ALWAYS:
{ {
sigset_t sigset; sigset_t sigset;
sigemptyset (&sigset); sigemptyset (&sigset);
sigprocmask (SIG_SETMASK, &sigset, NULL); sigprocmask (SIG_SETMASK, &sigset, NULL);
g_on_error_stack_trace (progname); g_on_error_stack_trace (progname);
} }
break; break;
} }
break; break;
} }
@ -1509,8 +1509,8 @@ gimp_plugin_sigfatal_handler (gint sig_num)
static gboolean static gboolean
gimp_plugin_io_error_handler (GIOChannel *channel, gimp_plugin_io_error_handler (GIOChannel *channel,
GIOCondition cond, GIOCondition cond,
gpointer data) gpointer data)
{ {
g_printerr ("%s: fatal error: GIMP crashed\n", progname); g_printerr ("%s: fatal error: GIMP crashed\n", progname);
gimp_quit (); gimp_quit ();
@ -1521,8 +1521,8 @@ gimp_plugin_io_error_handler (GIOChannel *channel,
static gboolean static gboolean
gimp_write (GIOChannel *channel, gimp_write (GIOChannel *channel,
guint8 *buf, guint8 *buf,
gulong count, gulong count,
gpointer user_data) gpointer user_data)
{ {
gulong bytes; gulong bytes;
@ -1530,19 +1530,19 @@ gimp_write (GIOChannel *channel,
while (count > 0) while (count > 0)
{ {
if ((write_buffer_index + count) >= WRITE_BUFFER_SIZE) if ((write_buffer_index + count) >= WRITE_BUFFER_SIZE)
{ {
bytes = WRITE_BUFFER_SIZE - write_buffer_index; bytes = WRITE_BUFFER_SIZE - write_buffer_index;
memcpy (&write_buffer[write_buffer_index], buf, bytes); memcpy (&write_buffer[write_buffer_index], buf, bytes);
write_buffer_index += bytes; write_buffer_index += bytes;
if (! gimp_wire_flush (channel, NULL)) if (! gimp_wire_flush (channel, NULL))
return FALSE; return FALSE;
} }
else else
{ {
bytes = count; bytes = count;
memcpy (&write_buffer[write_buffer_index], buf, bytes); memcpy (&write_buffer[write_buffer_index], buf, bytes);
write_buffer_index += bytes; write_buffer_index += bytes;
} }
buf += bytes; buf += bytes;
count -= bytes; count -= bytes;
@ -1565,32 +1565,32 @@ gimp_flush (GIOChannel *channel,
count = 0; count = 0;
while (count != write_buffer_index) while (count != write_buffer_index)
{ {
do do
{ {
bytes = 0; bytes = 0;
status = g_io_channel_write_chars (channel, status = g_io_channel_write_chars (channel,
&write_buffer[count], &write_buffer[count],
(write_buffer_index - count), (write_buffer_index - count),
&bytes, &bytes,
&error); &error);
} }
while (status == G_IO_STATUS_AGAIN); while (status == G_IO_STATUS_AGAIN);
if (status != G_IO_STATUS_NORMAL) if (status != G_IO_STATUS_NORMAL)
{ {
if (error) if (error)
{ {
g_warning ("%s: gimp_flush(): error: %s", g_warning ("%s: gimp_flush(): error: %s",
g_get_prgname (), error->message); g_get_prgname (), error->message);
g_error_free (error); g_error_free (error);
} }
else else
{ {
g_warning ("%s: gimp_flush(): error", g_get_prgname ()); g_warning ("%s: gimp_flush(): error", g_get_prgname ());
} }
return FALSE; return FALSE;
} }
count += bytes; count += bytes;
} }
@ -1610,53 +1610,53 @@ gimp_loop (void)
{ {
if (! gimp_wire_read_msg (_readchannel, &msg, NULL)) if (! gimp_wire_read_msg (_readchannel, &msg, NULL))
{ {
gimp_close (); gimp_close ();
return; return;
} }
switch (msg.type) switch (msg.type)
{ {
case GP_QUIT: case GP_QUIT:
gimp_wire_destroy (&msg); gimp_wire_destroy (&msg);
gimp_close (); gimp_close ();
return;
case GP_CONFIG:
gimp_config (msg.data);
break;
case GP_TILE_REQ:
case GP_TILE_ACK:
case GP_TILE_DATA:
g_warning ("unexpected tile message received (should not happen)");
break;
case GP_PROC_RUN:
gimp_proc_run (msg.data);
gimp_wire_destroy (&msg);
gimp_close ();
return; return;
case GP_PROC_RETURN: case GP_CONFIG:
g_warning ("unexpected proc return message received (should not happen)"); gimp_config (msg.data);
break; break;
case GP_TEMP_PROC_RUN: case GP_TILE_REQ:
g_warning ("unexpected temp proc run message received (should not happen"); case GP_TILE_ACK:
break; case GP_TILE_DATA:
g_warning ("unexpected tile message received (should not happen)");
break;
case GP_TEMP_PROC_RETURN: case GP_PROC_RUN:
g_warning ("unexpected temp proc return message received (should not happen"); gimp_proc_run (msg.data);
break; gimp_wire_destroy (&msg);
gimp_close ();
return;
case GP_PROC_INSTALL: case GP_PROC_RETURN:
g_warning ("unexpected proc install message received (should not happen)"); g_warning ("unexpected proc return message received (should not happen)");
break; break;
case GP_HAS_INIT: case GP_TEMP_PROC_RUN:
g_warning ("unexpected has init message received (should not happen)"); g_warning ("unexpected temp proc run message received (should not happen");
break; break;
}
case GP_TEMP_PROC_RETURN:
g_warning ("unexpected temp proc return message received (should not happen");
break;
case GP_PROC_INSTALL:
g_warning ("unexpected proc install message received (should not happen)");
break;
case GP_HAS_INIT:
g_warning ("unexpected has init message received (should not happen)");
break;
}
gimp_wire_destroy (&msg); gimp_wire_destroy (&msg);
} }
@ -1668,18 +1668,18 @@ gimp_config (GPConfig *config)
if (config->version < GIMP_PROTOCOL_VERSION) if (config->version < GIMP_PROTOCOL_VERSION)
{ {
g_message ("Could not execute plug-in \"%s\"\n(%s)\n" g_message ("Could not execute plug-in \"%s\"\n(%s)\n"
"because the GIMP is using an older version of the " "because the GIMP is using an older version of the "
"plug-in protocol.", "plug-in protocol.",
gimp_filename_to_utf8 (g_get_prgname ()), gimp_filename_to_utf8 (g_get_prgname ()),
gimp_filename_to_utf8 (progname)); gimp_filename_to_utf8 (progname));
gimp_quit (); gimp_quit ();
} }
else if (config->version > GIMP_PROTOCOL_VERSION) else if (config->version > GIMP_PROTOCOL_VERSION)
{ {
g_message ("Could not execute plug-in \"%s\"\n(%s)\n" g_message ("Could not execute plug-in \"%s\"\n(%s)\n"
"because it uses an obsolete version of the " "because it uses an obsolete version of the "
"plug-in protocol.", "plug-in protocol.",
gimp_filename_to_utf8 (g_get_prgname ()), gimp_filename_to_utf8 (g_get_prgname ()),
gimp_filename_to_utf8 (progname)); gimp_filename_to_utf8 (progname));
gimp_quit (); gimp_quit ();
} }
@ -1710,7 +1710,7 @@ gimp_config (GPConfig *config)
_shm_addr = (guchar *) shmat (_shm_ID, NULL, 0); _shm_addr = (guchar *) shmat (_shm_ID, NULL, 0);
if (_shm_addr == (guchar *) -1) if (_shm_addr == (guchar *) -1)
{ {
g_error ("shmat() failed: %s\n" ERRMSG_SHM_FAILED, g_error ("shmat() failed: %s\n" ERRMSG_SHM_FAILED,
g_strerror (errno)); g_strerror (errno));
} }
@ -1726,26 +1726,26 @@ gimp_config (GPConfig *config)
/* Open the file mapping */ /* Open the file mapping */
shm_handle = OpenFileMapping (FILE_MAP_ALL_ACCESS, shm_handle = OpenFileMapping (FILE_MAP_ALL_ACCESS,
0, fileMapName); 0, fileMapName);
if (shm_handle) if (shm_handle)
{ {
/* Map the shared memory into our address space for use */ /* Map the shared memory into our address space for use */
_shm_addr = (guchar *) MapViewOfFile (shm_handle, _shm_addr = (guchar *) MapViewOfFile (shm_handle,
FILE_MAP_ALL_ACCESS, FILE_MAP_ALL_ACCESS,
0, 0, TILE_MAP_SIZE); 0, 0, TILE_MAP_SIZE);
/* Verify that we mapped our view */ /* Verify that we mapped our view */
if (!_shm_addr) if (!_shm_addr)
{ {
g_error ("MapViewOfFile error: %d... " ERRMSG_SHM_FAILED, g_error ("MapViewOfFile error: %d... " ERRMSG_SHM_FAILED,
GetLastError ()); GetLastError ());
} }
} }
else else
{ {
g_error ("OpenFileMapping error: %d... " ERRMSG_SHM_FAILED, g_error ("OpenFileMapping error: %d... " ERRMSG_SHM_FAILED,
GetLastError ()); GetLastError ());
} }
#elif defined(USE_POSIX_SHM) #elif defined(USE_POSIX_SHM)
@ -1796,17 +1796,17 @@ gimp_proc_run (GPProcRun *proc_run)
gint n_return_vals; gint n_return_vals;
(* PLUG_IN_INFO.run_proc) (proc_run->name, (* PLUG_IN_INFO.run_proc) (proc_run->name,
proc_run->nparams, proc_run->nparams,
(GimpParam *) proc_run->params, (GimpParam *) proc_run->params,
&n_return_vals, &n_return_vals,
&return_vals); &return_vals);
proc_return.name = proc_run->name; proc_return.name = proc_run->name;
proc_return.nparams = n_return_vals; proc_return.nparams = n_return_vals;
proc_return.params = (GPParam *) return_vals; proc_return.params = (GPParam *) return_vals;
if (! gp_proc_return_write (_writechannel, &proc_return, NULL)) if (! gp_proc_return_write (_writechannel, &proc_return, NULL))
gimp_quit (); gimp_quit ();
} }
} }
@ -1817,7 +1817,7 @@ gimp_temp_proc_run (GPProcRun *proc_run)
GimpRunProc run_proc; GimpRunProc run_proc;
run_proc = (GimpRunProc) g_hash_table_lookup (temp_proc_ht, run_proc = (GimpRunProc) g_hash_table_lookup (temp_proc_ht,
(gpointer) proc_run->name); (gpointer) proc_run->name);
if (run_proc) if (run_proc)
{ {
@ -1826,10 +1826,10 @@ gimp_temp_proc_run (GPProcRun *proc_run)
gint n_return_vals; gint n_return_vals;
(* run_proc) (proc_run->name, (* run_proc) (proc_run->name,
proc_run->nparams, proc_run->nparams,
(GimpParam*) proc_run->params, (GimpParam*) proc_run->params,
&n_return_vals, &n_return_vals,
&return_vals); &return_vals);
proc_return.name = proc_run->name; proc_return.name = proc_run->name;
proc_return.nparams = n_return_vals; proc_return.nparams = n_return_vals;

View File

@ -59,7 +59,7 @@
#include <libgimp/gimp_pdb.h> #include <libgimp/gimp_pdb.h>
#ifdef G_OS_WIN32 #ifdef G_OS_WIN32
# include <stdlib.h> /* For __argc and __argv */ # include <stdlib.h> /* For __argc and __argv */
# ifdef LIBGIMP_COMPILATION # ifdef LIBGIMP_COMPILATION
# define GIMPVAR __declspec(dllexport) # define GIMPVAR __declspec(dllexport)
# else /* !LIBGIMP_COMPILATION */ # else /* !LIBGIMP_COMPILATION */
@ -86,10 +86,10 @@ typedef void (* GimpInitProc) (void);
typedef void (* GimpQuitProc) (void); typedef void (* GimpQuitProc) (void);
typedef void (* GimpQueryProc) (void); typedef void (* GimpQueryProc) (void);
typedef void (* GimpRunProc) (const gchar *name, typedef void (* GimpRunProc) (const gchar *name,
gint n_params, gint n_params,
const GimpParam *param, const GimpParam *param,
gint *n_return_vals, gint *n_return_vals,
GimpParam **return_vals); GimpParam **return_vals);
struct _GimpPlugInInfo struct _GimpPlugInInfo
@ -149,7 +149,7 @@ union _GimpParamData
gint32 d_drawable; gint32 d_drawable;
gint32 d_selection; gint32 d_selection;
gint32 d_boundary; gint32 d_boundary;
gint32 d_path; gint32 d_vectors;
gint32 d_unit; gint32 d_unit;
GimpParasite d_parasite; GimpParasite d_parasite;
gint32 d_tattoo; gint32 d_tattoo;
@ -187,28 +187,28 @@ struct _GimpParam
# endif # endif
# endif # endif
# define MAIN() \ # define MAIN() \
struct HINSTANCE__; \ struct HINSTANCE__; \
int _stdcall \ int _stdcall \
WinMain (struct HINSTANCE__ *hInstance, \ WinMain (struct HINSTANCE__ *hInstance, \
struct HINSTANCE__ *hPrevInstance, \ struct HINSTANCE__ *hPrevInstance, \
char *lpszCmdLine, \ char *lpszCmdLine, \
int nCmdShow) \ int nCmdShow) \
{ \ { \
return gimp_main (&PLUG_IN_INFO, __argc, __argv); \ return gimp_main (&PLUG_IN_INFO, __argc, __argv); \
} \ } \
\ \
int \ int \
main (int argc, char *argv[]) \ main (int argc, char *argv[]) \
{ \ { \
return gimp_main (&PLUG_IN_INFO, argc, argv); \ return gimp_main (&PLUG_IN_INFO, argc, argv); \
} }
#else #else
# define MAIN() \ # define MAIN() \
int \ int \
main (int argc, char *argv[]) \ main (int argc, char *argv[]) \
{ \ { \
return gimp_main (&PLUG_IN_INFO, argc, argv); \ return gimp_main (&PLUG_IN_INFO, argc, argv); \
} }
#endif #endif

View File

@ -1096,6 +1096,152 @@ gimp_image_lower_layer_to_bottom (gint32 image_ID,
return success; return success;
} }
/**
* gimp_image_raise_vectors:
* @image_ID: The image.
* @vectors_ID: The vectors object to raise.
*
* Raise the specified vectors in the image's vectors stack
*
* This procedure raises the specified vectors one step in the existing
* vectors stack. It will not move the vectors if there is no vectors
* above it.
*
* Returns: TRUE on success.
*
* Since: GIMP 2.4
*/
gboolean
gimp_image_raise_vectors (gint32 image_ID,
gint32 vectors_ID)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp-image-raise-vectors",
&nreturn_vals,
GIMP_PDB_IMAGE, image_ID,
GIMP_PDB_PATH, vectors_ID,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_image_lower_vectors:
* @image_ID: The image.
* @vectors_ID: The vectors object to lower.
*
* Lower the specified vectors in the image's vectors stack
*
* This procedure lowers the specified vectors one step in the existing
* vectors stack. It will not move the vectors if there is no vectors
* below it.
*
* Returns: TRUE on success.
*
* Since: GIMP 2.4
*/
gboolean
gimp_image_lower_vectors (gint32 image_ID,
gint32 vectors_ID)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp-image-lower-vectors",
&nreturn_vals,
GIMP_PDB_IMAGE, image_ID,
GIMP_PDB_PATH, vectors_ID,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_image_raise_vectors_to_top:
* @image_ID: The image.
* @vectors_ID: The vectors object to raise to top.
*
* Raise the specified vectors in the image's vectors stack to top of
* stack
*
* This procedure raises the specified vectors to top of the existing
* vectors stack. It will not move the vectors if there is no vectors
* above it.
*
* Returns: TRUE on success.
*
* Since: GIMP 2.4
*/
gboolean
gimp_image_raise_vectors_to_top (gint32 image_ID,
gint32 vectors_ID)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp-image-raise-vectors-to-top",
&nreturn_vals,
GIMP_PDB_IMAGE, image_ID,
GIMP_PDB_PATH, vectors_ID,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_image_lower_vectors_to_bottom:
* @image_ID: The image.
* @vectors_ID: The vectors object to lower to bottom.
*
* Lower the specified vectors in the image's vectors stack to bottom
* of stack
*
* This procedure lowers the specified vectors to bottom of the
* existing vectors stack. It will not move the vectors if there is no
* vectors below it.
*
* Returns: TRUE on success.
*
* Since: GIMP 2.4
*/
gboolean
gimp_image_lower_vectors_to_bottom (gint32 image_ID,
gint32 vectors_ID)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp-image-lower-vectors-to-bottom",
&nreturn_vals,
GIMP_PDB_IMAGE, image_ID,
GIMP_PDB_PATH, vectors_ID,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/** /**
* gimp_image_add_channel: * gimp_image_add_channel:
* @image_ID: The image. * @image_ID: The image.
@ -1166,6 +1312,41 @@ gimp_image_remove_channel (gint32 image_ID,
return success; return success;
} }
/**
* gimp_image_remove_vectors:
* @image_ID: The image.
* @vectors_ID: The vectors object.
*
* Remove the specified path from the image.
*
* This procedure removes the specified path from the image. If the
* path doesn't exist, an error is returned.
*
* Returns: TRUE on success.
*
* Since: GIMP 2.4
*/
gboolean
gimp_image_remove_vectors (gint32 image_ID,
gint32 vectors_ID)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp-image-remove-vectors",
&nreturn_vals,
GIMP_PDB_IMAGE, image_ID,
GIMP_PDB_PATH, vectors_ID,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/** /**
* gimp_image_raise_channel: * gimp_image_raise_channel:
* @image_ID: The image. * @image_ID: The image.
@ -1694,6 +1875,68 @@ gimp_image_set_active_channel (gint32 image_ID,
return success; return success;
} }
/**
* gimp_image_get_active_vectors:
* @image_ID: The image.
*
* Returns the specified image's active vectors.
*
* If there is an active path, its ID will be returned, otherwise, -1.
*
* Returns: The active vectors.
*/
gint32
gimp_image_get_active_vectors (gint32 image_ID)
{
GimpParam *return_vals;
gint nreturn_vals;
gint32 active_vectors_ID = -1;
return_vals = gimp_run_procedure ("gimp-image-get-active-vectors",
&nreturn_vals,
GIMP_PDB_IMAGE, image_ID,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
active_vectors_ID = return_vals[1].data.d_vectors;
gimp_destroy_params (return_vals, nreturn_vals);
return active_vectors_ID;
}
/**
* gimp_image_set_active_vectors:
* @image_ID: The image.
* @active_vectors_ID: The new image active vectors.
*
* Sets the specified image's active vectors.
*
* If the path exists, it is set as the active path in the image.
*
* Returns: TRUE on success.
*/
gboolean
gimp_image_set_active_vectors (gint32 image_ID,
gint32 active_vectors_ID)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp-image-set-active-vectors",
&nreturn_vals,
GIMP_PDB_IMAGE, image_ID,
GIMP_PDB_PATH, active_vectors_ID,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/** /**
* gimp_image_get_selection: * gimp_image_get_selection:
* @image_ID: The image. * @image_ID: The image.

View File

@ -91,11 +91,21 @@ gboolean gimp_image_raise_layer_to_top (gint32 ima
gint32 layer_ID); gint32 layer_ID);
gboolean gimp_image_lower_layer_to_bottom (gint32 image_ID, gboolean gimp_image_lower_layer_to_bottom (gint32 image_ID,
gint32 layer_ID); gint32 layer_ID);
gboolean gimp_image_raise_vectors (gint32 image_ID,
gint32 vectors_ID);
gboolean gimp_image_lower_vectors (gint32 image_ID,
gint32 vectors_ID);
gboolean gimp_image_raise_vectors_to_top (gint32 image_ID,
gint32 vectors_ID);
gboolean gimp_image_lower_vectors_to_bottom (gint32 image_ID,
gint32 vectors_ID);
gboolean gimp_image_add_channel (gint32 image_ID, gboolean gimp_image_add_channel (gint32 image_ID,
gint32 channel_ID, gint32 channel_ID,
gint position); gint position);
gboolean gimp_image_remove_channel (gint32 image_ID, gboolean gimp_image_remove_channel (gint32 image_ID,
gint32 channel_ID); gint32 channel_ID);
gboolean gimp_image_remove_vectors (gint32 image_ID,
gint32 vectors_ID);
gboolean gimp_image_raise_channel (gint32 image_ID, gboolean gimp_image_raise_channel (gint32 image_ID,
gint32 channel_ID); gint32 channel_ID);
gboolean gimp_image_lower_channel (gint32 image_ID, gboolean gimp_image_lower_channel (gint32 image_ID,
@ -127,6 +137,9 @@ gboolean gimp_image_set_active_layer (gint32 ima
gint32 gimp_image_get_active_channel (gint32 image_ID); gint32 gimp_image_get_active_channel (gint32 image_ID);
gboolean gimp_image_set_active_channel (gint32 image_ID, gboolean gimp_image_set_active_channel (gint32 image_ID,
gint32 active_channel_ID); gint32 active_channel_ID);
gint32 gimp_image_get_active_vectors (gint32 image_ID);
gboolean gimp_image_set_active_vectors (gint32 image_ID,
gint32 active_vectors_ID);
gint32 gimp_image_get_selection (gint32 image_ID); gint32 gimp_image_get_selection (gint32 image_ID);
gboolean gimp_image_get_component_active (gint32 image_ID, gboolean gimp_image_get_component_active (gint32 image_ID,
GimpChannelType component); GimpChannelType component);

View File

@ -69,14 +69,250 @@ gimp_vectors_get_strokes (gint32 vectors_ID,
return stroke_ids; return stroke_ids;
} }
/**
* gimp_vectors_get_locked:
* @vectors_ID: The vectors object.
*
* Gets the locking state of the vectors object.
*
* Gets the locking state of the vectors object.
*
* Returns: TRUE if the path is locked, FALSE otherwise.
*
* Since: GIMP 2.4
*/
gboolean
gimp_vectors_get_locked (gint32 vectors_ID)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean locked = FALSE;
return_vals = gimp_run_procedure ("gimp-vectors-get-locked",
&nreturn_vals,
GIMP_PDB_PATH, vectors_ID,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
locked = return_vals[1].data.d_int32;
gimp_destroy_params (return_vals, nreturn_vals);
return locked;
}
/**
* gimp_vectors_set_locked:
* @vectors_ID: The vectors object.
* @locked: Whether the path is locked.
*
* Sets the locking state of the vectors object.
*
* Sets the locking state of the vectors object.
*
* Returns: TRUE on success.
*
* Since: GIMP 2.4
*/
gboolean
gimp_vectors_set_locked (gint32 vectors_ID,
gboolean locked)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp-vectors-set-locked",
&nreturn_vals,
GIMP_PDB_PATH, vectors_ID,
GIMP_PDB_INT32, locked,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_vectors_get_visible:
* @vectors_ID: The vectors object.
*
* Gets the visibility of the vectors object.
*
* Gets the visibility of the vectors object.
*
* Returns: TRUE if the path is visible, FALSE otherwise.
*
* Since: GIMP 2.4
*/
gboolean
gimp_vectors_get_visible (gint32 vectors_ID)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean visible = FALSE;
return_vals = gimp_run_procedure ("gimp-vectors-get-visible",
&nreturn_vals,
GIMP_PDB_PATH, vectors_ID,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
visible = return_vals[1].data.d_int32;
gimp_destroy_params (return_vals, nreturn_vals);
return visible;
}
/**
* gimp_vectors_set_visible:
* @vectors_ID: The vectors object.
* @visible: Whether the path is visible.
*
* Sets the visibility of the vectors object.
*
* Sets the visibility of the vectors object.
*
* Returns: TRUE on success.
*
* Since: GIMP 2.4
*/
gboolean
gimp_vectors_set_visible (gint32 vectors_ID,
gboolean visible)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp-vectors-set-visible",
&nreturn_vals,
GIMP_PDB_PATH, vectors_ID,
GIMP_PDB_INT32, visible,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_vectors_get_name:
* @vectors_ID: The vectors object.
*
* Gets the name of the vectors object.
*
* Gets the name of the vectors object.
*
* Returns: The name of the vectors object.
*
* Since: GIMP 2.4
*/
gchar *
gimp_vectors_get_name (gint32 vectors_ID)
{
GimpParam *return_vals;
gint nreturn_vals;
gchar *name = NULL;
return_vals = gimp_run_procedure ("gimp-vectors-get-name",
&nreturn_vals,
GIMP_PDB_PATH, vectors_ID,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
name = g_strdup (return_vals[1].data.d_string);
gimp_destroy_params (return_vals, nreturn_vals);
return name;
}
/**
* gimp_vectors_set_name:
* @vectors_ID: The vectors object.
* @name: the new name of the path.
*
* Sets the name of the vectors object.
*
* Sets the name of the vectors object.
*
* Returns: TRUE on success.
*
* Since: GIMP 2.4
*/
gboolean
gimp_vectors_set_name (gint32 vectors_ID,
const gchar *name)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp-vectors-set-name",
&nreturn_vals,
GIMP_PDB_PATH, vectors_ID,
GIMP_PDB_STRING, name,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_vectors_stroke_get_length:
* @vectors_ID: The vectors object.
* @stroke_id: The stroke ID.
* @prescision: The prescision used for the approximation.
*
* measures the length of the given stroke.
*
* Measure the length of the given stroke.
*
* Returns: The length (in pixels) of the given stroke.
*
* Since: GIMP 2.4
*/
gdouble
gimp_vectors_stroke_get_length (gint32 vectors_ID,
gint stroke_id,
gdouble prescision)
{
GimpParam *return_vals;
gint nreturn_vals;
gdouble length = 0;
return_vals = gimp_run_procedure ("gimp-vectors-stroke-get-length",
&nreturn_vals,
GIMP_PDB_PATH, vectors_ID,
GIMP_PDB_INT32, stroke_id,
GIMP_PDB_FLOAT, prescision,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
length = return_vals[1].data.d_float;
gimp_destroy_params (return_vals, nreturn_vals);
return length;
}
/** /**
* gimp_vectors_stroke_remove: * gimp_vectors_stroke_remove:
* @vectors_ID: The vectors object. * @vectors_ID: The vectors object.
* @stroke_id: The stroke ID. * @stroke_id: The stroke ID.
* *
* return coordinates along the given stroke. * remove the stroke from a vectors object.
* *
* Returns a lot of coordinates along the passed stroke. * Remove the stroke from a vectors object.
* *
* Returns: TRUE on success. * Returns: TRUE on success.
* *
@ -107,8 +343,8 @@ gimp_vectors_stroke_remove (gint32 vectors_ID,
* gimp_vectors_stroke_translate: * gimp_vectors_stroke_translate:
* @vectors_ID: The vectors object. * @vectors_ID: The vectors object.
* @stroke_id: The stroke ID. * @stroke_id: The stroke ID.
* @offx: Offset in x direction. * @off_x: Offset in x direction.
* @offy: Offset in y direction. * @off_y: Offset in y direction.
* *
* translate the given stroke. * translate the given stroke.
* *
@ -121,8 +357,8 @@ gimp_vectors_stroke_remove (gint32 vectors_ID,
gboolean gboolean
gimp_vectors_stroke_translate (gint32 vectors_ID, gimp_vectors_stroke_translate (gint32 vectors_ID,
gint stroke_id, gint stroke_id,
gint offx, gint off_x,
gint offy) gint off_y)
{ {
GimpParam *return_vals; GimpParam *return_vals;
gint nreturn_vals; gint nreturn_vals;
@ -132,8 +368,48 @@ gimp_vectors_stroke_translate (gint32 vectors_ID,
&nreturn_vals, &nreturn_vals,
GIMP_PDB_PATH, vectors_ID, GIMP_PDB_PATH, vectors_ID,
GIMP_PDB_INT32, stroke_id, GIMP_PDB_INT32, stroke_id,
GIMP_PDB_INT32, offx, GIMP_PDB_INT32, off_x,
GIMP_PDB_INT32, offy, GIMP_PDB_INT32, off_y,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_vectors_stroke_scale:
* @vectors_ID: The vectors object.
* @stroke_id: The stroke ID.
* @scale_x: Scale factor in x direction.
* @scale_y: Scale factor in y direction.
*
* scales the given stroke.
*
* Scale the given stroke.
*
* Returns: TRUE on success.
*
* Since: GIMP 2.4
*/
gboolean
gimp_vectors_stroke_scale (gint32 vectors_ID,
gint stroke_id,
gdouble scale_x,
gdouble scale_y)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp-vectors-stroke-scale",
&nreturn_vals,
GIMP_PDB_PATH, vectors_ID,
GIMP_PDB_INT32, stroke_id,
GIMP_PDB_FLOAT, scale_x,
GIMP_PDB_FLOAT, scale_y,
GIMP_PDB_END); GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS; success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;

View File

@ -29,19 +29,35 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */ /* For information look into the C source or the html documentation */
gint* gimp_vectors_get_strokes (gint32 vectors_ID, gint* gimp_vectors_get_strokes (gint32 vectors_ID,
gint *num_strokes); gint *num_strokes);
gboolean gimp_vectors_stroke_remove (gint32 vectors_ID, gboolean gimp_vectors_get_locked (gint32 vectors_ID);
gint stroke_id); gboolean gimp_vectors_set_locked (gint32 vectors_ID,
gboolean gimp_vectors_stroke_translate (gint32 vectors_ID, gboolean locked);
gint stroke_id, gboolean gimp_vectors_get_visible (gint32 vectors_ID);
gint offx, gboolean gimp_vectors_set_visible (gint32 vectors_ID,
gint offy); gboolean visible);
gboolean gimp_vectors_stroke_interpolate (gint32 vectors_ID, gchar* gimp_vectors_get_name (gint32 vectors_ID);
gint stroke_id, gboolean gimp_vectors_set_name (gint32 vectors_ID,
gdouble prescision, const gchar *name);
gint *num_coords, gdouble gimp_vectors_stroke_get_length (gint32 vectors_ID,
gdouble **coords); gint stroke_id,
gdouble prescision);
gboolean gimp_vectors_stroke_remove (gint32 vectors_ID,
gint stroke_id);
gboolean gimp_vectors_stroke_translate (gint32 vectors_ID,
gint stroke_id,
gint off_x,
gint off_y);
gboolean gimp_vectors_stroke_scale (gint32 vectors_ID,
gint stroke_id,
gdouble scale_x,
gdouble scale_y);
gboolean gimp_vectors_stroke_interpolate (gint32 vectors_ID,
gint stroke_id,
gdouble prescision,
gint *num_coords,
gdouble **coords);
G_END_DECLS G_END_DECLS

View File

@ -29,6 +29,12 @@ sub channel_arg () {{
desc => 'The channel' desc => 'The channel'
}} }}
sub vectors_arg () {{
name => 'vectors',
type => 'vectors',
desc => 'The vectors object'
}}
sub new_dim_args { sub new_dim_args {
foreach (qw(width height)) { foreach (qw(width height)) {
push @inargs, { name => "new_$_", push @inargs, { name => "new_$_",
@ -907,6 +913,60 @@ HELP
%invoke = ( code => 'gimp_image_remove_channel (gimage, channel);' ); %invoke = ( code => 'gimp_image_remove_channel (gimage, channel);' );
} }
sub image_remove_vectors {
$blurb = 'Remove the specified path from the image.';
$help = <<'HELP';
This procedure removes the specified path from the image. If the path
doesn't exist, an error is returned.
HELP
&std_pdb_misc;
$author = "Simon Budig";
$date = 2005;
$since = 2.4;
@inargs = (
&std_image_arg,
&vectors_arg
);
%invoke = ( code => 'gimp_image_remove_vectors (gimage, vectors);' );
}
sub image_raise_vectors {
&type_move('vectors', 'raise', 'above');
&std_pdb_misc;
$author = "Simon Budig";
$date = 2005;
$since = 2.4;
}
sub image_lower_vectors {
&type_move('vectors', 'lower', 'below');
&std_pdb_misc;
$author = "Simon Budig";
$date = 2005;
$since = 2.4;
}
sub image_raise_vectors_to_top {
&type_move('vectors', 'raise_to_top', 'above');
&std_pdb_misc;
$author = "Simon Budig";
$date = 2005;
$since = 2.4;
}
sub image_lower_vectors_to_bottom {
&type_move('vectors', 'lower_to_bottom', 'below');
&std_pdb_misc;
$author = "Simon Budig";
$date = 2005;
$since = 2.4;
}
sub image_get_active_drawable { sub image_get_active_drawable {
$blurb = "Get the image's active drawable"; $blurb = "Get the image's active drawable";
@ -1178,6 +1238,25 @@ this procedure will return an execution error.
HELP HELP
CODE2 CODE2
&image_accessors('active_vectors', 'vectors', 'active vectors', 1,
[ <<'CODE1', <<'CODE2' ]);
$invoke{code} = "active_vectors = $outargs[0]->{alias};";
delete @{$outargs[0]}{qw(alias no_declare)};
$outargs[0]->{return_fail} = -1;
$outargs[0]->{init} = 1;
$help = <<'HELP';
If there is an active path, its ID will be returned, otherwise, -1.
HELP
CODE1
$invoke{code} =~ s/;//g;
$invoke{code} = "success = ($invoke{code} == active_vectors);";
$help = <<'HELP';
If the path exists, it is set as the active path in the image.
HELP
CODE2
&image_accessors('selection', 'selection', 'selection', 1, &image_accessors('selection', 'selection', 'selection', 1,
[ <<'CODE', undef ]); [ <<'CODE', undef ]);
$invoke{code} = "success = (selection = gimp_image_get_mask (gimage)) != NULL;"; $invoke{code} = "success = (selection = gimp_image_get_mask (gimage)) != NULL;";
@ -1427,7 +1506,7 @@ HELP
CODE2 CODE2
foreach (qw(layer channel)) { foreach (qw(layer channel vectors)) {
push @procs, "image_get_${_}_by_tattoo"; push @procs, "image_get_${_}_by_tattoo";
eval <<SUB; eval <<SUB;
sub image_get_${_}_by_tattoo { sub image_get_${_}_by_tattoo {
@ -1582,14 +1661,17 @@ unshift @procs, qw(image_list image_new image_duplicate image_delete
image_add_layer image_remove_layer image_add_layer image_remove_layer
image_raise_layer image_lower_layer image_raise_layer image_lower_layer
image_raise_layer_to_top image_lower_layer_to_bottom image_raise_layer_to_top image_lower_layer_to_bottom
image_raise_vectors image_lower_vectors
image_raise_vectors_to_top image_lower_vectors_to_bottom
image_add_channel image_remove_channel image_add_channel image_remove_channel
image_remove_vectors
image_raise_channel image_lower_channel image_raise_channel image_lower_channel
image_flatten image_merge_visible_layers image_merge_down image_flatten image_merge_visible_layers image_merge_down
image_add_layer_mask image_remove_layer_mask image_add_layer_mask image_remove_layer_mask
image_get_colormap image_set_colormap image_get_colormap image_set_colormap
image_clean_all image_is_dirty image_clean_all image_is_dirty
image_thumbnail); image_thumbnail);
%exports = (app => [@procs], lib => [@procs[0..35,38..62]]); %exports = (app => [@procs], lib => [@procs[0..40,43..69]]);
$desc = 'Image'; $desc = 'Image';

View File

@ -38,6 +38,188 @@ sub stroke_arg () {
desc => 'The stroke ID' desc => 'The stroke ID'
}} }}
sub vectors_get_current {
$blurb = 'Gets the current path in the given image.';
$help = <<'HELP';
Gets the current path in the given image.
HELP
&pdb_misc;
@inargs = ( &std_image_arg );
$inargs[0]->{desc} = 'The ID of the image to get the current path from.';
@outargs = (
{ name => 'vectors', type => 'vectors',
desc => 'the current vector object, 0 if no vector exists in the image.',
init => 1 }
);
%invoke = (
code => <<"CODE"
{
vectors = gimp_image_get_active_vectors (gimage);
}
CODE
);
}
sub vectors_get_locked {
$blurb = 'Gets the locking state of the vectors object.';
$help = <<'HELP';
Gets the locking state of the vectors object.
HELP
&pdb_misc;
@inargs = ( &vectors_arg );
@outargs = (
{ name => 'locked', type => 'boolean',
desc => 'TRUE if the path is locked, FALSE otherwise', init => 1 }
);
%invoke = (
code => <<"CODE"
{
locked = gimp_item_get_linked (GIMP_ITEM (vectors));
}
CODE
);
}
sub vectors_set_locked {
$blurb = 'Sets the locking state of the vectors object.';
$help = <<'HELP';
Sets the locking state of the vectors object.
HELP
&pdb_misc;
@inargs = ( &vectors_arg,
{ name => 'locked', type => 'boolean',
desc => 'Whether the path is locked', init => 1 }
);
%invoke = (
code => <<"CODE"
{
gimp_item_set_linked (GIMP_ITEM (vectors), locked, TRUE);
}
CODE
);
}
sub vectors_get_visible {
$blurb = 'Gets the visibility of the vectors object.';
$help = <<'HELP';
Gets the visibility of the vectors object.
HELP
&pdb_misc;
@inargs = ( &vectors_arg );
@outargs = (
{ name => 'visible', type => 'boolean',
desc => 'TRUE if the path is visible, FALSE otherwise', init => 1 }
);
%invoke = (
code => <<"CODE"
{
visible = gimp_item_get_visible (GIMP_ITEM (vectors));
}
CODE
);
}
sub vectors_set_visible {
$blurb = 'Sets the visibility of the vectors object.';
$help = <<'HELP';
Sets the visibility of the vectors object.
HELP
&pdb_misc;
@inargs = ( &vectors_arg,
{ name => 'visible', type => 'boolean',
desc => 'Whether the path is visible',
init => 1 }
);
%invoke = (
code => <<"CODE"
{
gimp_item_set_visible (GIMP_ITEM (vectors), visible, TRUE);
}
CODE
);
}
sub vectors_get_name {
$blurb = 'Gets the name of the vectors object.';
$help = <<'HELP';
Gets the name of the vectors object.
HELP
&pdb_misc;
@inargs = ( &vectors_arg );
@outargs = (
{ name => 'name', type => 'string',
desc => 'The name of the vectors object',
init => 1 }
);
%invoke = (
code => <<"CODE"
{
name = g_strdup (gimp_object_get_name (GIMP_OBJECT (vectors)));
}
CODE
);
}
sub vectors_set_name {
$blurb = 'Sets the name of the vectors object.';
$help = <<'HELP';
Sets the name of the vectors object.
HELP
&pdb_misc;
@inargs = ( &vectors_arg,
{ name => 'name', type => 'string',
desc => 'the new name of the path',
init => 1 }
);
%invoke = (
code => <<"CODE"
{
if (!gimp_item_rename (GIMP_ITEM (vectors), name))
success = FALSE;
}
CODE
);
}
sub vectors_get_strokes { sub vectors_get_strokes {
$blurb = 'List the strokes associated with the passed path.'; $blurb = 'List the strokes associated with the passed path.';
@ -82,11 +264,49 @@ CODE
} }
sub vectors_stroke_remove { sub vectors_stroke_get_length {
$blurb = 'return coordinates along the given stroke.'; $blurb = 'measures the length of the given stroke.';
$help = <<'HELP'; $help = <<'HELP';
Returns a lot of coordinates along the passed stroke. Measure the length of the given stroke.
HELP
&pdb_misc;
@inargs = ( &stroke_arg,
{ name => 'prescision', type => 'float',
desc => 'The prescision used for the approximation' } );
@outargs = (
{ name => 'length', type => 'float',
desc => 'The length (in pixels) of the given stroke.' }
);
%invoke = (
vars => [ 'GimpStroke *stroke' ],
code => <<"CODE"
{
stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_id);
if (!stroke)
{
success = FALSE;
}
else
{
length = gimp_stroke_get_length (stroke, prescision);
}
}
CODE
);
}
sub vectors_stroke_remove {
$blurb = 'remove the stroke from a vectors object.';
$help = <<'HELP';
Remove the stroke from a vectors object.
HELP HELP
&pdb_misc; &pdb_misc;
@ -120,7 +340,7 @@ HELP
@inargs = ( &stroke_arg ); @inargs = ( &stroke_arg );
foreach (qw(x y)) { foreach (qw(x y)) {
push @inargs, { name => "off$_", type => 'int32', push @inargs, { name => "off_$_", type => 'int32',
desc => "Offset in $_ direction" } desc => "Offset in $_ direction" }
} }
@ -142,7 +362,49 @@ HELP
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_ITEM_DISPLACE, gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_ITEM_DISPLACE,
_("Modify Path")); _("Modify Path"));
gimp_vectors_freeze (vectors); gimp_vectors_freeze (vectors);
gimp_stroke_translate (stroke, offx, offy); gimp_stroke_translate (stroke, off_x, off_y);
gimp_vectors_thaw (vectors);
gimp_image_undo_group_end (gimage);
}
}
CODE
);
}
sub vectors_stroke_scale {
$blurb = 'scales the given stroke.';
$help = <<'HELP';
Scale the given stroke.
HELP
&pdb_misc;
@inargs = ( &stroke_arg );
foreach (qw(x y)) {
push @inargs, { name => "scale_$_", type => 'float',
desc => "Scale factor in $_ direction" }
}
%invoke = (
vars => [ 'GimpStroke *stroke' ],
code => <<"CODE"
{
GimpImage *gimage = gimp_item_get_image (GIMP_ITEM (vectors));
stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_id);
if (!stroke)
{
success = FALSE;
}
else
{
/* need to figure out how undo is supposed to work */
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_ITEM_DISPLACE,
_("Modify Path"));
gimp_vectors_freeze (vectors);
gimp_stroke_scale (stroke, scale_x, scale_y);
gimp_vectors_thaw (vectors); gimp_vectors_thaw (vectors);
gimp_image_undo_group_end (gimage); gimp_image_undo_group_end (gimage);
} }
@ -218,14 +480,22 @@ CODE
@headers = qw(<string.h> "core/gimp.h" "core/gimplist.h" @headers = qw(<string.h> "core/gimp.h" "core/gimplist.h"
"core/gimpimage-undo.h" "core/gimpimage.h" "core/gimpimage-undo.h"
"vectors/gimpanchor.h" "vectors/gimpbezierstroke.h" "vectors/gimpanchor.h" "vectors/gimpbezierstroke.h"
"vectors/gimpvectors.h" "vectors/gimpvectors-compat.h" "vectors/gimpvectors.h" "vectors/gimpvectors-compat.h"
"gimp-intl.h"); "gimp-intl.h");
@procs = qw(vectors_get_strokes @procs = qw(vectors_get_strokes
vectors_get_locked
vectors_set_locked
vectors_get_visible
vectors_set_visible
vectors_get_name
vectors_set_name
vectors_stroke_get_length
vectors_stroke_remove vectors_stroke_remove
vectors_stroke_translate vectors_stroke_translate
vectors_stroke_scale
vectors_stroke_interpolate vectors_stroke_interpolate
); );
%exports = (app => [@procs], lib => [@procs]); %exports = (app => [@procs], lib => [@procs]);