mirror of
https://gitlab.gnome.org/GNOME/gimp
synced 2024-10-19 06:14:03 +00:00
Started a PDB api for vectors/strokes. Not yet functional, this commit is
2005-04-14 Simon Budig <simon@gimp.org> Started a PDB api for vectors/strokes. Not yet functional, this commit is to get the infrastructure up and running. * app/vectors/gimpstroke.[ch] * app/vectors/gimpvectors.[ch]: Added IDs to the strokes * tools/pdbgen/pdb.pl: corrected "vectors" type, deleted "path" type. * tools/pdbgen/pdb/image.pdb: added gimp_image_get_vectors() * tools/pdbgen/pdb/vectors.pdb: New file for the vectors API (just a stub for now) * tools/pdbgen/Makefile.am: Added vectors.pdb * tools/pdbgen/groups.pl: regenerated. * plug-ins/script-fu/siod-wrapper.c: Enable the Path/Vectors type. * libgimp/gimpvectors_pdb.[ch] * app/pdb/vectors_cmds.c: new autogenerated files. * libgimp/Makefile.am * app/pdb/Makefile.am: Added new autogenerated file. * libgimp/gimp_pdb.h * libgimp/gimpimage_pdb.[ch] * app/pdb/image_cmds.c * app/pdb/internal_procs.c: regenerated.
This commit is contained in:
parent
21a16899da
commit
5658edd077
30
ChangeLog
30
ChangeLog
|
@ -1,3 +1,33 @@
|
|||
2005-04-14 Simon Budig <simon@gimp.org>
|
||||
|
||||
Started a PDB api for vectors/strokes. Not yet functional, this
|
||||
commit is to get the infrastructure up and running.
|
||||
|
||||
* app/vectors/gimpstroke.[ch]
|
||||
* app/vectors/gimpvectors.[ch]: Added IDs to the strokes
|
||||
|
||||
* tools/pdbgen/pdb.pl: corrected "vectors" type, deleted "path" type.
|
||||
* tools/pdbgen/pdb/image.pdb: added gimp_image_get_vectors()
|
||||
* tools/pdbgen/pdb/vectors.pdb: New file for the vectors API
|
||||
(just a stub for now)
|
||||
|
||||
* tools/pdbgen/Makefile.am: Added vectors.pdb
|
||||
* tools/pdbgen/groups.pl: regenerated.
|
||||
|
||||
* plug-ins/script-fu/siod-wrapper.c: Enable the Path/Vectors type.
|
||||
|
||||
* libgimp/gimpvectors_pdb.[ch]
|
||||
* app/pdb/vectors_cmds.c: new autogenerated files.
|
||||
|
||||
* libgimp/Makefile.am
|
||||
* app/pdb/Makefile.am: Added new autogenerated file.
|
||||
|
||||
* libgimp/gimp_pdb.h
|
||||
* libgimp/gimpimage_pdb.[ch]
|
||||
* app/pdb/image_cmds.c
|
||||
* app/pdb/internal_procs.c: regenerated.
|
||||
|
||||
|
||||
2005-04-13 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/core/gimplayer.c: fixed gtk-doc comment.
|
||||
|
|
|
@ -52,7 +52,8 @@ libapppdb_a_SOURCES = \
|
|||
text_tool_cmds.c \
|
||||
transform_tools_cmds.c \
|
||||
undo_cmds.c \
|
||||
unit_cmds.c
|
||||
unit_cmds.c \
|
||||
vectors_cmds.c
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
-DG_LOG_DOMAIN=\"Gimp-PDB\" \
|
||||
|
|
|
@ -67,6 +67,7 @@ static ProcRecord image_flip_proc;
|
|||
static ProcRecord image_rotate_proc;
|
||||
static ProcRecord image_get_layers_proc;
|
||||
static ProcRecord image_get_channels_proc;
|
||||
static ProcRecord image_get_vectors_proc;
|
||||
static ProcRecord image_get_active_drawable_proc;
|
||||
static ProcRecord image_unset_active_channel_proc;
|
||||
static ProcRecord image_get_floating_sel_proc;
|
||||
|
@ -133,6 +134,7 @@ register_image_procs (Gimp *gimp)
|
|||
procedural_db_register (gimp, &image_rotate_proc);
|
||||
procedural_db_register (gimp, &image_get_layers_proc);
|
||||
procedural_db_register (gimp, &image_get_channels_proc);
|
||||
procedural_db_register (gimp, &image_get_vectors_proc);
|
||||
procedural_db_register (gimp, &image_get_active_drawable_proc);
|
||||
procedural_db_register (gimp, &image_unset_active_channel_proc);
|
||||
procedural_db_register (gimp, &image_get_floating_sel_proc);
|
||||
|
@ -1240,6 +1242,88 @@ static ProcRecord image_get_channels_proc =
|
|||
{ { image_get_channels_invoker } }
|
||||
};
|
||||
|
||||
static Argument *
|
||||
image_get_vectors_invoker (Gimp *gimp,
|
||||
GimpContext *context,
|
||||
GimpProgress *progress,
|
||||
Argument *args)
|
||||
{
|
||||
gboolean success = TRUE;
|
||||
Argument *return_args;
|
||||
GimpImage *gimage;
|
||||
gint32 num_vectors = 0;
|
||||
gint32 *vector_ids = NULL;
|
||||
GList *list = NULL;
|
||||
gint i;
|
||||
|
||||
gimage = gimp_image_get_by_ID (gimp, args[0].value.pdb_int);
|
||||
if (! GIMP_IS_IMAGE (gimage))
|
||||
success = FALSE;
|
||||
|
||||
if (success)
|
||||
{
|
||||
list = GIMP_LIST (gimage->vectors)->list;
|
||||
num_vectors = g_list_length (list);
|
||||
|
||||
if (num_vectors)
|
||||
{
|
||||
vector_ids = g_new (gint32, num_vectors);
|
||||
for (i = 0; i < num_vectors; i++, list = g_list_next (list))
|
||||
vector_ids[i] = gimp_item_get_ID (GIMP_ITEM (list->data));
|
||||
}
|
||||
}
|
||||
|
||||
return_args = procedural_db_return_args (&image_get_vectors_proc, success);
|
||||
|
||||
if (success)
|
||||
{
|
||||
return_args[1].value.pdb_int = num_vectors;
|
||||
return_args[2].value.pdb_pointer = vector_ids;
|
||||
}
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
||||
static ProcArg image_get_vectors_inargs[] =
|
||||
{
|
||||
{
|
||||
GIMP_PDB_IMAGE,
|
||||
"image",
|
||||
"The image"
|
||||
}
|
||||
};
|
||||
|
||||
static ProcArg image_get_vectors_outargs[] =
|
||||
{
|
||||
{
|
||||
GIMP_PDB_INT32,
|
||||
"num_vectors",
|
||||
"The number of vectors contained in the image"
|
||||
},
|
||||
{
|
||||
GIMP_PDB_INT32ARRAY,
|
||||
"vector_ids",
|
||||
"The list of vectors contained in the image"
|
||||
}
|
||||
};
|
||||
|
||||
static ProcRecord image_get_vectors_proc =
|
||||
{
|
||||
"gimp_image_get_vectors",
|
||||
"Returns the list of vectors contained in the specified image.",
|
||||
"This procedure returns the list of vectors contained in the specified image.",
|
||||
"Spencer Kimball & Peter Mattis",
|
||||
"Spencer Kimball & Peter Mattis",
|
||||
"1995-1996",
|
||||
NULL,
|
||||
GIMP_INTERNAL,
|
||||
1,
|
||||
image_get_vectors_inargs,
|
||||
2,
|
||||
image_get_vectors_outargs,
|
||||
{ { image_get_vectors_invoker } }
|
||||
};
|
||||
|
||||
static Argument *
|
||||
image_get_active_drawable_invoker (Gimp *gimp,
|
||||
GimpContext *context,
|
||||
|
|
|
@ -73,8 +73,9 @@ void register_text_tool_procs (Gimp *gimp);
|
|||
void register_transform_tools_procs (Gimp *gimp);
|
||||
void register_undo_procs (Gimp *gimp);
|
||||
void register_unit_procs (Gimp *gimp);
|
||||
void register_vectors_procs (Gimp *gimp);
|
||||
|
||||
/* 456 procedures registered total */
|
||||
/* 458 procedures registered total */
|
||||
|
||||
void
|
||||
internal_procs_init (Gimp *gimp,
|
||||
|
@ -98,118 +99,121 @@ internal_procs_init (Gimp *gimp,
|
|||
(* status_callback) (NULL, _("Color"), 0.09);
|
||||
register_color_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Context"), 0.123);
|
||||
(* status_callback) (NULL, _("Context"), 0.122);
|
||||
register_context_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Convert"), 0.171);
|
||||
(* status_callback) (NULL, _("Convert"), 0.17);
|
||||
register_convert_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Display procedures"), 0.178);
|
||||
(* status_callback) (NULL, _("Display procedures"), 0.177);
|
||||
register_display_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Drawable procedures"), 0.186);
|
||||
register_drawable_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Transformation procedures"), 0.261);
|
||||
(* status_callback) (NULL, _("Transformation procedures"), 0.26);
|
||||
register_drawable_transform_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Edit procedures"), 0.296);
|
||||
(* status_callback) (NULL, _("Edit procedures"), 0.295);
|
||||
register_edit_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("File Operations"), 0.316);
|
||||
(* status_callback) (NULL, _("File Operations"), 0.314);
|
||||
register_fileops_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Floating selections"), 0.338);
|
||||
(* status_callback) (NULL, _("Floating selections"), 0.336);
|
||||
register_floating_sel_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Font UI"), 0.351);
|
||||
(* status_callback) (NULL, _("Font UI"), 0.349);
|
||||
register_font_select_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Fonts"), 0.357);
|
||||
(* status_callback) (NULL, _("Fonts"), 0.356);
|
||||
register_fonts_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Gimprc procedures"), 0.362);
|
||||
(* status_callback) (NULL, _("Gimprc procedures"), 0.36);
|
||||
register_gimprc_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Gradient"), 0.375);
|
||||
(* status_callback) (NULL, _("Gradient"), 0.373);
|
||||
register_gradient_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Gradient UI"), 0.441);
|
||||
(* status_callback) (NULL, _("Gradient UI"), 0.439);
|
||||
register_gradient_select_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Gradients"), 0.447);
|
||||
(* status_callback) (NULL, _("Gradients"), 0.445);
|
||||
register_gradients_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Guide procedures"), 0.458);
|
||||
(* status_callback) (NULL, _("Guide procedures"), 0.456);
|
||||
register_guides_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Help procedures"), 0.471);
|
||||
(* status_callback) (NULL, _("Help procedures"), 0.469);
|
||||
register_help_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Image"), 0.474);
|
||||
(* status_callback) (NULL, _("Image"), 0.472);
|
||||
register_image_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Layer"), 0.61);
|
||||
(* status_callback) (NULL, _("Layer"), 0.609);
|
||||
register_layer_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Message procedures"), 0.669);
|
||||
(* status_callback) (NULL, _("Message procedures"), 0.668);
|
||||
register_message_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Miscellaneous"), 0.675);
|
||||
register_misc_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Paint Tool procedures"), 0.68);
|
||||
(* status_callback) (NULL, _("Paint Tool procedures"), 0.679);
|
||||
register_paint_tools_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Palette"), 0.713);
|
||||
(* status_callback) (NULL, _("Palette"), 0.712);
|
||||
register_palette_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Palette UI"), 0.743);
|
||||
(* status_callback) (NULL, _("Palette UI"), 0.742);
|
||||
register_palette_select_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Palettes"), 0.75);
|
||||
(* status_callback) (NULL, _("Palettes"), 0.749);
|
||||
register_palettes_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Parasite procedures"), 0.759);
|
||||
(* status_callback) (NULL, _("Parasite procedures"), 0.758);
|
||||
register_parasite_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Paths"), 0.785);
|
||||
(* status_callback) (NULL, _("Paths"), 0.784);
|
||||
register_paths_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Pattern"), 0.82);
|
||||
(* status_callback) (NULL, _("Pattern"), 0.819);
|
||||
register_pattern_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Pattern UI"), 0.825);
|
||||
(* status_callback) (NULL, _("Pattern UI"), 0.823);
|
||||
register_pattern_select_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Patterns"), 0.831);
|
||||
(* status_callback) (NULL, _("Patterns"), 0.83);
|
||||
register_patterns_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Plug-in"), 0.84);
|
||||
(* status_callback) (NULL, _("Plug-in"), 0.838);
|
||||
register_plug_in_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Procedural database"), 0.853);
|
||||
(* status_callback) (NULL, _("Procedural database"), 0.852);
|
||||
register_procedural_db_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Progress"), 0.873);
|
||||
(* status_callback) (NULL, _("Progress"), 0.871);
|
||||
register_progress_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Image mask"), 0.888);
|
||||
(* status_callback) (NULL, _("Image mask"), 0.886);
|
||||
register_selection_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Selection Tool procedures"), 0.925);
|
||||
(* status_callback) (NULL, _("Selection Tool procedures"), 0.924);
|
||||
register_selection_tools_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Text procedures"), 0.936);
|
||||
(* status_callback) (NULL, _("Text procedures"), 0.934);
|
||||
register_text_tool_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Transform Tool procedures"), 0.945);
|
||||
(* status_callback) (NULL, _("Transform Tool procedures"), 0.943);
|
||||
register_transform_tools_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Undo"), 0.958);
|
||||
(* status_callback) (NULL, _("Undo"), 0.956);
|
||||
register_undo_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Units"), 0.974);
|
||||
(* status_callback) (NULL, _("Units"), 0.972);
|
||||
register_unit_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Paths"), 0.998);
|
||||
register_vectors_procs (gimp);
|
||||
|
||||
}
|
||||
|
|
118
app/pdb/vectors_cmds.c
Normal file
118
app/pdb/vectors_cmds.c
Normal file
|
@ -0,0 +1,118 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* NOTE: This file is autogenerated by pdbgen.pl. */
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "pdb-types.h"
|
||||
#include "procedural_db.h"
|
||||
|
||||
#include "core/gimp.h"
|
||||
#include "core/gimpchannel-select.h"
|
||||
#include "core/gimplist.h"
|
||||
#include "gimp-intl.h"
|
||||
#include "vectors/gimpanchor.h"
|
||||
#include "vectors/gimpbezierstroke.h"
|
||||
#include "vectors/gimpvectors-compat.h"
|
||||
#include "vectors/gimpvectors.h"
|
||||
|
||||
static ProcRecord vectors_get_strokes_proc;
|
||||
|
||||
void
|
||||
register_vectors_procs (Gimp *gimp)
|
||||
{
|
||||
procedural_db_register (gimp, &vectors_get_strokes_proc);
|
||||
}
|
||||
|
||||
static Argument *
|
||||
vectors_get_strokes_invoker (Gimp *gimp,
|
||||
GimpContext *context,
|
||||
GimpProgress *progress,
|
||||
Argument *args)
|
||||
{
|
||||
gboolean success = TRUE;
|
||||
Argument *return_args;
|
||||
GimpVectors *vectors;
|
||||
gint32 num_strokes;
|
||||
gint32 *stroke_list = 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)
|
||||
{
|
||||
stroke_list = NULL;
|
||||
num_strokes = 0;
|
||||
}
|
||||
|
||||
return_args = procedural_db_return_args (&vectors_get_strokes_proc, success);
|
||||
|
||||
if (success)
|
||||
{
|
||||
return_args[1].value.pdb_int = num_strokes;
|
||||
return_args[2].value.pdb_pointer = stroke_list;
|
||||
}
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
||||
static ProcArg vectors_get_strokes_inargs[] =
|
||||
{
|
||||
{
|
||||
GIMP_PDB_PATH,
|
||||
"vectors",
|
||||
"The vectors object"
|
||||
}
|
||||
};
|
||||
|
||||
static ProcArg vectors_get_strokes_outargs[] =
|
||||
{
|
||||
{
|
||||
GIMP_PDB_INT32,
|
||||
"num_strokes",
|
||||
"The number of strokes returned."
|
||||
},
|
||||
{
|
||||
GIMP_PDB_INT32ARRAY,
|
||||
"stroke_list",
|
||||
"List of the paths belonging to this image."
|
||||
}
|
||||
};
|
||||
|
||||
static ProcRecord vectors_get_strokes_proc =
|
||||
{
|
||||
"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_INTERNAL,
|
||||
1,
|
||||
vectors_get_strokes_inargs,
|
||||
2,
|
||||
vectors_get_strokes_outargs,
|
||||
{ { vectors_get_strokes_invoker } }
|
||||
};
|
|
@ -289,6 +289,7 @@ gimp_stroke_class_init (GimpStrokeClass *klass)
|
|||
static void
|
||||
gimp_stroke_init (GimpStroke *stroke)
|
||||
{
|
||||
stroke->ID = 0;
|
||||
stroke->anchors = NULL;
|
||||
stroke->closed = FALSE;
|
||||
}
|
||||
|
@ -381,6 +382,25 @@ gimp_stroke_get_memsize (GimpObject *object,
|
|||
gui_size);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_stroke_set_ID (GimpStroke *stroke,
|
||||
gint id)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_STROKE (stroke));
|
||||
g_return_if_fail (stroke->ID == 0 /* we don't want changing IDs... */);
|
||||
|
||||
stroke->ID = id;
|
||||
}
|
||||
|
||||
gint
|
||||
gimp_stroke_get_ID (const GimpStroke *stroke)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_STROKE (stroke), -1);
|
||||
|
||||
return stroke->ID;
|
||||
}
|
||||
|
||||
|
||||
GimpAnchor *
|
||||
gimp_stroke_anchor_get (const GimpStroke *stroke,
|
||||
const GimpCoords *coord)
|
||||
|
@ -965,6 +985,7 @@ gimp_stroke_real_duplicate (const GimpStroke *stroke)
|
|||
}
|
||||
|
||||
new_stroke->closed = stroke->closed;
|
||||
/* we do *not* copy the ID! */
|
||||
|
||||
return new_stroke;
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ typedef struct _GimpStrokeClass GimpStrokeClass;
|
|||
struct _GimpStroke
|
||||
{
|
||||
GimpObject parent_instance;
|
||||
gint ID;
|
||||
|
||||
GList *anchors;
|
||||
|
||||
|
@ -154,6 +155,10 @@ struct _GimpStrokeClass
|
|||
|
||||
GType gimp_stroke_get_type (void) G_GNUC_CONST;
|
||||
|
||||
void gimp_stroke_set_ID (GimpStroke *stroke,
|
||||
gint id);
|
||||
gint gimp_stroke_get_ID (const GimpStroke *stroke);
|
||||
|
||||
|
||||
/* accessing / modifying the anchors */
|
||||
|
||||
|
|
|
@ -261,10 +261,11 @@ gimp_vectors_init (GimpVectors *vectors)
|
|||
{
|
||||
GimpItem *item = GIMP_ITEM (vectors);
|
||||
|
||||
item->visible = FALSE;
|
||||
vectors->strokes = NULL;
|
||||
vectors->freeze_count = 0;
|
||||
vectors->precision = 0.2;
|
||||
item->visible = FALSE;
|
||||
vectors->strokes = NULL;
|
||||
vectors->last_stroke_ID = 0;
|
||||
vectors->freeze_count = 0;
|
||||
vectors->precision = 0.2;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -639,6 +640,7 @@ gimp_vectors_copy_strokes (const GimpVectors *src_vectors,
|
|||
}
|
||||
|
||||
dest_vectors->strokes = NULL;
|
||||
dest_vectors->last_stroke_ID = 0;
|
||||
|
||||
gimp_vectors_add_strokes (src_vectors, dest_vectors);
|
||||
|
||||
|
@ -664,6 +666,8 @@ gimp_vectors_add_strokes (const GimpVectors *src_vectors,
|
|||
while (current_lstroke)
|
||||
{
|
||||
current_lstroke->data = gimp_stroke_duplicate (current_lstroke->data);
|
||||
gimp_stroke_set_ID (current_lstroke->data,
|
||||
dest_vectors->last_stroke_ID++);
|
||||
current_lstroke = g_list_next (current_lstroke);
|
||||
}
|
||||
|
||||
|
@ -673,8 +677,6 @@ gimp_vectors_add_strokes (const GimpVectors *src_vectors,
|
|||
}
|
||||
|
||||
|
||||
/* Calling the virtual functions */
|
||||
|
||||
void
|
||||
gimp_vectors_stroke_add (GimpVectors *vectors,
|
||||
GimpStroke *stroke)
|
||||
|
@ -696,6 +698,7 @@ gimp_vectors_real_stroke_add (GimpVectors *vectors,
|
|||
/* Don't g_list_prepend() here. See ChangeLog 2003-05-21 --Mitch */
|
||||
|
||||
vectors->strokes = g_list_append (vectors->strokes, stroke);
|
||||
gimp_stroke_set_ID (stroke, vectors->last_stroke_ID++);
|
||||
g_object_ref (stroke);
|
||||
}
|
||||
|
||||
|
@ -728,6 +731,21 @@ gimp_vectors_real_stroke_remove (GimpVectors *vectors,
|
|||
}
|
||||
}
|
||||
|
||||
GimpStroke *
|
||||
gimp_vectors_stroke_get_by_ID (const GimpVectors *vectors,
|
||||
gint id)
|
||||
{
|
||||
GList *stroke;
|
||||
|
||||
for (stroke = vectors->strokes; stroke; stroke = g_list_next (stroke))
|
||||
{
|
||||
if (gimp_stroke_get_ID (stroke->data) == id)
|
||||
return stroke->data;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
GimpStroke *
|
||||
gimp_vectors_stroke_get (const GimpVectors *vectors,
|
||||
|
|
|
@ -40,10 +40,10 @@ struct _GimpVectors
|
|||
GimpItem parent_instance;
|
||||
|
||||
GList *strokes; /* The List of GimpStrokes */
|
||||
gint last_stroke_ID;
|
||||
|
||||
gint freeze_count;
|
||||
gdouble precision;
|
||||
/* Stuff missing */
|
||||
};
|
||||
|
||||
struct _GimpVectorsClass
|
||||
|
@ -139,6 +139,8 @@ void gimp_vectors_stroke_add (GimpVectors *vectors,
|
|||
GimpStroke *stroke);
|
||||
void gimp_vectors_stroke_remove (GimpVectors *vectors,
|
||||
GimpStroke *stroke);
|
||||
GimpStroke * gimp_vectors_stroke_get_by_ID (const GimpVectors *vectors,
|
||||
gint id);
|
||||
GimpStroke * gimp_vectors_stroke_get (const GimpVectors *vectors,
|
||||
const GimpCoords *coord);
|
||||
|
||||
|
|
|
@ -110,7 +110,8 @@ PDB_WRAPPERS_C = \
|
|||
gimptexttool_pdb.c \
|
||||
gimptransformtools_pdb.c \
|
||||
gimpundo_pdb.c \
|
||||
gimpunit_pdb.c
|
||||
gimpunit_pdb.c \
|
||||
gimpvectors_pdb.c
|
||||
|
||||
PDB_WRAPPERS_H = \
|
||||
gimp_pdb.h \
|
||||
|
@ -156,7 +157,8 @@ PDB_WRAPPERS_H = \
|
|||
gimptexttool_pdb.h \
|
||||
gimptransformtools_pdb.h \
|
||||
gimpundo_pdb.h \
|
||||
gimpunit_pdb.h
|
||||
gimpunit_pdb.h \
|
||||
gimpvectors_pdb.h
|
||||
|
||||
libgimp_2_0_la_sources = \
|
||||
gimp.c \
|
||||
|
|
|
@ -67,5 +67,6 @@
|
|||
#include <libgimp/gimptransformtools_pdb.h>
|
||||
#include <libgimp/gimpundo_pdb.h>
|
||||
#include <libgimp/gimpunit_pdb.h>
|
||||
#include <libgimp/gimpvectors_pdb.h>
|
||||
|
||||
#endif /* __GIMP_PDB_H__ */
|
||||
|
|
|
@ -609,6 +609,48 @@ gimp_image_get_channels (gint32 image_ID,
|
|||
return channel_ids;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_image_get_vectors:
|
||||
* @image_ID: The image.
|
||||
* @num_vectors: The number of vectors contained in the image.
|
||||
*
|
||||
* Returns the list of vectors contained in the specified image.
|
||||
*
|
||||
* This procedure returns the list of vectors contained in the
|
||||
* specified image.
|
||||
*
|
||||
* Returns: The list of vectors contained in the image.
|
||||
*
|
||||
* Since: GIMP 2.4
|
||||
*/
|
||||
gint *
|
||||
gimp_image_get_vectors (gint32 image_ID,
|
||||
gint *num_vectors)
|
||||
{
|
||||
GimpParam *return_vals;
|
||||
gint nreturn_vals;
|
||||
gint *vector_ids = NULL;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp_image_get_vectors",
|
||||
&nreturn_vals,
|
||||
GIMP_PDB_IMAGE, image_ID,
|
||||
GIMP_PDB_END);
|
||||
|
||||
*num_vectors = 0;
|
||||
|
||||
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
|
||||
{
|
||||
*num_vectors = return_vals[1].data.d_int32;
|
||||
vector_ids = g_new (gint32, *num_vectors);
|
||||
memcpy (vector_ids, return_vals[2].data.d_int32array,
|
||||
*num_vectors * sizeof (gint32));
|
||||
}
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return vector_ids;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_image_get_active_drawable:
|
||||
* @image_ID: The image.
|
||||
|
|
|
@ -61,6 +61,8 @@ gint* gimp_image_get_layers (gint32 ima
|
|||
gint *num_layers);
|
||||
gint* gimp_image_get_channels (gint32 image_ID,
|
||||
gint *num_channels);
|
||||
gint* gimp_image_get_vectors (gint32 image_ID,
|
||||
gint *num_vectors);
|
||||
gint32 gimp_image_get_active_drawable (gint32 image_ID);
|
||||
gboolean gimp_image_unset_active_channel (gint32 image_ID);
|
||||
gint32 gimp_image_get_floating_sel (gint32 image_ID);
|
||||
|
|
70
libgimp/gimpvectors_pdb.c
Normal file
70
libgimp/gimpvectors_pdb.c
Normal file
|
@ -0,0 +1,70 @@
|
|||
/* LIBGIMP - The GIMP Library
|
||||
* Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
|
||||
*
|
||||
* gimpvectors_pdb.c
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* NOTE: This file is autogenerated by pdbgen.pl */
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "gimp.h"
|
||||
|
||||
/**
|
||||
* gimp_vectors_get_strokes:
|
||||
* @vectors_ID: The vectors object.
|
||||
* @num_strokes: The number of strokes returned.
|
||||
*
|
||||
* List the strokes associated with the passed path.
|
||||
*
|
||||
* Returns an Array with the stroke-IDs associated with the passed
|
||||
* path.
|
||||
*
|
||||
* Returns: List of the paths belonging to this image.
|
||||
*
|
||||
* Since: GIMP 2.4
|
||||
*/
|
||||
gint *
|
||||
gimp_vectors_get_strokes (gint32 vectors_ID,
|
||||
gint *num_strokes)
|
||||
{
|
||||
GimpParam *return_vals;
|
||||
gint nreturn_vals;
|
||||
gint *stroke_list = NULL;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp_vectors_get_strokes",
|
||||
&nreturn_vals,
|
||||
GIMP_PDB_PATH, vectors_ID,
|
||||
GIMP_PDB_END);
|
||||
|
||||
*num_strokes = 0;
|
||||
|
||||
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
|
||||
{
|
||||
*num_strokes = return_vals[1].data.d_int32;
|
||||
stroke_list = g_new (gint32, *num_strokes);
|
||||
memcpy (stroke_list, return_vals[2].data.d_int32array,
|
||||
*num_strokes * sizeof (gint32));
|
||||
}
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return stroke_list;
|
||||
}
|
38
libgimp/gimpvectors_pdb.h
Normal file
38
libgimp/gimpvectors_pdb.h
Normal file
|
@ -0,0 +1,38 @@
|
|||
/* LIBGIMP - The GIMP Library
|
||||
* Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
|
||||
*
|
||||
* gimpvectors_pdb.h
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* NOTE: This file is autogenerated by pdbgen.pl */
|
||||
|
||||
#ifndef __GIMP_VECTORS_PDB_H__
|
||||
#define __GIMP_VECTORS_PDB_H__
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/* For information look into the C source or the html documentation */
|
||||
|
||||
|
||||
gint* gimp_vectors_get_strokes (gint32 vectors_ID,
|
||||
gint *num_strokes);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GIMP_VECTORS_PDB_H__ */
|
|
@ -854,8 +854,13 @@ marshall_proc_db_call (LISP a)
|
|||
break;
|
||||
|
||||
case GIMP_PDB_PATH:
|
||||
return my_err ("Paths are currently unsupported as arguments",
|
||||
car (a));
|
||||
if (!TYPEP (car (a), tc_flonum))
|
||||
success = FALSE;
|
||||
if (success)
|
||||
{
|
||||
args[i].type = GIMP_PDB_PATH;
|
||||
args[i].data.d_int32 = get_c_long (car (a));
|
||||
}
|
||||
break;
|
||||
|
||||
case GIMP_PDB_PARASITE:
|
||||
|
@ -1126,7 +1131,8 @@ marshall_proc_db_call (LISP a)
|
|||
break;
|
||||
|
||||
case GIMP_PDB_PATH:
|
||||
return my_err ("Paths are currently unsupported as return values", NIL);
|
||||
return_val = cons (flocons (values[i + 1].data.d_int32),
|
||||
return_val);
|
||||
break;
|
||||
|
||||
case GIMP_PDB_PARASITE:
|
||||
|
|
|
@ -854,8 +854,13 @@ marshall_proc_db_call (LISP a)
|
|||
break;
|
||||
|
||||
case GIMP_PDB_PATH:
|
||||
return my_err ("Paths are currently unsupported as arguments",
|
||||
car (a));
|
||||
if (!TYPEP (car (a), tc_flonum))
|
||||
success = FALSE;
|
||||
if (success)
|
||||
{
|
||||
args[i].type = GIMP_PDB_PATH;
|
||||
args[i].data.d_int32 = get_c_long (car (a));
|
||||
}
|
||||
break;
|
||||
|
||||
case GIMP_PDB_PARASITE:
|
||||
|
@ -1126,7 +1131,8 @@ marshall_proc_db_call (LISP a)
|
|||
break;
|
||||
|
||||
case GIMP_PDB_PATH:
|
||||
return my_err ("Paths are currently unsupported as return values", NIL);
|
||||
return_val = cons (flocons (values[i + 1].data.d_int32),
|
||||
return_val);
|
||||
break;
|
||||
|
||||
case GIMP_PDB_PARASITE:
|
||||
|
|
|
@ -44,7 +44,8 @@ pdb_sources = \
|
|||
pdb/text_tool.pdb \
|
||||
pdb/transform_tools.pdb \
|
||||
pdb/undo.pdb \
|
||||
pdb/unit.pdb
|
||||
pdb/unit.pdb \
|
||||
pdb/vectors.pdb
|
||||
|
||||
EXTRA_DIST = \
|
||||
README \
|
||||
|
|
|
@ -43,4 +43,5 @@
|
|||
transform_tools
|
||||
undo
|
||||
unit
|
||||
vectors
|
||||
);
|
||||
|
|
|
@ -76,7 +76,7 @@ package Gimp::CodeGen::pdb;
|
|||
id_func => '(GimpLayerMask *) gimp_item_get_by_ID',
|
||||
id_ret_func => 'gimp_item_get_ID (GIMP_ITEM ($var))',
|
||||
check_func => '(GIMP_IS_LAYER_MASK ($var) && ! gimp_item_is_removed (GIMP_ITEM ($var)))' },
|
||||
vectors => { name => 'VECTORS',
|
||||
vectors => { name => 'PATH',
|
||||
type => 'GimpVectors *',
|
||||
headers => [ qw("vectors/gimpvectors.h") ],
|
||||
id_func => '(GimpVectors *) gimp_item_get_by_ID',
|
||||
|
@ -87,7 +87,6 @@ package Gimp::CodeGen::pdb;
|
|||
headers => [ qw("libgimpbase/gimpbase.h") ] },
|
||||
|
||||
boundary => { name => 'BOUNDARY', type => 'gpointer ' }, # ??? FIXME
|
||||
path => { name => 'PATH' , type => 'gpointer ' }, # ??? FIXME
|
||||
status => { name => 'STATUS' , type => 'gpointer ' }, # ??? FIXME
|
||||
|
||||
# Special cases
|
||||
|
|
|
@ -514,6 +514,12 @@ topmost to bottommost.
|
|||
HELP
|
||||
}
|
||||
|
||||
sub image_get_vectors {
|
||||
&image_list_proc('vector');
|
||||
|
||||
$since = '2.4';
|
||||
}
|
||||
|
||||
sub image_unset_active_channel {
|
||||
$blurb = 'Unsets the active channel in the specified image.';
|
||||
|
||||
|
@ -1562,6 +1568,7 @@ unshift @procs, qw(image_list image_new image_duplicate image_delete
|
|||
image_resize image_resize_to_layers image_scale
|
||||
image_crop image_flip image_rotate
|
||||
image_get_layers image_get_channels
|
||||
image_get_vectors
|
||||
image_get_active_drawable
|
||||
image_unset_active_channel
|
||||
image_get_floating_sel image_floating_sel_attached_to
|
||||
|
@ -1576,7 +1583,7 @@ unshift @procs, qw(image_list image_new image_duplicate image_delete
|
|||
image_get_colormap image_set_colormap
|
||||
image_clean_all image_is_dirty
|
||||
image_thumbnail);
|
||||
%exports = (app => [@procs], lib => [@procs[0..34,37..61]]);
|
||||
%exports = (app => [@procs], lib => [@procs[0..35,38..62]]);
|
||||
|
||||
$desc = 'Image';
|
||||
|
||||
|
|
73
tools/pdbgen/pdb/vectors.pdb
Normal file
73
tools/pdbgen/pdb/vectors.pdb
Normal file
|
@ -0,0 +1,73 @@
|
|||
# The GIMP -- an image manipulation program
|
||||
# Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
sub pdb_misc {
|
||||
$author = $copyright = 'Simon Budig';
|
||||
$date = '2005';
|
||||
|
||||
$since = '2.4';
|
||||
}
|
||||
|
||||
# The defs
|
||||
|
||||
sub vectors_arg () {{
|
||||
name => 'vectors',
|
||||
type => 'vectors',
|
||||
desc => 'The vectors object'
|
||||
}}
|
||||
|
||||
sub vectors_get_strokes {
|
||||
$blurb = 'List the strokes associated with the passed path.';
|
||||
|
||||
$help = <<'HELP';
|
||||
Returns an Array with the stroke-IDs associated with the passed path.
|
||||
HELP
|
||||
|
||||
&pdb_misc;
|
||||
|
||||
@inargs = ( &vectors_arg );
|
||||
|
||||
@outargs = (
|
||||
{ name => 'stroke_list', type => 'int32array',
|
||||
desc => 'List of the paths belonging to this image.',
|
||||
array => { name => 'num_strokes',
|
||||
desc => 'The number of strokes returned.' },
|
||||
init => 0 }
|
||||
);
|
||||
|
||||
$invoke{code} = <<"CODE";
|
||||
{
|
||||
stroke_list = NULL;
|
||||
num_strokes = 0;
|
||||
}
|
||||
CODE
|
||||
}
|
||||
|
||||
|
||||
@headers = qw(<string.h> "core/gimp.h" "core/gimplist.h"
|
||||
"core/gimpchannel-select.h"
|
||||
"vectors/gimpanchor.h" "vectors/gimpbezierstroke.h"
|
||||
"vectors/gimpvectors.h" "vectors/gimpvectors-compat.h"
|
||||
"gimp-intl.h");
|
||||
|
||||
@procs = qw(vectors_get_strokes
|
||||
);
|
||||
%exports = (app => [@procs], lib => [@procs]);
|
||||
|
||||
$desc = 'Paths';
|
||||
|
||||
1;
|
Loading…
Reference in a new issue