~ubuntu-branches/ubuntu/vivid/gimp/vivid

« back to all changes in this revision

Viewing changes to app/tools/gimpbrushtool.c

  • Committer: Package Import Robot
  • Author(s): Jordi Mallach
  • Date: 2012-05-08 18:50:03 UTC
  • mto: (1.1.26) (0.5.1 experimental)
  • mto: This revision was merged to the branch mainline in revision 71.
  • Revision ID: package-import@ubuntu.com-20120508185003-tltkvbaysf8d2426
ImportĀ upstreamĀ versionĀ 2.8.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* GIMP - The GNU Image Manipulation Program
2
2
 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
3
3
 *
4
 
 * This program is free software; you can redistribute it and/or modify
 
4
 * This program is free software: you can redistribute it and/or modify
5
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
 
6
 * the Free Software Foundation; either version 3 of the License, or
7
7
 * (at your option) any later version.
8
8
 *
9
9
 * This program is distributed in the hope that it will be useful,
12
12
 * GNU General Public License for more details.
13
13
 *
14
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.
 
15
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
16
 */
18
17
 
19
18
#include "config.h"
20
19
 
 
20
#include <string.h>
 
21
 
 
22
#include <gegl.h>
21
23
#include <gtk/gtk.h>
22
24
 
23
25
#include "libgimpmath/gimpmath.h"
27
29
#include "config/gimpdisplayconfig.h"
28
30
 
29
31
#include "core/gimp.h"
 
32
#include "core/gimpbezierdesc.h"
30
33
#include "core/gimpbrush.h"
31
34
#include "core/gimpimage.h"
32
35
#include "core/gimptoolinfo.h"
34
37
#include "paint/gimpbrushcore.h"
35
38
#include "paint/gimppaintoptions.h"
36
39
 
 
40
#include "display/gimpcanvashandle.h"
 
41
#include "display/gimpcanvaspath.h"
37
42
#include "display/gimpdisplay.h"
38
43
#include "display/gimpdisplayshell.h"
39
44
 
41
46
#include "gimptoolcontrol.h"
42
47
 
43
48
 
44
 
static GObject * gimp_brush_tool_constructor (GType                type,
45
 
                                              guint                n_params,
46
 
                                              GObjectConstructParam *params);
47
 
 
48
 
static void   gimp_brush_tool_motion         (GimpTool            *tool,
49
 
                                              GimpCoords          *coords,
50
 
                                              guint32              time,
51
 
                                              GdkModifierType      state,
52
 
                                              GimpDisplay         *display);
53
 
static void   gimp_brush_tool_oper_update    (GimpTool            *tool,
54
 
                                              GimpCoords          *coords,
55
 
                                              GdkModifierType      state,
56
 
                                              gboolean             proximity,
57
 
                                              GimpDisplay         *display);
58
 
static void   gimp_brush_tool_cursor_update  (GimpTool            *tool,
59
 
                                              GimpCoords          *coords,
60
 
                                              GdkModifierType      state,
61
 
                                              GimpDisplay         *display);
62
 
 
63
 
static void   gimp_brush_tool_draw           (GimpDrawTool        *draw_tool);
64
 
 
65
 
static void   gimp_brush_tool_brush_changed  (GimpContext         *context,
66
 
                                              GimpBrush           *brush,
67
 
                                              GimpBrushTool       *brush_tool);
68
 
static void   gimp_brush_tool_brush_scaled   (GimpPaintOptions    *options,
69
 
                                              GParamSpec          *pspec,
70
 
                                              GimpBrushTool       *brush_tool);
71
 
static void   gimp_brush_tool_set_brush      (GimpBrushCore       *brush_core,
72
 
                                              GimpBrush           *brush,
73
 
                                              GimpBrushTool       *brush_tool);
74
 
static void   gimp_brush_tool_set_brush_after(GimpBrushCore       *brush_core,
75
 
                                              GimpBrush           *brush,
76
 
                                              GimpBrushTool       *brush_tool);
77
 
static void   gimp_brush_tool_notify_brush   (GimpDisplayConfig   *config,
78
 
                                              GParamSpec          *pspec,
79
 
                                              GimpBrushTool       *brush_tool);
 
49
static void   gimp_brush_tool_constructed     (GObject           *object);
 
50
 
 
51
static void   gimp_brush_tool_motion          (GimpTool          *tool,
 
52
                                               const GimpCoords  *coords,
 
53
                                               guint32            time,
 
54
                                               GdkModifierType    state,
 
55
                                               GimpDisplay       *display);
 
