gimp/app/paint/gimppaintcore.h

211 lines
11 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
1997-11-25 06:05:25 +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
1997-11-25 06:05:25 +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/>.
1997-11-25 06:05:25 +08:00
*/
app/Makefile.am app/channel_pvt.h app/drawable_pvt.h app/gdisplayF.h 2000-12-29 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/channel_pvt.h * app/drawable_pvt.h * app/gdisplayF.h * app/gimpdrawableP.h * app/gimpimageP.h * app/layer_pvt.h * app/toolsF.h: removed these files. * app/apptypes.h * tools/pdbgen/enums.pl: added tons of opaque typedefs and enums. * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/channel.pdb * tools/pdbgen/pdb/color.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/display.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/fileops.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/help.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/tools.pdb * app/*: chainsaw #include cleanup: - Never (never!!) include stuff in header files except where we need access to structures' contents (like derived objects). - Added prototypes and proper formating in many files. - The #include order in *all* *.c files is as follows: #include "config.h" #include <system stuff> #include <gtk/gtk.h> #include "apptypes.h" #include "gimp stuff" #include "libgimp stuff" #include "libgimp/gimpintl.h" By following this scheme we can easily see a file's dependencies from it's #include's and can grep for the inclusion to find out where a file is used. * tools/pdbgen/app.pl: changed to follow the include scheme above. * libgimp/Makefile.am * libgimp/gimpuitypes.h: new file, included from libgimp/gimpui.h and from app/apptypes.h. * libgimp/gimpcolorbutton.[ch] * libgimp/gimpdialog.[ch] * libgimp/gimphelpui.[ch] * libgimp/gimpparasite.[ch] * libgimp/gimppatheditor.[ch] * libgimp/gimpprotocol.c * libgimp/gimpquerybox.[ch] * libgimp/gimpsizeentry.[ch] * libgimp/gimptypes.h * libgimp/gimpui.h * libgimp/gimpunit.h * libgimp/gimpunitmenu.[ch] * libgimp/gimpwidgets.[ch]: changed accordingly. * plug-ins/FractalExplorer/Dialogs.c * plug-ins/gdyntext/message_window.c * plug-ins/imagemap/imap_default_dialog.c * plug-ins/imagemap/imap_file.c: these files used to include "libgimp/gimpui.h" without including "libgimp/gimp.h". This is no longer possible because the libgimpui headers don't inlcude "libgimp/gimpunit.h" any more.
2000-12-29 23:22:01 +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
#ifndef __GIMP_PAINT_CORE_H__
#define __GIMP_PAINT_CORE_H__
1997-11-25 06:05:25 +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 "core/gimpobject.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
#define GIMP_TYPE_PAINT_CORE (gimp_paint_core_get_type ())
#define GIMP_PAINT_CORE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_PAINT_CORE, GimpPaintCore))
#define GIMP_PAINT_CORE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_PAINT_CORE, GimpPaintCoreClass))
#define GIMP_IS_PAINT_CORE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_PAINT_CORE))
#define GIMP_IS_PAINT_CORE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_PAINT_CORE))
#define GIMP_PAINT_CORE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_PAINT_CORE, GimpPaintCoreClass))
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
typedef struct _GimpPaintCoreClass GimpPaintCoreClass;
app/Makefile.am app/channel_pvt.h app/drawable_pvt.h app/gdisplayF.h 2000-12-29 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/channel_pvt.h * app/drawable_pvt.h * app/gdisplayF.h * app/gimpdrawableP.h * app/gimpimageP.h * app/layer_pvt.h * app/toolsF.h: removed these files. * app/apptypes.h * tools/pdbgen/enums.pl: added tons of opaque typedefs and enums. * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/channel.pdb * tools/pdbgen/pdb/color.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/display.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/fileops.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/help.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/tools.pdb * app/*: chainsaw #include cleanup: - Never (never!!) include stuff in header files except where we need access to structures' contents (like derived objects). - Added prototypes and proper formating in many files. - The #include order in *all* *.c files is as follows: #include "config.h" #include <system stuff> #include <gtk/gtk.h> #include "apptypes.h" #include "gimp stuff" #include "libgimp stuff" #include "libgimp/gimpintl.h" By following this scheme we can easily see a file's dependencies from it's #include's and can grep for the inclusion to find out where a file is used. * tools/pdbgen/app.pl: changed to follow the include scheme above. * libgimp/Makefile.am * libgimp/gimpuitypes.h: new file, included from libgimp/gimpui.h and from app/apptypes.h. * libgimp/gimpcolorbutton.[ch] * libgimp/gimpdialog.[ch] * libgimp/gimphelpui.[ch] * libgimp/gimpparasite.[ch] * libgimp/gimppatheditor.[ch] * libgimp/gimpprotocol.c * libgimp/gimpquerybox.[ch] * libgimp/gimpsizeentry.[ch] * libgimp/gimptypes.h * libgimp/gimpui.h * libgimp/gimpunit.h * libgimp/gimpunitmenu.[ch] * libgimp/gimpwidgets.[ch]: changed accordingly. * plug-ins/FractalExplorer/Dialogs.c * plug-ins/gdyntext/message_window.c * plug-ins/imagemap/imap_default_dialog.c * plug-ins/imagemap/imap_file.c: these files used to include "libgimp/gimpui.h" without including "libgimp/gimp.h". This is no longer possible because the libgimpui headers don't inlcude "libgimp/gimpunit.h" any more.
2000-12-29 23:22:01 +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
struct _GimpPaintCore
1997-11-25 06:05:25 +08:00
{
GimpObject parent_instance;
1997-11-25 06:05:25 +08:00
Immplement "Sample Merged" for the clone tool. Fixes bug #123627. 2005-08-28 Michael Natterer <mitch@gimp.org> Immplement "Sample Merged" for the clone tool. Fixes bug #123627. * app/paint/gimppaintcore.[ch] (struct GimpPaintCore): added members "saved_proj_tiles" which stores the unmodified projection, "orig_proj_buf" which stores the unmodified temp paint application buf and "use_saved_proj" which controls if all the additional stuff should be allocated and managed. (gimp_paint_core_start): allocate the saved_proj_tiles if needed. (gimp_paint_core_get_orig_proj): new function like gimp_paint_core_get_orig_image() which returns unmodified projection pixels for paint application. (gimp_paint_core_validate_saved_proj_tiles): new function like gimp_paint_core_validate_undo_tiles() which copies the tiles that will be dirtied to saved_proj_tiles. (gimp_paint_core_paste): call above save_proj_tiles() so projection tiles are saved before dirtying them. * app/paint/gimpclone.[ch]: replaced member src_drawable by src_pickable and use the image's projection if sample_merged it TRUE. Adjust src offsets accordingly and use GimpPaintCore's new get_orig_proj() API to get the src pixels. * app/paint/gimpcloneoptions.[ch]: added boolean "sample_merged" property. * app/tools/gimpclonetool.c: follow GimpClone's src_drawable -> src_pickable change. (gimp_clone_tool_button_press): set the paint_core's "use_saved_proj" boolean before chaining up. (gimp_clone_options_gui): add a "Sample Merged" toggle button.
2005-08-29 03:17:44 +08:00
gint ID; /* unique instance ID */
gchar *undo_desc; /* undo description */
1997-11-25 06:05:25 +08:00
Immplement "Sample Merged" for the clone tool. Fixes bug #123627. 2005-08-28 Michael Natterer <mitch@gimp.org> Immplement "Sample Merged" for the clone tool. Fixes bug #123627. * app/paint/gimppaintcore.[ch] (struct GimpPaintCore): added members "saved_proj_tiles" which stores the unmodified projection, "orig_proj_buf" which stores the unmodified temp paint application buf and "use_saved_proj" which controls if all the additional stuff should be allocated and managed. (gimp_paint_core_start): allocate the saved_proj_tiles if needed. (gimp_paint_core_get_orig_proj): new function like gimp_paint_core_get_orig_image() which returns unmodified projection pixels for paint application. (gimp_paint_core_validate_saved_proj_tiles): new function like gimp_paint_core_validate_undo_tiles() which copies the tiles that will be dirtied to saved_proj_tiles. (gimp_paint_core_paste): call above save_proj_tiles() so projection tiles are saved before dirtying them. * app/paint/gimpclone.[ch]: replaced member src_drawable by src_pickable and use the image's projection if sample_merged it TRUE. Adjust src offsets accordingly and use GimpPaintCore's new get_orig_proj() API to get the src pixels. * app/paint/gimpcloneoptions.[ch]: added boolean "sample_merged" property. * app/tools/gimpclonetool.c: follow GimpClone's src_drawable -> src_pickable change. (gimp_clone_tool_button_press): set the paint_core's "use_saved_proj" boolean before chaining up. (gimp_clone_options_gui): add a "Sample Merged" toggle button.
2005-08-29 03:17:44 +08:00
GimpCoords start_coords; /* starting coords (for undo only) */
1997-11-25 06:05:25 +08:00
Immplement "Sample Merged" for the clone tool. Fixes bug #123627. 2005-08-28 Michael Natterer <mitch@gimp.org> Immplement "Sample Merged" for the clone tool. Fixes bug #123627. * app/paint/gimppaintcore.[ch] (struct GimpPaintCore): added members "saved_proj_tiles" which stores the unmodified projection, "orig_proj_buf" which stores the unmodified temp paint application buf and "use_saved_proj" which controls if all the additional stuff should be allocated and managed. (gimp_paint_core_start): allocate the saved_proj_tiles if needed. (gimp_paint_core_get_orig_proj): new function like gimp_paint_core_get_orig_image() which returns unmodified projection pixels for paint application. (gimp_paint_core_validate_saved_proj_tiles): new function like gimp_paint_core_validate_undo_tiles() which copies the tiles that will be dirtied to saved_proj_tiles. (gimp_paint_core_paste): call above save_proj_tiles() so projection tiles are saved before dirtying them. * app/paint/gimpclone.[ch]: replaced member src_drawable by src_pickable and use the image's projection if sample_merged it TRUE. Adjust src offsets accordingly and use GimpPaintCore's new get_orig_proj() API to get the src pixels. * app/paint/gimpcloneoptions.[ch]: added boolean "sample_merged" property. * app/tools/gimpclonetool.c: follow GimpClone's src_drawable -> src_pickable change. (gimp_clone_tool_button_press): set the paint_core's "use_saved_proj" boolean before chaining up. (gimp_clone_options_gui): add a "Sample Merged" toggle button.
2005-08-29 03:17:44 +08:00
GimpCoords cur_coords; /* current coords */
GimpCoords last_coords; /* last coords */
1997-11-25 06:05:25 +08:00
Immplement "Sample Merged" for the clone tool. Fixes bug #123627. 2005-08-28 Michael Natterer <mitch@gimp.org> Immplement "Sample Merged" for the clone tool. Fixes bug #123627. * app/paint/gimppaintcore.[ch] (struct GimpPaintCore): added members "saved_proj_tiles" which stores the unmodified projection, "orig_proj_buf" which stores the unmodified temp paint application buf and "use_saved_proj" which controls if all the additional stuff should be allocated and managed. (gimp_paint_core_start): allocate the saved_proj_tiles if needed. (gimp_paint_core_get_orig_proj): new function like gimp_paint_core_get_orig_image() which returns unmodified projection pixels for paint application. (gimp_paint_core_validate_saved_proj_tiles): new function like gimp_paint_core_validate_undo_tiles() which copies the tiles that will be dirtied to saved_proj_tiles. (gimp_paint_core_paste): call above save_proj_tiles() so projection tiles are saved before dirtying them. * app/paint/gimpclone.[ch]: replaced member src_drawable by src_pickable and use the image's projection if sample_merged it TRUE. Adjust src offsets accordingly and use GimpPaintCore's new get_orig_proj() API to get the src pixels. * app/paint/gimpcloneoptions.[ch]: added boolean "sample_merged" property. * app/tools/gimpclonetool.c: follow GimpClone's src_drawable -> src_pickable change. (gimp_clone_tool_button_press): set the paint_core's "use_saved_proj" boolean before chaining up. (gimp_clone_options_gui): add a "Sample Merged" toggle button.
2005-08-29 03:17:44 +08:00
GimpVector2 last_paint; /* last point that was painted */
Immplement "Sample Merged" for the clone tool. Fixes bug #123627. 2005-08-28 Michael Natterer <mitch@gimp.org> Immplement "Sample Merged" for the clone tool. Fixes bug #123627. * app/paint/gimppaintcore.[ch] (struct GimpPaintCore): added members "saved_proj_tiles" which stores the unmodified projection, "orig_proj_buf" which stores the unmodified temp paint application buf and "use_saved_proj" which controls if all the additional stuff should be allocated and managed. (gimp_paint_core_start): allocate the saved_proj_tiles if needed. (gimp_paint_core_get_orig_proj): new function like gimp_paint_core_get_orig_image() which returns unmodified projection pixels for paint application. (gimp_paint_core_validate_saved_proj_tiles): new function like gimp_paint_core_validate_undo_tiles() which copies the tiles that will be dirtied to saved_proj_tiles. (gimp_paint_core_paste): call above save_proj_tiles() so projection tiles are saved before dirtying them. * app/paint/gimpclone.[ch]: replaced member src_drawable by src_pickable and use the image's projection if sample_merged it TRUE. Adjust src offsets accordingly and use GimpPaintCore's new get_orig_proj() API to get the src pixels. * app/paint/gimpcloneoptions.[ch]: added boolean "sample_merged" property. * app/tools/gimpclonetool.c: follow GimpClone's src_drawable -> src_pickable change. (gimp_clone_tool_button_press): set the paint_core's "use_saved_proj" boolean before chaining up. (gimp_clone_options_gui): add a "Sample Merged" toggle button.
2005-08-29 03:17:44 +08:00
gdouble distance; /* distance traveled by brush */
gdouble pixel_dist; /* distance in pixels */
Immplement "Sample Merged" for the clone tool. Fixes bug #123627. 2005-08-28 Michael Natterer <mitch@gimp.org> Immplement "Sample Merged" for the clone tool. Fixes bug #123627. * app/paint/gimppaintcore.[ch] (struct GimpPaintCore): added members "saved_proj_tiles" which stores the unmodified projection, "orig_proj_buf" which stores the unmodified temp paint application buf and "use_saved_proj" which controls if all the additional stuff should be allocated and managed. (gimp_paint_core_start): allocate the saved_proj_tiles if needed. (gimp_paint_core_get_orig_proj): new function like gimp_paint_core_get_orig_image() which returns unmodified projection pixels for paint application. (gimp_paint_core_validate_saved_proj_tiles): new function like gimp_paint_core_validate_undo_tiles() which copies the tiles that will be dirtied to saved_proj_tiles. (gimp_paint_core_paste): call above save_proj_tiles() so projection tiles are saved before dirtying them. * app/paint/gimpclone.[ch]: replaced member src_drawable by src_pickable and use the image's projection if sample_merged it TRUE. Adjust src offsets accordingly and use GimpPaintCore's new get_orig_proj() API to get the src pixels. * app/paint/gimpcloneoptions.[ch]: added boolean "sample_merged" property. * app/tools/gimpclonetool.c: follow GimpClone's src_drawable -> src_pickable change. (gimp_clone_tool_button_press): set the paint_core's "use_saved_proj" boolean before chaining up. (gimp_clone_options_gui): add a "Sample Merged" toggle button.
2005-08-29 03:17:44 +08:00
gint x1, y1; /* undo extents in image coords */
gint x2, y2; /* undo extents in image coords */
1997-11-25 06:05:25 +08:00
Immplement "Sample Merged" for the clone tool. Fixes bug #123627. 2005-08-28 Michael Natterer <mitch@gimp.org> Immplement "Sample Merged" for the clone tool. Fixes bug #123627. * app/paint/gimppaintcore.[ch] (struct GimpPaintCore): added members "saved_proj_tiles" which stores the unmodified projection, "orig_proj_buf" which stores the unmodified temp paint application buf and "use_saved_proj" which controls if all the additional stuff should be allocated and managed. (gimp_paint_core_start): allocate the saved_proj_tiles if needed. (gimp_paint_core_get_orig_proj): new function like gimp_paint_core_get_orig_image() which returns unmodified projection pixels for paint application. (gimp_paint_core_validate_saved_proj_tiles): new function like gimp_paint_core_validate_undo_tiles() which copies the tiles that will be dirtied to saved_proj_tiles. (gimp_paint_core_paste): call above save_proj_tiles() so projection tiles are saved before dirtying them. * app/paint/gimpclone.[ch]: replaced member src_drawable by src_pickable and use the image's projection if sample_merged it TRUE. Adjust src offsets accordingly and use GimpPaintCore's new get_orig_proj() API to get the src pixels. * app/paint/gimpcloneoptions.[ch]: added boolean "sample_merged" property. * app/tools/gimpclonetool.c: follow GimpClone's src_drawable -> src_pickable change. (gimp_clone_tool_button_press): set the paint_core's "use_saved_proj" boolean before chaining up. (gimp_clone_options_gui): add a "Sample Merged" toggle button.
2005-08-29 03:17:44 +08:00
gboolean use_saved_proj; /* keep the unmodified proj around */
Immplement "Sample Merged" for the clone tool. Fixes bug #123627. 2005-08-28 Michael Natterer <mitch@gimp.org> Immplement "Sample Merged" for the clone tool. Fixes bug #123627. * app/paint/gimppaintcore.[ch] (struct GimpPaintCore): added members "saved_proj_tiles" which stores the unmodified projection, "orig_proj_buf" which stores the unmodified temp paint application buf and "use_saved_proj" which controls if all the additional stuff should be allocated and managed. (gimp_paint_core_start): allocate the saved_proj_tiles if needed. (gimp_paint_core_get_orig_proj): new function like gimp_paint_core_get_orig_image() which returns unmodified projection pixels for paint application. (gimp_paint_core_validate_saved_proj_tiles): new function like gimp_paint_core_validate_undo_tiles() which copies the tiles that will be dirtied to saved_proj_tiles. (gimp_paint_core_paste): call above save_proj_tiles() so projection tiles are saved before dirtying them. * app/paint/gimpclone.[ch]: replaced member src_drawable by src_pickable and use the image's projection if sample_merged it TRUE. Adjust src offsets accordingly and use GimpPaintCore's new get_orig_proj() API to get the src pixels. * app/paint/gimpcloneoptions.[ch]: added boolean "sample_merged" property. * app/tools/gimpclonetool.c: follow GimpClone's src_drawable -> src_pickable change. (gimp_clone_tool_button_press): set the paint_core's "use_saved_proj" boolean before chaining up. (gimp_clone_options_gui): add a "Sample Merged" toggle button.
2005-08-29 03:17:44 +08:00
TileManager *undo_tiles; /* tiles which have been modified */
TileManager *saved_proj_tiles; /* proj tiles which have been modified */
TileManager *canvas_tiles; /* the buffer to paint the mask to */
Immplement "Sample Merged" for the clone tool. Fixes bug #123627. 2005-08-28 Michael Natterer <mitch@gimp.org> Immplement "Sample Merged" for the clone tool. Fixes bug #123627. * app/paint/gimppaintcore.[ch] (struct GimpPaintCore): added members "saved_proj_tiles" which stores the unmodified projection, "orig_proj_buf" which stores the unmodified temp paint application buf and "use_saved_proj" which controls if all the additional stuff should be allocated and managed. (gimp_paint_core_start): allocate the saved_proj_tiles if needed. (gimp_paint_core_get_orig_proj): new function like gimp_paint_core_get_orig_image() which returns unmodified projection pixels for paint application. (gimp_paint_core_validate_saved_proj_tiles): new function like gimp_paint_core_validate_undo_tiles() which copies the tiles that will be dirtied to saved_proj_tiles. (gimp_paint_core_paste): call above save_proj_tiles() so projection tiles are saved before dirtying them. * app/paint/gimpclone.[ch]: replaced member src_drawable by src_pickable and use the image's projection if sample_merged it TRUE. Adjust src offsets accordingly and use GimpPaintCore's new get_orig_proj() API to get the src pixels. * app/paint/gimpcloneoptions.[ch]: added boolean "sample_merged" property. * app/tools/gimpclonetool.c: follow GimpClone's src_drawable -> src_pickable change. (gimp_clone_tool_button_press): set the paint_core's "use_saved_proj" boolean before chaining up. (gimp_clone_options_gui): add a "Sample Merged" toggle button.
2005-08-29 03:17:44 +08:00
TempBuf *orig_buf; /* the unmodified drawable pixels */
TempBuf *orig_proj_buf; /* the unmodified projection pixels */
TempBuf *canvas_buf; /* the buffer to paint pixels to */
GArray *stroke_buffer;
1997-11-25 06:05:25 +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
struct _GimpPaintCoreClass
{
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
GimpObjectClass parent_class;
/* virtual functions */
gboolean (* start) (GimpPaintCore *core,
GimpDrawable *drawable,
GimpPaintOptions *paint_options,
const GimpCoords *coords,
GError **error);
gboolean (* pre_paint) (GimpPaintCore *core,
GimpDrawable *drawable,
GimpPaintOptions *paint_options,
GimpPaintState paint_state,
guint32 time);
void (* paint) (GimpPaintCore *core,
GimpDrawable *drawable,
GimpPaintOptions *paint_options,
const GimpCoords *coords,
GimpPaintState paint_state,
guint32 time);
void (* post_paint) (GimpPaintCore *core,
GimpDrawable *drawable,
GimpPaintOptions *paint_options,
GimpPaintState paint_state,
guint32 time);
void (* interpolate) (GimpPaintCore *core,
GimpDrawable *drawable,
GimpPaintOptions *paint_options,
guint32 time);
TempBuf * (* get_paint_area) (GimpPaintCore *core,
GimpDrawable *drawable,
GimpPaintOptions *paint_options,
const GimpCoords *coords);
GimpUndo * (* push_undo) (GimpPaintCore *core,
GimpImage *image,
const gchar *undo_desc);
};
1997-11-25 06:05:25 +08:00
GType gimp_paint_core_get_type (void) G_GNUC_CONST;
void gimp_paint_core_paint (GimpPaintCore *core,
GimpDrawable *drawable,
GimpPaintOptions *paint_options,
GimpPaintState state,
guint32 time);
gboolean gimp_paint_core_start (GimpPaintCore *core,
GimpDrawable *drawable,
GimpPaintOptions *paint_options,
const GimpCoords *coords,
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
GError **error);
void gimp_paint_core_finish (GimpPaintCore *core,
GimpDrawable *drawable,
gboolean push_undo);
void gimp_paint_core_cancel (GimpPaintCore *core,
GimpDrawable *drawable);
void gimp_paint_core_cleanup (GimpPaintCore *core);
void gimp_paint_core_interpolate (GimpPaintCore *core,
GimpDrawable *drawable,
GimpPaintOptions *paint_options,
const GimpCoords *coords,
guint32 time);
void gimp_paint_core_set_current_coords (GimpPaintCore *core,
const GimpCoords *coords);
void gimp_paint_core_get_current_coords (GimpPaintCore *core,
GimpCoords *coords);
void gimp_paint_core_set_last_coords (GimpPaintCore *core,
const GimpCoords *coords);
void gimp_paint_core_get_last_coords (GimpPaintCore *core,
GimpCoords *coords);
void gimp_paint_core_round_line (GimpPaintCore *core,
GimpPaintOptions *options,
gboolean constrain_15_degrees);
/* protected functions */
TempBuf * gimp_paint_core_get_paint_area (GimpPaintCore *core,
GimpDrawable *drawable,
GimpPaintOptions *options,
const GimpCoords *coords);
TempBuf * gimp_paint_core_get_orig_image (GimpPaintCore *core,
GimpDrawable *drawable,
gint x,
gint y,
gint width,
gint height);
TempBuf * gimp_paint_core_get_orig_proj (GimpPaintCore *core,
GimpPickable *pickable,
gint x,
gint y,
gint width,
gint height);
void gimp_paint_core_paste (GimpPaintCore *core,
PixelRegion *paint_maskPR,
GimpDrawable *drawable,
gdouble paint_opacity,
gdouble image_opacity,
GimpLayerModeEffects paint_mode,
GimpPaintApplicationMode mode);
void gimp_paint_core_replace (GimpPaintCore *core,
PixelRegion *paint_maskPR,
GimpDrawable *drawable,
gdouble paint_opacity,
gdouble image_opacity,
GimpPaintApplicationMode mode);
void gimp_paint_core_validate_undo_tiles (GimpPaintCore *core,
GimpDrawable *drawable,
gint x,
gint y,
gint w,
gint h);
void gimp_paint_core_validate_saved_proj_tiles (GimpPaintCore *core,
GimpPickable *pickable,
gint x,
gint y,
gint w,
gint h);
void gimp_paint_core_validate_canvas_tiles (GimpPaintCore *core,
gint x,
gint y,
gint w,
gint h);
void gimp_paint_core_smooth_coords (GimpPaintCore *core,
GimpPaintOptions *paint_options,
GimpCoords *coords);
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
#endif /* __GIMP_PAINT_CORE_H__ */