gimp/app/paint/gimppaintbrush.c

191 lines
6.3 KiB
C
Raw Normal View History

/* GIMP - The GNU Image Manipulation Program
1997-11-25 06:05:25 +08:00
* 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.
1997-11-25 06:05:25 +08:00
*/
#include "config.h"
1999-10-27 02:27:27 +08:00
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>
Makefile.am configure.in added stuff for the new library below. 2001-01-23 Michael Natterer <mitch@gimp.org> * Makefile.am * configure.in * gimptool.in: added stuff for the new library below. * libgimpcolor/.cvsignore * libgimpcolor/Makefile.am * libgimpcolor/gimpcolor.h * libgimpcolor/gimpcolorspace.c * libgimpcolor/gimpcolorspace.h * libgimpcolor/gimpcolortypes.h * libgimpcolor/gimphsv.c * libgimpcolor/gimphsv.h * libgimpcolor/gimprgb.c * libgimpcolor/gimprgb.h: new shared library which both the app and plug-ins link against. The library depends only on glib. * libgimpcolor/gimpcolor.def * libgimpcolor/makefile.mingw.in * libgimpcolor/makefile.msc: added Win32 build files which definitely don't work. * libgimp/Makefile.am * libgimp/gimpcolor.[ch] * libgimp/gimpcolorspace.[ch]: removed. * libgimp/gimp.h * libgimp/gimpadaptivesupersample.c * libgimp/gimpbilinear.c * libgimp/gimppalette.c * libgimp/gimptypes.h: include the stuff from libgimpcolor. Plug-Ins don't need to include <libgimpcolor/gimpcolor.h> explicitely. LibGimp depends on libgimpcolor and thus also includes it's headers. * libgimp/gimp.def * libgimp/makefile.mingw.in: fiddled around with Win32 stuff... * app/Makefile.am: link against libgimpcolor.la * app/apptypes.h: include "libgimpcolor/gimpcolortypes.h" * app/asupsample.c * app/channels_dialog.c * app/colormap_dialog.c * app/commands.c * app/convert.c * app/devices.c * app/disp_callbacks.c * app/drawable.c * app/gimpcontext.c * app/gimpdnd.c * app/gimpimage.c * app/gimppalette.c * app/gimprc.c * app/gradient.c * app/libgimp_glue.c * app/palette.c * app/palette_import.c * app/qmask.c * app/xcf.c * app/tools/paint_core.c * app/tools/paintbrush.c * app/tools/pencil.c: include "libgimpcolor/gimpcolor.h" before all gimp includes because it's a standalone library. * plug-ins/FractalExplorer/Makefile.am * plug-ins/Lighting/Makefile.am * plug-ins/MapObject/Makefile.am * plug-ins/bmp/Makefile.am * plug-ins/common/Makefile.am * plug-ins/common/mkgen.pl * plug-ins/dbbrowser/Makefile.am * plug-ins/faxg3/Makefile.am * plug-ins/fits/Makefile.am * plug-ins/flame/Makefile.am * plug-ins/fp/Makefile.am * plug-ins/gap/Makefile.am * plug-ins/gdyntext/Makefile.am * plug-ins/gfig/Makefile.am * plug-ins/gflare/Makefile.am * plug-ins/gfli/Makefile.am * plug-ins/gimpressionist/Makefile.am * plug-ins/helpbrowser/Makefile.am * plug-ins/ifscompose/Makefile.am * plug-ins/imagemap/Makefile.am * plug-ins/maze/Makefile.am * plug-ins/mosaic/Makefile.am * plug-ins/pagecurl/Makefile.am * plug-ins/print/Makefile.am * plug-ins/rcm/Makefile.am * plug-ins/script-fu/Makefile.am * plug-ins/sel2path/Makefile.am * plug-ins/sgi/Makefile.am * plug-ins/webbrowser/Makefile.am * plug-ins/xjt/Makefile.am: add libgimpcolor.la to LDADD. * INSTALL: don't recommend to --disable-shared for development. * TODO.xml: increased some percentages, added plug-in help stuff.
2001-01-24 02:49:44 +08:00
#include "libgimpcolor/gimpcolor.h"
#include "libgimpmath/gimpmath.h"
Makefile.am configure.in added new directory libgimpbase/ 2001-05-21 Michael Natterer <mitch@gimp.org> * Makefile.am * configure.in * gimptool-1.4.in: added new directory libgimpbase/ * app/Makefile.am: link against the new lib. * app/appenums.h: removed the PDB enums which are in libgimpbase/gimpbasetypes.h now. They are all "Gimp" prefixed. * app/apptypes.h: #include "libgimpbase/gimpbasetypes.h" * app/[lots] * app/core/[of] * app/gui/[files] * app/tools/: changed includes and all PDB types. * app/pdb/*: regenerated. * libgimp/Makefile.am: don't build libgimpi.a uglyness any more. * libgimp/gimpenv.[ch] * libgimp/gimplimits.[hh] * libgimp/gimpparasite.[ch] * libgimp/gimpparasiteio.[ch] * libgimp/gimpprotocol.[ch] * libgimp/gimpsignal.[ch] * libgimp/gimpunit.h * libgimp/gimputils.[ch] * libgimp/gimpwire.[ch]: removed... * libgimpbase/*: ...and added here as new library. * libgimp/gimp.[ch] * libgimp/gimpdrawable.[ch] * libgimp/gimpenums.h * libgimp/gimpimage.[ch] * libgimp/gimptile.c * libgimp/gimptypes.h * libgimp/gimpunit.c: changed accordingly. Added the gimp_*_add_new_parasite to gimp.[ch], gimpdrawable.[ch] and gimpimage.[ch]. * libgimpwidgets/gimppatheditor.c * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpsizeentry.c * libgimpwidgets/gimpunitmenu.c * libgimpwidgets/gimpwidgets.c * libgimpwidgets/gimpwidgetstypes.h: changed includes accordingly. * plug-ins/*/Makefile.am * plug-ins/common/mkgen.pl: link against libgimpbase. * tools/pdbgen/Makefile.am: scan libgimpbase/gimpbasetypes.h, so the enums are known to pdbgen... * tools/pdbgen/enumcode.pl: ...but don't write them out to libgimp/gimpenums.h * tools/pdbgen/app.pl: include libgimp/gimpbase.h in all *_cmds.c files. Added GIMP_ to the type names ganerated in app/. * tools/pdbgen/enums.pl: regenerated. * tools/pdbgen/pdb.pl * tools/pdbgen/pdb/fileops.pdb * tools/pdbgen/pdb/procedural_db.pdb * tools/pdbgen/pdb/unit.pdb: changed includes.
2001-05-21 21:58:46 +08:00
#include "libgimpbase/gimpbase.h"
Makefile.am configure.in added stuff for the new library below. 2001-01-23 Michael Natterer <mitch@gimp.org> * Makefile.am * configure.in * gimptool.in: added stuff for the new library below. * libgimpcolor/.cvsignore * libgimpcolor/Makefile.am * libgimpcolor/gimpcolor.h * libgimpcolor/gimpcolorspace.c * libgimpcolor/gimpcolorspace.h * libgimpcolor/gimpcolortypes.h * libgimpcolor/gimphsv.c * libgimpcolor/gimphsv.h * libgimpcolor/gimprgb.c * libgimpcolor/gimprgb.h: new shared library which both the app and plug-ins link against. The library depends only on glib. * libgimpcolor/gimpcolor.def * libgimpcolor/makefile.mingw.in * libgimpcolor/makefile.msc: added Win32 build files which definitely don't work. * libgimp/Makefile.am * libgimp/gimpcolor.[ch] * libgimp/gimpcolorspace.[ch]: removed. * libgimp/gimp.h * libgimp/gimpadaptivesupersample.c * libgimp/gimpbilinear.c * libgimp/gimppalette.c * libgimp/gimptypes.h: include the stuff from libgimpcolor. Plug-Ins don't need to include <libgimpcolor/gimpcolor.h> explicitely. LibGimp depends on libgimpcolor and thus also includes it's headers. * libgimp/gimp.def * libgimp/makefile.mingw.in: fiddled around with Win32 stuff... * app/Makefile.am: link against libgimpcolor.la * app/apptypes.h: include "libgimpcolor/gimpcolortypes.h" * app/asupsample.c * app/channels_dialog.c * app/colormap_dialog.c * app/commands.c * app/convert.c * app/devices.c * app/disp_callbacks.c * app/drawable.c * app/gimpcontext.c * app/gimpdnd.c * app/gimpimage.c * app/gimppalette.c * app/gimprc.c * app/gradient.c * app/libgimp_glue.c * app/palette.c * app/palette_import.c * app/qmask.c * app/xcf.c * app/tools/paint_core.c * app/tools/paintbrush.c * app/tools/pencil.c: include "libgimpcolor/gimpcolor.h" before all gimp includes because it's a standalone library. * plug-ins/FractalExplorer/Makefile.am * plug-ins/Lighting/Makefile.am * plug-ins/MapObject/Makefile.am * plug-ins/bmp/Makefile.am * plug-ins/common/Makefile.am * plug-ins/common/mkgen.pl * plug-ins/dbbrowser/Makefile.am * plug-ins/faxg3/Makefile.am * plug-ins/fits/Makefile.am * plug-ins/flame/Makefile.am * plug-ins/fp/Makefile.am * plug-ins/gap/Makefile.am * plug-ins/gdyntext/Makefile.am * plug-ins/gfig/Makefile.am * plug-ins/gflare/Makefile.am * plug-ins/gfli/Makefile.am * plug-ins/gimpressionist/Makefile.am * plug-ins/helpbrowser/Makefile.am * plug-ins/ifscompose/Makefile.am * plug-ins/imagemap/Makefile.am * plug-ins/maze/Makefile.am * plug-ins/mosaic/Makefile.am * plug-ins/pagecurl/Makefile.am * plug-ins/print/Makefile.am * plug-ins/rcm/Makefile.am * plug-ins/script-fu/Makefile.am * plug-ins/sel2path/Makefile.am * plug-ins/sgi/Makefile.am * plug-ins/webbrowser/Makefile.am * plug-ins/xjt/Makefile.am: add libgimpcolor.la to LDADD. * INSTALL: don't recommend to --disable-shared for development. * TODO.xml: increased some percentages, added plug-in help stuff.
2001-01-24 02:49:44 +08:00
Core/UI separation for the paint tools: 2002-02-14 Michael Natterer <mitch@gimp.org> Core/UI separation for the paint tools: * configure.in * app/Makefile.am * app/paint/.cvsignore * app/paint/Makefile.am: added new directory for the paint methods without GUI and tools around them. * app/paint/paint-types.h: typedefs for this module. * app/paint/gimppaintcore-kernels.h * app/paint/gimppaintcore.[ch]: the general paint logic taken from GimpPaintTool. * app/paint/gimpairbrush.[ch] * app/paint/gimpclone.[ch] * app/paint/gimpconvolve.[ch] * app/paint/gimpdodgeburn.[ch] * app/paint/gimperaser.[ch] * app/paint/gimppaintbrush.[ch] * app/paint/gimppencil.[ch] * app/paint/gimpsmudge.[ch]: subclasses of GimpPaintCore, implementing their own paint() methods. Needs more hacking to get the GtkWidget pointers out of the options structs. * app/tools/gimppainttool_kernels.h: removed. * app/tools/tools-types.h: removed the paint tool enums. * app/tools/gimpairbrushtool.[ch] * app/tools/gimpclonetool.[ch] * app/tools/gimpconvolvetool.[ch] * app/tools/gimpdodgeburntool.[ch] * app/tools/gimperasertool.[ch] * app/tools/gimppaintbrushtool.[ch] * app/tools/gimppainttool.[ch] * app/tools/gimppenciltool.[ch] * app/tools/gimpsmudgetool.[ch]: all paint tools are pure GUI things now. PaintOptions and friends still need to be chopped up though... * app/undo.c: changed PaintUndo to GimpPaintCoreUndo, some minor cleanup. * tools/kernelgen.c: changed accordingly. * tools/pdbgen/Makefile.am: scan paint/paint-types.h for enums. * tools/pdbgen/pdb/paint_tools.pdb: hardcode "success = FALSE" for all paint PDB wrappers. The non-gui stuff is completely broken. More commits to come... * app/pdb/paint_tools_cmds.c * tools/pdbgen/enums.pl: regenerated.
2002-02-15 03:31:16 +08:00
#include "paint-types.h"
new directory app/base/ 2001-05-15 Michael Natterer <mitch@gimp.org> * configure.in: new directory app/base/ * app/Makefile.am * app/boundary.[ch] * app/brush_scale.[ch] * app/gimpchecks.h * app/gimplut.[ch] * app/pixel_processor.[ch] * app/pixel_region.[ch] * app/pixel_surround.[ch] * app/temp_buf.[ch] * app/tile.[ch] * app/tile_cache.[ch] * app/tile_manager.[ch] * app/tile_manager_pvt.h * app/tile_pvt.h * app/tile_swap.[ch]: moved to base/ * app/base/Makefile.am * app/base/base-types.h * app/base/*: new directory for the sub-object pixel maniplation and storage stuff. Does not include Gtk+ or anything outside base/. Did some cleanup in all files. * app/appenums.h * app/apptypes.h * app/core/gimpimage.h: removed types which are now in base/base-types.h. * app/base/base-config.[ch] * app/gimprc.[ch]: put the config variables for base/ to their own file so base/ doesn not have to include gimprc.h (does not yet work, i.e. the variables are un-configurable right now) * app/main.c: set a log handler for "Gimp-Base". * app/paint-funcs/Makefile.am * app/paint-funcs/paint-funcs.[ch]: removed the color hash which maps RGB to color indices because it's a totally standalone system which has nothing to do with the paint-funcs and introduced a GimpImage dependency. paint-funcs/ should be considered on the same sub-object (glib-only) level as base/, only in a different directory. * app/core/Makefile.am * app/core/gimpimage-colorhash.[ch]: put the color hash here. * app/gimage.c: don't invalidate the color hash here... * app/core/gimpimage.c: ... but in the colormap_changed() default inplementation. Initialize the hash in class_init(). * tools/pdbgen/Makefile.am: scan app/base/base-types.h for enums. * tools/pdbgen/enums.pl: regenerated. * app/[lots] * app/core/[of] * app/gui/[files] * app/pdb/[all] * app/tools/[over] * app/widgets/[the] * tools/pdbgen/pdb/[place]: changed #includes accordingly. And use base_config->value instead of the stuff from gimprc.h.
2001-05-15 19:25:25 +08:00
#include "base/temp-buf.h"
#include "paint-funcs/paint-funcs.h"
app/Makefile.am removed. 2001-07-07 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/context_manager.[ch]: removed. * app/app_procs.c: call tool_mananger instead of context_manager functions, pass "the_gimp" to some more functions. * app/drawable.[ch]: pass a GimpContext to drawable_fill(). * app/errors.c: behave according to "stack_trace_mode" when using the debugging signal handler. * app/gimprc.[ch]: removed the core/ config variables. * app/selection.c: set the selection's state to INVISIBLE in selection_pause(). * app/core/Makefile.am * app/core/gimpcoreconfig.[ch]: new files (the configuration variables used by core/). * app/core/gimpcontext.[ch]: removed the global contexts (user, default, ...) and their functions. It's no longer possible to pass NULL to the context functions to manipulate the current context (gimpcontext.c doesn't know the current context any more). * app/core/gimp.[ch]: added them here. The functions are now called gimp_[set|get]_*_context(). Added gimp_create_context() which is the only function to create contexts now. * app/gui/dialogs.[ch] * app/gui/gui.[ch]: pass "gimp" to all functions. * app/tools/tool_manager.[ch] * app/tools/tools.[ch]: pass "gimp" to lots of functions. Added the "global_tool_context" logic and the global/non-global paint options switching from the context_manager. Pass "gimp" to all tools' "register" functions. * app/tools/*: changed accordingly. * app/devices.c * app/disp_callbacks.c * app/file-open.[ch] * app/file-save.c * app/gdisplay.c * app/gimage.c * app/libgimp_glue.c * app/module_db.c * app/nav_window.c * app/plug_in.c * app/qmask.c * app/undo.c * app/base/base-config.c * app/core/gimpbrushpipe.c * app/core/gimpdrawable-offset.c * app/core/gimpgradient.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-mask.c * app/core/gimpimage-new.c * app/core/gimpimage.c * app/core/gimppalette.c * app/core/gimptoolinfo.[ch] * app/core/gimpundo.c * app/gui/brush-select.c * app/gui/channels-commands.c * app/gui/color-area.c * app/gui/dialogs-constructors.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/gradient-editor.c * app/gui/gradient-select.c * app/gui/info-window.c * app/gui/layers-commands.c * app/gui/menus.c * app/gui/palette-editor.c * app/gui/palette-import-dialog.c * app/gui/palette-select.c * app/gui/paths-dialog.c * app/gui/pattern-select.c * app/gui/preferences-dialog.c * app/gui/resize-dialog.c * app/gui/test-commands.c * app/gui/tool-options-dialog.c * app/gui/toolbox.c * app/gui/tools-commands.c * app/xcf/xcf-load.c * app/xcf/xcf-save.c * app/widgets/gimpchannellistview.c * app/widgets/gimpdnd.c * app/widgets/gimpdrawablelistview.[ch] * app/widgets/gimpimagedock.c * app/widgets/gimplayerlistview.c * app/pdb/brushes_cmds.c * app/pdb/drawable_cmds.c * app/pdb/gradient_select_cmds.c * app/pdb/gradients_cmds.c * app/pdb/palette_cmds.c * app/pdb/patterns_cmds.c * app/pdb/procedural_db.c * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/palette.pdb * tools/pdbgen/pdb/patterns.pdb: changed accordingly: remove usage of gimp_context_[get|set]_*(NULL), create contexts with gimp_create_context(). Get the user/current context with gimp_get_[user|current]_context(). Added/removed access to the global "the_gimp" variable in some places. Get the core's config variables from "core_config".
2001-07-07 20:17:23 +08:00
#include "core/gimp.h"
#include "core/gimpbrush.h"
#include "core/gimpdrawable.h"
#include "core/gimpgradient.h"
#include "core/gimpimage.h"
Core/UI separation for the paint tools: 2002-02-14 Michael Natterer <mitch@gimp.org> Core/UI separation for the paint tools: * configure.in * app/Makefile.am * app/paint/.cvsignore * app/paint/Makefile.am: added new directory for the paint methods without GUI and tools around them. * app/paint/paint-types.h: typedefs for this module. * app/paint/gimppaintcore-kernels.h * app/paint/gimppaintcore.[ch]: the general paint logic taken from GimpPaintTool. * app/paint/gimpairbrush.[ch] * app/paint/gimpclone.[ch] * app/paint/gimpconvolve.[ch] * app/paint/gimpdodgeburn.[ch] * app/paint/gimperaser.[ch] * app/paint/gimppaintbrush.[ch] * app/paint/gimppencil.[ch] * app/paint/gimpsmudge.[ch]: subclasses of GimpPaintCore, implementing their own paint() methods. Needs more hacking to get the GtkWidget pointers out of the options structs. * app/tools/gimppainttool_kernels.h: removed. * app/tools/tools-types.h: removed the paint tool enums. * app/tools/gimpairbrushtool.[ch] * app/tools/gimpclonetool.[ch] * app/tools/gimpconvolvetool.[ch] * app/tools/gimpdodgeburntool.[ch] * app/tools/gimperasertool.[ch] * app/tools/gimppaintbrushtool.[ch] * app/tools/gimppainttool.[ch] * app/tools/gimppenciltool.[ch] * app/tools/gimpsmudgetool.[ch]: all paint tools are pure GUI things now. PaintOptions and friends still need to be chopped up though... * app/undo.c: changed PaintUndo to GimpPaintCoreUndo, some minor cleanup. * tools/kernelgen.c: changed accordingly. * tools/pdbgen/Makefile.am: scan paint/paint-types.h for enums. * tools/pdbgen/pdb/paint_tools.pdb: hardcode "success = FALSE" for all paint PDB wrappers. The non-gui stuff is completely broken. More commits to come... * app/pdb/paint_tools_cmds.c * tools/pdbgen/enums.pl: regenerated.
2002-02-15 03:31:16 +08:00
#include "gimppaintbrush.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 "gimppaintoptions.h"
#include "gimp-intl.h"
Moved the undo step implementations to the core and pass around lots of 2003-02-14 Michael Natterer <mitch@gimp.org> Moved the undo step implementations to the core and pass around lots of "const gchar *undo_desc". Fixes bug #104367. * app/Makefile.am * app/undo.[ch]: removed... * app/core/Makefile.am * app/core/gimpimage-undo-push.[ch]: ...and added here. * app/paint/Makefile.am * app/tools/Makefile.am * app/paint/gimppaintcore-undo.[ch] * app/tools/gimptransformtool-undo.[ch]: new files for the paint and transform undos. * app/core/gimppaintinfo.[ch]: added a blurb. * 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.c * app/paint/gimppencil.c * app/paint/gimpsmudge.c * app/paint/paint-types.h * app/paint/paint.c: pass the blurb when registering the core. * app/core/gimpdrawable.[ch] * app/core/gimpimage.[ch] * app/core/gimpimage-mask-select.[ch] * app/core/gimpimage-mask.[ch] * app/core/gimpimagemap.[ch] * app/core/gimplayer-floating-sel.[ch]: added "undo_desc" parameters to all undo pushing helper functions. * app/undo_history.c * app/core/gimpchannel.c * app/core/gimpdrawable-blend.c * app/core/gimpdrawable-bucket-fill.c * app/core/gimpdrawable-desaturate.c * app/core/gimpdrawable-equalize.c * app/core/gimpdrawable-invert.c * app/core/gimpdrawable-offset.c * app/core/gimpdrawable-transform.c * app/core/gimpedit.c * app/core/gimpimage-convert.c * app/core/gimpimage-crop.c * app/core/gimpimage-guides.c * app/core/gimpimage-merge.c * app/core/gimpimage-qmask.c * app/core/gimpimage-resize.c * app/core/gimpimage-scale.c * app/core/gimpimage-undo.c * app/core/gimpitem.c * app/core/gimplayer.c * app/core/gimplayermask.c * app/display/gimpdisplayshell-dnd.c * app/file/file-open.c * app/file/file-save.c * app/gui/channels-commands.c * app/gui/file-commands.c * app/gui/file-open-dialog.c * app/gui/image-commands.c * app/gui/layers-commands.c * app/gui/paths-dialog.c * app/gui/select-commands.c * app/gui/vectors-commands.c * app/text/gimptext-compat.c * app/tools/gimpbezierselecttool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpimagemaptool.c * app/tools/gimpinktool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmeasuretool.c * app/tools/gimpmovetool.c * app/tools/gimppainttool.c * app/tools/gimprectselecttool.c * app/tools/gimptexttool.c * app/tools/gimptransformtool.c * app/widgets/gimpchannellistview.c * app/widgets/gimpdrawablelistview.c * app/widgets/gimpselectioneditor.c * tools/pdbgen/pdb/color.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/guides.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/selection_tools.pdb: changed accordingly: pass "undo_desc" strings, changed includes or simply removed inclusion of "undo.h". Some random cleanups. * tools/pdbgen/pdb/guides.pdb: cleaned up a lot. Fixed gimp_image_find_next_guide() to not return guides with position < 0 (and made it shorter and readable). * app/pdb/color_cmds.c * app/pdb/drawable_cmds.c * app/pdb/guides_cmds.c * app/pdb/layer_cmds.c * app/pdb/selection_cmds.c * app/pdb/selection_tools_cmds.c: regenerated.
2003-02-14 22:14:29 +08:00
static void gimp_paintbrush_paint (GimpPaintCore *paint_core,
GimpDrawable *drawable,
GimpPaintOptions *paint_options,
GimpPaintState paint_state,
guint32 time);
G_DEFINE_TYPE (GimpPaintbrush, gimp_paintbrush, GIMP_TYPE_BRUSH_CORE)
app/core/Makefile.am new object for registering GimpPaintCore subclasses, 2002-02-27 Michael Natterer <mitch@gimp.org> * app/core/Makefile.am * app/core/gimppaintinfo.[ch]: new object for registering GimpPaintCore subclasses, just like GimpToolInfo for tools. * app/core/gimp.h: added gimp->paint_info_list to hold them. * app/core/gimptoolinfo.[ch]: removed the "pdb_string" and "paint_core_name" pointers and added a GimpPaintInfo pointer instead. * app/core/gimpimage-mask.c * app/gui/vectors-commands.c * app/tools/gimpbezierselecttool.c * app/tools/tool_manager.c: changed accordingly. * app/paint/paint-types.h * app/paint/paint.c: added paint class registration stuff like the tool_manager does. * app/paint/gimpairbrush.[ch] * app/paint/gimpclone.[ch] * app/paint/gimpconvolve.[ch] * app/paint/gimpdodgeburn.[ch] * app/paint/gimperaser.[ch] * app/paint/gimppaintbrush.[ch] * app/paint/gimppencil.[ch] * app/paint/gimpsmudge.[ch]: added register functions which are called from paint_init(). The core object system lives not only in "core/", but in core, paint, vectors, file, plug-in and xcf, so I had to hack a bit to keep the deps working: * app/pdb/pdb-types.h: don't include "paint/paint-types.h"... * app/core/core-types.h: ...because it's included here. Moved the inclusions of the core's subsystems' "foo/foo-types.h" files to the end of the file. * app/paint/Makefile.am: Some slimy radioactive uglyness. * app/gui/drawable-commands.c * app/tools/gimpblendtool.c: removed calling core functions via the PDB because it makes no sense to do it manually in only a few places. This needs to be done generically using generated wrappers living in "app/commands/" or something...
2002-02-27 21:57:49 +08:00
void
gimp_paintbrush_register (Gimp *gimp,
GimpPaintRegisterCallback callback)
{
Moved the undo step implementations to the core and pass around lots of 2003-02-14 Michael Natterer <mitch@gimp.org> Moved the undo step implementations to the core and pass around lots of "const gchar *undo_desc". Fixes bug #104367. * app/Makefile.am * app/undo.[ch]: removed... * app/core/Makefile.am * app/core/gimpimage-undo-push.[ch]: ...and added here. * app/paint/Makefile.am * app/tools/Makefile.am * app/paint/gimppaintcore-undo.[ch] * app/tools/gimptransformtool-undo.[ch]: new files for the paint and transform undos. * app/core/gimppaintinfo.[ch]: added a blurb. * 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.c * app/paint/gimppencil.c * app/paint/gimpsmudge.c * app/paint/paint-types.h * app/paint/paint.c: pass the blurb when registering the core. * app/core/gimpdrawable.[ch] * app/core/gimpimage.[ch] * app/core/gimpimage-mask-select.[ch] * app/core/gimpimage-mask.[ch] * app/core/gimpimagemap.[ch] * app/core/gimplayer-floating-sel.[ch]: added "undo_desc" parameters to all undo pushing helper functions. * app/undo_history.c * app/core/gimpchannel.c * app/core/gimpdrawable-blend.c * app/core/gimpdrawable-bucket-fill.c * app/core/gimpdrawable-desaturate.c * app/core/gimpdrawable-equalize.c * app/core/gimpdrawable-invert.c * app/core/gimpdrawable-offset.c * app/core/gimpdrawable-transform.c * app/core/gimpedit.c * app/core/gimpimage-convert.c * app/core/gimpimage-crop.c * app/core/gimpimage-guides.c * app/core/gimpimage-merge.c * app/core/gimpimage-qmask.c * app/core/gimpimage-resize.c * app/core/gimpimage-scale.c * app/core/gimpimage-undo.c * app/core/gimpitem.c * app/core/gimplayer.c * app/core/gimplayermask.c * app/display/gimpdisplayshell-dnd.c * app/file/file-open.c * app/file/file-save.c * app/gui/channels-commands.c * app/gui/file-commands.c * app/gui/file-open-dialog.c * app/gui/image-commands.c * app/gui/layers-commands.c * app/gui/paths-dialog.c * app/gui/select-commands.c * app/gui/vectors-commands.c * app/text/gimptext-compat.c * app/tools/gimpbezierselecttool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpimagemaptool.c * app/tools/gimpinktool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmeasuretool.c * app/tools/gimpmovetool.c * app/tools/gimppainttool.c * app/tools/gimprectselecttool.c * app/tools/gimptexttool.c * app/tools/gimptransformtool.c * app/widgets/gimpchannellistview.c * app/widgets/gimpdrawablelistview.c * app/widgets/gimpselectioneditor.c * tools/pdbgen/pdb/color.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/guides.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/selection_tools.pdb: changed accordingly: pass "undo_desc" strings, changed includes or simply removed inclusion of "undo.h". Some random cleanups. * tools/pdbgen/pdb/guides.pdb: cleaned up a lot. Fixed gimp_image_find_next_guide() to not return guides with position < 0 (and made it shorter and readable). * app/pdb/color_cmds.c * app/pdb/drawable_cmds.c * app/pdb/guides_cmds.c * app/pdb/layer_cmds.c * app/pdb/selection_cmds.c * app/pdb/selection_tools_cmds.c: regenerated.
2003-02-14 22:14:29 +08:00
(* callback) (gimp,
GIMP_TYPE_PAINTBRUSH,
GIMP_TYPE_PAINT_OPTIONS,
Fixed incomplete core/ui separation of paint tools and paint methods: 2005-12-27 Michael Natterer <mitch@gimp.org> Fixed incomplete core/ui separation of paint tools and paint methods: * app/core/core-enums.h * app/core/gimpcontext.[ch]: added a "paint-info" property and API so the current paint method can be selected without the need for an active tool. (gimp_context_real_set_tool): set the paint-info to tool_info->paint_info so the paint method follows the active tool just as the active image follows the active display. * app/core/gimp.h (struct Gimp) * app/core/gimppaintinfo.[ch]: added "standard_paint_info" API and stuff to be consistent with other context object properties. * app/paint/gimp-paint.c: set the paintbrush as standard_paint_info. * app/core/gimpstrokedesc.c (gimp_stroke_desc_new): removed the hack of falling back to the paintbrush when there is no active tool and use the active paint method instead. Fall back to the standard paint method if there is no active one. (nothing in the core uses the active tool any more now). * app/widgets/gimpdeviceinfo.h: add the paint info to the properties which are saved in devicerc. Added identifiers (names) and stock-ids to GimpPaintInfo: * app/core/gimppaintinfo.[ch] (gimp_paint_info_new): added identifier and stock-id parameters. * app/core/gimptoolinfo.c (gimp_tool_info_new): removed the hack of setting the paint-info stock-id from the tool-info stock-id. * app/paint/paint-types.h * app/paint/gimp-paint.c: changed GimpPaintRegisterCallback accordingly. * app/tools/gimp-tools.c (gimp_tools_register): changed paint info names accordingly. * app/paint/*.c (gimp_*_register): pass identifier and stock-id accordingly.
2005-12-28 02:57:01 +08:00
"gimp-paintbrush",
_("Paintbrush"),
"gimp-tool-paintbrush");
app/core/Makefile.am new object for registering GimpPaintCore subclasses, 2002-02-27 Michael Natterer <mitch@gimp.org> * app/core/Makefile.am * app/core/gimppaintinfo.[ch]: new object for registering GimpPaintCore subclasses, just like GimpToolInfo for tools. * app/core/gimp.h: added gimp->paint_info_list to hold them. * app/core/gimptoolinfo.[ch]: removed the "pdb_string" and "paint_core_name" pointers and added a GimpPaintInfo pointer instead. * app/core/gimpimage-mask.c * app/gui/vectors-commands.c * app/tools/gimpbezierselecttool.c * app/tools/tool_manager.c: changed accordingly. * app/paint/paint-types.h * app/paint/paint.c: added paint class registration stuff like the tool_manager does. * app/paint/gimpairbrush.[ch] * app/paint/gimpclone.[ch] * app/paint/gimpconvolve.[ch] * app/paint/gimpdodgeburn.[ch] * app/paint/gimperaser.[ch] * app/paint/gimppaintbrush.[ch] * app/paint/gimppencil.[ch] * app/paint/gimpsmudge.[ch]: added register functions which are called from paint_init(). The core object system lives not only in "core/", but in core, paint, vectors, file, plug-in and xcf, so I had to hack a bit to keep the deps working: * app/pdb/pdb-types.h: don't include "paint/paint-types.h"... * app/core/core-types.h: ...because it's included here. Moved the inclusions of the core's subsystems' "foo/foo-types.h" files to the end of the file. * app/paint/Makefile.am: Some slimy radioactive uglyness. * app/gui/drawable-commands.c * app/tools/gimpblendtool.c: removed calling core functions via the PDB because it makes no sense to do it manually in only a few places. This needs to be done generically using generated wrappers living in "app/commands/" or something...
2002-02-27 21:57:49 +08:00
}
static void
Core/UI separation for the paint tools: 2002-02-14 Michael Natterer <mitch@gimp.org> Core/UI separation for the paint tools: * configure.in * app/Makefile.am * app/paint/.cvsignore * app/paint/Makefile.am: added new directory for the paint methods without GUI and tools around them. * app/paint/paint-types.h: typedefs for this module. * app/paint/gimppaintcore-kernels.h * app/paint/gimppaintcore.[ch]: the general paint logic taken from GimpPaintTool. * app/paint/gimpairbrush.[ch] * app/paint/gimpclone.[ch] * app/paint/gimpconvolve.[ch] * app/paint/gimpdodgeburn.[ch] * app/paint/gimperaser.[ch] * app/paint/gimppaintbrush.[ch] * app/paint/gimppencil.[ch] * app/paint/gimpsmudge.[ch]: subclasses of GimpPaintCore, implementing their own paint() methods. Needs more hacking to get the GtkWidget pointers out of the options structs. * app/tools/gimppainttool_kernels.h: removed. * app/tools/tools-types.h: removed the paint tool enums. * app/tools/gimpairbrushtool.[ch] * app/tools/gimpclonetool.[ch] * app/tools/gimpconvolvetool.[ch] * app/tools/gimpdodgeburntool.[ch] * app/tools/gimperasertool.[ch] * app/tools/gimppaintbrushtool.[ch] * app/tools/gimppainttool.[ch] * app/tools/gimppenciltool.[ch] * app/tools/gimpsmudgetool.[ch]: all paint tools are pure GUI things now. PaintOptions and friends still need to be chopped up though... * app/undo.c: changed PaintUndo to GimpPaintCoreUndo, some minor cleanup. * tools/kernelgen.c: changed accordingly. * tools/pdbgen/Makefile.am: scan paint/paint-types.h for enums. * tools/pdbgen/pdb/paint_tools.pdb: hardcode "success = FALSE" for all paint PDB wrappers. The non-gui stuff is completely broken. More commits to come... * app/pdb/paint_tools_cmds.c * tools/pdbgen/enums.pl: regenerated.
2002-02-15 03:31:16 +08:00
gimp_paintbrush_class_init (GimpPaintbrushClass *klass)
{
GimpPaintCoreClass *paint_core_class = GIMP_PAINT_CORE_CLASS (klass);
GimpBrushCoreClass *brush_core_class = GIMP_BRUSH_CORE_CLASS (klass);
paint_core_class->paint = gimp_paintbrush_paint;
brush_core_class->handles_changing_brush = TRUE;
}
static void
Core/UI separation for the paint tools: 2002-02-14 Michael Natterer <mitch@gimp.org> Core/UI separation for the paint tools: * configure.in * app/Makefile.am * app/paint/.cvsignore * app/paint/Makefile.am: added new directory for the paint methods without GUI and tools around them. * app/paint/paint-types.h: typedefs for this module. * app/paint/gimppaintcore-kernels.h * app/paint/gimppaintcore.[ch]: the general paint logic taken from GimpPaintTool. * app/paint/gimpairbrush.[ch] * app/paint/gimpclone.[ch] * app/paint/gimpconvolve.[ch] * app/paint/gimpdodgeburn.[ch] * app/paint/gimperaser.[ch] * app/paint/gimppaintbrush.[ch] * app/paint/gimppencil.[ch] * app/paint/gimpsmudge.[ch]: subclasses of GimpPaintCore, implementing their own paint() methods. Needs more hacking to get the GtkWidget pointers out of the options structs. * app/tools/gimppainttool_kernels.h: removed. * app/tools/tools-types.h: removed the paint tool enums. * app/tools/gimpairbrushtool.[ch] * app/tools/gimpclonetool.[ch] * app/tools/gimpconvolvetool.[ch] * app/tools/gimpdodgeburntool.[ch] * app/tools/gimperasertool.[ch] * app/tools/gimppaintbrushtool.[ch] * app/tools/gimppainttool.[ch] * app/tools/gimppenciltool.[ch] * app/tools/gimpsmudgetool.[ch]: all paint tools are pure GUI things now. PaintOptions and friends still need to be chopped up though... * app/undo.c: changed PaintUndo to GimpPaintCoreUndo, some minor cleanup. * tools/kernelgen.c: changed accordingly. * tools/pdbgen/Makefile.am: scan paint/paint-types.h for enums. * tools/pdbgen/pdb/paint_tools.pdb: hardcode "success = FALSE" for all paint PDB wrappers. The non-gui stuff is completely broken. More commits to come... * app/pdb/paint_tools_cmds.c * tools/pdbgen/enums.pl: regenerated.
2002-02-15 03:31:16 +08:00
gimp_paintbrush_init (GimpPaintbrush *paintbrush)
1997-11-25 06:05:25 +08:00
{
}
static void
gimp_paintbrush_paint (GimpPaintCore *paint_core,
GimpDrawable *drawable,
GimpPaintOptions *paint_options,
GimpPaintState paint_state,
guint32 time)
{
Core/UI separation for the paint tools: 2002-02-14 Michael Natterer <mitch@gimp.org> Core/UI separation for the paint tools: * configure.in * app/Makefile.am * app/paint/.cvsignore * app/paint/Makefile.am: added new directory for the paint methods without GUI and tools around them. * app/paint/paint-types.h: typedefs for this module. * app/paint/gimppaintcore-kernels.h * app/paint/gimppaintcore.[ch]: the general paint logic taken from GimpPaintTool. * app/paint/gimpairbrush.[ch] * app/paint/gimpclone.[ch] * app/paint/gimpconvolve.[ch] * app/paint/gimpdodgeburn.[ch] * app/paint/gimperaser.[ch] * app/paint/gimppaintbrush.[ch] * app/paint/gimppencil.[ch] * app/paint/gimpsmudge.[ch]: subclasses of GimpPaintCore, implementing their own paint() methods. Needs more hacking to get the GtkWidget pointers out of the options structs. * app/tools/gimppainttool_kernels.h: removed. * app/tools/tools-types.h: removed the paint tool enums. * app/tools/gimpairbrushtool.[ch] * app/tools/gimpclonetool.[ch] * app/tools/gimpconvolvetool.[ch] * app/tools/gimpdodgeburntool.[ch] * app/tools/gimperasertool.[ch] * app/tools/gimppaintbrushtool.[ch] * app/tools/gimppainttool.[ch] * app/tools/gimppenciltool.[ch] * app/tools/gimpsmudgetool.[ch]: all paint tools are pure GUI things now. PaintOptions and friends still need to be chopped up though... * app/undo.c: changed PaintUndo to GimpPaintCoreUndo, some minor cleanup. * tools/kernelgen.c: changed accordingly. * tools/pdbgen/Makefile.am: scan paint/paint-types.h for enums. * tools/pdbgen/pdb/paint_tools.pdb: hardcode "success = FALSE" for all paint PDB wrappers. The non-gui stuff is completely broken. More commits to come... * app/pdb/paint_tools_cmds.c * tools/pdbgen/enums.pl: regenerated.
2002-02-15 03:31:16 +08:00
switch (paint_state)
1997-11-25 06:05:25 +08:00
{
case GIMP_PAINT_STATE_MOTION:
_gimp_paintbrush_motion (paint_core, drawable, paint_options,
GIMP_OPACITY_OPAQUE);
1997-11-25 06:05:25 +08:00
break;
default:
1997-11-25 06:05:25 +08:00
break;
}
}
void
_gimp_paintbrush_motion (GimpPaintCore *paint_core,
GimpDrawable *drawable,
GimpPaintOptions *paint_options,
gdouble opacity)
1997-11-25 06:05:25 +08:00
{
GimpBrushCore *brush_core = GIMP_BRUSH_CORE (paint_core);
GimpContext *context = GIMP_CONTEXT (paint_options);
GimpImage *image;
added "gboolean reverse" to gimp_gradient_get_color_at() so all gradients 2003-07-22 Michael Natterer <mitch@gimp.org> * app/core/gimpgradient.[ch]: added "gboolean reverse" to gimp_gradient_get_color_at() so all gradients can be used reversed. * app/core/gimpdrawable-blend.[ch] (gimp_drawable_blend) * app/core/gimppalette-import.[ch] (gimp_palette_import_from_gradient): added "gboolean reverse". * app/paint/paint-enums.[ch]: removed enum GimpGradientRepeatMode since it is identical to GimpRepeatMode, except for the now obsolete ONCE_BACKWARD value. * app/paint/gimppaintcore.[ch]: removed gimp_paint_core_get_color_from_gradient()... * app/paint/gimppaintoptions.[ch]: ...and added gimp_paint_options_get_gradient_color(), which is much more general. Added a "reverse" property to GimpGradientOptions and changed the type of the "repeat" property to GimpRepeatMode. * app/paint/gimppaintbrush.c: use gimp_paint_options_get_gradient_color(). * app/tools/gimpblendoptions.[ch]: removed the "repeat" property since it is in the parent class now. * app/gui/gradient-select.c * app/gui/palette-import-dialog.c * app/widgets/gimpgradienteditor.c * app/tools/gimpblendtool.c * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/misc_tools.pdb: changed accordingly. * app/tools/gimppaintoptions-gui.c: added a "Reverse" toggle right of the gradient preview. * app/widgets/gimppreviewrenderergradient.[ch]: added "gboolean reverse" member and gimp_preview_renderer_gradient_set_reverse() API. * tools/pdbgen/pdb/paint_tools.pdb: fixed the paintbrush invoker to set GimpPaintOption's "use-fade" and "use-gradient" properties correctly. * app/pdb/gradients_cmds.c * app/pdb/misc_tools_cmds.c * app/pdb/paint_tools_cmds.c * libgimp/gimpenums.h * libgimp/gimpmisctools_pdb.[ch] * plug-ins/pygimp/gimpenums.py * plug-ins/script-fu/script-fu-constants.c * tools/pdbgen/enums.pl: regenerated. * libgimp/gimpcompat.h * plug-ins/script-fu/siod-wrapper.c: removed GimpGradientPaintMode here too since it was only exported accidentially (it's not used by any external API). * plug-ins/script-fu/scripts/3dTruchet.scm * plug-ins/script-fu/scripts/alien-glow-arrow.scm * plug-ins/script-fu/scripts/alien-glow-bar.scm * plug-ins/script-fu/scripts/alien-glow-bullet.scm * plug-ins/script-fu/scripts/alien-glow-button.scm * plug-ins/script-fu/scripts/alien-glow-logo.scm * plug-ins/script-fu/scripts/basic1-logo.scm * plug-ins/script-fu/scripts/basic2-logo.scm * plug-ins/script-fu/scripts/beveled-button.scm * plug-ins/script-fu/scripts/blended-logo.scm * plug-ins/script-fu/scripts/burn-in-anim.scm * plug-ins/script-fu/scripts/coffee.scm * plug-ins/script-fu/scripts/comic-logo.scm * plug-ins/script-fu/scripts/coolmetal-logo.scm * plug-ins/script-fu/scripts/glossy.scm * plug-ins/script-fu/scripts/gradient-bevel-logo.scm * plug-ins/script-fu/scripts/gradient-example.scm * plug-ins/script-fu/scripts/pupi-button.scm * plug-ins/script-fu/scripts/rendermap.scm * plug-ins/script-fu/scripts/sphere.scm * plug-ins/script-fu/scripts/starscape-logo.scm * plug-ins/script-fu/scripts/test-sphere.scm * plug-ins/script-fu/scripts/textured-logo.scm * plug-ins/script-fu/scripts/title-header.scm * plug-ins/script-fu/scripts/weave.scm: pass "reverse" to gimp_blend(). Pass FALSE in most cases and added script parameters were it makes sense.
2003-07-22 22:24:11 +08:00
GimpRGB gradient_color;
TempBuf *area;
guchar col[MAX_CHANNELS];
GimpPaintApplicationMode paint_appl_mode;
2008-05-23 00:38:57 +08:00
gdouble grad_point;
gdouble hardness;
image = gimp_item_get_image (GIMP_ITEM (drawable));
opacity *= gimp_paint_options_get_fade (paint_options, image,
paint_core->pixel_dist);
if (opacity == 0.0)
return;
area = gimp_paint_core_get_paint_area (paint_core, drawable, paint_options);
if (! area)
1997-11-25 06:05:25 +08:00
return;
paint_appl_mode = paint_options->application_mode;
2008-05-23 00:38:57 +08:00
grad_point = gimp_paint_options_get_dynamic_color (paint_options,
&paint_core->cur_coords);
2008-05-23 00:38:57 +08:00
/* optionally take the color from the current gradient */
if (gimp_paint_options_get_gradient_color (paint_options, image,
2008-05-23 00:38:57 +08:00
grad_point,
added "gboolean reverse" to gimp_gradient_get_color_at() so all gradients 2003-07-22 Michael Natterer <mitch@gimp.org> * app/core/gimpgradient.[ch]: added "gboolean reverse" to gimp_gradient_get_color_at() so all gradients can be used reversed. * app/core/gimpdrawable-blend.[ch] (gimp_drawable_blend) * app/core/gimppalette-import.[ch] (gimp_palette_import_from_gradient): added "gboolean reverse". * app/paint/paint-enums.[ch]: removed enum GimpGradientRepeatMode since it is identical to GimpRepeatMode, except for the now obsolete ONCE_BACKWARD value. * app/paint/gimppaintcore.[ch]: removed gimp_paint_core_get_color_from_gradient()... * app/paint/gimppaintoptions.[ch]: ...and added gimp_paint_options_get_gradient_color(), which is much more general. Added a "reverse" property to GimpGradientOptions and changed the type of the "repeat" property to GimpRepeatMode. * app/paint/gimppaintbrush.c: use gimp_paint_options_get_gradient_color(). * app/tools/gimpblendoptions.[ch]: removed the "repeat" property since it is in the parent class now. * app/gui/gradient-select.c * app/gui/palette-import-dialog.c * app/widgets/gimpgradienteditor.c * app/tools/gimpblendtool.c * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/misc_tools.pdb: changed accordingly. * app/tools/gimppaintoptions-gui.c: added a "Reverse" toggle right of the gradient preview. * app/widgets/gimppreviewrenderergradient.[ch]: added "gboolean reverse" member and gimp_preview_renderer_gradient_set_reverse() API. * tools/pdbgen/pdb/paint_tools.pdb: fixed the paintbrush invoker to set GimpPaintOption's "use-fade" and "use-gradient" properties correctly. * app/pdb/gradients_cmds.c * app/pdb/misc_tools_cmds.c * app/pdb/paint_tools_cmds.c * libgimp/gimpenums.h * libgimp/gimpmisctools_pdb.[ch] * plug-ins/pygimp/gimpenums.py * plug-ins/script-fu/script-fu-constants.c * tools/pdbgen/enums.pl: regenerated. * libgimp/gimpcompat.h * plug-ins/script-fu/siod-wrapper.c: removed GimpGradientPaintMode here too since it was only exported accidentially (it's not used by any external API). * plug-ins/script-fu/scripts/3dTruchet.scm * plug-ins/script-fu/scripts/alien-glow-arrow.scm * plug-ins/script-fu/scripts/alien-glow-bar.scm * plug-ins/script-fu/scripts/alien-glow-bullet.scm * plug-ins/script-fu/scripts/alien-glow-button.scm * plug-ins/script-fu/scripts/alien-glow-logo.scm * plug-ins/script-fu/scripts/basic1-logo.scm * plug-ins/script-fu/scripts/basic2-logo.scm * plug-ins/script-fu/scripts/beveled-button.scm * plug-ins/script-fu/scripts/blended-logo.scm * plug-ins/script-fu/scripts/burn-in-anim.scm * plug-ins/script-fu/scripts/coffee.scm * plug-ins/script-fu/scripts/comic-logo.scm * plug-ins/script-fu/scripts/coolmetal-logo.scm * plug-ins/script-fu/scripts/glossy.scm * plug-ins/script-fu/scripts/gradient-bevel-logo.scm * plug-ins/script-fu/scripts/gradient-example.scm * plug-ins/script-fu/scripts/pupi-button.scm * plug-ins/script-fu/scripts/rendermap.scm * plug-ins/script-fu/scripts/sphere.scm * plug-ins/script-fu/scripts/starscape-logo.scm * plug-ins/script-fu/scripts/test-sphere.scm * plug-ins/script-fu/scripts/textured-logo.scm * plug-ins/script-fu/scripts/title-header.scm * plug-ins/script-fu/scripts/weave.scm: pass "reverse" to gimp_blend(). Pass FALSE in most cases and added script parameters were it makes sense.
2003-07-22 22:24:11 +08:00
paint_core->pixel_dist,
&gradient_color))
1997-11-25 06:05:25 +08:00
{
added "gboolean reverse" to gimp_gradient_get_color_at() so all gradients 2003-07-22 Michael Natterer <mitch@gimp.org> * app/core/gimpgradient.[ch]: added "gboolean reverse" to gimp_gradient_get_color_at() so all gradients can be used reversed. * app/core/gimpdrawable-blend.[ch] (gimp_drawable_blend) * app/core/gimppalette-import.[ch] (gimp_palette_import_from_gradient): added "gboolean reverse". * app/paint/paint-enums.[ch]: removed enum GimpGradientRepeatMode since it is identical to GimpRepeatMode, except for the now obsolete ONCE_BACKWARD value. * app/paint/gimppaintcore.[ch]: removed gimp_paint_core_get_color_from_gradient()... * app/paint/gimppaintoptions.[ch]: ...and added gimp_paint_options_get_gradient_color(), which is much more general. Added a "reverse" property to GimpGradientOptions and changed the type of the "repeat" property to GimpRepeatMode. * app/paint/gimppaintbrush.c: use gimp_paint_options_get_gradient_color(). * app/tools/gimpblendoptions.[ch]: removed the "repeat" property since it is in the parent class now. * app/gui/gradient-select.c * app/gui/palette-import-dialog.c * app/widgets/gimpgradienteditor.c * app/tools/gimpblendtool.c * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/misc_tools.pdb: changed accordingly. * app/tools/gimppaintoptions-gui.c: added a "Reverse" toggle right of the gradient preview. * app/widgets/gimppreviewrenderergradient.[ch]: added "gboolean reverse" member and gimp_preview_renderer_gradient_set_reverse() API. * tools/pdbgen/pdb/paint_tools.pdb: fixed the paintbrush invoker to set GimpPaintOption's "use-fade" and "use-gradient" properties correctly. * app/pdb/gradients_cmds.c * app/pdb/misc_tools_cmds.c * app/pdb/paint_tools_cmds.c * libgimp/gimpenums.h * libgimp/gimpmisctools_pdb.[ch] * plug-ins/pygimp/gimpenums.py * plug-ins/script-fu/script-fu-constants.c * tools/pdbgen/enums.pl: regenerated. * libgimp/gimpcompat.h * plug-ins/script-fu/siod-wrapper.c: removed GimpGradientPaintMode here too since it was only exported accidentially (it's not used by any external API). * plug-ins/script-fu/scripts/3dTruchet.scm * plug-ins/script-fu/scripts/alien-glow-arrow.scm * plug-ins/script-fu/scripts/alien-glow-bar.scm * plug-ins/script-fu/scripts/alien-glow-bullet.scm * plug-ins/script-fu/scripts/alien-glow-button.scm * plug-ins/script-fu/scripts/alien-glow-logo.scm * plug-ins/script-fu/scripts/basic1-logo.scm * plug-ins/script-fu/scripts/basic2-logo.scm * plug-ins/script-fu/scripts/beveled-button.scm * plug-ins/script-fu/scripts/blended-logo.scm * plug-ins/script-fu/scripts/burn-in-anim.scm * plug-ins/script-fu/scripts/coffee.scm * plug-ins/script-fu/scripts/comic-logo.scm * plug-ins/script-fu/scripts/coolmetal-logo.scm * plug-ins/script-fu/scripts/glossy.scm * plug-ins/script-fu/scripts/gradient-bevel-logo.scm * plug-ins/script-fu/scripts/gradient-example.scm * plug-ins/script-fu/scripts/pupi-button.scm * plug-ins/script-fu/scripts/rendermap.scm * plug-ins/script-fu/scripts/sphere.scm * plug-ins/script-fu/scripts/starscape-logo.scm * plug-ins/script-fu/scripts/test-sphere.scm * plug-ins/script-fu/scripts/textured-logo.scm * plug-ins/script-fu/scripts/title-header.scm * plug-ins/script-fu/scripts/weave.scm: pass "reverse" to gimp_blend(). Pass FALSE in most cases and added script parameters were it makes sense.
2003-07-22 22:24:11 +08:00
opacity *= gradient_color.a;
added "gboolean reverse" to gimp_gradient_get_color_at() so all gradients 2003-07-22 Michael Natterer <mitch@gimp.org> * app/core/gimpgradient.[ch]: added "gboolean reverse" to gimp_gradient_get_color_at() so all gradients can be used reversed. * app/core/gimpdrawable-blend.[ch] (gimp_drawable_blend) * app/core/gimppalette-import.[ch] (gimp_palette_import_from_gradient): added "gboolean reverse". * app/paint/paint-enums.[ch]: removed enum GimpGradientRepeatMode since it is identical to GimpRepeatMode, except for the now obsolete ONCE_BACKWARD value. * app/paint/gimppaintcore.[ch]: removed gimp_paint_core_get_color_from_gradient()... * app/paint/gimppaintoptions.[ch]: ...and added gimp_paint_options_get_gradient_color(), which is much more general. Added a "reverse" property to GimpGradientOptions and changed the type of the "repeat" property to GimpRepeatMode. * app/paint/gimppaintbrush.c: use gimp_paint_options_get_gradient_color(). * app/tools/gimpblendoptions.[ch]: removed the "repeat" property since it is in the parent class now. * app/gui/gradient-select.c * app/gui/palette-import-dialog.c * app/widgets/gimpgradienteditor.c * app/tools/gimpblendtool.c * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/misc_tools.pdb: changed accordingly. * app/tools/gimppaintoptions-gui.c: added a "Reverse" toggle right of the gradient preview. * app/widgets/gimppreviewrenderergradient.[ch]: added "gboolean reverse" member and gimp_preview_renderer_gradient_set_reverse() API. * tools/pdbgen/pdb/paint_tools.pdb: fixed the paintbrush invoker to set GimpPaintOption's "use-fade" and "use-gradient" properties correctly. * app/pdb/gradients_cmds.c * app/pdb/misc_tools_cmds.c * app/pdb/paint_tools_cmds.c * libgimp/gimpenums.h * libgimp/gimpmisctools_pdb.[ch] * plug-ins/pygimp/gimpenums.py * plug-ins/script-fu/script-fu-constants.c * tools/pdbgen/enums.pl: regenerated. * libgimp/gimpcompat.h * plug-ins/script-fu/siod-wrapper.c: removed GimpGradientPaintMode here too since it was only exported accidentially (it's not used by any external API). * plug-ins/script-fu/scripts/3dTruchet.scm * plug-ins/script-fu/scripts/alien-glow-arrow.scm * plug-ins/script-fu/scripts/alien-glow-bar.scm * plug-ins/script-fu/scripts/alien-glow-bullet.scm * plug-ins/script-fu/scripts/alien-glow-button.scm * plug-ins/script-fu/scripts/alien-glow-logo.scm * plug-ins/script-fu/scripts/basic1-logo.scm * plug-ins/script-fu/scripts/basic2-logo.scm * plug-ins/script-fu/scripts/beveled-button.scm * plug-ins/script-fu/scripts/blended-logo.scm * plug-ins/script-fu/scripts/burn-in-anim.scm * plug-ins/script-fu/scripts/coffee.scm * plug-ins/script-fu/scripts/comic-logo.scm * plug-ins/script-fu/scripts/coolmetal-logo.scm * plug-ins/script-fu/scripts/glossy.scm * plug-ins/script-fu/scripts/gradient-bevel-logo.scm * plug-ins/script-fu/scripts/gradient-example.scm * plug-ins/script-fu/scripts/pupi-button.scm * plug-ins/script-fu/scripts/rendermap.scm * plug-ins/script-fu/scripts/sphere.scm * plug-ins/script-fu/scripts/starscape-logo.scm * plug-ins/script-fu/scripts/test-sphere.scm * plug-ins/script-fu/scripts/textured-logo.scm * plug-ins/script-fu/scripts/title-header.scm * plug-ins/script-fu/scripts/weave.scm: pass "reverse" to gimp_blend(). Pass FALSE in most cases and added script parameters were it makes sense.
2003-07-22 22:24:11 +08:00
gimp_rgb_get_uchar (&gradient_color,
&col[RED_PIX],
&col[GREEN_PIX],
&col[BLUE_PIX]);
col[ALPHA_PIX] = OPAQUE_OPACITY;
color_pixels (temp_buf_data (area), col,
area->width * area->height,
area->bytes);
paint_appl_mode = GIMP_PAINT_INCREMENTAL;
1997-11-25 06:05:25 +08:00
}
/* otherwise check if the brush has a pixmap and use that to color the area */
else if (brush_core->brush && brush_core->brush->pixmap)
{
gimp_brush_core_color_area_with_pixmap (brush_core, drawable,
area,
gimp_paint_options_get_brush_mode (paint_options));
paint_appl_mode = GIMP_PAINT_INCREMENTAL;
}
/* otherwise fill the area with the foreground color */
else
{
gimp_image_get_foreground (image, context, gimp_drawable_type (drawable),
col);
col[area->bytes - 1] = OPAQUE_OPACITY;
color_pixels (temp_buf_data (area), col,
area->width * area->height,
area->bytes);
}
Applied modified patch from Alexia Death which adds velocity support to 2008-05-10 Michael Natterer <mitch@gimp.org> Applied modified patch from Alexia Death which adds velocity support to paint tools in the spirit of the pressure support we already have. Fixes bug #529431. * app/display/gimpdisplayshell-coords.c (gimp_display_shell_eval_event): tweak velocity calculation to work in screen coordinates. * app/paint/gimppaintoptions.[ch]: add velocity options in the same way as there are pressure options. Add utility functions which return dynamic opatity and dynamic rate according to the the option's settings and some GimpCoords' pressure and velocity. * app/tools/gimppaintoptions-gui.c: add GUI for the velocity options. * app/paint/gimpbrushcore.h: remove PRESSURE_SCALE define, it's now in gimppaintoptions.h. * app/paint/gimpbrushcore.c (gimp_brush_core_interpolate): inerpolate velocity too. (gimp_brush_core_calc_brush_scale): take velocity into account. (gimp_brush_core_get_brush_mask): always pressurize the mask in the GIMP_BRUSH_PRESSURE because there always is velocity (unlike pressure which is only there on tablets). * app/paint/gimpairbrush.c * app/paint/gimpclone.c * app/paint/gimpconvolve.c * app/paint/gimpdodgeburn.c * app/paint/gimperaser.c * app/paint/gimpheal.c * app/paint/gimppaintbrush.c * app/paint/gimpsmudge.c: get opacity and rate from the new paint options utility functions which take both pressure and velocity into account. * app/paint/gimppaintbrush.c: take velocity into account when calculating the gradient color offset. * app/paint/gimpairbrush.c: do some additional fiddling with velocity in the asynchronous airbrush timeout. * app/paint/gimpairbrushoptions.c: override the velocity-size property and have it default to FALSE. svn path=/trunk/; revision=25604
2008-05-10 18:03:21 +08:00
opacity *= gimp_paint_options_get_dynamic_opacity (paint_options,
&paint_core->cur_coords);
2008-05-23 00:38:57 +08:00
hardness = gimp_paint_options_get_dynamic_hardness (paint_options,
&paint_core->cur_coords);
2008-05-23 00:38:57 +08:00
/* finally, let the brush core paste the colored area on the canvas */
gimp_brush_core_paste_canvas (brush_core, drawable,
MIN (opacity, GIMP_OPACITY_OPAQUE),
gimp_context_get_opacity (context),
gimp_context_get_paint_mode (context),
gimp_paint_options_get_brush_mode (paint_options),
2008-05-23 00:38:57 +08:00
hardness,
paint_appl_mode);
1997-11-25 06:05:25 +08:00
}