56
static void   gimp_brush_tool_oper_update     (GimpTool          *tool,
 
57
                                               const GimpCoords  *coords,
 
58
                                               GdkModifierType    state,
 
59
                                               gboolean           proximity,
 
60
                                               GimpDisplay       *display);
 
61
static void   gimp_brush_tool_cursor_update   (GimpTool          *tool,
 
62
                                               const GimpCoords  *coords,
 
63
                                               GdkModifierType    state,
 
64
                                               GimpDisplay       *display);
 
65
static void   gimp_brush_tool_options_notify  (GimpTool          *tool,
 
66
                                               GimpToolOptions   *options,
 
67
                                               const GParamSpec  *pspec);
 
68
 
 
69
static void   gimp_brush_tool_draw            (GimpDrawTool      *draw_tool);
 
70
 
 
71
static void   gimp_brush_tool_brush_changed   (GimpContext       *context,
 
72
                                               GimpBrush         *brush,
 
73
                                               GimpBrushTool     *brush_tool);
 
74
static void   gimp_brush_tool_set_brush       (GimpBrushCore     *brush_core,
 
75
                                               GimpBrush         *brush,
 
76
                                               GimpBrushTool     *brush_tool);
 
77
static void   gimp_brush_tool_notify_brush    (GimpDisplayConfig *config,
 
78
                                               GParamSpec        *pspec,
 
79
                                               GimpBrushTool     *brush_tool);
80
80
 
81
81
 
82
82
G_DEFINE_TYPE (GimpBrushTool, gimp_brush_tool, GIMP_TYPE_PAINT_TOOL)
91
91
  GimpToolClass     *tool_class      = GIMP_TOOL_CLASS (klass);
92
92
  GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass);
93
93
 
94
 
  object_class->constructor = gimp_brush_tool_constructor;
95
 
 
96
 
  tool_class->motion        = gimp_brush_tool_motion;
97
 
  tool_class->oper_update   = gimp_brush_tool_oper_update;
98
 
  tool_class->cursor_update = gimp_brush_tool_cursor_update;
99
 
 
100
 
  draw_tool_class->draw     = gimp_brush_tool_draw;
 
94
  object_class->constructed  = gimp_brush_tool_constructed;
 
95
 
 
96
  tool_class->motion         = gimp_brush_tool_motion;
 
97
  tool_class->oper_update    = gimp_brush_tool_oper_update;
 
98
  tool_class->cursor_update  = gimp_brush_tool_cursor_update;
 
99
  tool_class->options_notify = gimp_brush_tool_options_notify;
 
100
 
 
101
  draw_tool_class->draw      = gimp_brush_tool_draw;
101
102
}
102
103
 
103
104
static void
106
107
  GimpTool *tool = GIMP_TOOL (brush_tool);
107
108
 
108
109
  gimp_tool_control_set_action_value_2 (tool->control,
109
 
                                        "tools/tools-paint-brush-scale-set");
 
110
                                        "tools/tools-paint-brush-size-set");
110
111
  gimp_tool_control_set_action_value_3  (tool->control,
111
112
                                         "context/context-brush-aspect-set");
112
113
  gimp_tool_control_set_action_value_4  (tool->control,
120
121
  brush_tool->brush_y     = 0.0;
121
122
}
122
123
 
123
 
static GObject *
124
 
gimp_brush_tool_constructor (GType                  type,
125
 
                             guint                  n_params,
126
 
                             GObjectConstructParam *params)
 
124
static void
 
125
gimp_brush_tool_constructed (GObject *object)
127
126
{
128
 
  GObject           *object;
129
 
  GimpTool          *tool;
130
 
  GimpPaintTool     *paint_tool;
131
 
  GimpBrushTool     *brush_tool;
 
127
  GimpTool          *tool       = GIMP_TOOL (object);
 
128
  GimpPaintTool     *paint_tool = GIMP_PAINT_TOOL (object);
 
129
  GimpBrushTool     *brush_tool = GIMP_BRUSH_TOOL (object);
132
130
  GimpDisplayConfig *display_config;
133
131
 
134
 
  object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params);
135
 
 
136
 
  tool       = GIMP_TOOL (object);
137
 
  paint_tool = GIMP_PAINT_TOOL (object);
138
 
  brush_tool = GIMP_BRUSH_TOOL (object);
 
