~ubuntu-branches/ubuntu/breezy/gimp/breezy

« back to all changes in this revision

Viewing changes to app/paint/gimppaintcore.h

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2005-10-04 19:04:46 UTC
  • Revision ID: james.westby@ubuntu.com-20051004190446-ukh32kwk56s4sjhu
Tags: upstream-2.2.8
ImportĀ upstreamĀ versionĀ 2.2.8

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* The GIMP -- an image manipulation program
 
2
 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
 
3
 *
 
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.
 
8
 *
 
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.
 
13
 *
 
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.
 
17
 */
 
18
 
 
19
#ifndef __GIMP_PAINT_CORE_H__
 
20
#define __GIMP_PAINT_CORE_H__
 
21
 
 
22
 
 
23
#include "core/gimpobject.h"
 
24
 
 
25
 
 
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))
 
32
 
 
33
 
 
34
typedef struct _GimpPaintCoreClass GimpPaintCoreClass;
 
35
 
 
36
struct _GimpPaintCore
 
37
{
 
38
  GimpObject   parent_instance;
 
39
 
 
40
  gint         ID;            /*  unique instance ID               */
 
41
 
 
42
  GimpCoords   start_coords;  /*  starting coords (for undo only)  */
 
43
 
 
44
  GimpCoords   cur_coords;    /*  current coords                   */
 
45
  GimpCoords   last_coords;   /*  last coords                      */
 
46
 
 
47
  GimpVector2  last_paint;    /*  last point that was painted      */
 
48
 
 
49
  gdouble      distance;      /*  distance traveled by brush       */
 
50
  gdouble      pixel_dist;    /*  distance in pixels               */
 
51
 
 
52
  gint         x1, y1;        /*  undo extents in image coords     */
 
53
  gint         x2, y2;        /*  undo extents in image coords     */
 
54
 
 
55
  gboolean     use_pressure;  /*  look at coords->pressure         */
 
56
 
 
57
  TileManager *undo_tiles;    /*  tiles which have been modified   */
 
58
  TileManager *canvas_tiles;  /*  the buffer to paint the mask to  */
 
59
 
 
60
  TempBuf     *orig_buf;      /*  the unmodified drawable pixels   */
 
61
  TempBuf     *canvas_buf;    /*  the buffer to paint pixels to    */
 
62
 
 
63
};
 
64
 
 
65
struct _GimpPaintCoreClass
 
66
{
 
67
  GimpObjectClass  parent_class;
 
68
 
 
69
  /*  virtual functions  */
 
70
  gboolean  (* start)          (GimpPaintCore    *core,
 
71
                                GimpDrawable     *drawable,
 
72
                                GimpPaintOptions *paint_options,
 
73
                                GimpCoords       *coords);
 
74
 
 
75
  gboolean  (* pre_paint)      (GimpPaintCore    *core,
 
76
                                GimpDrawable     *drawable,
 
77
                                GimpPaintOptions *paint_options,
 
78
                                GimpPaintState    paint_state,
 
79
                                guint32           time);
 
80
  void      (* paint)          (GimpPaintCore    *core,
 
81
                                GimpDrawable     *drawable,
 
82
                                GimpPaintOptions *paint_options,
 
83
                                GimpPaintState    paint_state,
 
84
                                guint32           time);
 
85
  void      (* post_paint)     (GimpPaintCore    *core,
 
86
                                GimpDrawable     *drawable,
 
87
                                GimpPaintOptions *paint_options,
 
88
                                GimpPaintState    paint_state,
 
89
                                guint32           time);
 
90
 
 
91
  void      (* interpolate)    (GimpPaintCore    *core,
 
92
                                GimpDrawable     *drawable,
 
93
                                GimpPaintOptions *paint_options,
 
94
                                guint32           time);
 
95
 
 
96
  TempBuf * (* get_paint_area) (GimpPaintCore    *core,
 
97
                                GimpDrawable     *drawable,
 
98
                                GimpPaintOptions *paint_options);
 
99
 
 
100
  gboolean  (* push_undo)      (GimpPaintCore    *core,
 
101
                                GimpImage        *gimage,
 
102
                                const gchar      *undo_desc);
 
103
};
 
104
 
 
105
 
 
106
GType     gimp_paint_core_get_type       (void) G_GNUC_CONST;
 
107
 
 
108
void      gimp_paint_core_paint          (GimpPaintCore      *core,
 
109
                                          GimpDrawable       *drawable,
 
110
                                          GimpPaintOptions   *paint_options,
 
111
                                          GimpPaintState      state,
 
112
                                          guint32             time);
 
113
 
 
114
gboolean  gimp_paint_core_start          (GimpPaintCore      *core,
 
115
                                          GimpDrawable       *drawable,
 
116
                                          GimpPaintOptions   *paint_options,
 
117
                                          GimpCoords         *coords);
 
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);
 
123
 
 
124
void      gimp_paint_core_interpolate    (GimpPaintCore      *core,
 
125
                                          GimpDrawable       *drawable,
 
126
                                          GimpPaintOptions   *paint_options,
 
127
                                          guint32             time);
 
128
 
 
129
 
 
130
/*  protected functions  */
 
131
 
 
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,
 
137
                                          gint                x1,
 
138
                                          gint                y1,
 
139
                                          gint                x2,
 
140
                                          gint                y2);
 
141
 
 
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);
 
155
 
 
156
void    gimp_paint_core_validate_undo_tiles   (GimpPaintCore *core,
 
157
                                               GimpDrawable  *drawable,
 
158
                                               gint           x,
 
159
                                               gint           y,
 
160
                                               gint           w,
 
161
                                               gint           h);
 
162
void    gimp_paint_core_validate_canvas_tiles (GimpPaintCore *core,
 
163
                                               gint           x,
 
164
                                               gint           y,
 
165
                                               gint           w,
 
166
                                               gint           h);
 
167
 
 
168
 
 
169
#endif  /*  __GIMP_PAINT_CORE_H__  */