gimp/app/paint_core.h
Owen Taylor f6a5a9383c app/Makefile.am app/app_procs.c app/brushes.c app/commands.[ch]
Fri Jun  5 22:37:40 1998  Owen Taylor  <otaylor@gtk.org>

	* app/Makefile.am app/app_procs.c app/brushes.c app/commands.[ch]
	  app/disp_callbacks.c app/gdisplay.[ch] app/gimprc.c
	  app/interface.[ch] app/menus.c app/paint_core.[ch]
	  app/paintbrush.c app/palette.c app/scroll.c
	  app/tools.[ch] app/undo.c

	- Added two new dialogs - input devices; (GtkInputDialog)
	  and DeviceStatus - which shows the tool/color for
	  each device.

	- Added device_status_update() call that gets called
	  whenever the tool/color etc. are changed.

	- Added ~/.gimp/devicerc file to store settings

	- Code to draw cursor on canvas for non XFree86 XInput
	  where device can't control cursor and extended input
	  device simultaneously.

	- Changed input handling so that we always use the pointer
	  position from the device, not from gdk_input_window_get_cursor,
	  so that motion and cursor position sync.

	- Various changes so things work with non-integer coordinates

	- Pay attention to pressure and tilt in basic tool support.

        - New paint mode PRESSURE that changes the brush based on
	  the brush pressure

	- Left in a few XInput hacks that should be removed, but I no longer
	  remember what they are.
1998-06-06 03:49:01 +00:00

116 lines
4.6 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__
#include "draw_core.h"
#include "temp_buf.h"
/* the different states that the painting function can be called with */
#define INIT_PAINT 0
#define MOTION_PAINT 1
#define PAUSE_PAINT 2
#define RESUME_PAINT 3
#define FINISH_PAINT 4
/* brush application types */
#define HARD 0 /* pencil */
#define SOFT 1 /* paintbrush */
#define PRESSURE 2 /* paintbrush with variable pressure */
/* paint application modes */
#define CONSTANT 0 /* pencil, paintbrush, airbrush, clone */
#define INCREMENTAL 1 /* convolve, smudge */
typedef struct _paint_core PaintCore;
typedef void * (* PaintFunc) (PaintCore *, GimpDrawable *, int);
struct _paint_core
{
DrawCore * core; /* Core select object */
double startx; /* starting x coord */
double starty; /* starting y coord */
double startpressure; /* starting pressure */
double startxtilt; /* starting xtilt */
double startytilt; /* starting ytilt */
double curx; /* current x coord */
double cury; /* current y coord */
double curpressure; /* current pressure */
double curxtilt; /* current xtilt */
double curytilt; /* current ytilt */
double lastx; /* last x coord */
double lasty; /* last y coord */
double lastpressure; /* last pressure */
double lastxtilt; /* last xtilt */
double lastytilt; /* last ytilt */
int state; /* state of buttons and keys */
double distance; /* distance traveled by brush */
double spacing; /* distance traveled by brush */
int x1, y1; /* image space coordinate */
int x2, y2; /* image space coords */
MaskBuf * brush_mask; /* mask for current brush */
PaintFunc paint_func; /* painting function */
};
extern PaintCore non_gui_paint_core;
/* Special undo type */
typedef struct _paint_undo PaintUndo;
struct _paint_undo
{
int tool_ID;
double lastx;
double lasty;
double lastpressure;
double lastxtilt;
double lastytilt;
};
/* paint tool action functions */
void paint_core_button_press (Tool *, GdkEventButton *, gpointer);
void paint_core_button_release (Tool *, GdkEventButton *, gpointer);
void paint_core_motion (Tool *, GdkEventMotion *, gpointer);
void paint_core_cursor_update (Tool *, GdkEventMotion *, gpointer);
void paint_core_control (Tool *, int, gpointer);
/* paint tool functions */
void paint_core_no_draw (Tool *);
Tool * paint_core_new (int);
void paint_core_free (Tool *);
int paint_core_init (PaintCore *, GimpDrawable *, double, double);
void paint_core_interpolate (PaintCore *, GimpDrawable *);
void paint_core_finish (PaintCore *, GimpDrawable *, int);
void paint_core_cleanup (void);
/* paint tool painting functions */
TempBuf * paint_core_get_paint_area (PaintCore *, GimpDrawable *);
TempBuf * paint_core_get_orig_image (PaintCore *, GimpDrawable *, int, int, int, int);
void paint_core_paste_canvas (PaintCore *, GimpDrawable *, int, int, int, int, int);
void paint_core_replace_canvas (PaintCore *, GimpDrawable *, int, int, int, int);
#endif /* __PAINT_CORE_H__ */