132
  if (G_OBJECT_CLASS (parent_class)->constructed)
 
133
    G_OBJECT_CLASS (parent_class)->constructed (object);
139
134
 
140
135
  g_assert (GIMP_IS_BRUSH_CORE (paint_tool->core));
141
136
 
154
149
  g_signal_connect_object (gimp_tool_get_options (tool), "brush-changed",
155
150
                           G_CALLBACK (gimp_brush_tool_brush_changed),
156
151
                           brush_tool, 0);
157
 
  g_signal_connect_object (gimp_tool_get_options (tool), "notify::brush-scale",
158
 
                           G_CALLBACK (gimp_brush_tool_brush_scaled),
 
152
 
 
153
  g_signal_connect_object (paint_tool->core, "set-brush",
 
154
                           G_CALLBACK (gimp_brush_tool_set_brush),
159
155
                           brush_tool, 0);
160
 
 
161
 
  g_signal_connect (paint_tool->core, "set-brush",
162
 
                    G_CALLBACK (gimp_brush_tool_set_brush),
163
 
                    brush_tool);
164
 
  g_signal_connect_after (paint_tool->core, "set-brush",
165
 
                          G_CALLBACK (gimp_brush_tool_set_brush_after),
166
 
                          brush_tool);
167
 
 
168
 
  return object;
169
156
}
170
157
 
171
158
static void
172
 
gimp_brush_tool_motion (GimpTool        *tool,
173
 
                        GimpCoords      *coords,
174
 
                        guint32          time,
175
 
                        GdkModifierType  state,
176
 
                        GimpDisplay     *display)
 
159
gimp_brush_tool_motion (GimpTool         *tool,
 
160
                        const GimpCoords *coords,
 
161
                        guint32           time,
 
162
                        GdkModifierType   state,
 
163
                        GimpDisplay      *display)
177
164
{
178
165
  GimpBrushTool *brush_tool = GIMP_BRUSH_TOOL (tool);
179
166
 
191
178
}
192
179
 
193
180
static void
194
 
gimp_brush_tool_oper_update (GimpTool        *tool,
195
 
                             GimpCoords      *coords,
196
 
                             GdkModifierType  state,
197
 
                             gboolean         proximity,
198
 
                             GimpDisplay     *display)
 
181
gimp_brush_tool_oper_update (GimpTool         *tool,
 
182
                             const GimpCoords *coords,
 
183
                             GdkModifierType   state,
 
184
                             gboolean          proximity,
 
185
                             GimpDisplay      *display)
199
186
{
200
187
  GimpBrushTool    *brush_tool    = GIMP_BRUSH_TOOL (tool);
201
188
  GimpPaintOptions *paint_options = GIMP_PAINT_TOOL_GET_OPTIONS (tool);
 
189
  GimpDrawable     *drawable;
202
190
 
203
191
  gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
204
192
 
205
193
  GIMP_TOOL_CLASS (parent_class)->oper_update (tool, coords, state,
206
194
                                               proximity, display);
207
195
 
 
196
  drawable = gimp_image_get_active_drawable (gimp_display_get_image (display));
 
197
 
208
198
  if (! gimp_color_tool_is_enabled (GIMP_COLOR_TOOL (tool)) &&
209
 
      gimp_image_get_active_drawable (display->image) && proximity)
 
199
      drawable && proximity)
210
200
    {
 
201
      GimpContext   *context    = GIMP_CONTEXT (paint_options);
211
202
      GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (tool);
212
203
      GimpBrushCore *brush_core = GIMP_BRUSH_CORE (paint_tool->core);
213
 
      GimpBrush     *brush;
214
204
 
215
205
      brush_tool->brush_x = coords->x;
216
206
      brush_tool->brush_y = coords->y;
217
207
 
218
 
      brush = gimp_context_get_brush (GIMP_CONTEXT (paint_options));
219
 
 
220
 
      if (brush_core->main_brush != brush)
221
 
        gimp_brush_core_set_brush (brush_core, brush);
 
208
      gimp_brush_core_set_brush (brush_core,
 
209
                                 gimp_context_get_brush (context));
 
210
 
 
211
      gimp_brush_core_set_dynamics (brush_core,
 
212
                                    gimp_context_get_dynamics (context));
 
213
 
 
214
      if (GIMP_BRUSH_CORE_GET_CLASS (brush_core)->handles_transforming_brush)
 
215
        {
 
216
          gimp_brush_core_eval_transform_dynamics (brush_core,
 
217
                                                   drawable,
 
218
                                                   paint_options,
 
219
                                                   coords);
 
220
        }
222
221
    }
