gimp/app/paint/gimppaintcore-stroke.c

388 lines
12 KiB
C
Raw Normal View History

/* GIMP - The GNU Image Manipulation Program
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
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software: you can redistribute it and/or modify
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
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
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
* (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, see <http://www.gnu.org/licenses/>.
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 "config.h"
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gegl.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 "libgimpmath/gimpmath.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"
#include "core/gimpboundary.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 "core/gimperror.h"
#include "core/gimpcoords.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 "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
#include "gimp-intl.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 void gimp_paint_core_stroke_emulate_dynamics (GimpCoords *coords,
gint length);
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,
gboolean push_undo,
GError **error)
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);
g_return_val_if_fail (error == NULL || *error == NULL, 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
if (gimp_paint_core_start (core, drawable, paint_options, &strokes[0],
error))
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->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++)
{
gimp_paint_core_interpolate (core, drawable, paint_options,
&strokes[i], 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, push_undo);
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_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,
gboolean emulate_dynamics,
const GimpBoundSeg *bound_segs,
gint n_bound_segs,
gint offset_x,
gint offset_y,
gboolean push_undo,
GError **error)
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
{
GimpBoundSeg *stroke_segs;
gint n_stroke_segs;
gint off_x;
gint off_y;
GimpCoords *coords;
gboolean initialized = FALSE;
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);
g_return_val_if_fail (error == NULL || *error == NULL, 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
stroke_segs = gimp_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_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
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
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 (emulate_dynamics)
gimp_paint_core_stroke_emulate_dynamics (coords, n_coords);
if (initialized ||
added GError** parameter to GimpPaintCore::start(). 2006-09-26 Michael Natterer <mitch@gimp.org> * app/paint/gimppaintcore.[ch]: added GError** parameter to GimpPaintCore::start(). * app/tools/gimppainttool.c (button_press): display the error in the statusbar. * app/paint/gimppaintcore-stroke.c: pass a NULL error, effectively swallowing mssages. Will fix that later. * app/paint/gimpbrushcore.c * app/paint/gimpclone.c * app/paint/gimpsourcecore.c: changed accordingly. Set the error instead of calling g_message(). * app/paint/gimpheal.c * app/paint/gimpperspectiveclone.c: implement start() and bail out early on indexed drawables instead of showing a g_message() in other functions that are called later. * app/tools/gimptool.[ch]: added GError** to GimpTool::initialize(). * app/tools/gimptool.c (gimp_tool_initialize): display the error in the statusbar. Keep the external API GError-free. * app/tools/gimprectangletool.[ch]: added GError** to gimp_rectangle_tool_initialize(). * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcolorizetool.c * app/tools/gimpcroptool.c * app/tools/gimpcurvestool.c * app/tools/gimphuesaturationtool.c * app/tools/gimpimagemaptool.c * app/tools/gimplevelstool.c * app/tools/gimpperspectiveclonetool.c * app/tools/gimpposterizetool.c * app/tools/gimpthresholdtool.c * app/tools/gimptransformtool.c: changed accordingly. Set the errors in initialize() instead of using gimp_message(). * app/tools/gimpblendtool.c: implement initialize() and bail out early on indexed images instead of showing a gimp_message() in button_press().
2006-09-27 04:55:40 +08:00
gimp_paint_core_start (core, drawable, paint_options, &coords[0],
error))
{
gint i;
initialized = TRUE;
core->cur_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++)
{
gimp_paint_core_interpolate (core, drawable, paint_options,
&coords[i], 0);
}
gimp_paint_core_paint (core, drawable, paint_options,
GIMP_PAINT_STATE_FINISH, 0);
}
else
{
break;
}
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, push_undo);
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 initialized;
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_vectors (GimpPaintCore *core,
GimpDrawable *drawable,
GimpPaintOptions *paint_options,
gboolean emulate_dynamics,
GimpVectors *vectors,
gboolean push_undo,
GError **error)
{
GList *stroke;
gboolean initialized = FALSE;
gboolean due_to_lack_of_points = FALSE;
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);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
gimp_item_get_offset (GIMP_ITEM (vectors), &vectors_off_x, &vectors_off_y);
gimp_item_get_offset (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)
{
GArray *coords;
gboolean closed;
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 (emulate_dynamics)
gimp_paint_core_stroke_emulate_dynamics ((GimpCoords *) coords->data,
coords->len);
if (initialized ||
gimp_paint_core_start (core, drawable, paint_options,
added GError** parameter to GimpPaintCore::start(). 2006-09-26 Michael Natterer <mitch@gimp.org> * app/paint/gimppaintcore.[ch]: added GError** parameter to GimpPaintCore::start(). * app/tools/gimppainttool.c (button_press): display the error in the statusbar. * app/paint/gimppaintcore-stroke.c: pass a NULL error, effectively swallowing mssages. Will fix that later. * app/paint/gimpbrushcore.c * app/paint/gimpclone.c * app/paint/gimpsourcecore.c: changed accordingly. Set the error instead of calling g_message(). * app/paint/gimpheal.c * app/paint/gimpperspectiveclone.c: implement start() and bail out early on indexed drawables instead of showing a g_message() in other functions that are called later. * app/tools/gimptool.[ch]: added GError** to GimpTool::initialize(). * app/tools/gimptool.c (gimp_tool_initialize): display the error in the statusbar. Keep the external API GError-free. * app/tools/gimprectangletool.[ch]: added GError** to gimp_rectangle_tool_initialize(). * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcolorizetool.c * app/tools/gimpcroptool.c * app/tools/gimpcurvestool.c * app/tools/gimphuesaturationtool.c * app/tools/gimpimagemaptool.c * app/tools/gimplevelstool.c * app/tools/gimpperspectiveclonetool.c * app/tools/gimpposterizetool.c * app/tools/gimpthresholdtool.c * app/tools/gimptransformtool.c: changed accordingly. Set the errors in initialize() instead of using gimp_message(). * app/tools/gimpblendtool.c: implement initialize() and bail out early on indexed images instead of showing a gimp_message() in button_press().
2006-09-27 04:55:40 +08:00
&g_array_index (coords, GimpCoords, 0),
error))
{
initialized = TRUE;
core->cur_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++)
{
gimp_paint_core_interpolate (core, drawable, paint_options,
&g_array_index (coords, GimpCoords, i),
0);
}
gimp_paint_core_paint (core, drawable, paint_options,
GIMP_PAINT_STATE_FINISH, 0);
}
else
{
if (coords)
g_array_free (coords, TRUE);
break;
}
}
else
{
due_to_lack_of_points = TRUE;
}
if (coords)
g_array_free (coords, TRUE);
}
if (initialized)
{
gimp_paint_core_finish (core, drawable, push_undo);
gimp_paint_core_cleanup (core);
}
if (! initialized && due_to_lack_of_points && *error == NULL)
{
g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED,
_("Not enough points to stroke"));
}
return initialized;
}
static void
gimp_paint_core_stroke_emulate_dynamics (GimpCoords *coords,
gint length)
{
const gint ramp_length = length / 3;
/* Calculate and create pressure ramp parameters */
if (ramp_length > 0)
{
gdouble slope = 1.0 / (gdouble) (ramp_length);
gint i;
/* Calculate pressure start ramp */
for (i = 0; i < ramp_length; i++)
{
coords[i].pressure = i * slope;
}
/* Calculate pressure end ramp */
for (i = length - ramp_length; i < length; i++)
{
coords[i].pressure = 1.0 - (i - (length - ramp_length)) * slope;
}
}
/* Calculate and create velocity ramp parameters */
if (length > 0)
{
gdouble slope = 1.0 / length;
gint i;
/* Calculate velocity end ramp */
for (i = 0; i < length; i++)
{
coords[i].velocity = i * slope;
}
}
2010-07-09 01:31:03 +08:00
if (length > 1)
{
gint i;
/* Fill in direction */
2010-07-09 01:31:03 +08:00
for (i = 1; i < length; i++)
{
coords[i].direction = gimp_coords_direction (&coords[i-1], &coords[i]);
}
coords[0].direction = coords[1].direction;
}
}