gimp/app/tools/gimpbrushtool.h

198 lines
7.5 KiB
C
Raw Normal View History

1997-11-25 06:05:25 +08:00
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
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
#ifndef __GIMP_PAINT_TOOL_H__
#define __GIMP_PAINT_TOOL_H__
1997-11-25 06:05:25 +08:00
#include "tools/gimpdrawtool.h"
1997-11-25 06:05:25 +08:00
/* the different states that the painting function can be called with */
typedef enum /*< skip >*/
{
INIT_PAINT, /* Setup PaintFunc internals */
MOTION_PAINT, /* PaintFunc performs motion-related rendering */
PAUSE_PAINT, /* Unused. Reserved */
RESUME_PAINT, /* Unused. Reserved */
FINISH_PAINT, /* Cleanup and/or reset PaintFunc operation */
PRETRACE_PAINT, /* PaintFunc performs window tracing activity prior to rendering */
POSTTRACE_PAINT /* PaintFunc performs window tracing activity following rendering */
} PaintState;
1997-11-25 06:05:25 +08:00
typedef enum /*< skip >*/
{
TOOL_CAN_HANDLE_CHANGING_BRUSH = 0x0001, /* Set for tools that don't mind
* if the brush changes while
* painting.
*/
TOOL_TRACES_ON_WINDOW /* Set for tools that perform temporary
* rendering directly to the window. These
* require sequencing with gdisplay_flush()
* routines. See clone.c for example.
*/
} ToolFlags;
#define GIMP_TYPE_PAINT_TOOL (gimp_paint_tool_get_type ())
#define GIMP_PAINT_TOOL(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_PAINT_TOOL, GimpPaintTool))
#define GIMP_IS_PAINT_TOOL(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_PAINT_TOOL))
#define GIMP_PAINT_TOOL_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GIMP_TYPE_PAINT_TOOL, GimpPaintToolClass))
#define GIMP_IS_PAINT_TOOL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_PAINT_TOOL))
typedef struct _GimpPaintToolClass GimpPaintToolClass;
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
struct _GimpPaintTool
1997-11-25 06:05:25 +08:00
{
GimpDrawTool parent_instance;
1997-11-25 06:05:25 +08:00
gdouble startx; /* starting x coord */
gdouble starty; /* starting y coord */
gdouble startpressure; /* starting pressure */
gdouble startxtilt; /* starting xtilt */
gdouble startytilt; /* starting ytilt */
#ifdef GTK_HAVE_SIX_VALUATORS
gdouble startwheel; /* starting wheel */
#endif /* GTK_HAVE_SIX_VALUATORS */
1997-11-25 06:05:25 +08:00
gdouble curx; /* current x coord */
gdouble cury; /* current y coord */
gdouble curpressure; /* current pressure */
gdouble curxtilt; /* current xtilt */
gdouble curytilt; /* current ytilt */
#ifdef GTK_HAVE_SIX_VALUATORS
gdouble curwheel; /* current wheel */
#endif /* GTK_HAVE_SIX_VALUATORS */
1997-11-25 06:05:25 +08:00
gdouble lastx; /* last x coord */
gdouble lasty; /* last y coord */
gdouble lastpressure; /* last pressure */
gdouble lastxtilt; /* last xtilt */
gdouble lastytilt; /* last ytilt */
#ifdef GTK_HAVE_SIX_VALUATORS
gdouble lastwheel; /* last wheel */
#endif /* GTK_HAVE_SIX_VALUATORS */
1997-11-25 06:05:25 +08:00
gint state; /* state of buttons and keys */
1997-11-25 06:05:25 +08:00
gdouble distance; /* distance traveled by brush */
gdouble pixel_dist; /* distance in pixels */
gdouble spacing; /* spacing */
1997-11-25 06:05:25 +08:00
gint x1, y1; /* image space coordinate */
gint x2, y2; /* image space coords */
1997-11-25 06:05:25 +08:00
GimpBrush * brush; /* current brush */
1997-11-25 06:05:25 +08:00
gboolean pick_colors; /* pick color if ctrl or alt is pressed */
gboolean pick_state; /* was ctrl or alt pressed when clicked? */
ToolFlags flags; /* tool flags, see ToolFlags above */
guint context_id; /* for the statusbar */
1997-11-25 06:05:25 +08:00
};
struct _GimpPaintToolClass
{
GimpDrawToolClass parent_class;
void (* paint) (GimpPaintTool *tool,
GimpDrawable *drawable,
PaintState paint_state);
};
1997-11-25 06:05:25 +08:00
/* Special undo type */
typedef struct _PaintUndo PaintUndo;
1997-11-25 06:05:25 +08:00
struct _PaintUndo
1997-11-25 06:05:25 +08:00
{
GimpPaintTool *tool;
gdouble lastx;
gdouble lasty;
gdouble lastpressure;
gdouble lastxtilt;
gdouble lastytilt;
#ifdef GTK_HAVE_SIX_VALUATORS
gdouble lastwheel;
#endif /* GTK_HAVE_SIX_VALUATORS */
1997-11-25 06:05:25 +08:00
};
GtkType gimp_paint_tool_get_type (void);
void gimp_paint_tool_paint (GimpPaintTool *tool,
GimpDrawable *drawable,
PaintState state);
void gimp_paint_tool_no_draw (GimpPaintTool *tool);
int gimp_paint_tool_start (GimpPaintTool *tool,
GimpDrawable *drawable,
gdouble x,
gdouble y);
void gimp_paint_tool_interpolate (GimpPaintTool *tool,
GimpDrawable *drawable);
void gimp_paint_tool_finish (GimpPaintTool *tool,
GimpDrawable *drawable);
void gimp_paint_tool_cleanup (void);
void gimp_paint_tool_get_color_from_gradient (GimpPaintTool *tool,
gdouble gradient_length,
GimpRGB *color,
GradientPaintMode mode);
1997-11-25 06:05:25 +08:00
/* paint tool painting functions */
TempBuf * gimp_paint_tool_get_paint_area (GimpPaintTool *tool,
GimpDrawable *drawable,
gdouble scale);
TempBuf * gimp_paint_tool_get_orig_image (GimpPaintTool *tool,
GimpDrawable *drawable,
gint x1,
gint y1,
gint x2,
gint y2);
void gimp_paint_tool_paste_canvas (GimpPaintTool *tool,
GimpDrawable *drawable,
gint brush_opacity,
gint image_opacity,
LayerModeEffects paint_mode,
BrushApplicationMode brush_hardness,
gdouble brush_scale,
PaintApplicationMode mode);
void gimp_paint_tool_replace_canvas (GimpPaintTool *tool,
GimpDrawable *drawable,
gint brush_opacity,
gint image_opacity,
BrushApplicationMode brush_hardness,
gdouble brush_scale,
PaintApplicationMode mode);
void gimp_paint_tool_color_area_with_pixmap (GimpPaintTool *tool,
GimpImage *dest,
GimpDrawable *drawable,
TempBuf *area,
gdouble scale,
BrushApplicationMode mode);
1997-11-25 06:05:25 +08:00
#endif /* __GIMP_PAINT_TOOL_H__ */