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
|
1998-04-13 13:44:11 +08:00
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
1997-11-25 06:05:25 +08:00
|
|
|
*/
|
|
|
|
#ifndef __PAINT_CORE_H__
|
|
|
|
#define __PAINT_CORE_H__
|
|
|
|
|
Actually use the enum types GimpImageType, GimpImageBaseType,
* app/*.[ch]: Actually use the enum types GimpImageType,
GimpImageBaseType, LayerModeEffects, PaintApplicationMode,
BrushApplicationMode, GimpFillType and ConvertPaletteType, instead
of just int or gint. Hopefully I catched most of the places
where these should be used.
Add an enum ConvolutionType, suffix the too general constants
NORMAL, ABSOLUTE and NEGATIVE with _CONVOL. Use NORMAL_MODE
instead of NORMAL in some places (this was what was intended). Fix
some minor gccisms.
* app/apptypes.h: New file. This file contains the above
enumeration types, and some opaque struct typedefs. It was
necessary to collect these in one header that doesn't include
other headers, because when we started using the above mentioned
types in the headers, all hell broke loose because of the
spaghetti-like cross-inclusion mess between headers.
(An example: Header A includes header B, which includes header C
which includes A. B uses a type defined in A. This is not defined,
because A hasn't defined it yet at the point where it includes B,
and A included from B of course is skipped as we already are
reading A.)
1999-08-19 07:41:39 +08:00
|
|
|
#include "apptypes.h"
|
1997-11-25 06:05:25 +08:00
|
|
|
#include "draw_core.h"
|
|
|
|
#include "temp_buf.h"
|
1998-07-24 16:56:18 +08:00
|
|
|
#include "gimpbrush.h"
|
1998-08-16 08:34:20 +08:00
|
|
|
#include "gimpdrawableF.h"
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* 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
|
|
|
|
|
1999-09-25 09:59:43 +08:00
|
|
|
typedef enum /*< skip >*/
|
1999-08-27 05:33:58 +08:00
|
|
|
{
|
|
|
|
TOOL_CAN_HANDLE_CHANGING_BRUSH = 0x0001 /* Set for tools that don't mind
|
|
|
|
* if the brush changes while
|
|
|
|
* painting.
|
|
|
|
*/
|
|
|
|
} ToolFlags;
|
1999-08-19 11:51:33 +08:00
|
|
|
|
1998-01-22 15:02:57 +08:00
|
|
|
typedef void * (* PaintFunc) (PaintCore *, GimpDrawable *, int);
|
1997-11-25 06:05:25 +08:00
|
|
|
struct _paint_core
|
|
|
|
{
|
1999-09-02 02:46:25 +08:00
|
|
|
DrawCore * core; /* Core select object */
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-09-02 02:46:25 +08:00
|
|
|
double startx; /* starting x coord */
|
|
|
|
double starty; /* starting y coord */
|
1999-09-04 22:42:43 +08:00
|
|
|
double startpressure; /* starting pressure */
|
|
|
|
double startxtilt; /* starting xtilt */
|
|
|
|
double startytilt; /* starting ytilt */
|
|
|
|
#ifdef GTK_HAVE_SIX_VALUATORS
|
|
|
|
double startwheel; /* starting wheel */
|
|
|
|
#endif /* GTK_HAVE_SIX_VALUATORS */
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-09-02 02:46:25 +08:00
|
|
|
double curx; /* current x coord */
|
|
|
|
double cury; /* current y coord */
|
|
|
|
double curpressure; /* current pressure */
|
|
|
|
double curxtilt; /* current xtilt */
|
|
|
|
double curytilt; /* current ytilt */
|
1999-09-04 22:42:43 +08:00
|
|
|
#ifdef GTK_HAVE_SIX_VALUATORS
|
|
|
|
double curwheel; /* current wheel */
|
|
|
|
#endif /* GTK_HAVE_SIX_VALUATORS */
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-09-02 02:46:25 +08:00
|
|
|
double lastx; /* last x coord */
|
|
|
|
double lasty; /* last y coord */
|
|
|
|
double lastpressure; /* last pressure */
|
|
|
|
double lastxtilt; /* last xtilt */
|
1999-09-04 22:42:43 +08:00
|
|
|
double lastytilt; /* last ytilt */
|
|
|
|
#ifdef GTK_HAVE_SIX_VALUATORS
|
|
|
|
double lastwheel; /* last wheel */
|
|
|
|
#endif /* GTK_HAVE_SIX_VALUATORS */
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-09-02 02:46:25 +08:00
|
|
|
int state; /* state of buttons and keys */
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-09-02 02:46:25 +08:00
|
|
|
double distance; /* distance traveled by brush */
|
1999-09-26 03:49:58 +08:00
|
|
|
double pixel_dist; /* distance in pixels */
|
|
|
|
double spacing; /* spacing */
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-09-02 02:46:25 +08:00
|
|
|
int x1, y1; /* image space coordinate */
|
|
|
|
int x2, y2; /* image space coords */
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-09-02 02:46:25 +08:00
|
|
|
GimpBrush * brush; /* current brush */
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-09-02 02:46:25 +08:00
|
|
|
PaintFunc paint_func; /* painting function */
|
1999-05-13 19:12:32 +08:00
|
|
|
|
1999-09-02 02:46:25 +08:00
|
|
|
int pick_colors; /* pick color if ctrl or alt is pressed */
|
|
|
|
int pick_state; /* was ctrl or alt pressed when clicked? */
|
|
|
|
int flags; /* tool flags, see ToolFlags above */
|
|
|
|
|
|
|
|
guint context_id; /* for the statusbar */
|
1997-11-25 06:05:25 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
extern PaintCore non_gui_paint_core;
|
|
|
|
|
|
|
|
/* Special undo type */
|
|
|
|
typedef struct _paint_undo PaintUndo;
|
|
|
|
|
|
|
|
struct _paint_undo
|
|
|
|
{
|
|
|
|
int tool_ID;
|
|
|
|
double lastx;
|
|
|
|
double lasty;
|
1998-06-06 11:49:01 +08:00
|
|
|
double lastpressure;
|
|
|
|
double lastxtilt;
|
|
|
|
double lastytilt;
|
1999-09-04 22:42:43 +08:00
|
|
|
#ifdef GTK_HAVE_SIX_VALUATORS
|
|
|
|
double lastwheel;
|
|
|
|
#endif /* GTK_HAVE_SIX_VALUATORS */
|
1997-11-25 06:05:25 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/* paint tool action functions */
|
1999-06-22 06:12:07 +08:00
|
|
|
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 *, ToolAction, gpointer);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* paint tool functions */
|
|
|
|
void paint_core_no_draw (Tool *);
|
1999-07-03 01:40:10 +08:00
|
|
|
Tool * paint_core_new (ToolType);
|
1997-11-25 06:05:25 +08:00
|
|
|
void paint_core_free (Tool *);
|
1998-01-22 15:02:57 +08:00
|
|
|
int paint_core_init (PaintCore *, GimpDrawable *, double, double);
|
|
|
|
void paint_core_interpolate (PaintCore *, GimpDrawable *);
|
1999-03-19 08:42:27 +08:00
|
|
|
void paint_core_get_color_from_gradient (PaintCore *, double, double*, double*, double*,double *,int);
|
1998-01-22 15:02:57 +08:00
|
|
|
void paint_core_finish (PaintCore *, GimpDrawable *, int);
|
1997-11-25 06:05:25 +08:00
|
|
|
void paint_core_cleanup (void);
|
|
|
|
|
|
|
|
/* paint tool painting functions */
|
Actually use the enum types GimpImageType, GimpImageBaseType,
* app/*.[ch]: Actually use the enum types GimpImageType,
GimpImageBaseType, LayerModeEffects, PaintApplicationMode,
BrushApplicationMode, GimpFillType and ConvertPaletteType, instead
of just int or gint. Hopefully I catched most of the places
where these should be used.
Add an enum ConvolutionType, suffix the too general constants
NORMAL, ABSOLUTE and NEGATIVE with _CONVOL. Use NORMAL_MODE
instead of NORMAL in some places (this was what was intended). Fix
some minor gccisms.
* app/apptypes.h: New file. This file contains the above
enumeration types, and some opaque struct typedefs. It was
necessary to collect these in one header that doesn't include
other headers, because when we started using the above mentioned
types in the headers, all hell broke loose because of the
spaghetti-like cross-inclusion mess between headers.
(An example: Header A includes header B, which includes header C
which includes A. B uses a type defined in A. This is not defined,
because A hasn't defined it yet at the point where it includes B,
and A included from B of course is skipped as we already are
reading A.)
1999-08-19 07:41:39 +08:00
|
|
|
TempBuf * paint_core_get_paint_area (PaintCore *,
|
1999-09-09 09:47:54 +08:00
|
|
|
GimpDrawable *,
|
|
|
|
gdouble);
|
Actually use the enum types GimpImageType, GimpImageBaseType,
* app/*.[ch]: Actually use the enum types GimpImageType,
GimpImageBaseType, LayerModeEffects, PaintApplicationMode,
BrushApplicationMode, GimpFillType and ConvertPaletteType, instead
of just int or gint. Hopefully I catched most of the places
where these should be used.
Add an enum ConvolutionType, suffix the too general constants
NORMAL, ABSOLUTE and NEGATIVE with _CONVOL. Use NORMAL_MODE
instead of NORMAL in some places (this was what was intended). Fix
some minor gccisms.
* app/apptypes.h: New file. This file contains the above
enumeration types, and some opaque struct typedefs. It was
necessary to collect these in one header that doesn't include
other headers, because when we started using the above mentioned
types in the headers, all hell broke loose because of the
spaghetti-like cross-inclusion mess between headers.
(An example: Header A includes header B, which includes header C
which includes A. B uses a type defined in A. This is not defined,
because A hasn't defined it yet at the point where it includes B,
and A included from B of course is skipped as we already are
reading A.)
1999-08-19 07:41:39 +08:00
|
|
|
TempBuf * paint_core_get_orig_image (PaintCore *,
|
|
|
|
GimpDrawable *,
|
|
|
|
int, int, int, int);
|
|
|
|
void paint_core_paste_canvas (PaintCore *,
|
|
|
|
GimpDrawable *, int, int,
|
|
|
|
LayerModeEffects,
|
|
|
|
BrushApplicationMode,
|
1999-09-09 09:47:54 +08:00
|
|
|
gdouble,
|
Actually use the enum types GimpImageType, GimpImageBaseType,
* app/*.[ch]: Actually use the enum types GimpImageType,
GimpImageBaseType, LayerModeEffects, PaintApplicationMode,
BrushApplicationMode, GimpFillType and ConvertPaletteType, instead
of just int or gint. Hopefully I catched most of the places
where these should be used.
Add an enum ConvolutionType, suffix the too general constants
NORMAL, ABSOLUTE and NEGATIVE with _CONVOL. Use NORMAL_MODE
instead of NORMAL in some places (this was what was intended). Fix
some minor gccisms.
* app/apptypes.h: New file. This file contains the above
enumeration types, and some opaque struct typedefs. It was
necessary to collect these in one header that doesn't include
other headers, because when we started using the above mentioned
types in the headers, all hell broke loose because of the
spaghetti-like cross-inclusion mess between headers.
(An example: Header A includes header B, which includes header C
which includes A. B uses a type defined in A. This is not defined,
because A hasn't defined it yet at the point where it includes B,
and A included from B of course is skipped as we already are
reading A.)
1999-08-19 07:41:39 +08:00
|
|
|
PaintApplicationMode);
|
|
|
|
void paint_core_replace_canvas (PaintCore *,
|
|
|
|
GimpDrawable *, int, int,
|
|
|
|
BrushApplicationMode,
|
1999-09-09 09:47:54 +08:00
|
|
|
gdouble,
|
Actually use the enum types GimpImageType, GimpImageBaseType,
* app/*.[ch]: Actually use the enum types GimpImageType,
GimpImageBaseType, LayerModeEffects, PaintApplicationMode,
BrushApplicationMode, GimpFillType and ConvertPaletteType, instead
of just int or gint. Hopefully I catched most of the places
where these should be used.
Add an enum ConvolutionType, suffix the too general constants
NORMAL, ABSOLUTE and NEGATIVE with _CONVOL. Use NORMAL_MODE
instead of NORMAL in some places (this was what was intended). Fix
some minor gccisms.
* app/apptypes.h: New file. This file contains the above
enumeration types, and some opaque struct typedefs. It was
necessary to collect these in one header that doesn't include
other headers, because when we started using the above mentioned
types in the headers, all hell broke loose because of the
spaghetti-like cross-inclusion mess between headers.
(An example: Header A includes header B, which includes header C
which includes A. B uses a type defined in A. This is not defined,
because A hasn't defined it yet at the point where it includes B,
and A included from B of course is skipped as we already are
reading A.)
1999-08-19 07:41:39 +08:00
|
|
|
PaintApplicationMode);
|
1999-09-10 03:11:38 +08:00
|
|
|
void paint_core_color_area_with_pixmap (PaintCore *,
|
|
|
|
GImage *, GimpDrawable *,
|
|
|
|
TempBuf *, gdouble, int);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
#endif /* __PAINT_CORE_H__ */
|