gimp/app/tools/paint_core.h
Michael Natterer 17335326d5 updated.
2001-02-24  Michael Natterer  <mitch@gimp.org>

	* TODO.xml: updated.

	* app/appenums.h
	* app/apptypes.h: prefixed the cursor stuff with "Gimp", added
	the new stock tool cursor enum. Removed the old ToolType enum.

	* app/cursorutil.[ch]
	* app/gdisplay.[ch]: removed the old ToolType enum and prefixed
	the functions with "gimp_". Also stripped all "toggle cursor"
	stuff from the cursor code, so the new API is easier and not
	depending on the tool system.

	All existing tool cursors can be used via the new stock tool
	cursor enum, so no tool has to fiddle around with bitmap cursors.
	There will be an cursorutil function for registering stock tool
	cursor types on the fly.

	* app/disp_callbacks.c
	* app/scroll.[ch]: moved the display scrollbar callbacks from
	scroll.[ch] to disp_callbacks.c. Removed some crap from scroll.h

	* app/tools/tool.[ch]: removed the BitmapCursor pointers from the
	tool class struct and add cursor and toggle cursor IDs to the
	GimpTool struct. Work in progress.

	* app/dialog_handler.c
	* app/tools/bezier_select.c
	* app/tools/blend.c
	* app/tools/bucket_fill.c
	* app/tools/by_color_select.c
	* app/tools/clone.c
	* app/tools/color_picker.c
	* app/tools/convolve.c
	* app/tools/crop.c
	* app/tools/dodgeburn.c
	* app/tools/edit_selection.c
	* app/tools/ellipse_select.c
	* app/tools/flip_tool.c
	* app/tools/free_select.c
	* app/tools/fuzzy_select.c
	* app/tools/ink.c
	* app/tools/iscissors.c
	* app/tools/magnify.c
	* app/tools/measure.c
	* app/tools/move.c
	* app/tools/paint_core.[ch]
	* app/tools/perspective_tool.c
	* app/tools/rect_select.c
	* app/tools/rotate_tool.c
	* app/tools/scale_tool.c
	* app/tools/shear_tool.c
	* app/tools/text_tool.c
	* app/tools/transform_core.[ch]: changed accordingly. Did this
	"blind" for most tools because they don't compile. The changes are
	minimal, so there should be no conflicts.
2001-02-24 19:29:47 +00:00

199 lines
7.8 KiB
C

/* 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.
*/
#ifndef __PAINT_CORE_H__
#define __PAINT_CORE_H__
/* 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;
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;
typedef gpointer (* PaintFunc) (PaintCore *paint_core,
GimpDrawable *drawable,
PaintState paint_state);
struct _PaintCore
{
DrawCore * core; /* Core select object */
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 */
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 */
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 */
gint state; /* state of buttons and keys */
gdouble distance; /* distance traveled by brush */
gdouble pixel_dist; /* distance in pixels */
gdouble spacing; /* spacing */
gint x1, y1; /* image space coordinate */
gint x2, y2; /* image space coords */
GimpBrush * brush; /* current brush */
PaintFunc paint_func; /* painting function */
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 */
};
extern PaintCore non_gui_paint_core;
/* Special undo type */
typedef struct _PaintUndo PaintUndo;
struct _PaintUndo
{
gint tool_ID;
gdouble lastx;
gdouble lasty;
gdouble lastpressure;
gdouble lastxtilt;
gdouble lastytilt;
#ifdef GTK_HAVE_SIX_VALUATORS
gdouble lastwheel;
#endif /* GTK_HAVE_SIX_VALUATORS */
};
/* paint tool action functions */
void paint_core_button_press (Tool *tool,
GdkEventButton *bevent,
GDisplay *gdisp);
void paint_core_button_release (Tool *tool,
GdkEventButton *bevent,
GDisplay *gdisp);
void paint_core_motion (Tool *tool,
GdkEventMotion *mevent,
GDisplay *gdisp);
void paint_core_cursor_update (Tool *tool,
GdkEventMotion *mevent,
GDisplay *gdisp);
void paint_core_control (Tool *tool,
ToolAction action,
GDisplay *gdisp);
/* paint tool functions */
void paint_core_no_draw (Tool *tool);
/* ToolType doesn't exist an more
Tool * paint_core_new (ToolType type);
*/
void paint_core_free (Tool *tool);
int paint_core_init (PaintCore *paint_core,
GimpDrawable *drawable,
gdouble x,
gdouble y);
void paint_core_interpolate (PaintCore *paint_core,
GimpDrawable *drawable);
void paint_core_finish (PaintCore *paint_core,
GimpDrawable *drawable,
gint tool_ID);
void paint_core_cleanup (void);
void paint_core_get_color_from_gradient (PaintCore *paint_core,
gdouble gradient_length,
GimpRGB *color,
GradientPaintMode mode);
/* paint tool painting functions */
TempBuf * paint_core_get_paint_area (PaintCore *paint_core,
GimpDrawable *drawable,
gdouble scale);
TempBuf * paint_core_get_orig_image (PaintCore *paint_core,
GimpDrawable *drawable,
gint x1,
gint y1,
gint x2,
gint y2);
void paint_core_paste_canvas (PaintCore *paint_core,
GimpDrawable *drawable,
gint brush_opacity,
gint image_opacity,
LayerModeEffects paint_mode,
BrushApplicationMode brush_hardness,
gdouble brush_scale,
PaintApplicationMode mode);
void paint_core_replace_canvas (PaintCore *paint_core,
GimpDrawable *drawable,
gint brush_opacity,
gint image_opacity,
BrushApplicationMode brush_hardness,
gdouble brush_scale,
PaintApplicationMode mode);
void paint_core_color_area_with_pixmap (PaintCore *paint_core,
GimpImage *dest,
GimpDrawable *drawable,
TempBuf *area,
gdouble scale,
BrushApplicationMode mode);
#endif /* __PAINT_CORE_H__ */