223
222
 
224
223
  gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
225
224
}
226
225
 
227
226
static void
228
 
gimp_brush_tool_cursor_update (GimpTool        *tool,
229
 
                               GimpCoords      *coords,
230
 
                               GdkModifierType  state,
231
 
                               GimpDisplay     *display)
 
227
gimp_brush_tool_cursor_update (GimpTool         *tool,
 
228
                               const GimpCoords *coords,
 
229
                               GdkModifierType   state,
 
230
                               GimpDisplay      *display)
232
231
{
233
232
  GimpBrushTool *brush_tool = GIMP_BRUSH_TOOL (tool);
 
233
  GimpBrushCore *brush_core = GIMP_BRUSH_CORE (GIMP_PAINT_TOOL (brush_tool)->core);
234
234
 
235
 
  if (! brush_tool->show_cursor &&
236
 
      ! gimp_color_tool_is_enabled (GIMP_COLOR_TOOL (tool)) &&
237
 
      gimp_tool_control_get_cursor_modifier (tool->control) !=
238
 
      GIMP_CURSOR_MODIFIER_BAD)
 
235
  if (! gimp_color_tool_is_enabled (GIMP_COLOR_TOOL (tool)))
239
236
    {
240
 
      gimp_tool_set_cursor (tool, display,
241
 
                            GIMP_CURSOR_NONE,
242
 
                            GIMP_TOOL_CURSOR_NONE,
243
 
                            GIMP_CURSOR_MODIFIER_NONE);
 
237
      if (! brush_core->main_brush || ! brush_core->dynamics)
 
238
        {
 
239
          gimp_tool_set_cursor (tool, display,
 
240
                                gimp_tool_control_get_cursor (tool->control),
 
241
                                gimp_tool_control_get_tool_cursor (tool->control),
 
242
                                GIMP_CURSOR_MODIFIER_BAD);
 
243
          return;
 
244
        }
 
245
      else if (! brush_tool->show_cursor &&
 
246
               gimp_tool_control_get_cursor_modifier (tool->control) !=
 
247
               GIMP_CURSOR_MODIFIER_BAD)
 
248
        {
 
249
          gimp_tool_set_cursor (tool, display,
 
250
                                GIMP_CURSOR_NONE,
 
251
                                GIMP_TOOL_CURSOR_NONE,
 
252
                                GIMP_CURSOR_MODIFIER_NONE);
 
253
          return;
 
254
        }
244
255
    }
245
 
  else
 
256
 
 
257
  GIMP_TOOL_CLASS (parent_class)->cursor_update (tool,  coords, state, display);
 
258
}
 
259
 
 
260
static void
 
261
gimp_brush_tool_options_notify (GimpTool         *tool,
 
262
                                GimpToolOptions  *options,
 
263
                                const GParamSpec *pspec)
 
264
{
 
265
  GIMP_TOOL_CLASS (parent_class)->options_notify (tool, options, pspec);
 
266
 
 
267
  if (! strcmp (pspec->name, "brush-size")  ||
 
268
      ! strcmp (pspec->name, "brush-angle") ||
 
269
      ! strcmp (pspec->name, "brush-aspect-ratio"))
246
270
    {
247
 
      GIMP_TOOL_CLASS (parent_class)->cursor_update (tool,
248
 
                                                     coords, state, display);
 
271
      GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (tool);
 
272
      GimpBrushCore *brush_core = GIMP_BRUSH_CORE (paint_tool->core);
 
273
 
 
274
      g_signal_emit_by_name (brush_core, "set-brush",
 
275
                             brush_core->main_brush);
249
276
    }
250
277
}
251
278
 
