gimp/app/paint_core.h

123 lines
4.8 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
*/
#ifndef __PAINT_CORE_H__
#define __PAINT_CORE_H__
#include "apptypes.h"
1997-11-25 06:05:25 +08:00
#include "draw_core.h"
#include "temp_buf.h"
#include "gimpbrush.h"
#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
typedef void * (* PaintFunc) (PaintCore *, GimpDrawable *, int);
1997-11-25 06:05:25 +08:00
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 */
1997-11-25 06:05: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 */
1997-11-25 06:05:25 +08:00
double lastx; /* last x coord */
double lasty; /* last y coord */
double lastpressure; /* last pressure */
double lastxtilt; /* last xtilt */
double lastytilt; /* last ytilt */
1997-11-25 06:05:25 +08:00
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 */
GimpBrush * brush; /* current brush */
1997-11-25 06:05:25 +08:00
PaintFunc paint_func; /* painting function */
int pick_colors; /* pick color if ctl or alt is pressed */
int pick_state; /* was ctl or alt pressed when clicked? */
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;
double lastpressure;
double lastxtilt;
double lastytilt;
1997-11-25 06:05:25 +08:00
};
/* paint tool action functions */
namespace cleanups. 1999-06-21 Michael Natterer <mitschel@cs.tu-berlin.de> * app/context_manager.c: namespace cleanups. * app/commands.[ch] * app/menus.c: moved the "Toggle Selection" menu entry to "View", sprinkled some separators and made the layers/channels/paths popup menus consistent with Tigert's last ops buttons change. * app/fileops.c * app/plug_in.c: check for gdisplay_active() returning NULL in some more places. * app/[all tool related files]: - Turned the ToolAction and ToolState #define's into typedef'ed enums, so the compiler can do some more sanity checking. - Removed one more unused global variable "active_tool_layer". - Removed some #include's from tools.c. - Standardized the individual tools' structure names. - Moved showing/hiding the tool options to separate functions. - Stuff... * app/commands.c * app/disp_callbacks.c * app/gdisplay.c * app/tools.c: fixed the segfaults which happened when the image of one of the tools which have dialogs (levels/posterize/...) was deleted. My approach was to do stricter sanity checking and to set some gdisplay pointers correctly where appropriate, so I can't tell exactly where the bug was. The curves tool now(??) updates on every _second_ display change only, which is really obscure. Finding/changing the display to operate on should definitely be done by connecting to the user context's "display_changed" signal. * app/gimpset.c: emit the "remove" signal _after_ removing the pointer from the set. If this was not a bug but a feature, please let me know, we'll need two signals then.
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 *);
Tool * paint_core_new (ToolType);
1997-11-25 06:05:25 +08:00
void paint_core_free (Tool *);
int paint_core_init (PaintCore *, GimpDrawable *, double, double);
void paint_core_interpolate (PaintCore *, GimpDrawable *);
void paint_core_get_color_from_gradient (PaintCore *, double, double*, double*, double*,double *,int);
void paint_core_finish (PaintCore *, GimpDrawable *, int);
1997-11-25 06:05:25 +08:00
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,
LayerModeEffects,
BrushApplicationMode,
PaintApplicationMode);
void paint_core_replace_canvas (PaintCore *,
GimpDrawable *, int, int,
BrushApplicationMode,
PaintApplicationMode);
1997-11-25 06:05:25 +08:00
#endif /* __PAINT_CORE_H__ */