gimp/app/paint/gimppaintcore-stroke.c

288 lines
8.6 KiB
C
Raw Normal View History

Made the paint tool PDB wrappers work again (a bit at least...) 2002-02-21 Michael Natterer <mitch@gimp.org> Made the paint tool PDB wrappers work again (a bit at least...) * app/Makefile.am: changed linking order. libtool sucks. * app/undo.c: check if active_tool is a GimpPaintTool before casting it. * app/paint/Makefile.am * app/paint/paint-types.h: added new files/types. * app/paint/gimppaintoptions.[ch]: new files cut out of tools/paint_options.h. Prefixed everything with "Gimp". There is still GtkWidget* cruft hanging around in the structs... * app/paint/gimppaintcore-stroke.[ch]: utility function which paints a stroke array. Needed for the PDB wrappers. * app/paint/gimpairbrush.[ch] * app/paint/gimpclone.[ch] * app/paint/gimpconvolve.[ch] * app/paint/gimpdodgeburn.[ch] * app/paint/gimperaser.[ch] * app/paint/gimppaintbrush.c * app/paint/gimppaintcore.[ch] * app/paint/gimppencil.c * app/paint/gimpsmudge.[ch]: added *_options_new() functions which create correctly initialized options structures without widgets. * app/tools/paint_options.[ch]: removed the options struct definitions and value initialisations. * app/tools/gimpairbrushtool.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpclonetool.c * app/tools/gimpconvolvetool.c * app/tools/gimpdodgeburntool.c * app/tools/gimperasertool.c * app/tools/gimpinktool.c * app/tools/gimppaintbrushtool.c * app/tools/gimppainttool.c * app/tools/gimppenciltool.c * app/tools/gimpsmudgetool.c: changed all paint_options functions accordingly, s/PaintOptions/GimpPaintOptions/g etc., removed all #if 0'ed non_gui functions. * tools/pdbgen/pdb/paint_tools.pdb: use gimp_paint_core_stroke(). We currently leak all paint_options structs created by the PDB wrappers, more stuff to come... * app/pdb/paint_tools_cmds.c: regenerated.
2002-02-22 00:02:30 +08:00
/* 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.
*/
#include "config.h"
Added object properties for almost all tool_options values and registered 2003-02-07 Michael Natterer <mitch@gimp.org> Added object properties for almost all tool_options values and registered lots of enums with the type system: Part I (enum and type cleanup): * app/core/core-enums.[ch] * app/core/core-types.h: removed InternalOrientaionType and register GimpOrientationType. Register GimpChannelOps. Removed GimpToolOptionsGUIFunc. * app/xcf/xcf-private.h: added XcfOrientationType with the same values as the old InternalOrientationType * app/xcf/xcf-load.c * app/xcf/xcf-save.c: translate between GimpOrientationType and XcfOrientationType. * app/core/gimpdrawable-transform-utils.[ch] * app/core/gimpdrawable-transform.[ch] * app/core/gimpimage-crop.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-guides.c * app/core/gimpimage-resize.c * app/core/gimpimage-scale.c * app/core/gimpimage.h * app/display/gimpdisplayshell.c * tools/pdbgen/stddefs.pdb * tools/pdbgen/pdb/transform_tools.pdb: changed accordingly. * app/pdb/guides_cmds.c * app/pdb/transform_tools_cmds.c * libgimp/gimpenums.h * libgimpproxy/gimpproxytypes.h * plug-ins/script-fu/script-fu-constants.c * tools/pdbgen/enums.pl: regenerated. * libgimptool/gimptoolenums.[ch]: added GimpTransformGridType. * libgimptool/gimptooltypes.h: removed GimpToolOptionsResetFunc, added GimpToolOptionsGUIFunc. Part II (tool options changes): * app/config/gimpconfig-utils.c (gimp_config_reset_properties): don't reset object properties because they have NULL as default value. * app/widgets/gimppropwidgets.[ch]: added gimp_prop_[enum|boolean]_radio_frame_new(), gimp_prop_paint_mode_menu_new() and gimp_prop_scale_entry_new(), which are all needed by the new tool options GUI code. * app/tools/tool_options.[ch]: removed the "reset_func" since the virtual reset() method is used now. * app/paint/gimpairbrushoptions.[ch] * app/paint/gimpcloneoptions.[ch] * app/paint/gimpconvolveoptions.[ch] * app/paint/gimpdodgeburnoptions.[ch] * app/paint/gimperaseroptions.[ch] * app/paint/gimppaintoptions.[ch] * app/paint/gimpsmudgeoptions.[ch]: added properties all over the place and removed the widget and default_value members from the structs. Renamed some values (e.g. s/type/clone_type/). Don't #include <gtk/gtk.h>. * app/paint/gimpairbrush.c * app/paint/gimpclone.c * app/paint/gimpconvolve.c * app/paint/gimpdodgeburn.c * app/paint/gimperaser.c * app/paint/gimppaintbrush.c * app/paint/gimppaintcore-stroke.c * app/paint/gimppaintcore.c * app/paint/gimppencil.c * app/paint/gimpsmudge.c * app/paint/paint-types.h * app/paint/paint.c: changed accordingly. Don't #include <gtk/gtk.h>. * tools/pdbgen/pdb/paint_tools.pdb: changed accordingly. * app/pdb/paint_tools_cmds.c: regenerated. * app/tools/gimpblendoptions.[ch] * app/tools/gimpbucketfilloptions.[ch] * app/tools/gimpcolorpickeroptions.[ch] * app/tools/gimpcropoptions.[ch] * app/tools/gimpflipoptions.[ch] * app/tools/gimpinkoptions.c * app/tools/gimpmagnifyoptions.[ch] * app/tools/gimpmeasureoptions.[ch] * app/tools/gimpmoveoptions.[ch] * app/tools/gimptextoptions.c * app/tools/paint_options.[ch] * app/tools/selection_options.[ch] * app/tools/transform_options.[ch]: ditto: added properties and removed widget and default_value stuff. Removed most reset functions. Use gimp_prop widgets all over the place, renamed some values as above. * app/tools/Makefile.am * app/tools/gimpairbrushtool.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpclonetool.c * app/tools/gimpconvolvetool.c * app/tools/gimpcroptool.c * app/tools/gimpdodgeburntool.c * app/tools/gimperasertool.c * app/tools/gimpfliptool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmovetool.c * app/tools/gimpselectiontool.c * app/tools/gimpsheartool.c * app/tools/gimpsmudgetool.c * app/tools/gimptransformtool.c * app/tools/gimpvectoroptions.c: changed accordingly. Ported the paint_options GUI constructors to gimp_prop widgets. * app/widgets/gimpselectioneditor.c * app/gui/tool-options-dialog.c: changed accordingly.
2003-02-08 01:12:21 +08:00
#include <glib-object.h>
Made the paint tool PDB wrappers work again (a bit at least...) 2002-02-21 Michael Natterer <mitch@gimp.org> Made the paint tool PDB wrappers work again (a bit at least...) * app/Makefile.am: changed linking order. libtool sucks. * app/undo.c: check if active_tool is a GimpPaintTool before casting it. * app/paint/Makefile.am * app/paint/paint-types.h: added new files/types. * app/paint/gimppaintoptions.[ch]: new files cut out of tools/paint_options.h. Prefixed everything with "Gimp". There is still GtkWidget* cruft hanging around in the structs... * app/paint/gimppaintcore-stroke.[ch]: utility function which paints a stroke array. Needed for the PDB wrappers. * app/paint/gimpairbrush.[ch] * app/paint/gimpclone.[ch] * app/paint/gimpconvolve.[ch] * app/paint/gimpdodgeburn.[ch] * app/paint/gimperaser.[ch] * app/paint/gimppaintbrush.c * app/paint/gimppaintcore.[ch] * app/paint/gimppencil.c * app/paint/gimpsmudge.[ch]: added *_options_new() functions which create correctly initialized options structures without widgets. * app/tools/paint_options.[ch]: removed the options struct definitions and value initialisations. * app/tools/gimpairbrushtool.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpclonetool.c * app/tools/gimpconvolvetool.c * app/tools/gimpdodgeburntool.c * app/tools/gimperasertool.c * app/tools/gimpinktool.c * app/tools/gimppaintbrushtool.c * app/tools/gimppainttool.c * app/tools/gimppenciltool.c * app/tools/gimpsmudgetool.c: changed all paint_options functions accordingly, s/PaintOptions/GimpPaintOptions/g etc., removed all #if 0'ed non_gui functions. * tools/pdbgen/pdb/paint_tools.pdb: use gimp_paint_core_stroke(). We currently leak all paint_options structs created by the PDB wrappers, more stuff to come... * app/pdb/paint_tools_cmds.c: regenerated.
2002-02-22 00:02:30 +08:00
#include "paint-types.h"
Fixed & cleaned up paint function registration to work without GUI. 2003-08-30 Michael Natterer <mitch@gimp.org> Fixed & cleaned up paint function registration to work without GUI. Finishes core/GUI separation for the paint tools: * app/core/gimppaintinfo.[ch]: removed "gchar *pdb_string" all over the place since we don't stroke using the PDB any more. (gimp_paint_info_new): create paint_info->paint_options here so the paint system is fully initialized when there is no GUI. * app/paint/paint.c: removed pdb_string stuff here, too. * app/core/gimptoolinfo.[ch]: create tool_info->tool_options only if tool_info->tool_options_type is not the same type as paint_info->paint_options_type (if we are no paint tool). * app/core/gimptooloptions.c: removed G_PARAM_CONSTRUCT_ONLY from the "tool-info" property. Instead, changed gimp_tool_options_set_property to ensure that it is only set once. * app/core/gimp.c (gimp_initialize): moved paint_init() after data_factory creation (was in gimp_init()), since GimpPaintInfo now creates the GimpPaintOptions, which are GimpContexts, which need gimp->*_factory to be constructed. * app/tools/tool_manager.c: don't create tool_info->tool_options here (it's not the job of the tool_manager to set up the core paint system correctly, it must be already initialized before any tool_manager function is called). Made "Stroke Selection" and "Stroke Path" work the same way: * app/paint/gimppaintcore-stroke.[ch]: added new function gimp_paint_core_stroke_boundary() which strokes without using the PDB. * app/core/gimpimage-mask.c (gimp_image_mask_stroke): use it instead of using the PDB. Enables all available paint options for stroke operations. Fixes bug #119411. * app/gui/vectors-commands.c (vectors_stroke_vectors) * app/core/gimpimage-mask.c (gimp_image_mask_stroke): removed all code which tries to figure how to stroke and simply look at the active tool's tool_info->paint_info, since it is always set up correctly now.
2003-08-30 21:22:20 +08:00
#include "base/boundary.h"
Made the paint tool PDB wrappers work again (a bit at least...) 2002-02-21 Michael Natterer <mitch@gimp.org> Made the paint tool PDB wrappers work again (a bit at least...) * app/Makefile.am: changed linking order. libtool sucks. * app/undo.c: check if active_tool is a GimpPaintTool before casting it. * app/paint/Makefile.am * app/paint/paint-types.h: added new files/types. * app/paint/gimppaintoptions.[ch]: new files cut out of tools/paint_options.h. Prefixed everything with "Gimp". There is still GtkWidget* cruft hanging around in the structs... * app/paint/gimppaintcore-stroke.[ch]: utility function which paints a stroke array. Needed for the PDB wrappers. * app/paint/gimpairbrush.[ch] * app/paint/gimpclone.[ch] * app/paint/gimpconvolve.[ch] * app/paint/gimpdodgeburn.[ch] * app/paint/gimperaser.[ch] * app/paint/gimppaintbrush.c * app/paint/gimppaintcore.[ch] * app/paint/gimppencil.c * app/paint/gimpsmudge.[ch]: added *_options_new() functions which create correctly initialized options structures without widgets. * app/tools/paint_options.[ch]: removed the options struct definitions and value initialisations. * app/tools/gimpairbrushtool.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpclonetool.c * app/tools/gimpconvolvetool.c * app/tools/gimpdodgeburntool.c * app/tools/gimperasertool.c * app/tools/gimpinktool.c * app/tools/gimppaintbrushtool.c * app/tools/gimppainttool.c * app/tools/gimppenciltool.c * app/tools/gimpsmudgetool.c: changed all paint_options functions accordingly, s/PaintOptions/GimpPaintOptions/g etc., removed all #if 0'ed non_gui functions. * tools/pdbgen/pdb/paint_tools.pdb: use gimp_paint_core_stroke(). We currently leak all paint_options structs created by the PDB wrappers, more stuff to come... * app/pdb/paint_tools_cmds.c: regenerated.
2002-02-22 00:02:30 +08:00
#include "core/gimpdrawable.h"
#include "vectors/gimpstroke.h"
#include "vectors/gimpvectors.h"
Made the paint tool PDB wrappers work again (a bit at least...) 2002-02-21 Michael Natterer <mitch@gimp.org> Made the paint tool PDB wrappers work again (a bit at least...) * app/Makefile.am: changed linking order. libtool sucks. * app/undo.c: check if active_tool is a GimpPaintTool before casting it. * app/paint/Makefile.am * app/paint/paint-types.h: added new files/types. * app/paint/gimppaintoptions.[ch]: new files cut out of tools/paint_options.h. Prefixed everything with "Gimp". There is still GtkWidget* cruft hanging around in the structs... * app/paint/gimppaintcore-stroke.[ch]: utility function which paints a stroke array. Needed for the PDB wrappers. * app/paint/gimpairbrush.[ch] * app/paint/gimpclone.[ch] * app/paint/gimpconvolve.[ch] * app/paint/gimpdodgeburn.[ch] * app/paint/gimperaser.[ch] * app/paint/gimppaintbrush.c * app/paint/gimppaintcore.[ch] * app/paint/gimppencil.c * app/paint/gimpsmudge.[ch]: added *_options_new() functions which create correctly initialized options structures without widgets. * app/tools/paint_options.[ch]: removed the options struct definitions and value initialisations. * app/tools/gimpairbrushtool.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpclonetool.c * app/tools/gimpconvolvetool.c * app/tools/gimpdodgeburntool.c * app/tools/gimperasertool.c * app/tools/gimpinktool.c * app/tools/gimppaintbrushtool.c * app/tools/gimppainttool.c * app/tools/gimppenciltool.c * app/tools/gimpsmudgetool.c: changed all paint_options functions accordingly, s/PaintOptions/GimpPaintOptions/g etc., removed all #if 0'ed non_gui functions. * tools/pdbgen/pdb/paint_tools.pdb: use gimp_paint_core_stroke(). We currently leak all paint_options structs created by the PDB wrappers, more stuff to come... * app/pdb/paint_tools_cmds.c: regenerated.
2002-02-22 00:02:30 +08:00
#include "gimppaintcore.h"
#include "gimppaintcore-stroke.h"
#include "gimppaintoptions.h"
Made the paint tool PDB wrappers work again (a bit at least...) 2002-02-21 Michael Natterer <mitch@gimp.org> Made the paint tool PDB wrappers work again (a bit at least...) * app/Makefile.am: changed linking order. libtool sucks. * app/undo.c: check if active_tool is a GimpPaintTool before casting it. * app/paint/Makefile.am * app/paint/paint-types.h: added new files/types. * app/paint/gimppaintoptions.[ch]: new files cut out of tools/paint_options.h. Prefixed everything with "Gimp". There is still GtkWidget* cruft hanging around in the structs... * app/paint/gimppaintcore-stroke.[ch]: utility function which paints a stroke array. Needed for the PDB wrappers. * app/paint/gimpairbrush.[ch] * app/paint/gimpclone.[ch] * app/paint/gimpconvolve.[ch] * app/paint/gimpdodgeburn.[ch] * app/paint/gimperaser.[ch] * app/paint/gimppaintbrush.c * app/paint/gimppaintcore.[ch] * app/paint/gimppencil.c * app/paint/gimpsmudge.[ch]: added *_options_new() functions which create correctly initialized options structures without widgets. * app/tools/paint_options.[ch]: removed the options struct definitions and value initialisations. * app/tools/gimpairbrushtool.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpclonetool.c * app/tools/gimpconvolvetool.c * app/tools/gimpdodgeburntool.c * app/tools/gimperasertool.c * app/tools/gimpinktool.c * app/tools/gimppaintbrushtool.c * app/tools/gimppainttool.c * app/tools/gimppenciltool.c * app/tools/gimpsmudgetool.c: changed all paint_options functions accordingly, s/PaintOptions/GimpPaintOptions/g etc., removed all #if 0'ed non_gui functions. * tools/pdbgen/pdb/paint_tools.pdb: use gimp_paint_core_stroke(). We currently leak all paint_options structs created by the PDB wrappers, more stuff to come... * app/pdb/paint_tools_cmds.c: regenerated.
2002-02-22 00:02:30 +08:00
static const GimpCoords default_coords = GIMP_COORDS_DEFAULT_VALUES;
Made the paint tool PDB wrappers work again (a bit at least...) 2002-02-21 Michael Natterer <mitch@gimp.org> Made the paint tool PDB wrappers work again (a bit at least...) * app/Makefile.am: changed linking order. libtool sucks. * app/undo.c: check if active_tool is a GimpPaintTool before casting it. * app/paint/Makefile.am * app/paint/paint-types.h: added new files/types. * app/paint/gimppaintoptions.[ch]: new files cut out of tools/paint_options.h. Prefixed everything with "Gimp". There is still GtkWidget* cruft hanging around in the structs... * app/paint/gimppaintcore-stroke.[ch]: utility function which paints a stroke array. Needed for the PDB wrappers. * app/paint/gimpairbrush.[ch] * app/paint/gimpclone.[ch] * app/paint/gimpconvolve.[ch] * app/paint/gimpdodgeburn.[ch] * app/paint/gimperaser.[ch] * app/paint/gimppaintbrush.c * app/paint/gimppaintcore.[ch] * app/paint/gimppencil.c * app/paint/gimpsmudge.[ch]: added *_options_new() functions which create correctly initialized options structures without widgets. * app/tools/paint_options.[ch]: removed the options struct definitions and value initialisations. * app/tools/gimpairbrushtool.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpclonetool.c * app/tools/gimpconvolvetool.c * app/tools/gimpdodgeburntool.c * app/tools/gimperasertool.c * app/tools/gimpinktool.c * app/tools/gimppaintbrushtool.c * app/tools/gimppainttool.c * app/tools/gimppenciltool.c * app/tools/gimpsmudgetool.c: changed all paint_options functions accordingly, s/PaintOptions/GimpPaintOptions/g etc., removed all #if 0'ed non_gui functions. * tools/pdbgen/pdb/paint_tools.pdb: use gimp_paint_core_stroke(). We currently leak all paint_options structs created by the PDB wrappers, more stuff to come... * app/pdb/paint_tools_cmds.c: regenerated.
2002-02-22 00:02:30 +08:00
gboolean
gimp_paint_core_stroke (GimpPaintCore *core,
GimpDrawable *drawable,
GimpPaintOptions *paint_options,
GimpCoords *strokes,
gint n_strokes)
Made the paint tool PDB wrappers work again (a bit at least...) 2002-02-21 Michael Natterer <mitch@gimp.org> Made the paint tool PDB wrappers work again (a bit at least...) * app/Makefile.am: changed linking order. libtool sucks. * app/undo.c: check if active_tool is a GimpPaintTool before casting it. * app/paint/Makefile.am * app/paint/paint-types.h: added new files/types. * app/paint/gimppaintoptions.[ch]: new files cut out of tools/paint_options.h. Prefixed everything with "Gimp". There is still GtkWidget* cruft hanging around in the structs... * app/paint/gimppaintcore-stroke.[ch]: utility function which paints a stroke array. Needed for the PDB wrappers. * app/paint/gimpairbrush.[ch] * app/paint/gimpclone.[ch] * app/paint/gimpconvolve.[ch] * app/paint/gimpdodgeburn.[ch] * app/paint/gimperaser.[ch] * app/paint/gimppaintbrush.c * app/paint/gimppaintcore.[ch] * app/paint/gimppencil.c * app/paint/gimpsmudge.[ch]: added *_options_new() functions which create correctly initialized options structures without widgets. * app/tools/paint_options.[ch]: removed the options struct definitions and value initialisations. * app/tools/gimpairbrushtool.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpclonetool.c * app/tools/gimpconvolvetool.c * app/tools/gimpdodgeburntool.c * app/tools/gimperasertool.c * app/tools/gimpinktool.c * app/tools/gimppaintbrushtool.c * app/tools/gimppainttool.c * app/tools/gimppenciltool.c * app/tools/gimpsmudgetool.c: changed all paint_options functions accordingly, s/PaintOptions/GimpPaintOptions/g etc., removed all #if 0'ed non_gui functions. * tools/pdbgen/pdb/paint_tools.pdb: use gimp_paint_core_stroke(). We currently leak all paint_options structs created by the PDB wrappers, more stuff to come... * app/pdb/paint_tools_cmds.c: regenerated.
2002-02-22 00:02:30 +08:00
{
g_return_val_if_fail (GIMP_IS_PAINT_CORE (core), FALSE);
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)), FALSE);
g_return_val_if_fail (GIMP_IS_PAINT_OPTIONS (paint_options), FALSE);
Made the paint tool PDB wrappers work again (a bit at least...) 2002-02-21 Michael Natterer <mitch@gimp.org> Made the paint tool PDB wrappers work again (a bit at least...) * app/Makefile.am: changed linking order. libtool sucks. * app/undo.c: check if active_tool is a GimpPaintTool before casting it. * app/paint/Makefile.am * app/paint/paint-types.h: added new files/types. * app/paint/gimppaintoptions.[ch]: new files cut out of tools/paint_options.h. Prefixed everything with "Gimp". There is still GtkWidget* cruft hanging around in the structs... * app/paint/gimppaintcore-stroke.[ch]: utility function which paints a stroke array. Needed for the PDB wrappers. * app/paint/gimpairbrush.[ch] * app/paint/gimpclone.[ch] * app/paint/gimpconvolve.[ch] * app/paint/gimpdodgeburn.[ch] * app/paint/gimperaser.[ch] * app/paint/gimppaintbrush.c * app/paint/gimppaintcore.[ch] * app/paint/gimppencil.c * app/paint/gimpsmudge.[ch]: added *_options_new() functions which create correctly initialized options structures without widgets. * app/tools/paint_options.[ch]: removed the options struct definitions and value initialisations. * app/tools/gimpairbrushtool.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpclonetool.c * app/tools/gimpconvolvetool.c * app/tools/gimpdodgeburntool.c * app/tools/gimperasertool.c * app/tools/gimpinktool.c * app/tools/gimppaintbrushtool.c * app/tools/gimppainttool.c * app/tools/gimppenciltool.c * app/tools/gimpsmudgetool.c: changed all paint_options functions accordingly, s/PaintOptions/GimpPaintOptions/g etc., removed all #if 0'ed non_gui functions. * tools/pdbgen/pdb/paint_tools.pdb: use gimp_paint_core_stroke(). We currently leak all paint_options structs created by the PDB wrappers, more stuff to come... * app/pdb/paint_tools_cmds.c: regenerated.
2002-02-22 00:02:30 +08:00
g_return_val_if_fail (strokes != NULL, FALSE);
g_return_val_if_fail (n_strokes > 0, FALSE);
Made the paint tool PDB wrappers work again (a bit at least...) 2002-02-21 Michael Natterer <mitch@gimp.org> Made the paint tool PDB wrappers work again (a bit at least...) * app/Makefile.am: changed linking order. libtool sucks. * app/undo.c: check if active_tool is a GimpPaintTool before casting it. * app/paint/Makefile.am * app/paint/paint-types.h: added new files/types. * app/paint/gimppaintoptions.[ch]: new files cut out of tools/paint_options.h. Prefixed everything with "Gimp". There is still GtkWidget* cruft hanging around in the structs... * app/paint/gimppaintcore-stroke.[ch]: utility function which paints a stroke array. Needed for the PDB wrappers. * app/paint/gimpairbrush.[ch] * app/paint/gimpclone.[ch] * app/paint/gimpconvolve.[ch] * app/paint/gimpdodgeburn.[ch] * app/paint/gimperaser.[ch] * app/paint/gimppaintbrush.c * app/paint/gimppaintcore.[ch] * app/paint/gimppencil.c * app/paint/gimpsmudge.[ch]: added *_options_new() functions which create correctly initialized options structures without widgets. * app/tools/paint_options.[ch]: removed the options struct definitions and value initialisations. * app/tools/gimpairbrushtool.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpclonetool.c * app/tools/gimpconvolvetool.c * app/tools/gimpdodgeburntool.c * app/tools/gimperasertool.c * app/tools/gimpinktool.c * app/tools/gimppaintbrushtool.c * app/tools/gimppainttool.c * app/tools/gimppenciltool.c * app/tools/gimpsmudgetool.c: changed all paint_options functions accordingly, s/PaintOptions/GimpPaintOptions/g etc., removed all #if 0'ed non_gui functions. * tools/pdbgen/pdb/paint_tools.pdb: use gimp_paint_core_stroke(). We currently leak all paint_options structs created by the PDB wrappers, more stuff to come... * app/pdb/paint_tools_cmds.c: regenerated.
2002-02-22 00:02:30 +08:00
Separated tool_options creation from tool registration so we don't 2002-06-17 Michael Natterer <mitch@gimp.org> Separated tool_options creation from tool registration so we don't implicitly create widgets before gui_init(): * libgimptool/gimptooltypes.h: removed GimpToolOptionsNewFunc typedef here... * app/core/core-types.h: ...and added it here. * libgimpproxy/gimpproxytypes.h: regenerated. * app/core/gimptoolinfo.[ch]: added a GimpToolOptionsNewFunc pointer to remember the constructor. Fixed the finalize() method (bug was never noticed because we leaked all tool infos) * app/tools/tool_manager.[ch]: moved tool_options creation to the new function tool_manager_restore(). Unref the tool infos after adding them to their container. Added "brush" and "gradient" to the context properties which are defined for tool contexts. * app/app_procs.c: call tool_manager_restore() after gui_init(). * app/gui/gui.c: removed the hack introduced recently and call render_setup() in gui_init() again, not in gui_themes_init(). Use the correct contexts now that they are properly initialized at the time of tool_options creation: * app/tools/gimpblendtool.c: use tool_info->context, not gimp_get_user_context() to get/set the tool's gradient. * app/paint/gimppaintcore.[ch] (gimp_paint_core_start): added a GimpPaintOptions paramater and get the brush to use from paint_options->context (instead of gimp_get_current_context()). * app/paint/gimppaintcore-stroke.c * app/tools/gimppainttool.c: changed accordingly. * app/tools/paint_options.c: added a brush preview to the paint options.
2002-06-17 18:34:28 +08:00
if (gimp_paint_core_start (core, drawable, paint_options, &strokes[0]))
Made the paint tool PDB wrappers work again (a bit at least...) 2002-02-21 Michael Natterer <mitch@gimp.org> Made the paint tool PDB wrappers work again (a bit at least...) * app/Makefile.am: changed linking order. libtool sucks. * app/undo.c: check if active_tool is a GimpPaintTool before casting it. * app/paint/Makefile.am * app/paint/paint-types.h: added new files/types. * app/paint/gimppaintoptions.[ch]: new files cut out of tools/paint_options.h. Prefixed everything with "Gimp". There is still GtkWidget* cruft hanging around in the structs... * app/paint/gimppaintcore-stroke.[ch]: utility function which paints a stroke array. Needed for the PDB wrappers. * app/paint/gimpairbrush.[ch] * app/paint/gimpclone.[ch] * app/paint/gimpconvolve.[ch] * app/paint/gimpdodgeburn.[ch] * app/paint/gimperaser.[ch] * app/paint/gimppaintbrush.c * app/paint/gimppaintcore.[ch] * app/paint/gimppencil.c * app/paint/gimpsmudge.[ch]: added *_options_new() functions which create correctly initialized options structures without widgets. * app/tools/paint_options.[ch]: removed the options struct definitions and value initialisations. * app/tools/gimpairbrushtool.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpclonetool.c * app/tools/gimpconvolvetool.c * app/tools/gimpdodgeburntool.c * app/tools/gimperasertool.c * app/tools/gimpinktool.c * app/tools/gimppaintbrushtool.c * app/tools/gimppainttool.c * app/tools/gimppenciltool.c * app/tools/gimpsmudgetool.c: changed all paint_options functions accordingly, s/PaintOptions/GimpPaintOptions/g etc., removed all #if 0'ed non_gui functions. * tools/pdbgen/pdb/paint_tools.pdb: use gimp_paint_core_stroke(). We currently leak all paint_options structs created by the PDB wrappers, more stuff to come... * app/pdb/paint_tools_cmds.c: regenerated.
2002-02-22 00:02:30 +08:00
{
gint i;
core->start_coords = strokes[0];
core->last_coords = strokes[0];
Made the paint tool PDB wrappers work again (a bit at least...) 2002-02-21 Michael Natterer <mitch@gimp.org> Made the paint tool PDB wrappers work again (a bit at least...) * app/Makefile.am: changed linking order. libtool sucks. * app/undo.c: check if active_tool is a GimpPaintTool before casting it. * app/paint/Makefile.am * app/paint/paint-types.h: added new files/types. * app/paint/gimppaintoptions.[ch]: new files cut out of tools/paint_options.h. Prefixed everything with "Gimp". There is still GtkWidget* cruft hanging around in the structs... * app/paint/gimppaintcore-stroke.[ch]: utility function which paints a stroke array. Needed for the PDB wrappers. * app/paint/gimpairbrush.[ch] * app/paint/gimpclone.[ch] * app/paint/gimpconvolve.[ch] * app/paint/gimpdodgeburn.[ch] * app/paint/gimperaser.[ch] * app/paint/gimppaintbrush.c * app/paint/gimppaintcore.[ch] * app/paint/gimppencil.c * app/paint/gimpsmudge.[ch]: added *_options_new() functions which create correctly initialized options structures without widgets. * app/tools/paint_options.[ch]: removed the options struct definitions and value initialisations. * app/tools/gimpairbrushtool.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpclonetool.c * app/tools/gimpconvolvetool.c * app/tools/gimpdodgeburntool.c * app/tools/gimperasertool.c * app/tools/gimpinktool.c * app/tools/gimppaintbrushtool.c * app/tools/gimppainttool.c * app/tools/gimppenciltool.c * app/tools/gimpsmudgetool.c: changed all paint_options functions accordingly, s/PaintOptions/GimpPaintOptions/g etc., removed all #if 0'ed non_gui functions. * tools/pdbgen/pdb/paint_tools.pdb: use gimp_paint_core_stroke(). We currently leak all paint_options structs created by the PDB wrappers, more stuff to come... * app/pdb/paint_tools_cmds.c: regenerated.
2002-02-22 00:02:30 +08:00
gimp_paint_core_paint (core, drawable, paint_options,
GIMP_PAINT_STATE_INIT, 0);
Made the paint tool PDB wrappers work again (a bit at least...) 2002-02-21 Michael Natterer <mitch@gimp.org> Made the paint tool PDB wrappers work again (a bit at least...) * app/Makefile.am: changed linking order. libtool sucks. * app/undo.c: check if active_tool is a GimpPaintTool before casting it. * app/paint/Makefile.am * app/paint/paint-types.h: added new files/types. * app/paint/gimppaintoptions.[ch]: new files cut out of tools/paint_options.h. Prefixed everything with "Gimp". There is still GtkWidget* cruft hanging around in the structs... * app/paint/gimppaintcore-stroke.[ch]: utility function which paints a stroke array. Needed for the PDB wrappers. * app/paint/gimpairbrush.[ch] * app/paint/gimpclone.[ch] * app/paint/gimpconvolve.[ch] * app/paint/gimpdodgeburn.[ch] * app/paint/gimperaser.[ch] * app/paint/gimppaintbrush.c * app/paint/gimppaintcore.[ch] * app/paint/gimppencil.c * app/paint/gimpsmudge.[ch]: added *_options_new() functions which create correctly initialized options structures without widgets. * app/tools/paint_options.[ch]: removed the options struct definitions and value initialisations. * app/tools/gimpairbrushtool.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpclonetool.c * app/tools/gimpconvolvetool.c * app/tools/gimpdodgeburntool.c * app/tools/gimperasertool.c * app/tools/gimpinktool.c * app/tools/gimppaintbrushtool.c * app/tools/gimppainttool.c * app/tools/gimppenciltool.c * app/tools/gimpsmudgetool.c: changed all paint_options functions accordingly, s/PaintOptions/GimpPaintOptions/g etc., removed all #if 0'ed non_gui functions. * tools/pdbgen/pdb/paint_tools.pdb: use gimp_paint_core_stroke(). We currently leak all paint_options structs created by the PDB wrappers, more stuff to come... * app/pdb/paint_tools_cmds.c: regenerated.
2002-02-22 00:02:30 +08:00
gimp_paint_core_paint (core, drawable, paint_options,
GIMP_PAINT_STATE_MOTION, 0);
Made the paint tool PDB wrappers work again (a bit at least...) 2002-02-21 Michael Natterer <mitch@gimp.org> Made the paint tool PDB wrappers work again (a bit at least...) * app/Makefile.am: changed linking order. libtool sucks. * app/undo.c: check if active_tool is a GimpPaintTool before casting it. * app/paint/Makefile.am * app/paint/paint-types.h: added new files/types. * app/paint/gimppaintoptions.[ch]: new files cut out of tools/paint_options.h. Prefixed everything with "Gimp". There is still GtkWidget* cruft hanging around in the structs... * app/paint/gimppaintcore-stroke.[ch]: utility function which paints a stroke array. Needed for the PDB wrappers. * app/paint/gimpairbrush.[ch] * app/paint/gimpclone.[ch] * app/paint/gimpconvolve.[ch] * app/paint/gimpdodgeburn.[ch] * app/paint/gimperaser.[ch] * app/paint/gimppaintbrush.c * app/paint/gimppaintcore.[ch] * app/paint/gimppencil.c * app/paint/gimpsmudge.[ch]: added *_options_new() functions which create correctly initialized options structures without widgets. * app/tools/paint_options.[ch]: removed the options struct definitions and value initialisations. * app/tools/gimpairbrushtool.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpclonetool.c * app/tools/gimpconvolvetool.c * app/tools/gimpdodgeburntool.c * app/tools/gimperasertool.c * app/tools/gimpinktool.c * app/tools/gimppaintbrushtool.c * app/tools/gimppainttool.c * app/tools/gimppenciltool.c * app/tools/gimpsmudgetool.c: changed all paint_options functions accordingly, s/PaintOptions/GimpPaintOptions/g etc., removed all #if 0'ed non_gui functions. * tools/pdbgen/pdb/paint_tools.pdb: use gimp_paint_core_stroke(). We currently leak all paint_options structs created by the PDB wrappers, more stuff to come... * app/pdb/paint_tools_cmds.c: regenerated.
2002-02-22 00:02:30 +08:00
for (i = 1; i < n_strokes; i++)
{
core->cur_coords = strokes[i];
Made the paint tool PDB wrappers work again (a bit at least...) 2002-02-21 Michael Natterer <mitch@gimp.org> Made the paint tool PDB wrappers work again (a bit at least...) * app/Makefile.am: changed linking order. libtool sucks. * app/undo.c: check if active_tool is a GimpPaintTool before casting it. * app/paint/Makefile.am * app/paint/paint-types.h: added new files/types. * app/paint/gimppaintoptions.[ch]: new files cut out of tools/paint_options.h. Prefixed everything with "Gimp". There is still GtkWidget* cruft hanging around in the structs... * app/paint/gimppaintcore-stroke.[ch]: utility function which paints a stroke array. Needed for the PDB wrappers. * app/paint/gimpairbrush.[ch] * app/paint/gimpclone.[ch] * app/paint/gimpconvolve.[ch] * app/paint/gimpdodgeburn.[ch] * app/paint/gimperaser.[ch] * app/paint/gimppaintbrush.c * app/paint/gimppaintcore.[ch] * app/paint/gimppencil.c * app/paint/gimpsmudge.[ch]: added *_options_new() functions which create correctly initialized options structures without widgets. * app/tools/paint_options.[ch]: removed the options struct definitions and value initialisations. * app/tools/gimpairbrushtool.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpclonetool.c * app/tools/gimpconvolvetool.c * app/tools/gimpdodgeburntool.c * app/tools/gimperasertool.c * app/tools/gimpinktool.c * app/tools/gimppaintbrushtool.c * app/tools/gimppainttool.c * app/tools/gimppenciltool.c * app/tools/gimpsmudgetool.c: changed all paint_options functions accordingly, s/PaintOptions/GimpPaintOptions/g etc., removed all #if 0'ed non_gui functions. * tools/pdbgen/pdb/paint_tools.pdb: use gimp_paint_core_stroke(). We currently leak all paint_options structs created by the PDB wrappers, more stuff to come... * app/pdb/paint_tools_cmds.c: regenerated.
2002-02-22 00:02:30 +08:00
gimp_paint_core_interpolate (core, drawable, paint_options, 0);
}
Made the paint tool PDB wrappers work again (a bit at least...) 2002-02-21 Michael Natterer <mitch@gimp.org> Made the paint tool PDB wrappers work again (a bit at least...) * app/Makefile.am: changed linking order. libtool sucks. * app/undo.c: check if active_tool is a GimpPaintTool before casting it. * app/paint/Makefile.am * app/paint/paint-types.h: added new files/types. * app/paint/gimppaintoptions.[ch]: new files cut out of tools/paint_options.h. Prefixed everything with "Gimp". There is still GtkWidget* cruft hanging around in the structs... * app/paint/gimppaintcore-stroke.[ch]: utility function which paints a stroke array. Needed for the PDB wrappers. * app/paint/gimpairbrush.[ch] * app/paint/gimpclone.[ch] * app/paint/gimpconvolve.[ch] * app/paint/gimpdodgeburn.[ch] * app/paint/gimperaser.[ch] * app/paint/gimppaintbrush.c * app/paint/gimppaintcore.[ch] * app/paint/gimppencil.c * app/paint/gimpsmudge.[ch]: added *_options_new() functions which create correctly initialized options structures without widgets. * app/tools/paint_options.[ch]: removed the options struct definitions and value initialisations. * app/tools/gimpairbrushtool.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpclonetool.c * app/tools/gimpconvolvetool.c * app/tools/gimpdodgeburntool.c * app/tools/gimperasertool.c * app/tools/gimpinktool.c * app/tools/gimppaintbrushtool.c * app/tools/gimppainttool.c * app/tools/gimppenciltool.c * app/tools/gimpsmudgetool.c: changed all paint_options functions accordingly, s/PaintOptions/GimpPaintOptions/g etc., removed all #if 0'ed non_gui functions. * tools/pdbgen/pdb/paint_tools.pdb: use gimp_paint_core_stroke(). We currently leak all paint_options structs created by the PDB wrappers, more stuff to come... * app/pdb/paint_tools_cmds.c: regenerated.
2002-02-22 00:02:30 +08:00
gimp_paint_core_paint (core, drawable, paint_options,
GIMP_PAINT_STATE_FINISH, 0);
Made the paint tool PDB wrappers work again (a bit at least...) 2002-02-21 Michael Natterer <mitch@gimp.org> Made the paint tool PDB wrappers work again (a bit at least...) * app/Makefile.am: changed linking order. libtool sucks. * app/undo.c: check if active_tool is a GimpPaintTool before casting it. * app/paint/Makefile.am * app/paint/paint-types.h: added new files/types. * app/paint/gimppaintoptions.[ch]: new files cut out of tools/paint_options.h. Prefixed everything with "Gimp". There is still GtkWidget* cruft hanging around in the structs... * app/paint/gimppaintcore-stroke.[ch]: utility function which paints a stroke array. Needed for the PDB wrappers. * app/paint/gimpairbrush.[ch] * app/paint/gimpclone.[ch] * app/paint/gimpconvolve.[ch] * app/paint/gimpdodgeburn.[ch] * app/paint/gimperaser.[ch] * app/paint/gimppaintbrush.c * app/paint/gimppaintcore.[ch] * app/paint/gimppencil.c * app/paint/gimpsmudge.[ch]: added *_options_new() functions which create correctly initialized options structures without widgets. * app/tools/paint_options.[ch]: removed the options struct definitions and value initialisations. * app/tools/gimpairbrushtool.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpclonetool.c * app/tools/gimpconvolvetool.c * app/tools/gimpdodgeburntool.c * app/tools/gimperasertool.c * app/tools/gimpinktool.c * app/tools/gimppaintbrushtool.c * app/tools/gimppainttool.c * app/tools/gimppenciltool.c * app/tools/gimpsmudgetool.c: changed all paint_options functions accordingly, s/PaintOptions/GimpPaintOptions/g etc., removed all #if 0'ed non_gui functions. * tools/pdbgen/pdb/paint_tools.pdb: use gimp_paint_core_stroke(). We currently leak all paint_options structs created by the PDB wrappers, more stuff to come... * app/pdb/paint_tools_cmds.c: regenerated.
2002-02-22 00:02:30 +08:00
gimp_paint_core_finish (core, drawable);
gimp_paint_core_cleanup (core);
return TRUE;
}
return FALSE;
}
Fixed & cleaned up paint function registration to work without GUI. 2003-08-30 Michael Natterer <mitch@gimp.org> Fixed & cleaned up paint function registration to work without GUI. Finishes core/GUI separation for the paint tools: * app/core/gimppaintinfo.[ch]: removed "gchar *pdb_string" all over the place since we don't stroke using the PDB any more. (gimp_paint_info_new): create paint_info->paint_options here so the paint system is fully initialized when there is no GUI. * app/paint/paint.c: removed pdb_string stuff here, too. * app/core/gimptoolinfo.[ch]: create tool_info->tool_options only if tool_info->tool_options_type is not the same type as paint_info->paint_options_type (if we are no paint tool). * app/core/gimptooloptions.c: removed G_PARAM_CONSTRUCT_ONLY from the "tool-info" property. Instead, changed gimp_tool_options_set_property to ensure that it is only set once. * app/core/gimp.c (gimp_initialize): moved paint_init() after data_factory creation (was in gimp_init()), since GimpPaintInfo now creates the GimpPaintOptions, which are GimpContexts, which need gimp->*_factory to be constructed. * app/tools/tool_manager.c: don't create tool_info->tool_options here (it's not the job of the tool_manager to set up the core paint system correctly, it must be already initialized before any tool_manager function is called). Made "Stroke Selection" and "Stroke Path" work the same way: * app/paint/gimppaintcore-stroke.[ch]: added new function gimp_paint_core_stroke_boundary() which strokes without using the PDB. * app/core/gimpimage-mask.c (gimp_image_mask_stroke): use it instead of using the PDB. Enables all available paint options for stroke operations. Fixes bug #119411. * app/gui/vectors-commands.c (vectors_stroke_vectors) * app/core/gimpimage-mask.c (gimp_image_mask_stroke): removed all code which tries to figure how to stroke and simply look at the active tool's tool_info->paint_info, since it is always set up correctly now.
2003-08-30 21:22:20 +08:00
gboolean
gimp_paint_core_stroke_boundary (GimpPaintCore *core,
GimpDrawable *drawable,
GimpPaintOptions *paint_options,
const BoundSeg *bound_segs,
gint n_bound_segs,
gint offset_x,
gint offset_y)
{
GimpImage *image;
Fixed & cleaned up paint function registration to work without GUI. 2003-08-30 Michael Natterer <mitch@gimp.org> Fixed & cleaned up paint function registration to work without GUI. Finishes core/GUI separation for the paint tools: * app/core/gimppaintinfo.[ch]: removed "gchar *pdb_string" all over the place since we don't stroke using the PDB any more. (gimp_paint_info_new): create paint_info->paint_options here so the paint system is fully initialized when there is no GUI. * app/paint/paint.c: removed pdb_string stuff here, too. * app/core/gimptoolinfo.[ch]: create tool_info->tool_options only if tool_info->tool_options_type is not the same type as paint_info->paint_options_type (if we are no paint tool). * app/core/gimptooloptions.c: removed G_PARAM_CONSTRUCT_ONLY from the "tool-info" property. Instead, changed gimp_tool_options_set_property to ensure that it is only set once. * app/core/gimp.c (gimp_initialize): moved paint_init() after data_factory creation (was in gimp_init()), since GimpPaintInfo now creates the GimpPaintOptions, which are GimpContexts, which need gimp->*_factory to be constructed. * app/tools/tool_manager.c: don't create tool_info->tool_options here (it's not the job of the tool_manager to set up the core paint system correctly, it must be already initialized before any tool_manager function is called). Made "Stroke Selection" and "Stroke Path" work the same way: * app/paint/gimppaintcore-stroke.[ch]: added new function gimp_paint_core_stroke_boundary() which strokes without using the PDB. * app/core/gimpimage-mask.c (gimp_image_mask_stroke): use it instead of using the PDB. Enables all available paint options for stroke operations. Fixes bug #119411. * app/gui/vectors-commands.c (vectors_stroke_vectors) * app/core/gimpimage-mask.c (gimp_image_mask_stroke): removed all code which tries to figure how to stroke and simply look at the active tool's tool_info->paint_info, since it is always set up correctly now.
2003-08-30 21:22:20 +08:00
BoundSeg *stroke_segs;
gint n_stroke_segs;
gint off_x;
gint off_y;
GimpCoords *coords;
gboolean initialized = FALSE;
Fixed & cleaned up paint function registration to work without GUI. 2003-08-30 Michael Natterer <mitch@gimp.org> Fixed & cleaned up paint function registration to work without GUI. Finishes core/GUI separation for the paint tools: * app/core/gimppaintinfo.[ch]: removed "gchar *pdb_string" all over the place since we don't stroke using the PDB any more. (gimp_paint_info_new): create paint_info->paint_options here so the paint system is fully initialized when there is no GUI. * app/paint/paint.c: removed pdb_string stuff here, too. * app/core/gimptoolinfo.[ch]: create tool_info->tool_options only if tool_info->tool_options_type is not the same type as paint_info->paint_options_type (if we are no paint tool). * app/core/gimptooloptions.c: removed G_PARAM_CONSTRUCT_ONLY from the "tool-info" property. Instead, changed gimp_tool_options_set_property to ensure that it is only set once. * app/core/gimp.c (gimp_initialize): moved paint_init() after data_factory creation (was in gimp_init()), since GimpPaintInfo now creates the GimpPaintOptions, which are GimpContexts, which need gimp->*_factory to be constructed. * app/tools/tool_manager.c: don't create tool_info->tool_options here (it's not the job of the tool_manager to set up the core paint system correctly, it must be already initialized before any tool_manager function is called). Made "Stroke Selection" and "Stroke Path" work the same way: * app/paint/gimppaintcore-stroke.[ch]: added new function gimp_paint_core_stroke_boundary() which strokes without using the PDB. * app/core/gimpimage-mask.c (gimp_image_mask_stroke): use it instead of using the PDB. Enables all available paint options for stroke operations. Fixes bug #119411. * app/gui/vectors-commands.c (vectors_stroke_vectors) * app/core/gimpimage-mask.c (gimp_image_mask_stroke): removed all code which tries to figure how to stroke and simply look at the active tool's tool_info->paint_info, since it is always set up correctly now.
2003-08-30 21:22:20 +08:00
gint n_coords;
gint seg;
gint s;
Fixed & cleaned up paint function registration to work without GUI. 2003-08-30 Michael Natterer <mitch@gimp.org> Fixed & cleaned up paint function registration to work without GUI. Finishes core/GUI separation for the paint tools: * app/core/gimppaintinfo.[ch]: removed "gchar *pdb_string" all over the place since we don't stroke using the PDB any more. (gimp_paint_info_new): create paint_info->paint_options here so the paint system is fully initialized when there is no GUI. * app/paint/paint.c: removed pdb_string stuff here, too. * app/core/gimptoolinfo.[ch]: create tool_info->tool_options only if tool_info->tool_options_type is not the same type as paint_info->paint_options_type (if we are no paint tool). * app/core/gimptooloptions.c: removed G_PARAM_CONSTRUCT_ONLY from the "tool-info" property. Instead, changed gimp_tool_options_set_property to ensure that it is only set once. * app/core/gimp.c (gimp_initialize): moved paint_init() after data_factory creation (was in gimp_init()), since GimpPaintInfo now creates the GimpPaintOptions, which are GimpContexts, which need gimp->*_factory to be constructed. * app/tools/tool_manager.c: don't create tool_info->tool_options here (it's not the job of the tool_manager to set up the core paint system correctly, it must be already initialized before any tool_manager function is called). Made "Stroke Selection" and "Stroke Path" work the same way: * app/paint/gimppaintcore-stroke.[ch]: added new function gimp_paint_core_stroke_boundary() which strokes without using the PDB. * app/core/gimpimage-mask.c (gimp_image_mask_stroke): use it instead of using the PDB. Enables all available paint options for stroke operations. Fixes bug #119411. * app/gui/vectors-commands.c (vectors_stroke_vectors) * app/core/gimpimage-mask.c (gimp_image_mask_stroke): removed all code which tries to figure how to stroke and simply look at the active tool's tool_info->paint_info, since it is always set up correctly now.
2003-08-30 21:22:20 +08:00
g_return_val_if_fail (GIMP_IS_PAINT_CORE (core), FALSE);
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)), FALSE);
Fixed & cleaned up paint function registration to work without GUI. 2003-08-30 Michael Natterer <mitch@gimp.org> Fixed & cleaned up paint function registration to work without GUI. Finishes core/GUI separation for the paint tools: * app/core/gimppaintinfo.[ch]: removed "gchar *pdb_string" all over the place since we don't stroke using the PDB any more. (gimp_paint_info_new): create paint_info->paint_options here so the paint system is fully initialized when there is no GUI. * app/paint/paint.c: removed pdb_string stuff here, too. * app/core/gimptoolinfo.[ch]: create tool_info->tool_options only if tool_info->tool_options_type is not the same type as paint_info->paint_options_type (if we are no paint tool). * app/core/gimptooloptions.c: removed G_PARAM_CONSTRUCT_ONLY from the "tool-info" property. Instead, changed gimp_tool_options_set_property to ensure that it is only set once. * app/core/gimp.c (gimp_initialize): moved paint_init() after data_factory creation (was in gimp_init()), since GimpPaintInfo now creates the GimpPaintOptions, which are GimpContexts, which need gimp->*_factory to be constructed. * app/tools/tool_manager.c: don't create tool_info->tool_options here (it's not the job of the tool_manager to set up the core paint system correctly, it must be already initialized before any tool_manager function is called). Made "Stroke Selection" and "Stroke Path" work the same way: * app/paint/gimppaintcore-stroke.[ch]: added new function gimp_paint_core_stroke_boundary() which strokes without using the PDB. * app/core/gimpimage-mask.c (gimp_image_mask_stroke): use it instead of using the PDB. Enables all available paint options for stroke operations. Fixes bug #119411. * app/gui/vectors-commands.c (vectors_stroke_vectors) * app/core/gimpimage-mask.c (gimp_image_mask_stroke): removed all code which tries to figure how to stroke and simply look at the active tool's tool_info->paint_info, since it is always set up correctly now.
2003-08-30 21:22:20 +08:00
g_return_val_if_fail (GIMP_IS_PAINT_OPTIONS (paint_options), FALSE);
g_return_val_if_fail (bound_segs != NULL && n_bound_segs > 0, FALSE);
image = gimp_item_get_image (GIMP_ITEM (drawable));
Fixed & cleaned up paint function registration to work without GUI. 2003-08-30 Michael Natterer <mitch@gimp.org> Fixed & cleaned up paint function registration to work without GUI. Finishes core/GUI separation for the paint tools: * app/core/gimppaintinfo.[ch]: removed "gchar *pdb_string" all over the place since we don't stroke using the PDB any more. (gimp_paint_info_new): create paint_info->paint_options here so the paint system is fully initialized when there is no GUI. * app/paint/paint.c: removed pdb_string stuff here, too. * app/core/gimptoolinfo.[ch]: create tool_info->tool_options only if tool_info->tool_options_type is not the same type as paint_info->paint_options_type (if we are no paint tool). * app/core/gimptooloptions.c: removed G_PARAM_CONSTRUCT_ONLY from the "tool-info" property. Instead, changed gimp_tool_options_set_property to ensure that it is only set once. * app/core/gimp.c (gimp_initialize): moved paint_init() after data_factory creation (was in gimp_init()), since GimpPaintInfo now creates the GimpPaintOptions, which are GimpContexts, which need gimp->*_factory to be constructed. * app/tools/tool_manager.c: don't create tool_info->tool_options here (it's not the job of the tool_manager to set up the core paint system correctly, it must be already initialized before any tool_manager function is called). Made "Stroke Selection" and "Stroke Path" work the same way: * app/paint/gimppaintcore-stroke.[ch]: added new function gimp_paint_core_stroke_boundary() which strokes without using the PDB. * app/core/gimpimage-mask.c (gimp_image_mask_stroke): use it instead of using the PDB. Enables all available paint options for stroke operations. Fixes bug #119411. * app/gui/vectors-commands.c (vectors_stroke_vectors) * app/core/gimpimage-mask.c (gimp_image_mask_stroke): removed all code which tries to figure how to stroke and simply look at the active tool's tool_info->paint_info, since it is always set up correctly now.
2003-08-30 21:22:20 +08:00
stroke_segs = boundary_sort (bound_segs, n_bound_segs, &n_stroke_segs);
Fixed & cleaned up paint function registration to work without GUI. 2003-08-30 Michael Natterer <mitch@gimp.org> Fixed & cleaned up paint function registration to work without GUI. Finishes core/GUI separation for the paint tools: * app/core/gimppaintinfo.[ch]: removed "gchar *pdb_string" all over the place since we don't stroke using the PDB any more. (gimp_paint_info_new): create paint_info->paint_options here so the paint system is fully initialized when there is no GUI. * app/paint/paint.c: removed pdb_string stuff here, too. * app/core/gimptoolinfo.[ch]: create tool_info->tool_options only if tool_info->tool_options_type is not the same type as paint_info->paint_options_type (if we are no paint tool). * app/core/gimptooloptions.c: removed G_PARAM_CONSTRUCT_ONLY from the "tool-info" property. Instead, changed gimp_tool_options_set_property to ensure that it is only set once. * app/core/gimp.c (gimp_initialize): moved paint_init() after data_factory creation (was in gimp_init()), since GimpPaintInfo now creates the GimpPaintOptions, which are GimpContexts, which need gimp->*_factory to be constructed. * app/tools/tool_manager.c: don't create tool_info->tool_options here (it's not the job of the tool_manager to set up the core paint system correctly, it must be already initialized before any tool_manager function is called). Made "Stroke Selection" and "Stroke Path" work the same way: * app/paint/gimppaintcore-stroke.[ch]: added new function gimp_paint_core_stroke_boundary() which strokes without using the PDB. * app/core/gimpimage-mask.c (gimp_image_mask_stroke): use it instead of using the PDB. Enables all available paint options for stroke operations. Fixes bug #119411. * app/gui/vectors-commands.c (vectors_stroke_vectors) * app/core/gimpimage-mask.c (gimp_image_mask_stroke): removed all code which tries to figure how to stroke and simply look at the active tool's tool_info->paint_info, since it is always set up correctly now.
2003-08-30 21:22:20 +08:00
if (n_stroke_segs == 0)
return TRUE;
gimp_item_offsets (GIMP_ITEM (drawable), &off_x, &off_y);
off_x -= offset_x;
off_y -= offset_y;
coords = g_new0 (GimpCoords, n_bound_segs + 4);
seg = 0;
n_coords = 0;
/* we offset all coordinates by 0.5 to align the brush with the path */
coords[n_coords] = default_coords;
coords[n_coords].x = (gdouble) (stroke_segs[0].x1 - off_x + 0.5);
coords[n_coords].y = (gdouble) (stroke_segs[0].y1 - off_y + 0.5);
Fixed & cleaned up paint function registration to work without GUI. 2003-08-30 Michael Natterer <mitch@gimp.org> Fixed & cleaned up paint function registration to work without GUI. Finishes core/GUI separation for the paint tools: * app/core/gimppaintinfo.[ch]: removed "gchar *pdb_string" all over the place since we don't stroke using the PDB any more. (gimp_paint_info_new): create paint_info->paint_options here so the paint system is fully initialized when there is no GUI. * app/paint/paint.c: removed pdb_string stuff here, too. * app/core/gimptoolinfo.[ch]: create tool_info->tool_options only if tool_info->tool_options_type is not the same type as paint_info->paint_options_type (if we are no paint tool). * app/core/gimptooloptions.c: removed G_PARAM_CONSTRUCT_ONLY from the "tool-info" property. Instead, changed gimp_tool_options_set_property to ensure that it is only set once. * app/core/gimp.c (gimp_initialize): moved paint_init() after data_factory creation (was in gimp_init()), since GimpPaintInfo now creates the GimpPaintOptions, which are GimpContexts, which need gimp->*_factory to be constructed. * app/tools/tool_manager.c: don't create tool_info->tool_options here (it's not the job of the tool_manager to set up the core paint system correctly, it must be already initialized before any tool_manager function is called). Made "Stroke Selection" and "Stroke Path" work the same way: * app/paint/gimppaintcore-stroke.[ch]: added new function gimp_paint_core_stroke_boundary() which strokes without using the PDB. * app/core/gimpimage-mask.c (gimp_image_mask_stroke): use it instead of using the PDB. Enables all available paint options for stroke operations. Fixes bug #119411. * app/gui/vectors-commands.c (vectors_stroke_vectors) * app/core/gimpimage-mask.c (gimp_image_mask_stroke): removed all code which tries to figure how to stroke and simply look at the active tool's tool_info->paint_info, since it is always set up correctly now.
2003-08-30 21:22:20 +08:00
n_coords++;
for (s = 0; s < n_stroke_segs; s++)
Fixed & cleaned up paint function registration to work without GUI. 2003-08-30 Michael Natterer <mitch@gimp.org> Fixed & cleaned up paint function registration to work without GUI. Finishes core/GUI separation for the paint tools: * app/core/gimppaintinfo.[ch]: removed "gchar *pdb_string" all over the place since we don't stroke using the PDB any more. (gimp_paint_info_new): create paint_info->paint_options here so the paint system is fully initialized when there is no GUI. * app/paint/paint.c: removed pdb_string stuff here, too. * app/core/gimptoolinfo.[ch]: create tool_info->tool_options only if tool_info->tool_options_type is not the same type as paint_info->paint_options_type (if we are no paint tool). * app/core/gimptooloptions.c: removed G_PARAM_CONSTRUCT_ONLY from the "tool-info" property. Instead, changed gimp_tool_options_set_property to ensure that it is only set once. * app/core/gimp.c (gimp_initialize): moved paint_init() after data_factory creation (was in gimp_init()), since GimpPaintInfo now creates the GimpPaintOptions, which are GimpContexts, which need gimp->*_factory to be constructed. * app/tools/tool_manager.c: don't create tool_info->tool_options here (it's not the job of the tool_manager to set up the core paint system correctly, it must be already initialized before any tool_manager function is called). Made "Stroke Selection" and "Stroke Path" work the same way: * app/paint/gimppaintcore-stroke.[ch]: added new function gimp_paint_core_stroke_boundary() which strokes without using the PDB. * app/core/gimpimage-mask.c (gimp_image_mask_stroke): use it instead of using the PDB. Enables all available paint options for stroke operations. Fixes bug #119411. * app/gui/vectors-commands.c (vectors_stroke_vectors) * app/core/gimpimage-mask.c (gimp_image_mask_stroke): removed all code which tries to figure how to stroke and simply look at the active tool's tool_info->paint_info, since it is always set up correctly now.
2003-08-30 21:22:20 +08:00
{
while (stroke_segs[seg].x1 != -1 ||
stroke_segs[seg].x2 != -1 ||
stroke_segs[seg].y1 != -1 ||
stroke_segs[seg].y2 != -1)
{
coords[n_coords] = default_coords;
coords[n_coords].x = (gdouble) (stroke_segs[seg].x1 - off_x + 0.5);
coords[n_coords].y = (gdouble) (stroke_segs[seg].y1 - off_y + 0.5);
Fixed & cleaned up paint function registration to work without GUI. 2003-08-30 Michael Natterer <mitch@gimp.org> Fixed & cleaned up paint function registration to work without GUI. Finishes core/GUI separation for the paint tools: * app/core/gimppaintinfo.[ch]: removed "gchar *pdb_string" all over the place since we don't stroke using the PDB any more. (gimp_paint_info_new): create paint_info->paint_options here so the paint system is fully initialized when there is no GUI. * app/paint/paint.c: removed pdb_string stuff here, too. * app/core/gimptoolinfo.[ch]: create tool_info->tool_options only if tool_info->tool_options_type is not the same type as paint_info->paint_options_type (if we are no paint tool). * app/core/gimptooloptions.c: removed G_PARAM_CONSTRUCT_ONLY from the "tool-info" property. Instead, changed gimp_tool_options_set_property to ensure that it is only set once. * app/core/gimp.c (gimp_initialize): moved paint_init() after data_factory creation (was in gimp_init()), since GimpPaintInfo now creates the GimpPaintOptions, which are GimpContexts, which need gimp->*_factory to be constructed. * app/tools/tool_manager.c: don't create tool_info->tool_options here (it's not the job of the tool_manager to set up the core paint system correctly, it must be already initialized before any tool_manager function is called). Made "Stroke Selection" and "Stroke Path" work the same way: * app/paint/gimppaintcore-stroke.[ch]: added new function gimp_paint_core_stroke_boundary() which strokes without using the PDB. * app/core/gimpimage-mask.c (gimp_image_mask_stroke): use it instead of using the PDB. Enables all available paint options for stroke operations. Fixes bug #119411. * app/gui/vectors-commands.c (vectors_stroke_vectors) * app/core/gimpimage-mask.c (gimp_image_mask_stroke): removed all code which tries to figure how to stroke and simply look at the active tool's tool_info->paint_info, since it is always set up correctly now.
2003-08-30 21:22:20 +08:00
n_coords++;
seg++;
}
Fixed & cleaned up paint function registration to work without GUI. 2003-08-30 Michael Natterer <mitch@gimp.org> Fixed & cleaned up paint function registration to work without GUI. Finishes core/GUI separation for the paint tools: * app/core/gimppaintinfo.[ch]: removed "gchar *pdb_string" all over the place since we don't stroke using the PDB any more. (gimp_paint_info_new): create paint_info->paint_options here so the paint system is fully initialized when there is no GUI. * app/paint/paint.c: removed pdb_string stuff here, too. * app/core/gimptoolinfo.[ch]: create tool_info->tool_options only if tool_info->tool_options_type is not the same type as paint_info->paint_options_type (if we are no paint tool). * app/core/gimptooloptions.c: removed G_PARAM_CONSTRUCT_ONLY from the "tool-info" property. Instead, changed gimp_tool_options_set_property to ensure that it is only set once. * app/core/gimp.c (gimp_initialize): moved paint_init() after data_factory creation (was in gimp_init()), since GimpPaintInfo now creates the GimpPaintOptions, which are GimpContexts, which need gimp->*_factory to be constructed. * app/tools/tool_manager.c: don't create tool_info->tool_options here (it's not the job of the tool_manager to set up the core paint system correctly, it must be already initialized before any tool_manager function is called). Made "Stroke Selection" and "Stroke Path" work the same way: * app/paint/gimppaintcore-stroke.[ch]: added new function gimp_paint_core_stroke_boundary() which strokes without using the PDB. * app/core/gimpimage-mask.c (gimp_image_mask_stroke): use it instead of using the PDB. Enables all available paint options for stroke operations. Fixes bug #119411. * app/gui/vectors-commands.c (vectors_stroke_vectors) * app/core/gimpimage-mask.c (gimp_image_mask_stroke): removed all code which tries to figure how to stroke and simply look at the active tool's tool_info->paint_info, since it is always set up correctly now.
2003-08-30 21:22:20 +08:00
/* Close the stroke points up */
coords[n_coords] = coords[0];
n_coords++;
if (initialized ||
gimp_paint_core_start (core, drawable, paint_options, &coords[0]))
{
gint i;
initialized = TRUE;
core->start_coords = coords[0];
core->last_coords = coords[0];
gimp_paint_core_paint (core, drawable, paint_options,
GIMP_PAINT_STATE_INIT, 0);
gimp_paint_core_paint (core, drawable, paint_options,
GIMP_PAINT_STATE_MOTION, 0);
for (i = 1; i < n_coords; i++)
{
core->cur_coords = coords[i];
gimp_paint_core_interpolate (core, drawable, paint_options, 0);
}
gimp_paint_core_paint (core, drawable, paint_options,
GIMP_PAINT_STATE_FINISH, 0);
}
Fixed & cleaned up paint function registration to work without GUI. 2003-08-30 Michael Natterer <mitch@gimp.org> Fixed & cleaned up paint function registration to work without GUI. Finishes core/GUI separation for the paint tools: * app/core/gimppaintinfo.[ch]: removed "gchar *pdb_string" all over the place since we don't stroke using the PDB any more. (gimp_paint_info_new): create paint_info->paint_options here so the paint system is fully initialized when there is no GUI. * app/paint/paint.c: removed pdb_string stuff here, too. * app/core/gimptoolinfo.[ch]: create tool_info->tool_options only if tool_info->tool_options_type is not the same type as paint_info->paint_options_type (if we are no paint tool). * app/core/gimptooloptions.c: removed G_PARAM_CONSTRUCT_ONLY from the "tool-info" property. Instead, changed gimp_tool_options_set_property to ensure that it is only set once. * app/core/gimp.c (gimp_initialize): moved paint_init() after data_factory creation (was in gimp_init()), since GimpPaintInfo now creates the GimpPaintOptions, which are GimpContexts, which need gimp->*_factory to be constructed. * app/tools/tool_manager.c: don't create tool_info->tool_options here (it's not the job of the tool_manager to set up the core paint system correctly, it must be already initialized before any tool_manager function is called). Made "Stroke Selection" and "Stroke Path" work the same way: * app/paint/gimppaintcore-stroke.[ch]: added new function gimp_paint_core_stroke_boundary() which strokes without using the PDB. * app/core/gimpimage-mask.c (gimp_image_mask_stroke): use it instead of using the PDB. Enables all available paint options for stroke operations. Fixes bug #119411. * app/gui/vectors-commands.c (vectors_stroke_vectors) * app/core/gimpimage-mask.c (gimp_image_mask_stroke): removed all code which tries to figure how to stroke and simply look at the active tool's tool_info->paint_info, since it is always set up correctly now.
2003-08-30 21:22:20 +08:00
n_coords = 0;
seg++;
coords[n_coords] = default_coords;
coords[n_coords].x = (gdouble) (stroke_segs[seg].x1 - off_x + 0.5);
coords[n_coords].y = (gdouble) (stroke_segs[seg].y1 - off_y + 0.5);
Fixed & cleaned up paint function registration to work without GUI. 2003-08-30 Michael Natterer <mitch@gimp.org> Fixed & cleaned up paint function registration to work without GUI. Finishes core/GUI separation for the paint tools: * app/core/gimppaintinfo.[ch]: removed "gchar *pdb_string" all over the place since we don't stroke using the PDB any more. (gimp_paint_info_new): create paint_info->paint_options here so the paint system is fully initialized when there is no GUI. * app/paint/paint.c: removed pdb_string stuff here, too. * app/core/gimptoolinfo.[ch]: create tool_info->tool_options only if tool_info->tool_options_type is not the same type as paint_info->paint_options_type (if we are no paint tool). * app/core/gimptooloptions.c: removed G_PARAM_CONSTRUCT_ONLY from the "tool-info" property. Instead, changed gimp_tool_options_set_property to ensure that it is only set once. * app/core/gimp.c (gimp_initialize): moved paint_init() after data_factory creation (was in gimp_init()), since GimpPaintInfo now creates the GimpPaintOptions, which are GimpContexts, which need gimp->*_factory to be constructed. * app/tools/tool_manager.c: don't create tool_info->tool_options here (it's not the job of the tool_manager to set up the core paint system correctly, it must be already initialized before any tool_manager function is called). Made "Stroke Selection" and "Stroke Path" work the same way: * app/paint/gimppaintcore-stroke.[ch]: added new function gimp_paint_core_stroke_boundary() which strokes without using the PDB. * app/core/gimpimage-mask.c (gimp_image_mask_stroke): use it instead of using the PDB. Enables all available paint options for stroke operations. Fixes bug #119411. * app/gui/vectors-commands.c (vectors_stroke_vectors) * app/core/gimpimage-mask.c (gimp_image_mask_stroke): removed all code which tries to figure how to stroke and simply look at the active tool's tool_info->paint_info, since it is always set up correctly now.
2003-08-30 21:22:20 +08:00
n_coords++;
}
if (initialized)
{
gimp_paint_core_finish (core, drawable);
gimp_paint_core_cleanup (core);
}
Fixed & cleaned up paint function registration to work without GUI. 2003-08-30 Michael Natterer <mitch@gimp.org> Fixed & cleaned up paint function registration to work without GUI. Finishes core/GUI separation for the paint tools: * app/core/gimppaintinfo.[ch]: removed "gchar *pdb_string" all over the place since we don't stroke using the PDB any more. (gimp_paint_info_new): create paint_info->paint_options here so the paint system is fully initialized when there is no GUI. * app/paint/paint.c: removed pdb_string stuff here, too. * app/core/gimptoolinfo.[ch]: create tool_info->tool_options only if tool_info->tool_options_type is not the same type as paint_info->paint_options_type (if we are no paint tool). * app/core/gimptooloptions.c: removed G_PARAM_CONSTRUCT_ONLY from the "tool-info" property. Instead, changed gimp_tool_options_set_property to ensure that it is only set once. * app/core/gimp.c (gimp_initialize): moved paint_init() after data_factory creation (was in gimp_init()), since GimpPaintInfo now creates the GimpPaintOptions, which are GimpContexts, which need gimp->*_factory to be constructed. * app/tools/tool_manager.c: don't create tool_info->tool_options here (it's not the job of the tool_manager to set up the core paint system correctly, it must be already initialized before any tool_manager function is called). Made "Stroke Selection" and "Stroke Path" work the same way: * app/paint/gimppaintcore-stroke.[ch]: added new function gimp_paint_core_stroke_boundary() which strokes without using the PDB. * app/core/gimpimage-mask.c (gimp_image_mask_stroke): use it instead of using the PDB. Enables all available paint options for stroke operations. Fixes bug #119411. * app/gui/vectors-commands.c (vectors_stroke_vectors) * app/core/gimpimage-mask.c (gimp_image_mask_stroke): removed all code which tries to figure how to stroke and simply look at the active tool's tool_info->paint_info, since it is always set up correctly now.
2003-08-30 21:22:20 +08:00
g_free (coords);
g_free (stroke_segs);
return TRUE;
}
gboolean
gimp_paint_core_stroke_vectors (GimpPaintCore *core,
GimpDrawable *drawable,
GimpPaintOptions *paint_options,
GimpVectors *vectors)
{
GList *stroke;
GArray *coords = NULL;
gboolean initialized = FALSE;
gboolean closed;
gint off_x, off_y;
gint vectors_off_x, vectors_off_y;
g_return_val_if_fail (GIMP_IS_PAINT_CORE (core), FALSE);
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)), FALSE);
g_return_val_if_fail (GIMP_IS_PAINT_OPTIONS (paint_options), FALSE);
g_return_val_if_fail (GIMP_IS_VECTORS (vectors), FALSE);
gimp_item_offsets (GIMP_ITEM (vectors), &vectors_off_x, &vectors_off_y);
gimp_item_offsets (GIMP_ITEM (drawable), &off_x, &off_y);
off_x -= vectors_off_x;
off_y -= vectors_off_y;
for (stroke = vectors->strokes; stroke; stroke = stroke->next)
{
coords = gimp_stroke_interpolate (GIMP_STROKE (stroke->data),
1.0, &closed);
if (coords && coords->len)
{
gint i;
for (i = 0; i < coords->len; i++)
{
g_array_index (coords, GimpCoords, i).x -= off_x;
g_array_index (coords, GimpCoords, i).y -= off_y;
}
if (initialized ||
gimp_paint_core_start (core, drawable, paint_options,
&g_array_index (coords, GimpCoords, 0)))
{
initialized = TRUE;
core->start_coords = g_array_index (coords, GimpCoords, 0);
core->last_coords = g_array_index (coords, GimpCoords, 0);
gimp_paint_core_paint (core, drawable, paint_options,
GIMP_PAINT_STATE_INIT, 0);
gimp_paint_core_paint (core, drawable, paint_options,
GIMP_PAINT_STATE_MOTION, 0);
for (i = 1; i < coords->len; i++)
{
core->cur_coords = g_array_index (coords, GimpCoords, i);
gimp_paint_core_interpolate (core, drawable, paint_options, 0);
}
gimp_paint_core_paint (core, drawable, paint_options,
GIMP_PAINT_STATE_FINISH, 0);
}
}
if (coords)
g_array_free (coords, TRUE);
}
if (initialized)
{
gimp_paint_core_finish (core, drawable);
gimp_paint_core_cleanup (core);
}
return TRUE;
}