252
279
static void
253
280
gimp_brush_tool_draw (GimpDrawTool *draw_tool)
254
281
{
255
 
  GimpBrushTool *brush_tool = GIMP_BRUSH_TOOL (draw_tool);
 
282
  GimpBrushTool  *brush_tool = GIMP_BRUSH_TOOL (draw_tool);
 
283
  GimpCanvasItem *item;
256
284
 
257
285
  GIMP_DRAW_TOOL_CLASS (parent_class)->draw (draw_tool);
258
286
 
259
287
  if (gimp_color_tool_is_enabled (GIMP_COLOR_TOOL (draw_tool)))
260
288
    return;
261
289
 
262
 
  gimp_brush_tool_draw_brush (brush_tool,
263
 
                              brush_tool->brush_x, brush_tool->brush_y,
264
 
                              ! brush_tool->show_cursor);
 
290
  item = gimp_brush_tool_create_outline (brush_tool,
 
291
                                         draw_tool->display,
 
292
                                         brush_tool->brush_x,
 
293
                                         brush_tool->brush_y,
 
294
                                         ! brush_tool->show_cursor);
 
295
 
 
296
  if (item)
 
297
    {
 
298
      gimp_draw_tool_add_item (draw_tool, item);
 
299
      g_object_unref (item);
 
300
    }
265
301
}
266
302
 
267
 
void
268
 
gimp_brush_tool_draw_brush (GimpBrushTool *brush_tool,
269
 
                            gdouble        x,
270
 
                            gdouble        y,
271
 
                            gboolean       draw_fallback)
 
303
GimpCanvasItem *
 
304
gimp_brush_tool_create_outline (GimpBrushTool *brush_tool,
 
305
                                GimpDisplay   *display,
 
306
                                gdouble        x,
 
307
                                gdouble        y,
 
308
                                gboolean       draw_fallback)
272
309
{
273
 
  GimpDrawTool     *draw_tool;
274
 
  GimpBrushCore    *brush_core;
275
 
  GimpPaintOptions *options;
 
310
  GimpBrushCore        *brush_core;
 
311
  GimpPaintOptions     *options;
 
312
  GimpDisplayShell     *shell;
 
313
  const GimpBezierDesc *boundary = NULL;
 
314
  gint                  width    = 0;
 
315
  gint                  height   = 0;
276
316
 
277
 
  g_return_if_fail (GIMP_IS_BRUSH_TOOL (brush_tool));
 
317
  g_return_val_if_fail (GIMP_IS_BRUSH_TOOL (brush_tool), NULL);
 
318
  g_return_val_if_fail (GIMP_IS_DISPLAY (display), NULL);
278
319
 
279
320
  if (! brush_tool->draw_brush)
280
 
    return;
 
321
    return NULL;
281
322
 
282
 
  draw_tool  = GIMP_DRAW_TOOL (brush_tool);
283
323
  brush_core = GIMP_BRUSH_CORE (GIMP_PAINT_TOOL (brush_tool)->core);
284
324
  options    = GIMP_PAINT_TOOL_GET_OPTIONS (brush_tool);
285
 
 
286
 
  /*  don't create the segments for the purpose of undrawing (if we
287
 
   *  don't have the segments, we can hardly have drawn them before)
288
 
   */
289
 
  if (! brush_core->brush_bound_segs && brush_core->main_brush &&
290
 
      ! gimp_draw_tool_is_drawn (draw_tool))
291
 
    {
292
 
      gimp_brush_core_create_bound_segs (brush_core, options);
293
 
    }
294
 
 
295
 
  if (brush_core->brush_bound_segs)
296
 
    {
297
 
      GimpDisplayShell *shell  = GIMP_DISPLAY_SHELL (draw_tool->display->shell);
298
 
      gdouble           width  = brush_core->brush_bound_width;
299
 
      gdouble           height = brush_core->brush_bound_height;
300
 
 
301
 
      /*  don't draw the boundary if it becomes too small  */
302
 
      if (SCALEX (shell, width) > 4 && SCALEY (shell, height) > 4)
 
325
  shell      = gimp_display_get_shell (display);
 
326
 
 
327
  if (! brush_core->main_brush || ! brush_core->dynamics)
 
328
    return NULL;
 
329
 
 
330
  if (brush_core->scale > 0.0)
 
331
    boundary = gimp_brush_transform_boundary (brush_core->main_brush,
 
332
                                              brush_core->scale,
 
333
                                              brush_core->aspect_ratio,
 
334
                                              brush_core->angle,
 
335
                                              brush_core->hardness,
 
336
                                              &width,
 
337
                                              &height);
 
338
 
 
339
  /*  don't draw the boundary if it becomes too small  */
 
340
  if (boundary                   &&
 
341
      SCALEX (shell, width)  > 4 &&
 
342
      SCALEY (shell, height) > 4)
 
343
    {
 
344
      x -= width  / 2.0;
 
345
      y -= height / 2.0;
 
346
 
 
347
      if (gimp_paint_options_get_brush_mode (options) == GIMP_BRUSH_HARD)
303
348
        {
304
 
          x -= width  / 2.0;
305
 
          y -= height / 2.0;
306
 
 
307
 
          if (gimp_paint_options_get_brush_mode (options) == GIMP_BRUSH_HARD)
308
 
            {
309
349
#define EPSILON 0.000001
310
 
              /*  Add EPSILON before rounding since e.g.
311
 
               *  (5.0 - 0.5) may end up at (4.499999999....)
312
 
               *  due to floating point fnords
313
 
               */
314
 
              x = RINT (x + EPSILON);
315
 
              y = RINT (y + EPSILON);
 
350
          /*  Add EPSILON before rounding since e.g.
 
351
           *  (5.0 - 0.5) may end up at (4.499999999....)
 
352
           *  due to floating point fnords
 
353
           */
 
354
          x = RINT (x + EPSILON);
 
355
          y = RINT (y + EPSILON);
316
356
#undef EPSILON
317
 
            }
318
 
 
319
 
          gimp_draw_tool_draw_boundary (draw_tool,
320
 
                                        brush_core->brush_bound_segs,
321
 
                                        brush_core->n_brush_bound_segs,
322
 
                                        x, y,
323
 
                                        FALSE);
324
 
        }
325
 
      else if (draw_fallback)
326
 
        {
327
 
          gimp_draw_tool_draw_handle (draw_tool, GIMP_HANDLE_CROSS,
328
 
                                      x, y,
329
 
                                      5, 5, GTK_ANCHOR_CENTER,
330
 
                                      FALSE);
331
 
        }
332
 
    }
 
357
        }
 
358
 
 
359
      return gimp_canvas_path_new (shell, boundary, x, y, FALSE,
 
360
                                   GIMP_PATH_STYLE_OUTLINE);
 
361
    }
 
