1
/* The GIMP -- an image manipulation program
2
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 2 of the License, or
7
* (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
#ifndef __GIMP_PAINT_CORE_H__
20
#define __GIMP_PAINT_CORE_H__
23
#include "core/gimpobject.h"
26
#define GIMP_TYPE_PAINT_CORE (gimp_paint_core_get_type ())
27
#define GIMP_PAINT_CORE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_PAINT_CORE, GimpPaintCore))
28
#define GIMP_PAINT_CORE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_PAINT_CORE, GimpPaintCoreClass))
29
#define GIMP_IS_PAINT_CORE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_PAINT_CORE))
30
#define GIMP_IS_PAINT_CORE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_PAINT_CORE))
31
#define GIMP_PAINT_CORE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_PAINT_CORE, GimpPaintCoreClass))
34
typedef struct _GimpPaintCoreClass GimpPaintCoreClass;
38
GimpObject parent_instance;
40
gint ID; /* unique instance ID */
42
GimpCoords start_coords; /* starting coords (for undo only) */
44
GimpCoords cur_coords; /* current coords */
45
GimpCoords last_coords; /* last coords */
47
GimpVector2 last_paint; /* last point that was painted */
49
gdouble distance; /* distance traveled by brush */
50
gdouble pixel_dist; /* distance in pixels */
52
gint x1, y1; /* undo extents in image coords */
53
gint x2, y2; /* undo extents in image coords */
55
gboolean use_pressure; /* look at coords->pressure */
57
TileManager *undo_tiles; /* tiles which have been modified */
58
TileManager *canvas_tiles; /* the buffer to paint the mask to */
60
TempBuf *orig_buf; /* the unmodified drawable pixels */
61
TempBuf *canvas_buf; /* the buffer to paint pixels to */
65
struct _GimpPaintCoreClass
67
GimpObjectClass parent_class;
69
/* virtual functions */
70
gboolean (* start) (GimpPaintCore *core,
71
GimpDrawable *drawable,
72
GimpPaintOptions *paint_options,
75
gboolean (* pre_paint) (GimpPaintCore *core,
76
GimpDrawable *drawable,
77
GimpPaintOptions *paint_options,
78
GimpPaintState paint_state,
80
void (* paint) (GimpPaintCore *core,
81
GimpDrawable *drawable,
82
GimpPaintOptions *paint_options,
83
GimpPaintState paint_state,
85
void (* post_paint) (GimpPaintCore *core,
86
GimpDrawable *drawable,
87
GimpPaintOptions *paint_options,
88
GimpPaintState paint_state,
91
void (* interpolate) (GimpPaintCore *core,
92
GimpDrawable *drawable,
93
GimpPaintOptions *paint_options,
96
TempBuf * (* get_paint_area) (GimpPaintCore *core,
97
GimpDrawable *drawable,
98
GimpPaintOptions *paint_options);
100
gboolean (* push_undo) (GimpPaintCore *core,
102
const gchar *undo_desc);
106
GType gimp_paint_core_get_type (void) G_GNUC_CONST;
108
void gimp_paint_core_paint (GimpPaintCore *core,
109
GimpDrawable *drawable,
110
GimpPaintOptions *paint_options,
111
GimpPaintState state,
114
gboolean gimp_paint_core_start (GimpPaintCore *core,
115
GimpDrawable *drawable,
116
GimpPaintOptions *paint_options,
118
void gimp_paint_core_finish (GimpPaintCore *core,
119
GimpDrawable *drawable);
120
void gimp_paint_core_cancel (GimpPaintCore *core,
121
GimpDrawable *drawable);
122
void gimp_paint_core_cleanup (GimpPaintCore *core);
124
void gimp_paint_core_interpolate (GimpPaintCore *core,
125
GimpDrawable *drawable,
126
GimpPaintOptions *paint_options,
130
/* protected functions */
132
TempBuf * gimp_paint_core_get_paint_area (GimpPaintCore *core,
133
GimpDrawable *drawable,
134
GimpPaintOptions *options);
135
TempBuf * gimp_paint_core_get_orig_image (GimpPaintCore *core,
136
GimpDrawable *drawable,
142
void gimp_paint_core_paste (GimpPaintCore *core,
143
PixelRegion *paint_maskPR,
144
GimpDrawable *drawable,
145
gdouble paint_opacity,
146
gdouble image_opacity,
147
GimpLayerModeEffects paint_mode,
148
GimpPaintApplicationMode mode);
149
void gimp_paint_core_replace (GimpPaintCore *core,
150
PixelRegion *paint_maskPR,
151
GimpDrawable *drawable,
152
gdouble paint_opacity,
153
gdouble image_opacity,
154
GimpPaintApplicationMode mode);
156
void gimp_paint_core_validate_undo_tiles (GimpPaintCore *core,
157
GimpDrawable *drawable,
162
void gimp_paint_core_validate_canvas_tiles (GimpPaintCore *core,
169
#endif /* __GIMP_PAINT_CORE_H__ */