362
  else if (draw_fallback)
 
363
    {
 
364
      return gimp_canvas_handle_new (shell,
 
365
                                     GIMP_HANDLE_CROSS,
 
366
                                     GIMP_HANDLE_ANCHOR_CENTER,
 
367
                                     x, y,
 
368
                                     GIMP_TOOL_HANDLE_SIZE_SMALL,
 
369
                                     GIMP_TOOL_HANDLE_SIZE_SMALL);
 
370
    }
 
371
 
 
372
  return NULL;
333
373
}
334
374
 
335
375
static void
340
380
  GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (brush_tool);
341
381
  GimpBrushCore *brush_core = GIMP_BRUSH_CORE (paint_tool->core);
342
382
 
343
 
  if (brush_core->main_brush != brush)
344
 
    gimp_brush_core_set_brush (brush_core, brush);
345
 
}
346
 
 
347
 
static void
348
 
gimp_brush_tool_brush_scaled (GimpPaintOptions *options,
349
 
                              GParamSpec       *pspec,
350
 
                              GimpBrushTool    *brush_tool)
351
 
{
352
 
  GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (brush_tool);
353
 
  GimpBrushCore *brush_core = GIMP_BRUSH_CORE (paint_tool->core);
354
 
 
355
 
  gimp_brush_core_set_brush (brush_core, brush_core->main_brush);
 
383
  gimp_brush_core_set_brush (brush_core, brush);
 
384
 
356
385
}
357
386
 
358
387
static void
361
390
                           GimpBrushTool *brush_tool)
362
391
{
363
392
  gimp_draw_tool_pause (GIMP_DRAW_TOOL (brush_tool));
364
 
}
365
 
 
366
 
static void
367
 
gimp_brush_tool_set_brush_after (GimpBrushCore *brush_core,
368
 
                                 GimpBrush     *brush,
369
 
                                 GimpBrushTool *brush_tool)
370
 
{
 
393
 
 
394
  if (GIMP_BRUSH_CORE_GET_CLASS (brush_core)->handles_transforming_brush)
 
395
    {
 
396
      GimpPaintCore *paint_core = GIMP_PAINT_CORE (brush_core);
 
397
 
 
398
      gimp_brush_core_eval_transform_dynamics (brush_core,
 
399
                                               NULL,
 
400
                                               GIMP_PAINT_TOOL_GET_OPTIONS (brush_tool),
 
401
                                               &paint_core->cur_coords);
 
402
    }
 
403
 
371
404
  gimp_draw_tool_resume (GIMP_DRAW_TOOL (brush_tool));
372
405
}
373
406