1 --- gimp-2.6.6/app/actions/tool-options-commands.c 2008-11-21 07:43:04 +0900
2 +++ gimp-painter--2.6.6-20100627/app/actions/tool-options-commands.c 2010-06-27 02:14:18 +0900
4 static void tool_options_rename_callback (GtkWidget *widget,
7 +static void tool_options_sync (GObject *src,
12 /* public functions */
14 options = gimp_tool_presets_get_options (tool_info->presets, value);
17 - gimp_config_sync (G_OBJECT (options),
18 - G_OBJECT (tool_info->tool_options),
19 - GIMP_CONFIG_PARAM_SERIALIZE);
21 + GdkModifierType state;
22 + guint flags = GIMP_CONFIG_PARAM_DONT_RESTORE;
24 + if (gtk_get_current_event_state (&state))
26 + if (state & GDK_SHIFT_MASK && ! (state & GDK_CONTROL_MASK))
28 + else if (state & GDK_CONTROL_MASK && ! (state & GDK_SHIFT_MASK))
29 + flags |= GIMP_CONFIG_PARAM_DONT_RESTORE_SECONDARY;
32 + tool_options_sync (G_OBJECT (options),
33 + G_OBJECT (tool_info->tool_options),
41 gimp_object_set_static_name (GIMP_OBJECT (options), _("Saved Options"));
45 +tool_options_sync (GObject *src,
49 + GParamSpec **param_specs;
50 + guint n_param_specs;
53 + g_return_val_if_fail (G_IS_OBJECT (src), FALSE);
54 + g_return_val_if_fail (G_IS_OBJECT (dest), FALSE);
56 + param_specs = g_object_class_list_properties (G_OBJECT_GET_CLASS (src),
59 + for (i = 0; i < n_param_specs; i++)
61 + GParamSpec *prop_spec = param_specs[i];
63 + if ((prop_spec->flags & GIMP_CONFIG_PARAM_SERIALIZE) && ! (prop_spec->flags & (flags | G_PARAM_CONSTRUCT_ONLY)))
65 + GValue value = { 0, };
67 + g_value_init (&value, prop_spec->value_type);
69 + g_object_get_property (src, prop_spec->name, &value);
70 + g_object_set_property (dest, prop_spec->name, &value);
72 + g_value_unset (&value);
76 + g_free (param_specs);
80 --- gimp-2.6.6/app/core/core-enums.h 2008-11-21 07:42:58 +0900
81 +++ gimp-painter--2.6.6-20100627/app/core/core-enums.h 2010-06-27 02:14:18 +0900
83 GIMP_CONTEXT_PROP_FOREGROUND = 6,
84 GIMP_CONTEXT_PROP_BACKGROUND = 7,
85 GIMP_CONTEXT_PROP_OPACITY = 8,
86 - GIMP_CONTEXT_PROP_PAINT_MODE = 9,
87 - GIMP_CONTEXT_PROP_BRUSH = 10,
88 - GIMP_CONTEXT_PROP_PATTERN = 11,
89 - GIMP_CONTEXT_PROP_GRADIENT = 12,
90 - GIMP_CONTEXT_PROP_PALETTE = 13,
91 - GIMP_CONTEXT_PROP_FONT = 14,
92 - GIMP_CONTEXT_PROP_BUFFER = 15,
93 - GIMP_CONTEXT_PROP_IMAGEFILE = 16,
94 - GIMP_CONTEXT_PROP_TEMPLATE = 17,
95 + GIMP_CONTEXT_PROP_FLOW = 9,
96 + GIMP_CONTEXT_PROP_PAINT_MODE = 10,
97 + GIMP_CONTEXT_PROP_BRUSH = 11,
98 + GIMP_CONTEXT_PROP_PATTERN = 12,
99 + GIMP_CONTEXT_PROP_GRADIENT = 13,
100 + GIMP_CONTEXT_PROP_PALETTE = 14,
101 + GIMP_CONTEXT_PROP_FONT = 15,
102 + GIMP_CONTEXT_PROP_BUFFER = 16,
103 + GIMP_CONTEXT_PROP_IMAGEFILE = 17,
104 + GIMP_CONTEXT_PROP_TEMPLATE = 18,
106 GIMP_CONTEXT_LAST_PROP = GIMP_CONTEXT_PROP_TEMPLATE
107 } GimpContextPropType;
108 @@ -626,20 +627,22 @@
109 GIMP_CONTEXT_FOREGROUND_MASK = 1 << 6,
110 GIMP_CONTEXT_BACKGROUND_MASK = 1 << 7,
111 GIMP_CONTEXT_OPACITY_MASK = 1 << 8,
112 - GIMP_CONTEXT_PAINT_MODE_MASK = 1 << 9,
113 - GIMP_CONTEXT_BRUSH_MASK = 1 << 10,
114 - GIMP_CONTEXT_PATTERN_MASK = 1 << 11,
115 - GIMP_CONTEXT_GRADIENT_MASK = 1 << 12,
116 - GIMP_CONTEXT_PALETTE_MASK = 1 << 13,
117 - GIMP_CONTEXT_FONT_MASK = 1 << 14,
118 - GIMP_CONTEXT_BUFFER_MASK = 1 << 15,
119 - GIMP_CONTEXT_IMAGEFILE_MASK = 1 << 16,
120 - GIMP_CONTEXT_TEMPLATE_MASK = 1 << 17,
121 + GIMP_CONTEXT_FLOW_MASK = 1 << 9,
122 + GIMP_CONTEXT_PAINT_MODE_MASK = 1 << 10,
123 + GIMP_CONTEXT_BRUSH_MASK = 1 << 11,
124 + GIMP_CONTEXT_PATTERN_MASK = 1 << 12,
125 + GIMP_CONTEXT_GRADIENT_MASK = 1 << 13,
126 + GIMP_CONTEXT_PALETTE_MASK = 1 << 14,
127 + GIMP_CONTEXT_FONT_MASK = 1 << 15,
128 + GIMP_CONTEXT_BUFFER_MASK = 1 << 16,
129 + GIMP_CONTEXT_IMAGEFILE_MASK = 1 << 17,
130 + GIMP_CONTEXT_TEMPLATE_MASK = 1 << 18,
133 GIMP_CONTEXT_PAINT_PROPS_MASK = (GIMP_CONTEXT_FOREGROUND_MASK |
134 GIMP_CONTEXT_BACKGROUND_MASK |
135 GIMP_CONTEXT_OPACITY_MASK |
136 + GIMP_CONTEXT_FLOW_MASK |
137 GIMP_CONTEXT_PAINT_MODE_MASK |
138 GIMP_CONTEXT_BRUSH_MASK |
139 GIMP_CONTEXT_PATTERN_MASK |
140 --- gimp-2.6.6/app/core/gimpbrushgenerated.c 2008-11-21 07:42:58 +0900
141 +++ gimp-painter--2.6.6-20100627/app/core/gimpbrushgenerated.c 2010-06-27 02:14:18 +0900
143 #include "gimpbrushgenerated-save.h"
146 -#define OVERSAMPLING 4
147 +#define MAX_OVERSAMPLING 32
148 +#define MIN_OVERSAMPLING 4 /* original value */
149 +#define OVERSAMPLING (_oversampling)
151 +static gint _oversampling;
159 - gdouble buffer[OVERSAMPLING];
160 + gdouble buffer[MAX_OVERSAMPLING];
162 + _oversampling = MAX (MAX_OVERSAMPLING - (radius - 0.5), MIN_OVERSAMPLING);
164 length = OVERSAMPLING * ceil (1 + sqrt (2 * SQR (ceil (radius + 1.0))));
166 --- gimp-2.6.6/app/core/gimpcontext.c 2008-11-21 07:42:58 +0900
167 +++ gimp-painter--2.6.6-20100627/app/core/gimpcontext.c 2010-06-27 02:14:18 +0900
169 static void gimp_context_real_set_opacity (GimpContext *context,
173 +static void gimp_context_real_set_flow (GimpContext *context,
177 static void gimp_context_real_set_paint_mode (GimpContext *context,
178 GimpLayerModeEffects paint_mode);
207 + gimp_context_signals[FLOW_CHANGED] =
208 + g_signal_new ("flow-changed",
209 + G_TYPE_FROM_CLASS (klass),
210 + G_SIGNAL_RUN_FIRST,
211 + G_STRUCT_OFFSET (GimpContextClass, flow_changed),
213 + gimp_marshal_VOID__DOUBLE,
217 gimp_context_signals[PAINT_MODE_CHANGED] =
218 g_signal_new ("paint-mode-changed",
219 G_TYPE_FROM_CLASS (klass),
221 klass->foreground_changed = NULL;
222 klass->background_changed = NULL;
223 klass->opacity_changed = NULL;
224 + klass->flow_changed = NULL;
225 klass->paint_mode_changed = NULL;
226 klass->brush_changed = NULL;
227 klass->pattern_changed = NULL;
228 @@ -581,13 +599,13 @@
229 gimp_context_prop_names[GIMP_CONTEXT_PROP_FOREGROUND],
232 - GIMP_PARAM_STATIC_STRINGS);
233 + GIMP_PARAM_STATIC_STRINGS | GIMP_CONFIG_PARAM_DONT_RESTORE);
235 GIMP_CONFIG_INSTALL_PROP_RGB (object_class, GIMP_CONTEXT_PROP_BACKGROUND,
236 gimp_context_prop_names[GIMP_CONTEXT_PROP_BACKGROUND],
239 - GIMP_PARAM_STATIC_STRINGS);
240 + GIMP_PARAM_STATIC_STRINGS | GIMP_CONFIG_PARAM_DONT_RESTORE);
242 GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, GIMP_CONTEXT_PROP_OPACITY,
243 gimp_context_prop_names[GIMP_CONTEXT_PROP_OPACITY],
244 @@ -597,42 +615,50 @@
246 GIMP_PARAM_STATIC_STRINGS);
248 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, GIMP_CONTEXT_PROP_FLOW,
249 + gimp_context_prop_names[GIMP_CONTEXT_PROP_FLOW],
251 + GIMP_OPACITY_TRANSPARENT,
252 + GIMP_OPACITY_OPAQUE,
253 + GIMP_OPACITY_OPAQUE,
254 + GIMP_PARAM_STATIC_STRINGS);
256 GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, GIMP_CONTEXT_PROP_PAINT_MODE,
257 gimp_context_prop_names[GIMP_CONTEXT_PROP_PAINT_MODE],
259 GIMP_TYPE_LAYER_MODE_EFFECTS,
261 - GIMP_PARAM_STATIC_STRINGS);
262 + GIMP_PARAM_STATIC_STRINGS | GIMP_CONFIG_PARAM_DONT_RESTORE_SECONDARY);
264 GIMP_CONFIG_INSTALL_PROP_OBJECT (object_class, GIMP_CONTEXT_PROP_BRUSH,
265 gimp_context_prop_names[GIMP_CONTEXT_PROP_BRUSH],
268 - GIMP_PARAM_STATIC_STRINGS);
269 + GIMP_PARAM_STATIC_STRINGS | GIMP_CONFIG_PARAM_DONT_RESTORE_SECONDARY);
271 GIMP_CONFIG_INSTALL_PROP_OBJECT (object_class, GIMP_CONTEXT_PROP_PATTERN,
272 gimp_context_prop_names[GIMP_CONTEXT_PROP_PATTERN],
275 - GIMP_PARAM_STATIC_STRINGS);
276 + GIMP_PARAM_STATIC_STRINGS | GIMP_CONFIG_PARAM_DONT_RESTORE);
278 GIMP_CONFIG_INSTALL_PROP_OBJECT (object_class, GIMP_CONTEXT_PROP_GRADIENT,
279 gimp_context_prop_names[GIMP_CONTEXT_PROP_GRADIENT],
282 - GIMP_PARAM_STATIC_STRINGS);
283 + GIMP_PARAM_STATIC_STRINGS | GIMP_CONFIG_PARAM_DONT_RESTORE);
285 GIMP_CONFIG_INSTALL_PROP_OBJECT (object_class, GIMP_CONTEXT_PROP_PALETTE,
286 gimp_context_prop_names[GIMP_CONTEXT_PROP_PALETTE],
289 - GIMP_PARAM_STATIC_STRINGS);
290 + GIMP_PARAM_STATIC_STRINGS | GIMP_CONFIG_PARAM_DONT_RESTORE);
292 GIMP_CONFIG_INSTALL_PROP_OBJECT (object_class, GIMP_CONTEXT_PROP_FONT,
293 gimp_context_prop_names[GIMP_CONTEXT_PROP_FONT],
296 - GIMP_PARAM_STATIC_STRINGS);
297 + GIMP_PARAM_STATIC_STRINGS | GIMP_CONFIG_PARAM_DONT_RESTORE);
299 g_object_class_install_property (object_class, GIMP_CONTEXT_PROP_BUFFER,
300 g_param_spec_object (gimp_context_prop_names[GIMP_CONTEXT_PROP_BUFFER],
302 case GIMP_CONTEXT_PROP_OPACITY:
303 gimp_context_set_opacity (context, g_value_get_double (value));
305 + case GIMP_CONTEXT_PROP_FLOW:
306 + gimp_context_set_flow (context, g_value_get_double (value));
308 case GIMP_CONTEXT_PROP_PAINT_MODE:
309 gimp_context_set_paint_mode (context, g_value_get_enum (value));
311 @@ -1049,6 +1078,9 @@
312 case GIMP_CONTEXT_PROP_OPACITY:
313 g_value_set_double (value, gimp_context_get_opacity (context));
315 + case GIMP_CONTEXT_PROP_FLOW:
316 + g_value_set_double (value, gimp_context_get_flow (context));
318 case GIMP_CONTEXT_PROP_PAINT_MODE:
319 g_value_set_enum (value, gimp_context_get_paint_mode (context));
321 @@ -1478,6 +1510,10 @@
322 gimp_context_real_set_opacity (dest, src->opacity);
325 + case GIMP_CONTEXT_PROP_FLOW:
326 + gimp_context_real_set_flow (dest, src->flow);
329 case GIMP_CONTEXT_PROP_PAINT_MODE:
330 gimp_context_real_set_paint_mode (dest, src->paint_mode);
332 @@ -2233,6 +2269,50 @@
333 gimp_context_opacity_changed (context);
336 +/*****************************************************************************/
337 +/* flow ********************************************************************/
340 +gimp_context_get_flow (GimpContext *context)
342 + g_return_val_if_fail (GIMP_IS_CONTEXT (context), GIMP_OPACITY_OPAQUE);
344 + return context->flow;
348 +gimp_context_set_flow (GimpContext *context,
351 + g_return_if_fail (GIMP_IS_CONTEXT (context));
352 + context_find_defined (context, GIMP_CONTEXT_PROP_FLOW);
354 + gimp_context_real_set_flow (context, flow);
358 +gimp_context_flow_changed (GimpContext *context)
360 + g_return_if_fail (GIMP_IS_CONTEXT (context));
362 + g_signal_emit (context,
363 + gimp_context_signals[FLOW_CHANGED], 0,
368 +gimp_context_real_set_flow (GimpContext *context,
371 + if (context->flow == flow)
374 + context->flow = flow;
376 + g_object_notify (G_OBJECT (context), "flow");
377 + gimp_context_flow_changed (context);
381 /*****************************************************************************/
382 /* paint mode **************************************************************/
383 --- gimp-2.6.6/app/core/gimpcontext.h 2008-11-21 07:42:58 +0900
384 +++ gimp-painter--2.6.6-20100627/app/core/gimpcontext.h 2010-06-27 02:14:18 +0900
386 #include "gimpobject.h"
389 +/* Definitions of special GParamFlags for restoring the tool presets */
390 +#define GIMP_CONFIG_PARAM_DONT_RESTORE (1 << (6 + G_PARAM_USER_SHIFT))
391 +#define GIMP_CONFIG_PARAM_DONT_RESTORE_SECONDARY (1 << (7 + G_PARAM_USER_SHIFT))
394 #define GIMP_TYPE_CONTEXT (gimp_context_get_type ())
395 #define GIMP_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_CONTEXT, GimpContext))
396 #define GIMP_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST (klass, GIMP_TYPE_CONTEXT, GimpContextClass))
402 GimpLayerModeEffects paint_mode;
407 void (* opacity_changed) (GimpContext *context,
409 + void (* flow_changed) (GimpContext *context,
411 void (* paint_mode_changed) (GimpContext *context,
412 GimpLayerModeEffects paint_mode);
413 void (* brush_changed) (GimpContext *context,
415 void gimp_context_opacity_changed (GimpContext *context);
419 +gdouble gimp_context_get_flow (GimpContext *context);
420 +void gimp_context_set_flow (GimpContext *context,
422 +void gimp_context_flow_changed (GimpContext *context);
427 gimp_context_get_paint_mode (GimpContext *context);
428 --- gimp-2.6.6/app/core/gimpprojection.c 2008-11-21 07:42:58 +0900
429 +++ gimp-painter--2.6.6-20100627/app/core/gimpprojection.c 2010-06-27 02:14:18 +0900
433 /* halfway between G_PRIORITY_HIGH_IDLE and G_PRIORITY_DEFAULT_IDLE */
434 -#define GIMP_PROJECTION_IDLE_PRIORITY 150
435 +#define GIMP_PROJECTION_IDLE_PRIORITY G_PRIORITY_HIGH_IDLE
439 --- gimp-2.6.6/app/core/gimptooloptions.c 2008-11-21 07:42:58 +0900
440 +++ gimp-painter--2.6.6-20100627/app/core/gimptooloptions.c 2010-06-27 02:14:18 +0900
447 + PROP_MAX_COORD_SMOOTH
453 GIMP_PARAM_READWRITE));
455 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_MAX_COORD_SMOOTH,
456 + "max-coord-smooth", NULL,
458 + GIMP_PARAM_STATIC_STRINGS);
466 + case PROP_MAX_COORD_SMOOTH:
467 + options->max_coord_smooth = g_value_get_double (value);
471 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
474 g_value_set_object (value, options->tool_info);
477 + case PROP_MAX_COORD_SMOOTH:
478 + g_value_set_double (value, options->max_coord_smooth);
482 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
484 --- gimp-2.6.6/app/core/gimptooloptions.h 2008-11-21 07:42:58 +0900
485 +++ gimp-painter--2.6.6-20100627/app/core/gimptooloptions.h 2010-06-27 02:14:18 +0900
487 GimpContext parent_instance;
489 GimpToolInfo *tool_info;
491 + gdouble max_coord_smooth;
494 struct _GimpToolOptionsClass
495 --- gimp-2.6.6/app/dialogs/about-dialog.c 2008-11-21 07:43:00 +0900
496 +++ gimp-painter--2.6.6-20100627/app/dialogs/about-dialog.c 2010-06-27 02:14:18 +0900
499 about_dialog_add_message (GtkWidget *vbox)
501 -#ifdef GIMP_UNSTABLE
504 +#ifdef GIMP_UNSTABLE
505 label = gtk_label_new (_("This is an unstable development release."));
506 gimp_label_set_attributes (GTK_LABEL (label),
507 PANGO_ATTR_STYLE, PANGO_STYLE_ITALIC,
509 gtk_box_reorder_child (GTK_BOX (vbox), label, 2);
510 gtk_widget_show (label);
513 + label = gtk_label_new (_("gimp-painter- (release 20100627)"));
514 + gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
515 + gtk_box_reorder_child (GTK_BOX (vbox), label, 2);
516 + gtk_widget_show (label);
519 --- gimp-2.6.6/app/dialogs/preferences-dialog.c 2008-12-28 08:13:03 +0900
520 +++ gimp-painter--2.6.6-20100627/app/dialogs/preferences-dialog.c 2010-06-27 02:14:18 +0900
521 @@ -1978,6 +1978,11 @@
522 vbox2 = prefs_frame_new (_("Appearance"),
523 GTK_CONTAINER (vbox), FALSE);
525 + prefs_check_button_add_with_icon (object, "toolbox-wilber",
528 + GTK_BOX (vbox2), size_group);
530 prefs_check_button_add_with_icon (object, "toolbox-color-area",
531 _("Show _foreground & background color"),
532 GIMP_STOCK_DEFAULT_COLORS,
533 @@ -2412,6 +2417,14 @@
534 g_object_unref (size_group);
538 + vbox2 = prefs_frame_new (_("Zoomed-out View"), GTK_CONTAINER (vbox), FALSE);
539 + table = prefs_table_new (1, GTK_CONTAINER (vbox2));
541 + prefs_enum_combo_box_add (object, "zoom-quality", 0, 0,
543 + GTK_TABLE (table), 0, NULL);
546 /**********************/
547 /* Color Management */
548 @@ -2636,7 +2649,7 @@
549 _("Hint for other _docks:"),
550 GTK_TABLE (table), 1, size_group);
552 -#ifdef GIMP_UNSTABLE
554 prefs_check_button_add (object, "transient-docks",
555 _("Toolbox and other docks are transient "
556 "to the active image window"),
557 --- gimp-2.6.6/app/display/gimpdisplayshell-callbacks.c 2008-11-21 07:43:04 +0900
558 +++ gimp-painter--2.6.6-20100627/app/display/gimpdisplayshell-callbacks.c 2010-06-27 02:14:18 +0900
560 #include "core/gimpimage-quick-mask.h"
561 #include "core/gimplayer.h"
562 #include "core/gimptoolinfo.h"
563 +#include "core/gimptooloptions.h"
565 #include "tools/gimpimagemaptool.h"
566 #include "tools/gimpmovetool.h"
567 @@ -1208,6 +1209,11 @@
569 GdkTimeCoord **history_events;
570 gint n_history_events;
571 + gdouble max_coord_smooth = 0;
572 + GimpToolOptions *active_tool_options;
574 + if ((active_tool_options = GIMP_TOOL_GET_OPTIONS (active_tool)))
575 + max_coord_smooth = active_tool_options->max_coord_smooth;
577 /* if the first mouse button is down, check for automatic
579 @@ -1269,7 +1275,7 @@
581 if (gimp_display_shell_eval_event (shell,
583 - active_tool->max_coord_smooth,
585 history_events[i]->time))
587 tool_manager_motion_active (gimp,
588 @@ -1290,7 +1296,7 @@
590 if (gimp_display_shell_eval_event (shell,
592 - active_tool->max_coord_smooth,
596 tool_manager_motion_active (gimp,
597 --- gimp-2.6.6/app/paint/Makefile.am 2008-11-21 07:43:08 +0900
598 +++ gimp-painter--2.6.6-20100627/app/paint/Makefile.am 2010-06-27 02:14:18 +0900
602 gimpsourceoptions.c \
603 - gimpsourceoptions.h
604 + gimpsourceoptions.h \
609 + gimpink2options.c \
610 + gimpink2options.h \
613 + gimpmixbrushoptions.c \
614 + gimpmixbrushoptions.h
616 libapppaint_a_built_sources = paint-enums.c
618 --- gimp-2.6.6/app/paint/Makefile.in 2009-03-16 05:58:04 +0900
619 +++ gimp-painter--2.6.6-20100627/app/paint/Makefile.in 2010-06-27 02:14:18 +0900
621 gimppaintbrush.$(OBJEXT) gimpperspectiveclone.$(OBJEXT) \
622 gimpperspectivecloneoptions.$(OBJEXT) gimpsmudge.$(OBJEXT) \
623 gimpsmudgeoptions.$(OBJEXT) gimpsourcecore.$(OBJEXT) \
624 - gimpsourceoptions.$(OBJEXT)
625 + gimpsourceoptions.$(OBJEXT) \
626 + gimpink2.$(OBJEXT) gimpink2options.$(OBJEXT) gimpink2undo.$(OBJEXT) \
627 + gimpmixbrush.$(OBJEXT) gimpmixbrushoptions.$(OBJEXT)
628 am_libapppaint_a_OBJECTS = $(am__objects_1) $(am__objects_2)
629 libapppaint_a_OBJECTS = $(am_libapppaint_a_OBJECTS)
630 DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
634 gimpsourceoptions.c \
635 - gimpsourceoptions.h
636 + gimpsourceoptions.h \
639 + gimpink2options.c \
640 + gimpink2options.h \
645 + gimpmixbrushoptions.c \
646 + gimpmixbrushoptions.h
648 libapppaint_a_built_sources = paint-enums.c
649 libapppaint_a_SOURCES = $(libapppaint_a_built_sources) $(libapppaint_a_sources)
651 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpsourcecore.Po@am__quote@
652 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpsourceoptions.Po@am__quote@
653 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/paint-enums.Po@am__quote@
654 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpink2.Po@am__quote@
655 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpink2options.Po@am__quote@
656 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpink2undo.Po@am__quote@
657 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpmixbrush.Po@am__quote@
658 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpmixbrushoptions.Po@am__quote@
661 @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
662 --- gimp-2.6.6/app/paint/gimp-paint.c 2008-11-21 07:43:08 +0900
663 +++ gimp-painter--2.6.6-20100627/app/paint/gimp-paint.c 2010-06-27 02:14:18 +0900
665 #include "gimppencil.h"
666 #include "gimpperspectiveclone.h"
667 #include "gimpsmudge.h"
668 +#include "gimpink2.h"
669 +#include "gimpmixbrush.h"
672 /* local function prototypes */
674 gimp_airbrush_register,
675 gimp_eraser_register,
676 gimp_paintbrush_register,
677 - gimp_pencil_register
678 + gimp_pencil_register,
679 + gimp_ink2_register,
680 + gimp_mixbrush_register
684 --- gimp-2.6.6/app/paint/gimpbrushcore.c 2008-11-21 07:43:08 +0900
685 +++ gimp-painter--2.6.6-20100627/app/paint/gimpbrushcore.c 2010-06-27 02:14:18 +0900
686 @@ -828,11 +828,13 @@
687 gimp_brush_core_paste_canvas (GimpBrushCore *core,
688 GimpDrawable *drawable,
689 gdouble brush_opacity,
690 + gdouble brush_flow,
691 gdouble image_opacity,
692 GimpLayerModeEffects paint_mode,
693 GimpBrushApplicationMode brush_hardness,
694 gdouble dynamic_hardness,
695 - GimpPaintApplicationMode mode)
696 + GimpPaintApplicationMode mode,
697 + GimpUpdateFreqOptions *update_freq_options)
699 TempBuf *brush_mask = gimp_brush_core_get_brush_mask (core,
702 paint_core->canvas_buf->height);
704 gimp_paint_core_paste (paint_core, &brush_maskPR, drawable,
706 + brush_opacity, brush_flow,
707 image_opacity, paint_mode,
709 + mode, update_freq_options);
714 gdouble image_opacity,
715 GimpBrushApplicationMode brush_hardness,
716 gdouble dynamic_hardness,
717 - GimpPaintApplicationMode mode)
718 + GimpPaintApplicationMode mode,
719 + GimpUpdateFreqOptions *update_freq_options)
721 TempBuf *brush_mask = gimp_brush_core_get_brush_mask (core,
724 gimp_paint_core_replace (paint_core, &brush_maskPR, drawable,
728 + mode, update_freq_options);
732 --- gimp-2.6.6/app/paint/gimpbrushcore.h 2008-11-21 07:43:08 +0900
733 +++ gimp-painter--2.6.6-20100627/app/paint/gimpbrushcore.h 2010-06-27 02:14:18 +0900
734 @@ -108,18 +108,21 @@
735 void gimp_brush_core_paste_canvas (GimpBrushCore *core,
736 GimpDrawable *drawable,
737 gdouble brush_opacity,
738 + gdouble brush_flow,
739 gdouble image_opacity,
740 GimpLayerModeEffects paint_mode,
741 GimpBrushApplicationMode brush_hardness,
742 gdouble dynamic_hardness,
743 - GimpPaintApplicationMode mode);
744 + GimpPaintApplicationMode mode,
745 + GimpUpdateFreqOptions *update_freq_options);
746 void gimp_brush_core_replace_canvas (GimpBrushCore *core,
747 GimpDrawable *drawable,
748 gdouble brush_opacity,
749 gdouble image_opacity,
750 GimpBrushApplicationMode brush_hardness,
751 gdouble dynamic_hardness,
752 - GimpPaintApplicationMode mode);
753 + GimpPaintApplicationMode mode,
754 + GimpUpdateFreqOptions *update_freq_options);
756 void gimp_brush_core_color_area_with_pixmap
757 (GimpBrushCore *core,
758 --- gimp-2.6.6/app/paint/gimpclone.c 2008-11-21 07:43:08 +0900
759 +++ gimp-painter--2.6.6-20100627/app/paint/gimpclone.c 2010-06-27 02:14:18 +0900
762 gimp_brush_core_paste_canvas (GIMP_BRUSH_CORE (paint_core), drawable,
763 MIN (opacity, GIMP_OPACITY_OPAQUE),
764 + GIMP_OPACITY_OPAQUE,
765 gimp_context_get_opacity (context),
766 gimp_context_get_paint_mode (context),
767 gimp_paint_options_get_brush_mode (paint_options),
770 source_options->align_mode ==
771 GIMP_SOURCE_ALIGN_FIXED ?
772 - GIMP_PAINT_INCREMENTAL : GIMP_PAINT_CONSTANT);
773 + GIMP_PAINT_INCREMENTAL : GIMP_PAINT_CONSTANT,
774 + paint_options->update_freq_options);
778 --- gimp-2.6.6/app/paint/gimpconvolve.c 2008-11-21 07:43:08 +0900
779 +++ gimp-painter--2.6.6-20100627/app/paint/gimpconvolve.c 2010-06-27 02:14:18 +0900
781 gimp_context_get_opacity (context),
782 gimp_paint_options_get_brush_mode (paint_options),
784 - GIMP_PAINT_INCREMENTAL);
785 + GIMP_PAINT_INCREMENTAL,
786 + paint_options->update_freq_options);
790 --- gimp-2.6.6/app/paint/gimpdodgeburn.c 2008-11-21 07:43:08 +0900
791 +++ gimp-painter--2.6.6-20100627/app/paint/gimpdodgeburn.c 2010-06-27 02:14:18 +0900
793 gimp_context_get_opacity (context),
794 gimp_paint_options_get_brush_mode (paint_options),
796 - GIMP_PAINT_CONSTANT);
797 + GIMP_PAINT_CONSTANT,
798 + paint_options->update_freq_options);
802 --- gimp-2.6.6/app/paint/gimperaser.c 2008-11-21 07:43:08 +0900
803 +++ gimp-painter--2.6.6-20100627/app/paint/gimperaser.c 2010-06-27 02:14:18 +0900
804 @@ -139,10 +139,12 @@
806 gimp_brush_core_paste_canvas (GIMP_BRUSH_CORE (paint_core), drawable,
807 MIN (opacity, GIMP_OPACITY_OPAQUE),
808 + GIMP_OPACITY_OPAQUE,
809 gimp_context_get_opacity (context),
810 (options->anti_erase ?
811 GIMP_ANTI_ERASE_MODE : GIMP_ERASE_MODE),
812 gimp_paint_options_get_brush_mode (paint_options),
814 - paint_options->application_mode);
815 + paint_options->application_mode,
816 + paint_options->update_freq_options);
818 --- gimp-2.6.6/app/paint/gimpheal.c 2008-11-21 07:43:08 +0900
819 +++ gimp-painter--2.6.6-20100627/app/paint/gimpheal.c 2010-06-27 02:14:18 +0900
821 gimp_context_get_opacity (context),
822 gimp_paint_options_get_brush_mode (paint_options),
824 - GIMP_PAINT_INCREMENTAL);
825 + GIMP_PAINT_INCREMENTAL,
826 + paint_options->update_freq_options);
828 --- gimp-2.6.6/app/paint/gimpink.c 2008-11-21 07:43:08 +0900
829 +++ gimp-painter--2.6.6-20100627/app/paint/gimpink.c 2010-06-27 02:14:18 +0900
832 gimp_paint_core_paste (paint_core, &blob_maskPR, drawable,
834 + GIMP_OPACITY_OPAQUE,
835 gimp_context_get_opacity (context),
836 gimp_context_get_paint_mode (context),
837 - GIMP_PAINT_CONSTANT);
838 + GIMP_PAINT_CONSTANT,
839 + paint_options->update_freq_options);
843 --- gimp-2.6.6/app/paint/gimpink2.c 1970-01-01 09:00:00 +0900
844 +++ gimp-painter--2.6.6-20100627/app/paint/gimpink2.c 2010-06-27 02:14:18 +0900
846 +/* GIMP - The GNU Image Manipulation Program
847 + * Copyright (C) 1995 Spencer Kimball and Peter Mattis
849 + * This program is free software; you can redistribute it and/or modify
850 + * it under the terms of the GNU General Public License as published by
851 + * the Free Software Foundation; either version 2 of the License, or
852 + * (at your option) any later version.
854 + * This program is distributed in the hope that it will be useful,
855 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
856 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
857 + * GNU General Public License for more details.
859 + * You should have received a copy of the GNU General Public License
860 + * along with this program; if not, write to the Free Software
861 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
868 +#include <glib-object.h>
870 +#include "libgimpmath/gimpmath.h"
872 +#include "paint-types.h"
874 +#include "base/pixel-region.h"
875 +#include "base/temp-buf.h"
876 +#include "base/tile.h"
877 +#include "base/tile-manager.h"
879 +#include "paint-funcs/paint-funcs.h"
881 +#include "core/gimpdrawable.h"
882 +#include "core/gimpimage.h"
883 +#include "core/gimpimage-undo.h"
885 +#include "gimpink2options.h"
886 +#include "gimpink2.h"
887 +#include "gimpink-blob.h"
888 +#include "gimpink2undo.h"
890 +#include "gimp-intl.h"
896 +/* local function prototypes */
898 +static void gimp_ink2_finalize (GObject *object);
900 +static void gimp_ink2_paint (GimpPaintCore *paint_core,
901 + GimpDrawable *drawable,
902 + GimpPaintOptions *paint_options,
903 + GimpPaintState paint_state,
905 +static TempBuf * gimp_ink2_get_paint_area (GimpPaintCore *paint_core,
906 + GimpDrawable *drawable,
907 + GimpPaintOptions *paint_options);
908 +static GimpUndo* gimp_ink2_push_undo (GimpPaintCore *core,
910 + const gchar *undo_desc);
912 +static void gimp_ink2_motion (GimpPaintCore *paint_core,
913 + GimpDrawable *drawable,
914 + GimpPaintOptions *paint_options,
918 +static Blob * ink2_pen_ellipse (GimpInk2Options *options,
926 +static void time_smoother_add (GimpInk2 *ink,
928 +static guint32 time_smoother_result (GimpInk2 *ink);
929 +static void time_smoother_init (GimpInk2 *ink,
932 +static void dist_smoother_add (GimpInk2 *ink,
934 +static gdouble dist_smoother_result (GimpInk2 *ink);
935 +static void dist_smoother_init (GimpInk2 *ink,
938 +static void render_blob (Blob *blob,
939 + PixelRegion *dest);
941 +/* Ink2 additional functions */
942 +static void hist_init (GimpInk2 *ink, GimpCoords* coords);
943 +static void hist_add (GimpInk2 *ink, GimpCoords* coords, gdouble speed);
944 +static GimpCoords hist_result (GimpInk2 *ink, GimpInk2Options *options);
950 +G_DEFINE_TYPE (GimpInk2, gimp_ink2, GIMP_TYPE_PAINT_CORE)
952 +#define parent_class gimp_ink2_parent_class
956 +gimp_ink2_register (Gimp *gimp,
957 + GimpPaintRegisterCallback callback)
959 + (* callback) (gimp,
961 + GIMP_TYPE_INK2_OPTIONS,
968 +gimp_ink2_class_init (GimpInk2Class *klass)
970 + GObjectClass *object_class = G_OBJECT_CLASS (klass);
971 + GimpPaintCoreClass *paint_core_class = GIMP_PAINT_CORE_CLASS (klass);
973 + object_class->finalize = gimp_ink2_finalize;
975 + paint_core_class->paint = gimp_ink2_paint;
976 + paint_core_class->get_paint_area = gimp_ink2_get_paint_area;
977 + paint_core_class->push_undo = gimp_ink2_push_undo;
979 + /* initialize internal variables */
984 +gimp_ink2_init (GimpInk2 *ink)
989 +gimp_ink2_finalize (GObject *object)
991 + GimpInk2 *ink = GIMP_INK2 (object);
993 + if (ink->start_blob)
995 + g_free (ink->start_blob);
996 + ink->start_blob = NULL;
999 + if (ink->last_blob)
1001 + g_free (ink->last_blob);
1002 + ink->last_blob = NULL;
1005 + G_OBJECT_CLASS (parent_class)->finalize (object);
1009 +gimp_ink2_paint (GimpPaintCore *paint_core,
1010 + GimpDrawable *drawable,
1011 + GimpPaintOptions *paint_options,
1012 + GimpPaintState paint_state,
1015 + GimpInk2 *ink = GIMP_INK2 (paint_core);
1017 + switch (paint_state)
1019 + case GIMP_PAINT_STATE_INIT:
1020 + if (paint_core->cur_coords.x == paint_core->last_coords.x &&
1021 + paint_core->cur_coords.y == paint_core->last_coords.y)
1023 + /* start with new blobs if we're not interpolating */
1025 + if (ink->start_blob)
1027 + g_free (ink->start_blob);
1028 + ink->start_blob = NULL;
1031 + if (ink->last_blob)
1033 + g_free (ink->last_blob);
1034 + ink->last_blob = NULL;
1037 + else if (ink->last_blob)
1039 + /* save the start blob of the line for undo otherwise */
1041 + if (ink->start_blob)
1042 + g_free (ink->start_blob);
1044 + ink->start_blob = blob_duplicate (ink->last_blob);
1048 + case GIMP_PAINT_STATE_MOTION:
1049 + gimp_ink2_motion (paint_core, drawable, paint_options, time, FALSE);
1052 + case GIMP_PAINT_STATE_FINISH:
1053 + gimp_ink2_motion (paint_core, drawable, paint_options, time, TRUE);
1054 + /*g_printf("\n");*/
1060 +gimp_ink2_get_paint_area (GimpPaintCore *paint_core,
1061 + GimpDrawable *drawable,
1062 + GimpPaintOptions *paint_options)
1064 + GimpInk2 *ink = GIMP_INK2 (paint_core);
1066 + gint width, height;
1067 + gint dwidth, dheight;
1068 + gint x1, y1, x2, y2;
1071 + bytes = gimp_drawable_bytes_with_alpha (drawable);
1073 + blob_bounds (ink->cur_blob, &x, &y, &width, &height);
1075 + dwidth = gimp_item_width (GIMP_ITEM (drawable));
1076 + dheight = gimp_item_height (GIMP_ITEM (drawable));
1078 + x1 = CLAMP (x / SUBSAMPLE - 1, 0, dwidth);
1079 + y1 = CLAMP (y / SUBSAMPLE - 1, 0, dheight);
1080 + x2 = CLAMP ((x + width) / SUBSAMPLE + 2, 0, dwidth);
1081 + y2 = CLAMP ((y + height) / SUBSAMPLE + 2, 0, dheight);
1083 + /* configure the canvas buffer */
1084 + if ((x2 - x1) && (y2 - y1))
1085 + paint_core->canvas_buf = temp_buf_resize (paint_core->canvas_buf, bytes,
1087 + (x2 - x1), (y2 - y1));
1091 + return paint_core->canvas_buf;
1095 +gimp_ink2_push_undo (GimpPaintCore *core,
1097 + const gchar *undo_desc)
1099 + return gimp_image_undo_push (image, GIMP_TYPE_INK2_UNDO,
1100 + GIMP_UNDO_INK, undo_desc,
1102 + "paint-core", core,
1107 +gimp_ink2_motion (GimpPaintCore *paint_core,
1108 + GimpDrawable *drawable,
1109 + GimpPaintOptions *paint_options,
1113 + GimpInk2 *ink = GIMP_INK2 (paint_core);
1114 + GimpInk2Options *options = GIMP_INK2_OPTIONS (paint_options);
1115 + GimpContext *context = GIMP_CONTEXT (paint_options);
1117 + Blob *blob_union = NULL;
1118 + Blob *blob_to_render;
1120 + guchar col[MAX_CHANNELS];
1121 + PixelRegion blob_maskPR;
1123 + if (at_last && !options->compensate_at_last)
1126 + image = gimp_item_get_image (GIMP_ITEM (drawable));
1128 + if (! ink->last_blob)
1130 + ink->last_blob = ink2_pen_ellipse (options,
1131 + paint_core->cur_coords.x,
1132 + paint_core->cur_coords.y,
1133 + paint_core->cur_coords.pressure,
1134 + paint_core->cur_coords.xtilt,
1135 + paint_core->cur_coords.ytilt,
1138 + if (ink->start_blob)
1139 + g_free (ink->start_blob);
1141 + ink->start_blob = blob_duplicate (ink->last_blob);
1143 + time_smoother_init (ink, time);
1144 + ink->last_time = time;
1146 + dist_smoother_init (ink, 0.0);
1147 + ink->init_velocity = TRUE;
1149 + hist_init (ink, &paint_core->cur_coords);
1151 + blob_to_render = ink->last_blob;
1158 + guint32 lasttime = ink->last_time;
1160 + GimpCoords average_hist;
1161 + GimpCoords average_velocity;
1163 + time_smoother_add (ink, time);
1164 + thistime = ink->last_time = time_smoother_result (ink);
1166 + /* The time resolution on X-based GDK motion events is bloody
1167 + * awful, hence the use of the smoothing function. Sadly this
1168 + * also means that there is always the chance of having an
1169 + * indeterminite velocity since this event and the previous
1170 + * several may still appear to issue at the same
1173 + if (thistime == lasttime)
1174 + thistime = lasttime + 1;
1176 + dist = sqrt ((paint_core->last_coords.x - paint_core->cur_coords.x) *
1177 + (paint_core->last_coords.x - paint_core->cur_coords.x) +
1178 + (paint_core->last_coords.y - paint_core->cur_coords.y) *
1179 + (paint_core->last_coords.y - paint_core->cur_coords.y));
1181 + if (ink->init_velocity)
1183 + dist_smoother_init (ink, dist);
1184 + ink->init_velocity = FALSE;
1188 + dist_smoother_add (ink, dist);
1189 + dist = dist_smoother_result (ink);
1192 + velocity = 10.0 * sqrt ((dist) / (gdouble) (thistime - lasttime));
1194 + /* g_printf("%f, %f, %f\n", paint_core->cur_coords.x, paint_core->cur_coords.y, velocity); */
1196 + if (!at_last && options->compensation_hist_size > 1)
1198 + hist_add(ink, &paint_core->cur_coords, velocity);
1199 + average_hist = hist_result(ink, options);
1200 + blob = ink2_pen_ellipse (options,
1203 + paint_core->cur_coords.pressure,
1204 + paint_core->cur_coords.xtilt,
1205 + paint_core->cur_coords.ytilt,
1207 + ink->last_point = average_hist;
1211 + blob = ink2_pen_ellipse (options,
1212 + paint_core->cur_coords.x,
1213 + paint_core->cur_coords.y,
1214 + paint_core->cur_coords.pressure,
1215 + paint_core->cur_coords.xtilt,
1216 + paint_core->cur_coords.ytilt,
1220 + blob_union = blob_convex_union (ink->last_blob, blob);
1221 + g_free (ink->last_blob);
1222 + ink->last_blob = blob;
1224 + blob_to_render = blob_union;
1227 + /* Get the buffer */
1228 + ink->cur_blob = blob_to_render;
1229 + area = gimp_paint_core_get_paint_area (paint_core, drawable, paint_options);
1230 + ink->cur_blob = NULL;
1235 + gimp_image_get_foreground (image, context, gimp_drawable_type (drawable), col);
1237 + /* set the alpha channel */
1238 + col[paint_core->canvas_buf->bytes - 1] = OPAQUE_OPACITY;
1240 + /* color the pixels */
1241 + color_pixels (temp_buf_data (paint_core->canvas_buf), col,
1242 + area->width * area->height, area->bytes);
1244 + gimp_paint_core_validate_canvas_tiles (paint_core,
1245 + paint_core->canvas_buf->x,
1246 + paint_core->canvas_buf->y,
1247 + paint_core->canvas_buf->width,
1248 + paint_core->canvas_buf->height);
1250 + /* draw the blob directly to the canvas_tiles */
1251 + pixel_region_init (&blob_maskPR, paint_core->canvas_tiles,
1252 + paint_core->canvas_buf->x,
1253 + paint_core->canvas_buf->y,
1254 + paint_core->canvas_buf->width,
1255 + paint_core->canvas_buf->height,
1258 + render_blob (blob_to_render, &blob_maskPR);
1260 + /* draw the canvas_buf using the just rendered canvas_tiles as mask */
1261 + pixel_region_init (&blob_maskPR, paint_core->canvas_tiles,
1262 + paint_core->canvas_buf->x,
1263 + paint_core->canvas_buf->y,
1264 + paint_core->canvas_buf->width,
1265 + paint_core->canvas_buf->height,
1268 + gimp_paint_core_paste (paint_core, &blob_maskPR, drawable,
1269 + GIMP_OPACITY_OPAQUE,
1270 + GIMP_OPACITY_OPAQUE,
1271 + gimp_context_get_opacity (context),
1272 + gimp_context_get_paint_mode (context),
1273 + GIMP_PAINT_CONSTANT,
1274 + paint_options->update_freq_options);
1277 + g_free (blob_union);
1281 +ink2_pen_ellipse (GimpInk2Options *options,
1289 + BlobFunc blob_function;
1291 + gdouble tsin, tcos;
1292 + gdouble aspect, radmin;
1298 + /* Adjust the size depending on pressure. */
1300 + size = options->size * (1.0 + options->size_sensitivity *
1301 + (2.0 * pressure - 1.0));
1303 + /* Adjust the size further depending on pointer velocity and
1304 + * velocity-sensitivity. These 'magic constants' are 'feels
1305 + * natural' tigert-approved. --ADM
1308 + if (velocity < 3.0)
1312 + g_printerr ("%g (%g) -> ", size, velocity);
1315 + size = (options->vel_sensitivity *
1316 + ((4.5 * size) / (1.0 + options->vel_sensitivity * (2.0 * velocity)))
1317 + + (1.0 - options->vel_sensitivity) * size);
1320 + g_printerr ("%g\n", (gfloat) size);
1323 + /* Clamp resulting size to sane limits */
1325 + if (size > options->size * (1.0 + options->size_sensitivity))
1326 + size = options->size * (1.0 + options->size_sensitivity);
1328 + if (size * SUBSAMPLE < 1.0)
1329 + size = 1.0 / SUBSAMPLE;
1331 + /* Add brush angle/aspect to tilt vectorially */
1333 + /* I'm not happy with the way the brush widget info is combined with
1334 + * tilt info from the brush. My personal feeling is that
1335 + * representing both as affine transforms would make the most
1339 + tscale = options->tilt_sensitivity * 10.0;
1340 + tscale_c = tscale * cos (gimp_deg_to_rad (options->tilt_angle));
1341 + tscale_s = tscale * sin (gimp_deg_to_rad (options->tilt_angle));
1343 + x = (options->blob_aspect * cos (options->blob_angle) +
1344 + xtilt * tscale_c - ytilt * tscale_s);
1345 + y = (options->blob_aspect * sin (options->blob_angle) +
1346 + ytilt * tscale_c + xtilt * tscale_s);
1349 + g_printerr ("angle %g aspect %g; %g %g; %g %g\n",
1350 + options->blob_angle, options->blob_aspect,
1351 + tscale_c, tscale_s, x, y);
1354 + aspect = sqrt (x * x + y * y);
1358 + tcos = x / aspect;
1359 + tsin = y / aspect;
1363 + tsin = sin (options->blob_angle);
1364 + tcos = cos (options->blob_angle);
1367 + aspect = CLAMP (aspect, 1.0, 10.0);
1369 + radmin = MAX (1.0, SUBSAMPLE * size / aspect);
1371 + switch (options->blob_type)
1373 + case GIMP_INK_BLOB_TYPE_ELLIPSE:
1374 + blob_function = blob_ellipse;
1377 + case GIMP_INK_BLOB_TYPE_SQUARE:
1378 + blob_function = blob_square;
1381 + case GIMP_INK_BLOB_TYPE_DIAMOND:
1382 + blob_function = blob_diamond;
1386 + g_return_val_if_reached (NULL);
1390 + return (* blob_function) (x_center * SUBSAMPLE,
1391 + y_center * SUBSAMPLE,
1392 + radmin * aspect * tcos,
1393 + radmin * aspect * tsin,
1400 +time_smoother_init (GimpInk2 *ink,
1405 + ink->ts_index = 0;
1407 + for (i = 0; i < INK2_TIME_SMOOTHER_BUFFER; i++)
1408 + ink->ts_buffer[i] = initval;
1412 +time_smoother_result (GimpInk2 *ink)
1415 + guint64 result = 0;
1417 + for (i = 0; i < INK2_TIME_SMOOTHER_BUFFER; i++)
1418 + result += ink->ts_buffer[i];
1420 + return (result / (guint64) INK2_TIME_SMOOTHER_BUFFER);
1424 +time_smoother_add (GimpInk2 *ink,
1427 + guint64 long_value = (guint64) value;
1429 + /* handle wrap-around of time values */
1430 + if (long_value < ink->ts_buffer[ink->ts_index])
1431 + long_value += (guint64) + G_MAXUINT32;
1433 + ink->ts_buffer[ink->ts_index++] = long_value;
1435 + ink->ts_buffer[ink->ts_index++] = value;
1437 + if (ink->ts_index == INK2_TIME_SMOOTHER_BUFFER)
1438 + ink->ts_index = 0;
1443 +dist_smoother_init (GimpInk2 *ink,
1448 + ink->dt_index = 0;
1450 + for (i = 0; i < INK2_DIST_SMOOTHER_BUFFER; i++)
1451 + ink->dt_buffer[i] = initval;
1455 +dist_smoother_result (GimpInk2 *ink)
1458 + gdouble result = 0.0;
1460 + for (i = 0; i < INK2_DIST_SMOOTHER_BUFFER; i++)
1461 + result += ink->dt_buffer[i];
1463 + return (result / (gdouble) INK2_DIST_SMOOTHER_BUFFER);
1467 +dist_smoother_add (GimpInk2 *ink,
1470 + ink->dt_buffer[ink->dt_index++] = value;
1472 + if (ink->dt_index == INK2_DIST_SMOOTHER_BUFFER)
1473 + ink->dt_index = 0;
1476 +/**************************************************************/
1479 +hist_init(GimpInk2 * ink, GimpCoords* coords)
1481 + ink->hist_index = 0;
1482 + ink->hist_count = 0;
1484 + hist_add(ink, coords, 0);
1487 +#define HIST_IGNORE_THRESHOULD 0.0001
1490 +hist_add(GimpInk2 *ink, GimpCoords* coords, gdouble speed)
1494 + if (ink->hist_count > 0) {
1495 + gint prev_index = (ink->hist_index + INK2_HISTORY_BUFFER - 1) % INK2_HISTORY_BUFFER;
1496 + gdouble dist_x = coords->x - ink->hist_buffer[prev_index].x;
1497 + gdouble dist_y = coords->y - ink->hist_buffer[prev_index].y;
1498 + dist = sqrt(dist_x * dist_x + dist_y * dist_y);
1499 + if (dist < HIST_IGNORE_THRESHOULD)
1502 + ink->hist_buffer[ink->hist_index] = *coords;
1503 + ink->hist_dist_buffer[ink->hist_index] = speed;
1504 + ink->hist_index ++;
1506 + if (ink->hist_count < INK2_HISTORY_BUFFER)
1507 + ink->hist_count ++;
1509 + if (ink->hist_index == INK2_HISTORY_BUFFER)
1510 + ink->hist_index = 0;
1515 +hist_result(GimpInk2 *ink, GimpInk2Options* options)
1518 + GimpCoords result;
1519 + result.x = result.y = 0.0;
1520 + gdouble scale_sum = 0.0;
1522 + if (ink->hist_count > 0) {
1523 + gint max_hist_count = MIN(ink->hist_count, options->compensation_hist_size);
1524 + gint cur_index = (ink->hist_index + INK2_HISTORY_BUFFER - 1) % INK2_HISTORY_BUFFER;
1526 + gdouble gaussian_weight = 0.0;
1527 + gdouble gaussian_weight2 = SQR (options->compensation_rate_temperature);
1528 + gdouble velocity_sum = 0.0;
1530 + if (gaussian_weight2 != 0.0)
1531 + gaussian_weight = 1 / (sqrt (2 * PI) * options->compensation_rate_temperature);
1533 + for (i = 0; i < max_hist_count; i ++, cur_index --)
1536 + if (cur_index == -1)
1537 + cur_index = INK2_HISTORY_BUFFER - 1;
1539 + if (gaussian_weight2 != 0)
1541 + /* We use gaussian function with velocity as a window function */
1542 + velocity_sum += ink->hist_dist_buffer[cur_index];
1543 + rate = gaussian_weight * exp (-velocity_sum*velocity_sum / (2 * gaussian_weight2));
1544 + /* If i == 0 && rate == 0.0, resulting value becomes zero.
1545 + * To avoid this, we treat this as a special case.
1547 + if (i == 0 && rate == 0.0)
1552 + rate = (i == 0) ? 1.0 : 0.0;
1554 + scale_sum += rate;
1555 + result.x += rate * ink->hist_buffer[cur_index].x;
1556 + result.y += rate * ink->hist_buffer[cur_index].y;
1559 + if (scale_sum != 0.0)
1561 + result.x /= scale_sum;
1562 + result.y /= scale_sum;
1568 +/**************************************************************/
1570 +/*********************************/
1571 +/* Rendering functions */
1572 +/*********************************/
1574 +/* Some of this stuff should probably be combined with the
1575 + * code it was copied from in paint_core.c; but I wanted
1576 + * to learn this stuff, so I've kept it simple.
1578 + * The following only supports CONSTANT mode. Incremental
1579 + * would, I think, interact strangely with the way we
1580 + * do things. But it wouldn't be hard to implement at all.
1583 +enum { ROW_START, ROW_STOP };
1585 +/* The insertion sort here, for SUBSAMPLE = 8, tends to beat out
1586 + * qsort() by 4x with CFLAGS=-O2, 2x with CFLAGS=-g
1589 +insert_sort (gint *data,
1595 + for (i = 2; i < 2 * n; i += 2)
1598 + tmp2 = data[i + 1];
1600 + while (data[j] < tmp1)
1603 + for (k = i; k > j; k -= 2)
1605 + data[k] = data[k - 2];
1606 + data[k + 1] = data[k - 1];
1610 + data[j + 1] = tmp2;
1615 +fill_run (guchar *dest,
1621 + memset (dest, 255, w);
1627 + *dest = MAX (*dest, alpha);
1634 +render_blob_line (Blob *blob,
1640 + gint buf[4 * SUBSAMPLE];
1644 + gint current = 0; /* number of filled rows at this point
1645 + * in the scan line
1649 + /* Sort start and ends for all lines */
1651 + j = y * SUBSAMPLE - blob->y;
1652 + for (i = 0; i < SUBSAMPLE; i++)
1654 + if (j >= blob->height)
1657 + if ((j > 0) && (blob->data[j].left <= blob->data[j].right))
1659 + data[2 * n] = blob->data[j].left;
1660 + data[2 * n + 1] = ROW_START;
1661 + data[2 * SUBSAMPLE + 2 * n] = blob->data[j].right;
1662 + data[2 * SUBSAMPLE + 2 * n + 1] = ROW_STOP;
1668 + /* If we have less than SUBSAMPLE rows, compress */
1669 + if (n < SUBSAMPLE)
1671 + for (i = 0; i < 2 * n; i++)
1672 + data[2 * n + i] = data[2 * SUBSAMPLE + i];
1675 + /* Now count start and end separately */
1678 + insert_sort (data, n);
1680 + /* Discard portions outside of tile */
1682 + while ((n > 0) && (data[0] < SUBSAMPLE*x))
1684 + if (data[1] == ROW_START)
1692 + while ((n > 0) && (data[2*(n-1)] >= SUBSAMPLE*(x+width)))
1695 + /* Render the row */
1698 + for (i = 0; i < n;)
1700 + gint cur_x = data[2 * i] / SUBSAMPLE - x;
1703 + /* Fill in portion leading up to this pixel */
1704 + if (current && cur_x != last_x)
1705 + fill_run (dest + last_x, (255 * current) / SUBSAMPLE, cur_x - last_x);
1707 + /* Compute the value for this pixel */
1708 + pixel = current * SUBSAMPLE;
1712 + gint tmp_x = data[2 * i] / SUBSAMPLE;
1714 + if (tmp_x - x != cur_x)
1717 + if (data[2 * i + 1] == ROW_START)
1720 + pixel += ((tmp_x + 1) * SUBSAMPLE) - data[2 * i];
1725 + pixel -= ((tmp_x + 1) * SUBSAMPLE) - data[2 * i];
1731 + dest[cur_x] = MAX (dest[cur_x], (pixel * 255) / (SUBSAMPLE * SUBSAMPLE));
1733 + last_x = cur_x + 1;
1737 + fill_run (dest + last_x, (255 * current)/ SUBSAMPLE, width - last_x);
1741 +render_blob (Blob *blob,
1742 + PixelRegion *dest)
1749 + for (pr = pixel_regions_register (1, dest);
1751 + pr = pixel_regions_process (pr))
1756 + for (i=0; i<h; i++)
1758 + render_blob_line (blob, s,
1759 + dest->x, dest->y + i, dest->w);
1760 + s += dest->rowstride;
1764 --- gimp-2.6.6/app/paint/gimpink2.h 1970-01-01 09:00:00 +0900
1765 +++ gimp-painter--2.6.6-20100627/app/paint/gimpink2.h 2010-06-27 02:14:18 +0900
1767 +/* GIMP - The GNU Image Manipulation Program
1768 + * Copyright (C) 1995 Spencer Kimball and Peter Mattis
1770 + * This program is free software; you can redistribute it and/or modify
1771 + * it under the terms of the GNU General Public License as published by
1772 + * the Free Software Foundation; either version 2 of the License, or
1773 + * (at your option) any later version.
1775 + * This program is distributed in the hope that it will be useful,
1776 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1777 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1778 + * GNU General Public License for more details.
1780 + * You should have received a copy of the GNU General Public License
1781 + * along with this program; if not, write to the Free Software
1782 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1785 +#ifndef __GIMP_INK2_H__
1786 +#define __GIMP_INK2_H__
1789 +#include "gimppaintcore.h"
1790 +#include "gimpink-blob.h"
1793 +#define INK2_DIST_SMOOTHER_BUFFER 10
1794 +#define INK2_TIME_SMOOTHER_BUFFER 10
1795 +#define INK2_HISTORY_BUFFER 20
1798 +#define GIMP_TYPE_INK2 (gimp_ink2_get_type ())
1799 +#define GIMP_INK2(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_INK2, GimpInk2))
1800 +#define GIMP_INK2_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_INK2, GimpInk2Class))
1801 +#define GIMP_IS_INK2(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_INK2))
1802 +#define GIMP_IS_INK2_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_INK2))
1803 +#define GIMP_INK2_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_INK2, GimpInk2Class))
1806 +typedef struct _GimpInk2Class GimpInk2Class;
1810 + GimpPaintCore parent_instance;
1812 + Blob *start_blob; /* starting blob (for undo) */
1814 + Blob *cur_blob; /* current blob */
1815 + Blob *last_blob; /* blob for last cursor position */
1817 + /* circular distance history buffer */
1818 + gdouble dt_buffer[INK2_DIST_SMOOTHER_BUFFER];
1821 + /* circular timing history buffer */
1822 + guint32 ts_buffer[INK2_TIME_SMOOTHER_BUFFER];
1825 + GimpCoords hist_buffer[INK2_HISTORY_BUFFER];
1826 + gdouble hist_dist_buffer[INK2_HISTORY_BUFFER];
1830 + guint32 last_time; /* previous time of a motion event */
1832 + GimpCoords last_point; /* last compensated position */
1834 + gboolean init_velocity;
1837 +struct _GimpInk2Class
1839 + GimpPaintCoreClass parent_class;
1843 +void gimp_ink2_register (Gimp *gimp,
1844 + GimpPaintRegisterCallback callback);
1846 +GType gimp_ink2_get_type (void) G_GNUC_CONST;
1849 +#endif /* __GIMP_INK2_H__ */
1850 --- gimp-2.6.6/app/paint/gimpink2options.c 1970-01-01 09:00:00 +0900
1851 +++ gimp-painter--2.6.6-20100627/app/paint/gimpink2options.c 2010-06-27 02:14:18 +0900
1853 +/* GIMP - The GNU Image Manipulation Program
1854 + * Copyright (C) 1995 Spencer Kimball and Peter Mattis
1856 + * This program is free software; you can redistribute it and/or modify
1857 + * it under the terms of the GNU General Public License as published by
1858 + * the Free Software Foundation; either version 2 of the License, or
1859 + * (at your option) any later version.
1861 + * This program is distributed in the hope that it will be useful,
1862 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1863 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1864 + * GNU General Public License for more details.
1866 + * You should have received a copy of the GNU General Public License
1867 + * along with this program; if not, write to the Free Software
1868 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1871 +#include "config.h"
1873 +#include <glib-object.h>
1875 +#include "libgimpconfig/gimpconfig.h"
1877 +#include "paint-types.h"
1879 +#include "core/gimp.h"
1880 +#include "core/gimpdrawable.h"
1881 +#include "core/gimppaintinfo.h"
1883 +#include "gimpink2.h"
1884 +#include "gimpink2options.h"
1885 +#include "gimpink-blob.h"
1887 +#include "gimp-intl.h"
1895 + PROP_SIZE_SENSITIVITY,
1896 + PROP_VEL_SENSITIVITY,
1897 + PROP_TILT_SENSITIVITY,
1901 + PROP_COMPENSATION_HIST_SIZE,
1902 + PROP_COMPENSATE_AT_LAST,
1903 + PROP_COMPENSATION_RATE_TEMPERATURE,
1905 + PROP_MAX_COORD_SMOOTH
1909 +static void gimp_ink2_options_set_property (GObject *object,
1910 + guint property_id,
1911 + const GValue *value,
1912 + GParamSpec *pspec);
1913 +static void gimp_ink2_options_get_property (GObject *object,
1914 + guint property_id,
1916 + GParamSpec *pspec);
1919 +G_DEFINE_TYPE (GimpInk2Options, gimp_ink2_options, GIMP_TYPE_PAINT_OPTIONS)
1923 +gimp_ink2_options_class_init (GimpInk2OptionsClass *klass)
1925 + GObjectClass *object_class = G_OBJECT_CLASS (klass);
1927 + object_class->set_property = gimp_ink2_options_set_property;
1928 + object_class->get_property = gimp_ink2_options_get_property;
1930 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_SIZE,
1933 + GIMP_PARAM_STATIC_STRINGS);
1934 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_TILT_ANGLE,
1935 + "tilt-angle", NULL,
1937 + GIMP_PARAM_STATIC_STRINGS);
1939 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_SIZE_SENSITIVITY,
1940 + "size-sensitivity", NULL,
1942 + GIMP_PARAM_STATIC_STRINGS);
1943 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_VEL_SENSITIVITY,
1944 + "vel-sensitivity", NULL,
1946 + GIMP_PARAM_STATIC_STRINGS);
1947 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_TILT_SENSITIVITY,
1948 + "tilt-sensitivity", NULL,
1950 + GIMP_PARAM_STATIC_STRINGS);
1952 + GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_BLOB_TYPE,
1953 + "blob-type", NULL,
1954 + GIMP_TYPE_INK_BLOB_TYPE,
1955 + GIMP_INK_BLOB_TYPE_ELLIPSE,
1956 + GIMP_PARAM_STATIC_STRINGS);
1957 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_BLOB_ASPECT,
1958 + "blob-aspect", NULL,
1960 + GIMP_PARAM_STATIC_STRINGS);
1961 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_BLOB_ANGLE,
1962 + "blob-angle", NULL,
1964 + GIMP_PARAM_STATIC_STRINGS);
1966 + GIMP_CONFIG_INSTALL_PROP_INT (object_class, PROP_COMPENSATION_HIST_SIZE,
1967 + "compensation-history-size", NULL,
1968 + 1, INK2_HISTORY_BUFFER, MIN(20, INK2_HISTORY_BUFFER), 0);
1969 + GIMP_CONFIG_INSTALL_PROP_BOOLEAN(object_class, PROP_COMPENSATE_AT_LAST,
1970 + "compensate-at-last", NULL,
1972 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_COMPENSATION_RATE_TEMPERATURE,
1973 + "compensation-rate-temperature", NULL,
1977 + /* G-Pen uses the own smoothing routin, so disable the GimpDisplayShell's one */
1978 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_MAX_COORD_SMOOTH,
1979 + "ink2-max-coord-smooth", NULL,
1981 + GIMP_PARAM_STATIC_STRINGS);
1983 + g_object_class_override_property (object_class, PROP_MAX_COORD_SMOOTH, "paint-max-coord-smooth");
1987 +gimp_ink2_options_init (GimpInk2Options *options)
1992 +gimp_ink2_options_set_property (GObject *object,
1993 + guint property_id,
1994 + const GValue *value,
1995 + GParamSpec *pspec)
1997 + GimpInk2Options *options = GIMP_INK2_OPTIONS (object);
1999 + switch (property_id)
2002 + options->size = g_value_get_double (value);
2004 + case PROP_TILT_ANGLE:
2005 + options->tilt_angle = g_value_get_double (value);
2007 + case PROP_SIZE_SENSITIVITY:
2008 + options->size_sensitivity = g_value_get_double (value);
2010 + case PROP_VEL_SENSITIVITY:
2011 + options->vel_sensitivity = g_value_get_double (value);
2013 + case PROP_TILT_SENSITIVITY:
2014 + options->tilt_sensitivity = g_value_get_double (value);
2016 + case PROP_BLOB_TYPE:
2017 + options->blob_type = g_value_get_enum (value);
2019 + case PROP_BLOB_ASPECT:
2020 + options->blob_aspect = g_value_get_double (value);
2022 + case PROP_BLOB_ANGLE:
2023 + options->blob_angle = g_value_get_double (value);
2025 + case PROP_COMPENSATION_HIST_SIZE:
2026 + options->compensation_hist_size = g_value_get_int (value);
2028 + case PROP_COMPENSATE_AT_LAST:
2029 + options->compensate_at_last = g_value_get_boolean (value);
2031 + case PROP_COMPENSATION_RATE_TEMPERATURE:
2032 + options->compensation_rate_temperature = g_value_get_double (value);
2035 + case PROP_MAX_COORD_SMOOTH:
2036 + GIMP_TOOL_OPTIONS (options)->max_coord_smooth = g_value_get_double (value);
2040 + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
2046 +gimp_ink2_options_get_property (GObject *object,
2047 + guint property_id,
2049 + GParamSpec *pspec)
2051 + GimpInk2Options *options = GIMP_INK2_OPTIONS (object);
2053 + switch (property_id)
2056 + g_value_set_double (value, options->size);
2058 + case PROP_TILT_ANGLE:
2059 + g_value_set_double (value, options->tilt_angle);
2061 + case PROP_SIZE_SENSITIVITY:
2062 + g_value_set_double (value, options->size_sensitivity);
2064 + case PROP_VEL_SENSITIVITY:
2065 + g_value_set_double (value, options->vel_sensitivity);
2067 + case PROP_TILT_SENSITIVITY:
2068 + g_value_set_double (value, options->tilt_sensitivity);
2070 + case PROP_BLOB_TYPE:
2071 + g_value_set_enum (value, options->blob_type);
2073 + case PROP_BLOB_ASPECT:
2074 + g_value_set_double (value, options->blob_aspect);
2076 + case PROP_BLOB_ANGLE:
2077 + g_value_set_double (value, options->blob_angle);
2079 + case PROP_COMPENSATION_HIST_SIZE:
2080 + g_value_set_int (value, options->compensation_hist_size);
2082 + case PROP_COMPENSATE_AT_LAST:
2083 + g_value_set_boolean (value, options->compensate_at_last);
2085 + case PROP_COMPENSATION_RATE_TEMPERATURE:
2086 + g_value_set_double (value, options->compensation_rate_temperature);
2089 + case PROP_MAX_COORD_SMOOTH:
2090 + g_value_set_double (value, GIMP_TOOL_OPTIONS (options)->max_coord_smooth);
2094 + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
2098 --- gimp-2.6.6/app/paint/gimpink2options.h 1970-01-01 09:00:00 +0900
2099 +++ gimp-painter--2.6.6-20100627/app/paint/gimpink2options.h 2010-06-27 02:14:18 +0900
2101 +/* GIMP - The GNU Image Manipulation Program
2102 + * Copyright (C) 1995 Spencer Kimball and Peter Mattis
2104 + * This program is free software; you can redistribute it and/or modify
2105 + * it under the terms of the GNU General Public License as published by
2106 + * the Free Software Foundation; either version 2 of the License, or
2107 + * (at your option) any later version.
2109 + * This program is distributed in the hope that it will be useful,
2110 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2111 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2112 + * GNU General Public License for more details.
2114 + * You should have received a copy of the GNU General Public License
2115 + * along with this program; if not, write to the Free Software
2116 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2119 +#ifndef __GIMP_INK2_OPTIONS_H__
2120 +#define __GIMP_INK2_OPTIONS_H__
2123 +#include "gimppaintoptions.h"
2126 +#define GIMP_TYPE_INK2_OPTIONS (gimp_ink2_options_get_type ())
2127 +#define GIMP_INK2_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_INK2_OPTIONS, GimpInk2Options))
2128 +#define GIMP_INK2_OPTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_INK2_OPTIONS, GimpInk2OptionsClass))
2129 +#define GIMP_IS_INK2_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_INK2_OPTIONS))
2130 +#define GIMP_IS_INK2_OPTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_INK2_OPTIONS))
2131 +#define GIMP_INK2_OPTIONS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_INK2_OPTIONS, GimpInk2OptionsClass))
2134 +typedef struct _GimpInk2OptionsClass GimpInk2OptionsClass;
2136 +struct _GimpInk2Options
2138 + GimpPaintOptions parent_instance;
2141 + gdouble tilt_angle;
2143 + gdouble size_sensitivity;
2144 + gdouble vel_sensitivity;
2145 + gdouble tilt_sensitivity;
2147 + GimpInkBlobType blob_type;
2148 + gdouble blob_aspect;
2149 + gdouble blob_angle;
2151 + gint compensation_hist_size;
2152 + gboolean compensate_at_last;
2153 + gdouble compensation_rate_temperature;
2156 +struct _GimpInk2OptionsClass
2158 + GimpPaintOptionsClass parent_instance;
2162 +GType gimp_ink2_options_get_type (void) G_GNUC_CONST;
2165 +#endif /* __GIMP_INK2_OPTIONS_H__ */
2166 --- gimp-2.6.6/app/paint/gimpink2undo.c 1970-01-01 09:00:00 +0900
2167 +++ gimp-painter--2.6.6-20100627/app/paint/gimpink2undo.c 2010-06-27 02:14:18 +0900
2169 +/* GIMP - The GNU Image Manipulation Program
2170 + * Copyright (C) 1995 Spencer Kimball and Peter Mattis
2172 + * This program is free software; you can redistribute it and/or modify
2173 + * it under the terms of the GNU General Public License as published by
2174 + * the Free Software Foundation; either version 2 of the License, or
2175 + * (at your option) any later version.
2177 + * This program is distributed in the hope that it will be useful,
2178 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2179 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2180 + * GNU General Public License for more details.
2182 + * You should have received a copy of the GNU General Public License
2183 + * along with this program; if not, write to the Free Software
2184 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2187 +#include "config.h"
2189 +#include <string.h>
2191 +#include <glib-object.h>
2193 +#include "paint-types.h"
2195 +#include "gimpink2.h"
2196 +#include "gimpink-blob.h"
2197 +#include "gimpink2undo.h"
2200 +static GObject * gimp_ink2_undo_constructor (GType type,
2202 + GObjectConstructParam *params);
2204 +static void gimp_ink2_undo_pop (GimpUndo *undo,
2205 + GimpUndoMode undo_mode,
2206 + GimpUndoAccumulator *accum);
2207 +static void gimp_ink2_undo_free (GimpUndo *undo,
2208 + GimpUndoMode undo_mode);
2211 +G_DEFINE_TYPE (GimpInk2Undo, gimp_ink2_undo, GIMP_TYPE_PAINT_CORE_UNDO)
2213 +#define parent_class gimp_ink2_undo_parent_class
2217 +gimp_ink2_undo_class_init (GimpInk2UndoClass *klass)
2219 + GObjectClass *object_class = G_OBJECT_CLASS (klass);
2220 + GimpUndoClass *undo_class = GIMP_UNDO_CLASS (klass);
2222 + object_class->constructor = gimp_ink2_undo_constructor;
2224 + undo_class->pop = gimp_ink2_undo_pop;
2225 + undo_class->free = gimp_ink2_undo_free;
2229 +gimp_ink2_undo_init (GimpInk2Undo *undo)
2234 +gimp_ink2_undo_constructor (GType type,
2236 + GObjectConstructParam *params)
2239 + GimpInk2Undo *ink_undo;
2242 + object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params);
2244 + ink_undo = GIMP_INK2_UNDO (object);
2246 + g_assert (GIMP_IS_INK2 (GIMP_PAINT_CORE_UNDO (ink_undo)->paint_core));
2248 + ink = GIMP_INK2 (GIMP_PAINT_CORE_UNDO (ink_undo)->paint_core);
2250 + if (ink->start_blob)
2251 + ink_undo->last_blob = blob_duplicate (ink->start_blob);
2257 +gimp_ink2_undo_pop (GimpUndo *undo,
2258 + GimpUndoMode undo_mode,
2259 + GimpUndoAccumulator *accum)
2261 + GimpInk2Undo *ink_undo = GIMP_INK2_UNDO (undo);
2263 + GIMP_UNDO_CLASS (parent_class)->pop (undo, undo_mode, accum);
2265 + if (GIMP_PAINT_CORE_UNDO (ink_undo)->paint_core)
2267 + GimpInk2 *ink = GIMP_INK2 (GIMP_PAINT_CORE_UNDO (ink_undo)->paint_core);
2270 + tmp_blob = ink->last_blob;
2271 + ink->last_blob = ink_undo->last_blob;
2272 + ink_undo->last_blob = tmp_blob;
2277 +gimp_ink2_undo_free (GimpUndo *undo,
2278 + GimpUndoMode undo_mode)
2280 + GimpInk2Undo *ink_undo = GIMP_INK2_UNDO (undo);
2282 + if (ink_undo->last_blob)
2284 + g_free (ink_undo->last_blob);
2285 + ink_undo->last_blob = NULL;
2288 + GIMP_UNDO_CLASS (parent_class)->free (undo, undo_mode);
2290 --- gimp-2.6.6/app/paint/gimpink2undo.h 1970-01-01 09:00:00 +0900
2291 +++ gimp-painter--2.6.6-20100627/app/paint/gimpink2undo.h 2010-06-27 02:14:18 +0900
2293 +/* GIMP - The GNU Image Manipulation Program
2294 + * Copyright (C) 1995 Spencer Kimball and Peter Mattis
2296 + * This program is free software; you can redistribute it and/or modify
2297 + * it under the terms of the GNU General Public License as published by
2298 + * the Free Software Foundation; either version 2 of the License, or
2299 + * (at your option) any later version.
2301 + * This program is distributed in the hope that it will be useful,
2302 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2303 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2304 + * GNU General Public License for more details.
2306 + * You should have received a copy of the GNU General Public License
2307 + * along with this program; if not, write to the Free Software
2308 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2311 +#ifndef __GIMP_INK2_UNDO_H__
2312 +#define __GIMP_INK2_UNDO_H__
2315 +#include "gimppaintcoreundo.h"
2316 +#include "gimpink2.h"
2319 +#define GIMP_TYPE_INK2_UNDO (gimp_ink2_undo_get_type ())
2320 +#define GIMP_INK2_UNDO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_INK2_UNDO, GimpInk2Undo))
2321 +#define GIMP_INK2_UNDO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_INK2_UNDO, GimpInk2UndoClass))
2322 +#define GIMP_IS_INK2_UNDO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_INK2_UNDO))
2323 +#define GIMP_IS_INK2_UNDO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_INK2_UNDO))
2324 +#define GIMP_INK2_UNDO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_INK2_UNDO, GimpInk2UndoClass))
2327 +typedef struct _GimpInk2UndoClass GimpInk2UndoClass;
2329 +struct _GimpInk2Undo
2331 + GimpPaintCoreUndo parent_instance;
2336 +struct _GimpInk2UndoClass
2338 + GimpPaintCoreUndoClass parent_class;
2342 +GType gimp_ink2_undo_get_type (void) G_GNUC_CONST;
2345 +#endif /* __GIMP_INK2_UNDO_H__ */
2346 --- gimp-2.6.6/app/paint/gimpmixbrush.c 1970-01-01 09:00:00 +0900
2347 +++ gimp-painter--2.6.6-20100627/app/paint/gimpmixbrush.c 2010-06-27 02:14:18 +0900
2349 +/* GIMP - The GNU Image Manipulation Program
2350 + * Copyright (C) 1995 Spencer Kimball and Peter Mattis
2352 + * This program is free software; you can redistribute it and/or modify
2353 + * it under the terms of the GNU General Public License as published by
2354 + * the Free Software Foundation; either version 2 of the License, or
2355 + * (at your option) any later version.
2357 + * This program is distributed in the hope that it will be useful,
2358 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2359 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2360 + * GNU General Public License for more details.
2362 + * You should have received a copy of the GNU General Public License
2363 + * along with this program; if not, write to the Free Software
2364 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2368 +#include "config.h"
2370 +#include <glib-object.h>
2372 +#include "libgimpcolor/gimpcolor.h"
2373 +#include "libgimpmath/gimpmath.h"
2374 +#include "libgimpbase/gimpbase.h"
2376 +#include "paint-types.h"
2378 +#include "base/pixel-region.h"
2379 +#include "base/temp-buf.h"
2381 +#include "base/pixel-processor.h"
2383 +#include "paint-funcs/paint-funcs.h"
2385 +#include "core/gimp.h"
2386 +#include "core/gimpbrush.h"
2387 +#include "core/gimpchannel.h"
2388 +#include "core/gimpdrawable.h"
2389 +#include "core/gimplayer.h"
2390 +#include "core/gimpgradient.h"
2391 +#include "core/gimppattern.h"
2392 +#include "core/gimpimage.h"
2393 +#include "core/gimppickable.h"
2394 +#include "core/gimpprojection.h"
2396 +#include "gimpmixbrush.h"
2397 +#include "gimpmixbrushoptions.h"
2399 +#ifdef GIMP_MIXBRUSH_COMPOSITE
2400 +#include "gimpmixbrush-composite.h"
2403 +#include "gimp-intl.h"
2406 +/* Coords history */
2408 +typedef struct _CoordsHistory
2410 + GimpCoords coords;
2411 + GimpCoords prev_coords;
2412 + gdouble pixel_dist;
2419 +/* Params of composite functions */
2421 +typedef struct _CompositeDabParam
2423 + GimpRGB paint_color;
2424 + GimpRGB _paint_color;
2426 + gdouble adjusted_opacity;
2432 + gdouble fringe_contrast;
2433 + gdouble fringe_contrast_offset;
2435 + gint texture_jitter_x;
2436 + gint texture_jitter_y;
2438 + gboolean has_alpha;
2439 + gboolean active_components[MAX_CHANNELS];
2441 + guchar *texture_data;
2442 + gint texture_bytes;
2443 + gint texture_width;
2444 + gint texture_height;
2445 + gint texture_stride;
2446 +} CompositeDabParam;
2449 +static void gimp_mixbrush_finalize (GObject *object);
2451 +static void gimp_mixbrush_paint (GimpPaintCore *paint_core,
2452 + GimpDrawable *drawable,
2453 + GimpPaintOptions *paint_options,
2454 + GimpPaintState paint_state,
2457 +static void gimp_mixbrush_motion (GimpPaintCore *paint_core,
2458 + GimpDrawable *drawable,
2459 + GimpPaintOptions *paint_options);
2461 +static void gimp_mixbrush_start (GimpPaintCore *paint_core,
2462 + GimpDrawable *drawable,
2463 + GimpPaintOptions *paint_options);
2465 +static void gimp_mixbrush_finish (GimpPaintCore *paint_core,
2466 + GimpDrawable *drawable,
2467 + GimpPaintOptions *paint_options);
2470 +static void gimp_mixbrush_paste_canvas (GimpPaintCore *paint_core,
2471 + GimpDrawable *drawable,
2472 + GimpPaintOptions *paint_options);
2474 +static void coords_history_free (CoordsHistory *history,
2477 +static inline gboolean get_canvas_color (GimpImage *image,
2478 + GimpDrawable *drawable,
2479 + GimpPaintCore *paint_core,
2482 + guint sample_size_limit,
2486 +static inline gboolean pick_up_avarage_color (GimpPickable *pickable,
2487 + GimpBrushCore *brush_core,
2493 +static inline void color_to_alpha (GimpRGB *src,
2494 + const GimpRGB *color);
2496 +static inline void composite_rgba (const GimpRGB *color1,
2498 + const GimpRGB *color2,
2501 + gboolean use_alt_alpha_op);
2503 +static inline void blend_rgba (const GimpRGB *color1,
2505 + const GimpRGB *color2,
2508 + gboolean use_alt_alpha_op);
2510 +static inline void calc_pressure_params (PressureParams *params,
2516 +static inline gdouble calc_pressure (gdouble value,
2517 + PressureParams *params);
2519 +#ifndef GIMP_MIXBRUSH_COMPOSITE
2520 +void paste_canvas (GimpPaintCore *core,
2521 + GimpDrawable *drawable,
2522 + GimpPattern *texture,
2523 + GimpRGB *paint_color,
2525 + GimpBrushApplicationMode hardness_mode,
2528 + gdouble fringe_contrast,
2531 + GimpUpdateFreqOptions *update_freq_options);
2533 +static void composite_dab (CompositeDabParam *params,
2534 + PixelRegion *srcPR,
2535 + PixelRegion *maskPR);
2537 +static void composite_textured_dab (CompositeDabParam *params,
2538 + PixelRegion *srcPR,
2539 + PixelRegion *maskPR);
2541 +static void composite_dab_selection (CompositeDabParam *params,
2542 + PixelRegion *srcPR,
2543 + PixelRegion *maskPR,
2544 + PixelRegion *selPR);
2546 +static void composite_textured_dab_selection (CompositeDabParam *params,
2547 + PixelRegion *srcPR,
2548 + PixelRegion *maskPR,
2549 + PixelRegion *selPR);
2554 +G_DEFINE_TYPE (GimpMixbrush, gimp_mixbrush, GIMP_TYPE_PAINTBRUSH)
2556 +#define parent_class gimp_mixbrush_parent_class
2560 +gimp_mixbrush_register (Gimp *gimp,
2561 + GimpPaintRegisterCallback callback)
2563 + (* callback) (gimp,
2564 + GIMP_TYPE_MIXBRUSH,
2565 + GIMP_TYPE_MIXBRUSH_OPTIONS,
2568 + "gimp-tool-mixbrush");
2572 +gimp_mixbrush_class_init (GimpMixbrushClass *klass)
2574 + GimpPaintCoreClass *paint_core_class = GIMP_PAINT_CORE_CLASS (klass);
2575 + GimpBrushCoreClass *brush_core_class = GIMP_BRUSH_CORE_CLASS (klass);
2577 + paint_core_class->paint = gimp_mixbrush_paint;
2578 + G_OBJECT_CLASS (klass)->finalize = gimp_mixbrush_finalize;
2580 + brush_core_class->handles_changing_brush = TRUE;
2584 +gimp_mixbrush_init (GimpMixbrush *mixbrush)
2586 + mixbrush->history = NULL;
2587 + mixbrush->mask = NULL;
2589 +#ifdef GIMP_MIXBRUSH_COMPOSITE
2590 + gimp_mixbrush_composite_init ();
2595 +gimp_mixbrush_finalize (GObject *object)
2597 + GimpMixbrush *mixbrush = GIMP_MIXBRUSH (object);
2599 + if (mixbrush->history) {
2600 + g_list_foreach (mixbrush->history, (GFunc)coords_history_free, NULL);
2601 + g_list_free (mixbrush->history);
2603 + if (mixbrush->mask)
2604 + temp_buf_free (mixbrush->mask);
2606 + G_OBJECT_CLASS (parent_class)->finalize (object);
2610 +gimp_mixbrush_paint (GimpPaintCore *paint_core,
2611 + GimpDrawable *drawable,
2612 + GimpPaintOptions *paint_options,
2613 + GimpPaintState paint_state,
2618 + static gdouble total_time = 0;
2619 + static guint count = 0;
2621 + switch (paint_state)
2623 + case GIMP_PAINT_STATE_INIT:
2628 + gimp_mixbrush_start (paint_core, drawable, paint_options);
2629 + GIMP_PAINT_CORE_CLASS (parent_class)->paint (paint_core, drawable,
2631 + paint_state, time);
2634 + case GIMP_PAINT_STATE_MOTION:
2636 + timer = g_timer_new ();
2637 + g_timer_start (timer);
2638 + gimp_mixbrush_motion (paint_core, drawable, paint_options);
2639 + g_timer_stop (timer);
2640 + total_time += g_timer_elapsed (timer, NULL);
2641 + g_timer_destroy (timer);
2644 + gimp_mixbrush_motion (paint_core, drawable, paint_options);
2648 + case GIMP_PAINT_STATE_FINISH:
2650 + g_printerr ("average time:%f\n", total_time / count);
2652 + gimp_mixbrush_finish (paint_core, drawable, paint_options);
2653 + GIMP_PAINT_CORE_CLASS (parent_class)->paint (paint_core, drawable,
2655 + paint_state, time);
2664 +gimp_mixbrush_start (GimpPaintCore *paint_core,
2665 + GimpDrawable *drawable,
2666 + GimpPaintOptions *paint_options)
2668 + GimpMixbrush *mixbrush = GIMP_MIXBRUSH (paint_core);
2669 + GimpMixbrushOptions *mixbrush_options = GIMP_MIXBRUSH_OPTIONS (paint_options);
2671 + guchar color_uchar[MAX_CHANNELS];
2673 + image = gimp_item_get_image (GIMP_ITEM (drawable));
2675 + mixbrush->use_alt_alpha_op =
2676 + (mixbrush_options->alpha_channel_mixing && gimp_drawable_has_alpha (drawable));
2678 + /* Init the pressure params */
2679 + calc_pressure_params (&mixbrush->pr_texture_grain,
2680 + mixbrush_options->texture_options->grain_pressure_in1,
2681 + mixbrush_options->texture_options->grain_pressure_in2,
2682 + mixbrush_options->texture_options->grain_pressure_out1,
2683 + mixbrush_options->texture_options->grain_pressure_out2);
2684 + calc_pressure_params (&mixbrush->pr_main_density,
2685 + mixbrush_options->main_color_density_pressure_in1,
2686 + mixbrush_options->main_color_density_pressure_in2,
2687 + mixbrush_options->main_color_density_pressure_out1,
2688 + mixbrush_options->main_color_density_pressure_out2);
2689 + calc_pressure_params (&mixbrush->pr_main_rate,
2690 + mixbrush_options->main_color_pressure_in1,
2691 + mixbrush_options->main_color_pressure_in2,
2692 + mixbrush_options->main_color_pressure_out1,
2693 + mixbrush_options->main_color_pressure_out2);
2694 + calc_pressure_params (&mixbrush->pr_canvas_density,
2695 + mixbrush_options->canvas_color_density_pressure_in1,
2696 + mixbrush_options->canvas_color_density_pressure_in2,
2697 + mixbrush_options->canvas_color_density_pressure_out1,
2698 + mixbrush_options->canvas_color_density_pressure_out2);
2699 + calc_pressure_params (&mixbrush->pr_canvas_rate,
2700 + mixbrush_options->canvas_color_pressure_in1,
2701 + mixbrush_options->canvas_color_pressure_in2,
2702 + mixbrush_options->canvas_color_pressure_out1,
2703 + mixbrush_options->canvas_color_pressure_out2);
2705 + /* Get the index of the alpha component */
2706 + switch (gimp_drawable_type_without_alpha (drawable))
2709 + mixbrush->alpha_pix = ALPHA_PIX;
2712 + mixbrush->alpha_pix = ALPHA_G_PIX;
2714 + case GIMP_INDEXED:
2716 + mixbrush->alpha_pix = ALPHA_I_PIX;
2719 + /* Setup the paint(foreground) color */
2720 + gimp_image_get_foreground (image, GIMP_CONTEXT (paint_options),
2721 + gimp_drawable_type (drawable),
2724 + if (mixbrush->alpha_pix == ALPHA_PIX)
2725 + gimp_rgba_set_uchar (&mixbrush->paint_color,
2731 + gimp_rgba_set_uchar (&mixbrush->paint_color,
2737 + mixbrush->paint_color.a = 1.0;
2739 + /* Setup the last color */
2740 + if (mixbrush->use_alt_alpha_op)
2742 + get_canvas_color (image, drawable, paint_core,
2743 + (gint) paint_core->cur_coords.x, (gint) paint_core->cur_coords.y,
2744 + mixbrush_options->sample_size_limit,
2745 + mixbrush_options->merged,
2746 + &mixbrush->last_color);
2747 + mixbrush->last_color.a *= mixbrush_options->canvas_color_density *
2748 + calc_pressure (paint_core->cur_coords.pressure, &mixbrush->pr_canvas_density);
2751 + mixbrush->last_color.a = 0.0;
2753 + /* Setup the hidden color */
2754 + mixbrush->hidden_color.a = 0.0;
2756 + if (gimp_drawable_has_alpha (drawable))
2758 + switch (mixbrush_options->hidden_color)
2760 + case GIMP_HIDDEN_COLOR_WHITE:
2761 + gimp_rgba_set (&mixbrush->hidden_color, 1.0, 1.0, 1.0, 1.0);
2763 + case GIMP_HIDDEN_COLOR_BACKGROUND:
2764 + gimp_image_get_background (image, GIMP_CONTEXT (paint_options),
2765 + gimp_drawable_type (drawable),
2768 + gimp_rgba_set_uchar (&mixbrush->hidden_color,
2774 + mixbrush->hidden_color.a = 1.0;
2779 + /* Reset the rounding error */
2780 + gimp_rgba_set (&mixbrush->error, 0, 0, 0, 0);
2784 +gimp_mixbrush_finish (GimpPaintCore *paint_core,
2785 + GimpDrawable *drawable,
2786 + GimpPaintOptions *paint_options)
2788 + GimpMixbrush *mixbrush = GIMP_MIXBRUSH (paint_core);
2790 + if (!(GIMP_MIXBRUSH_OPTIONS (paint_options)->tail) && mixbrush->history)
2792 + g_list_foreach (mixbrush->history, (GFunc)coords_history_free, NULL);
2793 + g_list_free (mixbrush->history);
2794 + mixbrush->history = NULL;
2797 + while (mixbrush->history)
2798 + gimp_mixbrush_paste_canvas (paint_core, drawable, paint_options);
2800 + if (mixbrush->mask)
2802 + temp_buf_free (mixbrush->mask);
2803 + mixbrush->mask = NULL;
2808 +gimp_mixbrush_motion (GimpPaintCore *paint_core,
2809 + GimpDrawable *drawable,
2810 + GimpPaintOptions *paint_options)
2813 + GimpMixbrush *mixbrush = GIMP_MIXBRUSH (paint_core);
2814 + GimpMixbrushOptions *mixbrush_options = GIMP_MIXBRUSH_OPTIONS (paint_options);
2815 + CoordsHistory *history;
2816 + gdouble opacity = GIMP_OPACITY_OPAQUE;
2818 + image = gimp_item_get_image (GIMP_ITEM (drawable));
2820 + opacity *= gimp_paint_options_get_fade (paint_options, image,
2821 + paint_core->pixel_dist);
2823 + /* Add history item */
2824 + history = g_new (CoordsHistory, 1);
2825 + history->coords = paint_core->cur_coords;
2826 + history->prev_coords = paint_core->last_coords;
2827 + history->pixel_dist = paint_core->pixel_dist;
2829 + /* Pick up the raw canvas color */
2830 + get_canvas_color (image, drawable, paint_core,
2831 + (gint) history->coords.x, (gint) history->coords.y,
2832 + mixbrush_options->sample_size_limit,
2833 + mixbrush_options->merged,
2836 + history->opacity = opacity;
2838 + mixbrush->history = g_list_append (mixbrush->history, history);
2840 + /* Process a history item */
2841 + if (g_list_length (mixbrush->history) > mixbrush_options->delay)
2842 + gimp_mixbrush_paste_canvas (paint_core, drawable, paint_options);
2846 +gimp_mixbrush_paste_canvas (GimpPaintCore *paint_core,
2847 + GimpDrawable *drawable,
2848 + GimpPaintOptions *paint_options)
2850 + GimpBrushCore *brush_core = GIMP_BRUSH_CORE (paint_core);
2851 + GimpContext *context = GIMP_CONTEXT (paint_options);
2852 + GimpDynamicOptions *pressure_options = paint_options->pressure_options;
2855 + GimpMixbrush *mixbrush = GIMP_MIXBRUSH (paint_core);
2856 + GimpRGB *last_color = &mixbrush->last_color;
2857 + GimpMixbrushOptions *mixbrush_options = GIMP_MIXBRUSH_OPTIONS (paint_options);
2858 + GimpPaintApplicationMode paint_appl_mode;
2859 + CoordsHistory *history;
2860 + GimpCoords orig_coords;
2861 + GimpCoords prev_coords;
2863 + if (mixbrush->history == NULL)
2866 + history = mixbrush->history->data;
2867 + mixbrush->history = g_list_delete_link (mixbrush->history, mixbrush->history);
2869 + if (history->opacity != 0.0)
2871 + image = gimp_item_get_image (GIMP_ITEM (drawable));
2873 + paint_appl_mode = paint_options->application_mode;
2875 + orig_coords = paint_core->cur_coords;
2876 + prev_coords = paint_core->last_coords;
2877 + paint_core->cur_coords = history->coords;
2878 + paint_core->last_coords = history->prev_coords;
2879 + area = gimp_paint_core_get_paint_area (paint_core, drawable, paint_options);
2882 + guchar color_uchar[MAX_CHANNELS];
2883 + GimpRGB main_color, canvas_color;
2884 + gdouble main_op, canvas_op;
2886 + /* Init the main color */
2887 + if (!gimp_paint_options_get_gradient_color (paint_options, image,
2888 + paint_core->cur_coords.pressure,
2889 + paint_core->pixel_dist,
2891 + main_color = mixbrush->paint_color;
2893 + /* Blend the main color and last color */
2894 + main_op = CLAMP (mixbrush_options->main_color_rate *
2895 + calc_pressure (paint_core->cur_coords.pressure, &mixbrush->pr_main_rate),
2898 + /*if (mixbrush_options->alpha_channel_mixing)
2899 + blend_rgba (&main_color, main_op,
2900 + last_color, 1.0 - main_op,
2901 + &main_color, FALSE);
2903 + composite_rgba (&main_color, main_op,
2905 + &main_color, FALSE);*/
2906 + composite_rgba (&main_color, main_op,
2908 + &main_color, FALSE);
2910 + /* Pick up the covered canvas color */
2911 + get_canvas_color (image, drawable, paint_core,
2912 + (gint) paint_core->cur_coords.x, (gint) paint_core->cur_coords.y,
2913 + mixbrush_options->sample_size_limit,
2914 + mixbrush_options->merged,
2917 + /* Blend the covered canvas color and the raw canvas color */
2918 + canvas_op = CLAMP (mixbrush_options->canvas_color_rate *
2919 + calc_pressure (paint_core->cur_coords.pressure, &mixbrush->pr_canvas_rate),
2922 + /*if (mixbrush_options->alpha_channel_mixing)
2923 + blend_rgba (&canvas_color, canvas_op,
2924 + &history->color, 1.0 - canvas_op,
2925 + &canvas_color, FALSE);
2927 + composite_rgba (&canvas_color, canvas_op,
2928 + &history->color, 1.0,
2929 + &canvas_color, FALSE);*/
2930 + blend_rgba (&canvas_color, canvas_op,
2931 + &history->color, 1.0 - canvas_op,
2932 + &canvas_color, TRUE/*FALSE*/);
2934 + /* Correct the rounding error came from the last process */
2935 + gimp_rgba_add (&canvas_color, &mixbrush->error);
2937 + /* Put the hidden color below the canvas color */
2938 + if (mixbrush->hidden_color.a > 0.0)
2939 + composite_rgba (&canvas_color, 1.0, &mixbrush->hidden_color, 1.0, &canvas_color, FALSE);
2942 + /* Blend the main color and the canvas color */
2943 + main_op = mixbrush_options->main_color_density;
2945 + main_op *= calc_pressure (paint_core->cur_coords.pressure, &mixbrush->pr_main_density);
2947 + if (mixbrush_options->dryout > 0)
2948 + main_op *= 1.0 - MIN (paint_core->pixel_dist / mixbrush_options->dryout, 1.0);
2950 + canvas_op = mixbrush_options->canvas_color_density;
2952 + canvas_op *= calc_pressure (paint_core->cur_coords.pressure, &mixbrush->pr_canvas_density);
2954 + /* If the canvas color is transparent, assume that *
2955 + * the main color and the hidden color are same.
2956 + if (canvas_color.a == 0.0)
2957 + gimp_rgb_set (&canvas_color, main_color.r, main_color.g, main_color.b);*/
2959 + main_op = CLAMP (main_op, 0.0, 1.0);
2960 + canvas_op = CLAMP (canvas_op, 0.0, 1.0);
2962 +//g_printerr ("m:%f, %f, %f %f\n",canvas_color.r,canvas_color.g,canvas_color.b,canvas_color.a);
2963 +//g_printerr ("l:%f, %f, %f %f\n",history->color.r,history->color.g,history->color.b,history->color.a);
2964 + if (mixbrush_options->pigment)
2965 + composite_rgba (&main_color, main_op, &canvas_color, canvas_op,
2966 + last_color, /*FALSE*/mixbrush->use_alt_alpha_op);
2968 + blend_rgba (&main_color, main_op, &canvas_color, canvas_op,
2969 + last_color, /*FALSE*/mixbrush->use_alt_alpha_op);
2970 +//g_printerr ("r:%f, %f, %f %f\n\n",canvas_color.r,canvas_color.g,canvas_color.b,canvas_color.a);
2973 + if (mixbrush_options->remove_color &&
2974 + gimp_drawable_type_without_alpha (drawable) == GIMP_RGB_IMAGE)
2976 + /* Remove color */
2977 + GimpRGB color1, color2;
2978 + guchar paint_color[4];
2980 + gimp_rgba_set_uchar (&color1,
2981 + color[0], color[1], color[2], OPAQUE_OPACITY);
2982 + gimp_rgba_set_uchar (&color2,
2983 + hidden_color[0], hidden_color[1], hidden_color[2], OPAQUE_OPACITY);
2985 + color_to_alpha (&color1, &color2);
2987 + history->opacity *= color1.a;
2989 + gimp_rgba_get_uchar (&color1,
2990 + &paint_color[0], &paint_color[1], &paint_color[2], &paint_color[3]);
2991 + paint_color[mixbrush->alpha_pix] = OPAQUE_OPACITY;
2993 + color_pixels (temp_buf_data (area), paint_color,
2994 + area->width * area->height,
2999 + color[mixbrush->alpha_pix] = OPAQUE_OPACITY;
3001 + color_pixels (temp_buf_data (area), color,
3002 + area->width * area->height,
3010 + history->opacity *= gimp_paint_options_get_dynamic_opacity (paint_options,
3011 + &paint_core->cur_coords);
3013 + history->hardness = gimp_paint_options_get_dynamic_hardness (paint_options,
3014 + &paint_core->cur_coords);
3016 + /* finally, let the brush core paste the colored area on the canvas */
3017 + if (mixbrush_options->alpha_channel_mixing &&
3018 + paint_appl_mode == GIMP_PAINT_INCREMENTAL)
3020 + gdouble op = MIN (history->opacity, GIMP_OPACITY_OPAQUE) * gimp_context_get_opacity (context);
3021 + gdouble grain = 0.0;
3022 + GimpPattern *texture = NULL;
3024 + if (mixbrush_options->texture_options->use_texture)
3026 + grain = mixbrush_options->texture_options->grain;
3027 + grain = -1.0 + (grain + 1.0) * calc_pressure (paint_core->cur_coords.pressure,
3028 + &mixbrush->pr_texture_grain);
3030 + texture = gimp_context_get_pattern (context);
3033 + paste_canvas (paint_core, drawable,
3036 + gimp_paint_options_get_brush_mode (paint_options),
3037 + history->hardness,
3038 + mixbrush_options->texture_options->fringe,
3039 + mixbrush_options->texture_options->fringe_contrast,
3041 + mixbrush_options->texture_options->jitter,
3042 + paint_options->update_freq_options);
3046 + gimp_rgba_get_uchar (last_color,
3052 + /* Set the rounding error to mixbrush->error */
3053 + mixbrush->error.r = last_color->r - color_uchar[0] / 255.0;
3054 + mixbrush->error.g = last_color->g - color_uchar[1] / 255.0;
3055 + mixbrush->error.b = last_color->b - color_uchar[2] / 255.0;
3056 + mixbrush->error.a = last_color->a - color_uchar[3] / 255.0;
3058 + color_uchar[mixbrush->alpha_pix] = OPAQUE_OPACITY;
3060 + color_pixels (temp_buf_data (area), color_uchar,
3061 + area->width * area->height,
3064 + history->opacity *= last_color->a;
3066 + gimp_brush_core_paste_canvas (brush_core, drawable,
3067 + MIN (history->opacity, GIMP_OPACITY_OPAQUE),
3068 + gimp_context_get_flow (context),
3069 + gimp_context_get_opacity (context),
3070 + gimp_context_get_paint_mode (context),
3071 + gimp_paint_options_get_brush_mode (paint_options),
3072 + history->hardness,
3074 + paint_options->update_freq_options);
3077 + paint_core->cur_coords = orig_coords;
3078 + paint_core->last_coords = prev_coords;
3082 + last_color->a = 0.0;
3083 + gimp_rgba_set (&mixbrush->error, 0, 0, 0, 0);
3091 +coords_history_free (CoordsHistory *history, gpointer dummy)
3096 +static inline gboolean
3097 +get_canvas_color (GimpImage *image,
3098 + GimpDrawable *drawable,
3099 + GimpPaintCore *paint_core,
3102 + guint sample_size_limit,
3106 + GimpPickable *pickable;
3107 + GimpItem *item = GIMP_ITEM (drawable);
3108 + gint offset_x, offset_y;
3110 + offset_x = CLAMP (x, 0, gimp_item_width (item) - 1);
3111 + offset_y = CLAMP (y, 0, gimp_item_height (item) - 1);
3113 + if (merged && GIMP_IS_LAYER (drawable))
3115 + gint item_offset_x, item_offset_y;
3117 + gimp_item_offsets (item, &item_offset_x, &item_offset_y);
3118 + offset_x += item_offset_x;
3119 + offset_y += item_offset_y;
3121 + pickable = GIMP_PICKABLE (image->projection);
3122 + gimp_pickable_flush (pickable);
3125 + pickable = GIMP_PICKABLE (drawable);
3127 + return pick_up_avarage_color (pickable,
3128 + GIMP_BRUSH_CORE (paint_core),
3129 + offset_x, offset_y,
3130 + sample_size_limit,
3134 +static inline gboolean
3135 +pick_up_avarage_color (GimpPickable *pickable,
3136 + GimpBrushCore *brush_core,
3144 + gint width, height;
3146 + gimp_brush_scale_size (brush_core->brush, brush_core->scale, &width, &height);
3148 + result = gimp_pickable_pick_color (pickable,
3151 + CLAMP (MIN (width, height), 1, size_limit) / 2.0,
3159 +/* This function came from colortoalpha.c */
3162 +color_to_alpha (GimpRGB *src,
3163 + const GimpRGB *color)
3169 + if (color->r < 0.0001)
3171 + else if (src->r > color->r)
3172 + alpha.r = (src->r - color->r) / (1.0 - color->r);
3173 + else if (src->r < color->r)
3174 + alpha.r = (color->r - src->r) / color->r;
3175 + else alpha.r = 0.0;
3177 + if (color->g < 0.0001)
3179 + else if (src->g > color->g)
3180 + alpha.g = (src->g - color->g) / (1.0 - color->g);
3181 + else if (src->g < color->g)
3182 + alpha.g = (color->g - src->g) / (color->g);
3183 + else alpha.g = 0.0;
3185 + if (color->b < 0.0001)
3187 + else if (src->b > color->b)
3188 + alpha.b = (src->b - color->b) / (1.0 - color->b);
3189 + else if (src->b < color->b)
3190 + alpha.b = (color->b - src->b) / (color->b);
3191 + else alpha.b = 0.0;
3193 + if (alpha.r > alpha.g)
3195 + if (alpha.r > alpha.b)
3204 + else if (alpha.g > alpha.b)
3213 + if (src->a < 0.0001)
3216 + src->r = (src->r - color->r) / src->a + color->r;
3217 + src->g = (src->g - color->g) / src->a + color->g;
3218 + src->b = (src->b - color->b) / src->a + color->b;
3220 + src->a *= alpha.a;
3224 +composite_rgba (const GimpRGB *color1,
3226 + const GimpRGB *color2,
3229 + gboolean use_alt_alpha_op)
3231 + GimpRGB rgb1 = *color1, rgb2 = *color2;
3234 + rgb2.a = (1.0 - rgb1.a) * rgb2.a * op2;
3236 + if (rgb1.a == 0.0)
3238 + else if (rgb2.a > 0.0)
3240 + gdouble factor1 = rgb1.a / (rgb1.a + rgb2.a);
3241 + gdouble factor2 = 1.0 - factor1;
3243 + rgb1.r = rgb1.r * factor1 + rgb2.r * factor2;
3244 + rgb1.g = rgb1.g * factor1 + rgb2.g * factor2;
3245 + rgb1.b = rgb1.b * factor1 + rgb2.b * factor2;
3247 + } /* if (rgb1.a > 0.0 && rgb2.a == 0.0) rgb1 = rgb1; */
3249 + if (use_alt_alpha_op)
3251 + op1 = pow (op1, 1.35); /* workaround against opacity inflation */
3252 + op2 = pow (op2, 1.15);
3253 + rgb1.a = op1 + op2;
3257 + rgb1.a = op1 / rgb1.a; /* factor */
3258 + rgb1.a = color1->a * rgb1.a + color2->a * (1.0 - rgb1.a);
3259 + rgb1.a *= op1 + (1.0 - op1) * op2;
3265 + static gint count = 0;
3266 + //if ((count %= 3) == 0) {
3267 + g_printerr("1 = %f %f %f %f\n",color1->r,color1->g,color1->b,color1->a);
3268 + g_printerr("2 = %f %f %f %f\n",color2->r,color2->g,color2->b,color2->a);
3269 + g_printerr("r = %f %f %f %f\n",rgb1.r,rgb1.g,rgb1.b,rgb1.a);
3270 + g_printerr("o = %f %f\n",op1, op2);
3280 +blend_rgba (const GimpRGB *color1,
3282 + const GimpRGB *color2,
3285 + gboolean use_alt_alpha_op)
3287 + GimpRGB rgb1 = *color1, rgb2 = *color2, _result;
3289 + gdouble factor1, factor2;
3296 + else if (rgb2.a == 0)
3300 + _op3 = rgb1.a + rgb2.a;
3302 + factor1 = _op3 == 0 ? 0.5 : rgb1.a / _op3;
3303 + factor2 = 1.0 - factor1;
3305 + _result.r = rgb1.r * factor1 + rgb2.r * factor2;
3306 + _result.g = rgb1.g * factor1 + rgb2.g * factor2;
3307 + _result.b = rgb1.b * factor1 + rgb2.b * factor2;
3308 + _result.a = rgb1.a * factor1 + rgb2.a * factor2;
3311 + if (use_alt_alpha_op)
3313 + _result.a = op1 + op2;
3314 + if (_result.a != 0)
3316 + gdouble factor = op1 / _result.a;
3317 + _result.a = color1->a * factor + color2->a * (1.0 - factor);
3318 + //_result.a = MAX (_result.a, color2->a);
3323 + static gint count = 0;
3324 + //if ((count %= 3) == 1) {
3325 + g_printerr("1 = %f %f %f %f\n",color1->r,color1->g,color1->b,color1->a);
3326 + g_printerr("2 = %f %f %f %f\n",color2->r,color2->g,color2->b,color2->a);
3327 + g_printerr("r = %f %f %f %f\n",_result.r,_result.g,_result.b,_result.a);
3328 + g_printerr("o = %f %f\n",op1, op2);
3329 + g_printerr("o'= %f %f\n",_op1, _op2);
3330 + g_printerr("f = %f %f\n\n",factor1, factor2);
3336 + *result = _result;
3341 +static inline void calc_pressure_params (PressureParams *params,
3349 + params->in_min = in1;
3350 + params->in_factor = 0;
3352 + else if (in1 > in2)
3354 + params->in_min = in2;
3355 + params->in_factor = 1.0 / (in1 - in2);
3359 + params->in_min = in1;
3360 + params->in_factor = 1.0 / (in2 - in1);
3365 + params->out_min = out1;
3366 + params->out_factor = 0;
3368 + else if (out1 > out2)
3370 + params->out_min = out2;
3371 + params->out_factor = out1 - out2;
3372 + params->invert = TRUE;
3376 + params->out_min = out1;
3377 + params->out_factor = out2 - out1;
3378 + params->invert = FALSE;
3382 +static inline gdouble calc_pressure (gdouble value,
3383 + PressureParams *params)
3385 + g_return_val_if_fail (params != NULL, 1.0);
3387 + if (params->out_factor == 0)
3388 + return params->out_min;
3390 + if (params->in_factor != 0)
3392 + value = MIN (MAX (value - params->in_min, 0.0) * params->in_factor, 1.0);
3394 + if (params->invert)
3395 + value = 1.0 - value;
3398 + value = params->in_min;
3400 + return CLAMP (value * params->out_factor + params->out_min, 0.0, 1.0);
3404 +#ifndef GIMP_MIXBRUSH_COMPOSITE
3406 +paste_canvas (GimpPaintCore *core,
3407 + GimpDrawable *drawable,
3408 + GimpPattern *texture,
3409 + GimpRGB *paint_color,
3411 + GimpBrushApplicationMode hardness_mode,
3414 + gdouble fringe_contrast,
3417 + GimpUpdateFreqOptions *update_freq_options)
3419 + CompositeDabParam params;
3421 + GimpChannel *selection;
3422 + TempBuf *brush_mask;
3423 + TempBuf *canvas_buf;
3424 + gint c_x, c_y, c_w, c_h;
3425 + PixelRegion srcPR, maskPR, selPR;
3429 + selection = gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)));
3430 + /* don't apply the mask to itself and don't apply an empty mask */
3431 + if (GIMP_DRAWABLE (selection) == drawable || gimp_channel_is_empty (selection))
3434 + brush_mask = gimp_brush_core_get_brush_mask (GIMP_BRUSH_CORE (core),
3437 + canvas_buf = core->canvas_buf;
3439 + if (!brush_mask ||
3442 + (texture && !fringe && grain <= -1.0))
3445 + params.x = (gint) floor (core->cur_coords.x) - (brush_mask->width >> 1);
3446 + params.y = (gint) floor (core->cur_coords.y) - (brush_mask->height >> 1);
3448 + gimp_item_offsets (GIMP_ITEM (drawable), ¶ms.drawable_x, ¶ms.drawable_y);
3450 + c_x = canvas_buf->x;
3451 + c_y = canvas_buf->y;
3452 + c_w = canvas_buf->width;
3453 + c_h = canvas_buf->height;
3455 + /* set undo blocks */
3456 + gimp_paint_core_validate_undo_tiles (core, drawable,
3457 + c_x, c_y, c_w, c_h);
3461 + gint sel_x, sel_y, sel_x2, sel_y2;
3463 + gimp_item_offsets (GIMP_ITEM (selection), &sel_x, &sel_y);
3465 + sel_x -= params.drawable_x;
3466 + sel_y -= params.drawable_y;
3467 + sel_x2 = sel_x + gimp_item_width (GIMP_ITEM (selection));
3468 + sel_y2 = sel_y + gimp_item_height (GIMP_ITEM (selection));
3475 + off_x = sel_x - c_x;
3480 + off_y = sel_y - c_y;
3483 + c_w = MIN (x2, sel_x2) - c_x;
3484 + c_h = MIN (y2, sel_y2) - c_y;
3487 + /* init the pixel regions */
3488 + if (!off_x && (params.x < 0))
3489 + off_x = -params.x;
3490 + if (!off_y && (params.y < 0))
3491 + off_y = -params.y;
3493 + pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
3494 + c_x, c_y, c_w, c_h,
3497 + pixel_region_init_temp_buf (&maskPR, brush_mask,
3499 + brush_mask->width, brush_mask->height);
3501 + params.is_rgb = (srcPR.bytes > 2);
3502 + params.has_alpha = (srcPR.bytes == 2 || srcPR.bytes == 4);
3504 + /* configure the active channel array */
3505 + gimp_drawable_get_active_components (drawable, params.active_components);
3507 + /* setup the composite params */
3508 + params.paint_color = *paint_color;
3509 + params._paint_color.r = paint_color->r * 255.0;
3510 + if (params.is_rgb)
3512 + params._paint_color.g = paint_color->g * 255.0;
3513 + params._paint_color.b = paint_color->b * 255.0;
3515 + params.opacity = opacity;
3516 + params.adjusted_opacity = pow (opacity, 1.0 / 1.5);
3520 + params.grain = grain;
3521 + params.fringe = fringe;
3522 + params.fringe_contrast = fringe_contrast;
3523 + params.fringe_contrast_offset = (fringe_contrast - 1.0) * 0.5;
3524 + params.texture_jitter_x = g_random_int_range (-jitter, jitter + 1);
3525 + params.texture_jitter_y = g_random_int_range (-jitter, jitter + 1);
3527 + params.texture_data = temp_buf_data (texture->mask);
3528 + params.texture_bytes = texture->mask->bytes;
3529 + params.texture_width = texture->mask->width;
3530 + params.texture_height = texture->mask->height;
3531 + params.texture_stride = params.texture_width * params.texture_bytes;
3535 + pixel_region_init (&selPR,
3536 + gimp_drawable_get_tiles (GIMP_DRAWABLE (selection)),
3537 + c_x + params.drawable_x,
3538 + c_y + params.drawable_y,
3542 + pixel_regions_process_parallel ((PixelProcessorFunc) composite_textured_dab_selection,
3543 + ¶ms, 3, &srcPR, &maskPR, &selPR);
3546 + pixel_regions_process_parallel ((PixelProcessorFunc) composite_textured_dab,
3547 + ¶ms, 2, &srcPR, &maskPR);
3553 + pixel_region_init (&selPR,
3554 + gimp_drawable_get_tiles (GIMP_DRAWABLE (selection)),
3555 + c_x + params.drawable_x,
3556 + c_y + params.drawable_y,
3560 + pixel_regions_process_parallel ((PixelProcessorFunc) composite_dab_selection,
3561 + ¶ms, 3, &srcPR, &maskPR, &selPR);
3564 + pixel_regions_process_parallel ((PixelProcessorFunc) composite_dab,
3565 + ¶ms, 2, &srcPR, &maskPR);
3573 + /*g_file_set_contents ("r:\\out_canvas_buf_00.raw", temp_buf_data (canvas_buf),
3574 + canvas_buf->width * canvas_buf->height * canvas_buf->bytes,
3576 + g_file_set_contents ("r:\\out_brush_mask_00.raw", temp_buf_data (brush_mask),
3577 + brush_mask->width * brush_mask->height * brush_mask->bytes,
3580 + TileManager *tm = gimp_drawable_get_tiles (drawable);
3581 + guint stride = tile_manager_width (tm) * tile_manager_bpp (tm);
3582 + guint len = stride * tile_manager_height (tm);
3583 + guchar *buf = g_malloc(len);
3584 + read_pixel_data (tm, 0, 0,
3585 + tile_manager_width (tm) - 1,
3586 + tile_manager_height (tm) - 1,
3588 + g_file_set_contents ("r:\\out_drawable_00.raw", buf, len, NULL);
3593 + /* Update the undo extents */
3594 + core->x1 = MIN (core->x1, c_x);
3595 + core->y1 = MIN (core->y1, c_y);
3596 + core->x2 = MAX (core->x2, c_x + c_w) ;
3597 + core->y2 = MAX (core->y2, c_y + c_h) ;
3599 + /* Update the drawable */
3600 + if (update_freq_options->reduce_update_freq)
3606 + v = core->cur_coords.velocity - update_freq_options->v_threshold;
3607 + r = (core->canvas_buf->width + core->canvas_buf->height) / 2.0;
3609 + if (v > 0 && r > update_freq_options->s_threshold)
3613 + m = MIN (n * faster_pow (r / update_freq_options->s_threshold,
3614 + update_freq_options->gamma),
3615 + update_freq_options->max_n_dabs);
3616 + //g_printerr ("velo : %f / n : %f / threshold %d\n", core->cur_coords.velocity, n, (gint)(MIN (n, 25.0 - sqrt (r))));
3621 + if (core->update_count)
3623 + core->_x1 = MIN (core->_x1, c_x);
3624 + core->_y1 = MIN (core->_y1, c_y);
3625 + core->_x2 = MAX (core->_x2, c_x + c_w - 1);
3626 + core->_y2 = MAX (core->_y2, c_y + c_h - 1);
3631 + core->_x2 = c_x + c_w - 1;
3633 + core->_y2 = c_y + c_h - 1;
3636 + if (++core->update_count >= m)
3638 + core->update_count = 0;
3639 + core->updated = TRUE;
3641 + gimp_drawable_update (drawable,
3644 + core->_x2 - core->_x1 + 1,
3645 + core->_y2 - core->_y1 + 1);
3648 + core->updated = FALSE;
3651 + gimp_drawable_update (drawable, c_x, c_y, c_w, c_h);
3656 +composite_dab (CompositeDabParam *params,
3657 + PixelRegion *srcPR,
3658 + PixelRegion *maskPR)
3660 + gint width, height, bytes;
3662 + gint src_stride, mask_stride;
3663 + guchar *src_data, *_src_data;
3664 + guchar *mask_data, *_mask_data;
3668 + src_data = srcPR->data;
3669 + src_bytes = srcPR->bytes;
3670 + mask_data = maskPR->data;
3671 + width = maskPR->w;
3672 + height = maskPR->h;
3673 + bytes = maskPR->bytes;
3674 + src_stride = srcPR->rowstride;
3675 + mask_stride = maskPR->rowstride;
3677 + for (i = 0; i < height; i++)
3679 + _src_data = src_data;
3680 + _mask_data = mask_data;
3682 + for (j = 0; j < width; j++)
3684 + gdouble op, mask_op, paint_color_op, canvas_color_op, src_op;
3685 + gdouble factor1, factor2;
3686 + gdouble component;
3689 + if (j == c_w / 2 && i == c_h / 2)
3691 + g_printerr ( "\nPos : %d %d\n", j, i);
3692 + g_printerr ( "Paint color: %f %f %f %f\n", params->_paint_color.r, params->_paint_color.g, params->_paint_color.b, params->paint_color->a);
3693 + g_printerr ( "Canvas color: %d %d %d %d\n", _src_data[0], _src_data[1], _src_data[2], _src_data[3]);
3694 + g_printerr ( "Opacity : %f\n", params->opacity);
3697 + if (_mask_data[0])
3699 + mask_op = _mask_data[0] / 255.0;
3701 + if (params->has_alpha && params->active_components[src_bytes - 1])
3706 + src_op = _src_data[src_bytes - 1] / 255.0;
3708 + /* workaround against insufficiency of opacity */
3709 + /*if (params->paint_color->a > src_op)
3710 + op = pow (params->opacity, 1.0 / 1.5) * mask_op;*/
3711 + n = params->paint_color.a - src_op;
3712 + _n = (*(guint32 *) &n) >> 31;
3713 + op = (params->opacity * _n + params->adjusted_opacity * (1 - _n)) * mask_op;
3715 + component = (params->paint_color.a * op + src_op * (1.0 - op)) * 255.0/* + error.a*/;
3716 + _src_data[src_bytes - 1] = component + .5;
3717 + /*_error.a += component - _src_data[src_bytes - 1];*/
3722 + op = params->opacity * mask_op;
3723 + paint_color_op = params->paint_color.a * op;
3725 + if (paint_color_op > 0.0)
3727 + canvas_color_op = (1.0 - paint_color_op) * src_op;
3729 + factor1 = paint_color_op / (paint_color_op + canvas_color_op);
3730 + factor2 = 1.0 - factor1;
3732 + component = params->_paint_color.r * factor1 + _src_data[0] * factor2/* + error.r*/;
3733 + _src_data[0] = component + .5;
3734 + /*_error.r += component - _src_data[0];*/
3735 + if (params->is_rgb)
3737 + component = params->_paint_color.g * factor1 + _src_data[1] * factor2/* + error.g*/;
3738 + _src_data[1] = component + .5;
3739 + /*_error.g += component - _src_data[1];*/
3741 + component = params->_paint_color.b * factor1 + _src_data[2] * factor2/* + error.b*/;
3742 + _src_data[2] = component + .5;
3743 + /*_error.b += component - _src_data[2];*/
3748 + if (j == c_w / 2 && i == c_h / 2)
3750 + g_printerr ( "Result color: %d %d %d %d\n", _src_data[0], _src_data[1], _src_data[2], _src_data[3]);
3753 + _src_data += src_bytes;
3756 + src_data += src_stride;
3757 + mask_data += mask_stride;
3759 +} /* end of iteration */
3763 +composite_textured_dab (CompositeDabParam *params,
3764 + PixelRegion *srcPR,
3765 + PixelRegion *maskPR)
3767 + gint width, height, bytes;
3769 + gint src_stride, mask_stride;
3770 + guchar *src_data, *_src_data;
3771 + guchar *mask_data, *_mask_data;
3774 + gint texture_off_x, _texture_off_x, texture_off_y;
3775 + guchar *texture_row_data;
3777 + /* calc origin of texture buffer */
3778 + texture_off_x = params->drawable_x + params->x + maskPR->x + params->texture_jitter_x;
3779 + if (texture_off_x < 0)
3780 + texture_off_x = params->texture_width + (texture_off_x % params->texture_width);
3782 + texture_off_y = params->drawable_y + params->y + maskPR->y + params->texture_jitter_y;
3783 + if (texture_off_y < 0)
3784 + texture_off_y = params->texture_height + (texture_off_y % params->texture_height);
3786 + src_data = srcPR->data;
3787 + src_bytes = srcPR->bytes;
3788 + mask_data = maskPR->data;
3789 + width = maskPR->w;
3790 + height = maskPR->h;
3791 + bytes = maskPR->bytes;
3792 + src_stride = srcPR->rowstride;
3793 + mask_stride = maskPR->rowstride;
3795 +//g_printerr("<<");
3796 + for (i = 0; i < height; i++, texture_off_y++)
3798 + _src_data = src_data;
3799 + _mask_data = mask_data;
3801 + texture_off_y = texture_off_y % params->texture_height;
3802 + _texture_off_x = texture_off_x;
3803 + texture_row_data = params->texture_data + texture_off_y * params->texture_stride;
3805 + for (j = 0; j < width; j++, _texture_off_x++)
3807 + gdouble op, mask_op, paint_color_op, canvas_color_op, src_op;
3808 + gdouble texture_op;
3809 + gdouble factor1, factor2;
3810 + gdouble component;
3812 + _texture_off_x = _texture_off_x % params->texture_width;
3814 + texture_op = *(texture_row_data + _texture_off_x * params->texture_bytes) / 255.0;
3815 + texture_op = CLAMP (texture_op + params->grain, 0.0, 1.0);
3817 + if (_mask_data[0])
3819 + mask_op = _mask_data[0] / 255.0;
3822 + if (params->fringe)
3824 + texture_op = (texture_op * (1.0 - mask_op) + mask_op);
3825 + mask_op = CLAMP (mask_op * texture_op * params->fringe_contrast - params->fringe_contrast_offset, 0.0, 1.0);
3828 + mask_op *= texture_op;
3830 + if (params->fringe)
3831 + texture_op = (texture_op * (1.0 - mask_op) + mask_op);
3833 + if (params->fringe_contrast > 1.0)
3834 + mask_op = CLAMP (mask_op * texture_op * params->fringe_contrast - params->fringe_contrast_offset, 0.0, 1.0);
3836 + mask_op *= texture_op;
3841 + if (params->has_alpha && params->active_components[src_bytes - 1])
3846 + src_op = _src_data[src_bytes - 1] / 255.0;
3848 + /* workaround against insufficiency of opacity */
3849 + /*if (params->paint_color.a > src_op)
3850 + op = pow (params->opacity, 1.0 / 1.5) * mask_op;*/
3851 + n = params->paint_color.a - src_op;
3852 + _n = (*(guint32 *) &n) >> 31;
3853 + op = (params->opacity * _n + params->adjusted_opacity * (1 - _n)) * mask_op;
3855 + component = (params->paint_color.a * op + src_op * (1.0 - op)) * 255.0/* + error.a*/;
3856 + _src_data[src_bytes - 1] = component + .5;
3857 + /*_error.a += component - _src_data[src_bytes - 1];*/
3862 + op = params->opacity * mask_op;
3863 + paint_color_op = params->paint_color.a * op;
3865 + if (paint_color_op > 0.0)
3867 + canvas_color_op = (1.0 - paint_color_op) * src_op;
3869 + factor1 = paint_color_op / (paint_color_op + canvas_color_op);
3870 + factor2 = 1.0 - factor1;
3872 + component = params->_paint_color.r * factor1 + _src_data[0] * factor2/* + error.r*/;
3873 + _src_data[0] = component + .5;
3874 + /*_error.r += component - _src_data[0];*/
3875 + if (params->is_rgb)
3877 + component = params->_paint_color.g * factor1 + _src_data[1] * factor2/* + error.g*/;
3878 + _src_data[1] = component + .5;
3879 + /*_error.g += component - _src_data[1];*/
3881 + component = params->_paint_color.b * factor1 + _src_data[2] * factor2/* + error.b*/;
3882 + _src_data[2] = component + .5;
3883 + /*_error.b += component - _src_data[2];*/
3888 + _src_data += src_bytes;
3891 + src_data += src_stride;
3892 + mask_data += mask_stride;
3894 +//g_printerr(">>");
3895 +} /* end of iteration */
3897 +/* compositing with selection */
3899 +composite_dab_selection (CompositeDabParam *params,
3900 + PixelRegion *srcPR,
3901 + PixelRegion *maskPR,
3902 + PixelRegion *selPR)
3904 + gint width, height, bytes;
3906 + gint src_stride, mask_stride, sel_stride;
3907 + guchar *src_data, *_src_data;
3908 + guchar *mask_data, *_mask_data;
3909 + guchar *sel_data, *_sel_data;
3913 + src_data = srcPR->data;
3914 + src_bytes = srcPR->bytes;
3915 + mask_data = maskPR->data;
3916 + sel_data = selPR->data;
3917 + width = maskPR->w;
3918 + height = maskPR->h;
3919 + bytes = maskPR->bytes;
3920 + src_stride = srcPR->rowstride;
3921 + mask_stride = maskPR->rowstride;
3922 + sel_stride = selPR->rowstride;
3924 + for (i = 0; i < height; i++)
3926 + _src_data = src_data;
3927 + _mask_data = mask_data;
3928 + _sel_data = sel_data;
3930 + for (j = 0; j < width; j++)
3932 + gdouble op, mask_op, paint_color_op, canvas_color_op, src_op;
3933 + gdouble factor1, factor2;
3934 + gdouble component;
3936 + if (*_mask_data && *_sel_data)
3938 + mask_op = *_mask_data * *_sel_data / 65025.0;
3940 + if (params->has_alpha && params->active_components[src_bytes - 1])
3945 + src_op = _src_data[src_bytes - 1] / 255.0;
3947 + /* workaround against insufficiency of opacity */
3948 + /*if (params->paint_color->a > src_op)
3949 + op = pow (params->opacity, 1.0 / 1.5) * mask_op;*/
3950 + n = params->paint_color.a - src_op;
3951 + _n = (*(guint32 *) &n) >> 31;
3952 + op = (params->opacity * _n + params->adjusted_opacity * (1 - _n)) * mask_op;
3954 + component = (params->paint_color.a * op + src_op * (1.0 - op)) * 255.0/* + error.a*/;
3955 + _src_data[src_bytes - 1] = component + .5;
3956 + /*_error.a += component - _src_data[src_bytes - 1];*/
3961 + op = params->opacity * mask_op;
3962 + paint_color_op = params->paint_color.a * op;
3964 + if (paint_color_op > 0.0)
3966 + canvas_color_op = (1.0 - paint_color_op) * src_op;
3968 + factor1 = paint_color_op / (paint_color_op + canvas_color_op);
3969 + factor2 = 1.0 - factor1;
3971 + component = params->_paint_color.r * factor1 + _src_data[0] * factor2/* + error.r*/;
3972 + _src_data[0] = component + .5;
3973 + /*_error.r += component - _src_data[0];*/
3974 + if (params->is_rgb)
3976 + component = params->_paint_color.g * factor1 + _src_data[1] * factor2/* + error.g*/;
3977 + _src_data[1] = component + .5;
3978 + /*_error.g += component - _src_data[1];*/
3980 + component = params->_paint_color.b * factor1 + _src_data[2] * factor2/* + error.b*/;
3981 + _src_data[2] = component + .5;
3982 + /*_error.b += component - _src_data[2];*/
3986 + _src_data += src_bytes;
3990 + src_data += src_stride;
3991 + mask_data += mask_stride;
3992 + sel_data += sel_stride;
3994 +} /* end of iteration */
3997 +composite_textured_dab_selection (CompositeDabParam *params,
3998 + PixelRegion *srcPR,
3999 + PixelRegion *maskPR,
4000 + PixelRegion *selPR)
4002 + gint width, height, bytes;
4004 + gint src_stride, mask_stride, sel_stride;
4005 + guchar *src_data, *_src_data;
4006 + guchar *mask_data, *_mask_data;
4007 + guchar *sel_data, *_sel_data;
4010 + gint texture_off_x, _texture_off_x, texture_off_y;
4011 + guchar *texture_row_data;
4013 + /* calc origin of texture buffer */
4014 + texture_off_x = params->drawable_x + params->x + maskPR->x + params->texture_jitter_x;
4015 + if (texture_off_x < 0)
4016 + texture_off_x = params->texture_width + (texture_off_x % params->texture_width);
4018 + texture_off_y = params->drawable_y + params->y + maskPR->y + params->texture_jitter_y;
4019 + if (texture_off_y < 0)
4020 + texture_off_y = params->texture_height + (texture_off_y % params->texture_height);
4022 + src_data = srcPR->data;
4023 + src_bytes = srcPR->bytes;
4024 + mask_data = maskPR->data;
4025 + sel_data = selPR->data;
4026 + width = maskPR->w;
4027 + height = maskPR->h;
4028 + bytes = maskPR->bytes;
4029 + src_stride = srcPR->rowstride;
4030 + mask_stride = maskPR->rowstride;
4031 + sel_stride = selPR->rowstride;
4033 + for (i = 0; i < height; i++, texture_off_y++)
4035 + _src_data = src_data;
4036 + _mask_data = mask_data;
4037 + _sel_data = sel_data;
4039 + texture_off_y = texture_off_y % params->texture_height;
4040 + _texture_off_x = texture_off_x;
4041 + texture_row_data = params->texture_data + texture_off_y * params->texture_stride;
4043 + for (j = 0; j < width; j++, _texture_off_x++)
4045 + gdouble op, mask_op, paint_color_op, canvas_color_op, src_op;
4046 + gdouble texture_op;
4047 + gdouble factor1, factor2;
4048 + gdouble component;
4050 + _texture_off_x = _texture_off_x % params->texture_width;
4052 + texture_op = *(texture_row_data + _texture_off_x * params->texture_bytes) / 255.0;
4053 + texture_op = CLAMP (texture_op + params->grain, 0.0, 1.0);
4055 + if (*_mask_data && *_sel_data)
4057 + mask_op = *_mask_data * *_sel_data / 65025.0;
4059 + if (params->fringe)
4060 + texture_op = (texture_op * (1.0 - mask_op) + mask_op);
4062 + if (params->fringe_contrast > 1.0)
4063 + mask_op = CLAMP (mask_op * texture_op * params->fringe_contrast - params->fringe_contrast_offset, 0.0, 1.0);
4065 + mask_op *= texture_op;
4069 + if (params->has_alpha && params->active_components[src_bytes - 1])
4074 + src_op = _src_data[src_bytes - 1] / 255.0;
4076 + /* workaround against insufficiency of opacity */
4077 + /*if (params->paint_color.a > src_op)
4078 + op = pow (params->opacity, 1.0 / 1.5) * mask_op;*/
4079 + n = params->paint_color.a - src_op;
4080 + _n = (*(guint32 *) &n) >> 31;
4081 + op = (params->opacity * _n + params->adjusted_opacity * (1 - _n)) * mask_op;
4083 + component = (params->paint_color.a * op + src_op * (1.0 - op)) * 255.0/* + error.a*/;
4084 + _src_data[src_bytes - 1] = component + .5;
4085 + /*_error.a += component - _src_data[src_bytes - 1];*/
4090 + op = params->opacity * mask_op;
4091 + paint_color_op = params->paint_color.a * op;
4093 + if (paint_color_op > 0.0)
4095 + canvas_color_op = (1.0 - paint_color_op) * src_op;
4097 + factor1 = paint_color_op / (paint_color_op + canvas_color_op);
4098 + factor2 = 1.0 - factor1;
4100 + component = params->_paint_color.r * factor1 + _src_data[0] * factor2/* + error.r*/;
4101 + _src_data[0] = component + .5;
4102 + /*_error.r += component - _src_data[0];*/
4103 + if (params->is_rgb)
4105 + component = params->_paint_color.g * factor1 + _src_data[1] * factor2/* + error.g*/;
4106 + _src_data[1] = component + .5;
4107 + /*_error.g += component - _src_data[1];*/
4109 + component = params->_paint_color.b * factor1 + _src_data[2] * factor2/* + error.b*/;
4110 + _src_data[2] = component + .5;
4111 + /*_error.b += component - _src_data[2];*/
4116 + _src_data += src_bytes;
4120 + src_data += src_stride;
4121 + mask_data += mask_stride;
4122 + sel_data += sel_stride;
4124 +} /* end of iteration */
4126 --- gimp-2.6.6/app/paint/gimpmixbrush.h 1970-01-01 09:00:00 +0900
4127 +++ gimp-painter--2.6.6-20100627/app/paint/gimpmixbrush.h 2010-06-27 02:14:18 +0900
4129 +/* GIMP - The GNU Image Manipulation Program
4130 + * Copyright (C) 1995 Spencer Kimball and Peter Mattis
4132 + * This program is free software; you can redistribute it and/or modify
4133 + * it under the terms of the GNU General Public License as published by
4134 + * the Free Software Foundation; either version 2 of the License, or
4135 + * (at your option) any later version.
4137 + * This program is distributed in the hope that it will be useful,
4138 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
4139 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4140 + * GNU General Public License for more details.
4142 + * You should have received a copy of the GNU General Public License
4143 + * along with this program; if not, write to the Free Software
4144 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
4147 +#ifndef __GIMP_MIXBRUSH_H__
4148 +#define __GIMP_MIXBRUSH_H__
4151 +#include "gimppaintbrush.h"
4154 +/* Pressure control params */
4156 +typedef struct _PressureParams
4159 + gdouble in_factor;
4161 + gdouble out_factor;
4166 +#define GIMP_TYPE_MIXBRUSH (gimp_mixbrush_get_type ())
4167 +#define GIMP_MIXBRUSH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_MIXBRUSH, GimpMixbrush))
4168 +#define GIMP_MIXBRUSH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_MIXBRUSH, GimpMixbrushClass))
4169 +#define GIMP_IS_MIXBRUSH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_MIXBRUSH))
4170 +#define GIMP_IS_MIXBRUSH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_MIXBRUSH))
4171 +#define GIMP_MIXBRUSH_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_MIXBRUSH, GimpMixbrushClass))
4174 +typedef struct _GimpMixbrushClass GimpMixbrushClass;
4176 +struct _GimpMixbrush
4178 + GimpPaintbrush parent_instance;
4180 + GimpDrawable *drawable;
4181 + GimpPaintOptions *paint_options;
4183 + PressureParams pr_texture_grain;
4184 + PressureParams pr_main_density;
4185 + PressureParams pr_main_rate;
4186 + PressureParams pr_canvas_density;
4187 + PressureParams pr_canvas_rate;
4189 + GimpRGB paint_color;
4190 + GimpRGB last_color;
4191 + GimpRGB hidden_color;
4194 + gboolean use_alt_alpha_op;
4197 +struct _GimpMixbrushClass
4199 + GimpPaintbrushClass parent_class;
4203 +void gimp_mixbrush_register (Gimp *gimp,
4204 + GimpPaintRegisterCallback callback);
4206 +GType gimp_mixbrush_get_type (void) G_GNUC_CONST;
4209 +#endif /* __GIMP_MIXBRUSH_H__ */
4210 --- gimp-2.6.6/app/paint/gimpmixbrushoptions.c 1970-01-01 09:00:00 +0900
4211 +++ gimp-painter--2.6.6-20100627/app/paint/gimpmixbrushoptions.c 2010-06-27 02:14:18 +0900
4213 +/* GIMP - The GNU Image Manipulation Program
4214 + * Copyright (C) 1995 Spencer Kimball and Peter Mattis
4216 + * This program is free software; you can redistribute it and/or modify
4217 + * it under the terms of the GNU General Public License as published by
4218 + * the Free Software Foundation; either version 2 of the License, or
4219 + * (at your option) any later version.
4221 + * This program is distributed in the hope that it will be useful,
4222 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
4223 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4224 + * GNU General Public License for more details.
4226 + * You should have received a copy of the GNU General Public License
4227 + * along with this program; if not, write to the Free Software
4228 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
4231 +#include "config.h"
4233 +#include <glib-object.h>
4235 +#include "libgimpconfig/gimpconfig.h"
4237 +#include "paint-types.h"
4239 +#include "gimppaintoptions.h"
4240 +#include "gimpmixbrushoptions.h"
4243 +#define MIXBRUSH_DEFAULT_USE_TEXTURE FALSE
4244 +#define MIXBRUSH_DEFAULT_TEXTURE_FRINGE FALSE
4245 +#define MIXBRUSH_DEFAULT_TEXTURE_FRINGE_CONTRAST 1.0
4246 +#define MIXBRUSH_DEFAULT_TEXTURE_GRAIN 0.0
4247 +#define MIXBRUSH_DEFAULT_TEXTURE_JITTER 0
4249 +#define MIXBRUSH_DEFAULT_MAIN_COLOR_DENSITY 0.5
4250 +#define MIXBRUSH_DEFAULT_MAIN_COLOR_RATE 0.2
4251 +#define MIXBRUSH_DEFAULT_CANVAS_COLOR_DENSITY 1.0
4252 +#define MIXBRUSH_DEFAULT_CANVAS_COLOR_RATE 1.0
4253 +#define MIXBRUSH_DEFAULT_PRESSURE_IN1 0.0
4254 +#define MIXBRUSH_DEFAULT_PRESSURE_IN2 1.0
4255 +#define MIXBRUSH_DEFAULT_PRESSURE_OUT1 0.5
4256 +#define MIXBRUSH_DEFAULT_PRESSURE_OUT2 1.0
4257 +#define MIXBRUSH_DEFAULT_CANVAS_PRESSURE_OUT1 1.0
4258 +#define MIXBRUSH_DEFAULT_CANVAS_PRESSURE_OUT2 1.0
4259 +#define MIXBRUSH_DEFAULT_DRYOUT 0.0
4260 +#define MIXBRUSH_DEFAULT_DELAY 0
4261 +#define MIXBRUSH_DEFAULT_TAIL FALSE
4262 +#define MIXBRUSH_DEFAULT_MERGED FALSE
4263 +#define MIXBRUSH_DEFAULT_PIGMENT TRUE
4264 +#define MIXBRUSH_DEFAULT_HIDDEN_COLOR GIMP_HIDDEN_COLOR_NORMAL
4265 +#define MIXBRUSH_DEFAULT_REMOVE_COLOR FALSE
4266 +#define MIXBRUSH_DEFAULT_SAMPLE_SIZE_LIMIT 1
4267 +#define MIXBRUSH_DEFAULT_ALPHA_CHANNEL_MIXING TRUE
4268 +#define MIXBRUSH_DEFAULT_APPLICATION_MODE GIMP_PAINT_INCREMENTAL
4275 + PROP_TEXTURE_FRINGE,
4276 + PROP_TEXTURE_FRINGE_CONTRAST,
4277 + PROP_TEXTURE_GRAIN,
4278 + PROP_TEXTURE_GRAIN_PRESSURE_IN1,
4279 + PROP_TEXTURE_GRAIN_PRESSURE_IN2,
4280 + PROP_TEXTURE_GRAIN_PRESSURE_OUT1,
4281 + PROP_TEXTURE_GRAIN_PRESSURE_OUT2,
4282 + PROP_TEXTURE_JITTER,
4284 + PROP_MAIN_COLOR_DENSITY,
4285 + PROP_MAIN_COLOR_RATE,
4286 + PROP_CANVAS_COLOR_DENSITY,
4287 + PROP_CANVAS_COLOR_RATE,
4288 + PROP_MAIN_COLOR_DENSITY_PRESSURE_IN1,
4289 + PROP_MAIN_COLOR_DENSITY_PRESSURE_IN2,
4290 + PROP_MAIN_COLOR_DENSITY_PRESSURE_OUT1,
4291 + PROP_MAIN_COLOR_DENSITY_PRESSURE_OUT2,
4292 + PROP_MAIN_COLOR_PRESSURE_IN1,
4293 + PROP_MAIN_COLOR_PRESSURE_IN2,
4294 + PROP_MAIN_COLOR_PRESSURE_OUT1,
4295 + PROP_MAIN_COLOR_PRESSURE_OUT2,
4296 + PROP_CANVAS_COLOR_DENSITY_PRESSURE_IN1,
4297 + PROP_CANVAS_COLOR_DENSITY_PRESSURE_IN2,
4298 + PROP_CANVAS_COLOR_DENSITY_PRESSURE_OUT1,
4299 + PROP_CANVAS_COLOR_DENSITY_PRESSURE_OUT2,
4300 + PROP_CANVAS_COLOR_PRESSURE_IN1,
4301 + PROP_CANVAS_COLOR_PRESSURE_IN2,
4302 + PROP_CANVAS_COLOR_PRESSURE_OUT1,
4303 + PROP_CANVAS_COLOR_PRESSURE_OUT2,
4309 + PROP_HIDDEN_COLOR,
4310 + PROP_REMOVE_COLOR,
4311 + PROP_SAMPLE_SIZE_LIMIT,
4312 + PROP_ALPHA_CHANNEL_MIXING,
4313 + PROP_APPLICATION_MODE
4317 +static void gimp_mixbrush_options_finalize (GObject *object);
4318 +static void gimp_mixbrush_options_set_property (GObject *object,
4319 + guint property_id,
4320 + const GValue *value,
4321 + GParamSpec *pspec);
4322 +static void gimp_mixbrush_options_get_property (GObject *object,
4323 + guint property_id,
4325 + GParamSpec *pspec);
4328 +G_DEFINE_TYPE (GimpMixbrushOptions, gimp_mixbrush_options,
4329 + GIMP_TYPE_PAINT_OPTIONS)
4331 +#define parent_class gimp_mixbrush_options_parent_class
4335 +gimp_mixbrush_options_class_init (GimpMixbrushOptionsClass *klass)
4337 + GObjectClass *object_class = G_OBJECT_CLASS (klass);
4339 + object_class->finalize = gimp_mixbrush_options_finalize;
4340 + object_class->set_property = gimp_mixbrush_options_set_property;
4341 + object_class->get_property = gimp_mixbrush_options_get_property;
4343 + GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_USE_TEXTURE,
4344 + "use-texture", NULL,
4345 + MIXBRUSH_DEFAULT_USE_TEXTURE,
4346 + GIMP_PARAM_STATIC_STRINGS);
4348 + GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_TEXTURE_FRINGE,
4349 + "texture-fringe", NULL,
4350 + MIXBRUSH_DEFAULT_TEXTURE_FRINGE,
4351 + GIMP_PARAM_STATIC_STRINGS);
4353 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_TEXTURE_FRINGE_CONTRAST,
4354 + "texture-fringe-contrast", NULL,
4355 + 1.0, 10.0, MIXBRUSH_DEFAULT_TEXTURE_FRINGE_CONTRAST,
4356 + GIMP_PARAM_STATIC_STRINGS);
4358 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_TEXTURE_GRAIN,
4359 + "texture-grain", NULL,
4360 + -1.0, 1.0, MIXBRUSH_DEFAULT_TEXTURE_GRAIN,
4361 + GIMP_PARAM_STATIC_STRINGS);
4363 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_TEXTURE_GRAIN_PRESSURE_IN1,
4364 + "texture-grain-pressure-in1", NULL,
4365 + 0.0, 1.0, MIXBRUSH_DEFAULT_PRESSURE_IN1,
4366 + GIMP_PARAM_STATIC_STRINGS);
4368 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_TEXTURE_GRAIN_PRESSURE_IN2,
4369 + "texture-grain-pressure-in2", NULL,
4370 + 0.0, 1.0, MIXBRUSH_DEFAULT_PRESSURE_IN2,
4371 + GIMP_PARAM_STATIC_STRINGS);
4373 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_TEXTURE_GRAIN_PRESSURE_OUT1,
4374 + "texture-grain-pressure-out1", NULL,
4375 + 0.0, 1.0, MIXBRUSH_DEFAULT_PRESSURE_OUT1,
4376 + GIMP_PARAM_STATIC_STRINGS);
4378 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_TEXTURE_GRAIN_PRESSURE_OUT2,
4379 + "texture-grain-pressure-out2", NULL,
4380 + 0.0, 1.0, MIXBRUSH_DEFAULT_PRESSURE_OUT2,
4381 + GIMP_PARAM_STATIC_STRINGS);
4383 + GIMP_CONFIG_INSTALL_PROP_UINT (object_class, PROP_TEXTURE_JITTER,
4384 + "texture-jitter", NULL,
4385 + 0, 1000, MIXBRUSH_DEFAULT_TEXTURE_JITTER,
4386 + GIMP_PARAM_STATIC_STRINGS);
4388 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_MAIN_COLOR_DENSITY,
4389 + "main-color-density", NULL,
4390 + 0.0, 1.0, MIXBRUSH_DEFAULT_MAIN_COLOR_DENSITY,
4391 + GIMP_PARAM_STATIC_STRINGS);
4393 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_MAIN_COLOR_RATE,
4394 + "main-color-rate", NULL,
4395 + 0.0, 1.0, MIXBRUSH_DEFAULT_MAIN_COLOR_RATE,
4396 + GIMP_PARAM_STATIC_STRINGS);
4398 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_MAIN_COLOR_DENSITY_PRESSURE_IN1,
4399 + "main-color-density-pressure-in1", NULL,
4400 + 0.0, 1.0, MIXBRUSH_DEFAULT_PRESSURE_IN1,
4401 + GIMP_PARAM_STATIC_STRINGS);
4403 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_MAIN_COLOR_DENSITY_PRESSURE_IN2,
4404 + "main-color-density-pressure-in2", NULL,
4405 + 0.0, 1.0, MIXBRUSH_DEFAULT_PRESSURE_IN2,
4406 + GIMP_PARAM_STATIC_STRINGS);
4408 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_MAIN_COLOR_DENSITY_PRESSURE_OUT1,
4409 + "main-color-density-pressure-out1", NULL,
4410 + 0.0, 1.0, MIXBRUSH_DEFAULT_PRESSURE_OUT1,
4411 + GIMP_PARAM_STATIC_STRINGS);
4413 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_MAIN_COLOR_DENSITY_PRESSURE_OUT2,
4414 + "main-color-density-pressure-out2", NULL,
4415 + 0.0, 1.0, MIXBRUSH_DEFAULT_PRESSURE_OUT2,
4416 + GIMP_PARAM_STATIC_STRINGS);
4418 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_MAIN_COLOR_PRESSURE_IN1,
4419 + "main-color-pressure-in1", NULL,
4420 + 0.0, 1.0, MIXBRUSH_DEFAULT_PRESSURE_IN1,
4421 + GIMP_PARAM_STATIC_STRINGS);
4423 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_MAIN_COLOR_PRESSURE_IN2,
4424 + "main-color-pressure-in2", NULL,
4425 + 0.0, 1.0, MIXBRUSH_DEFAULT_PRESSURE_IN2,
4426 + GIMP_PARAM_STATIC_STRINGS);
4428 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_MAIN_COLOR_PRESSURE_OUT1,
4429 + "main-color-pressure-out1", NULL,
4430 + 0.0, 1.0, MIXBRUSH_DEFAULT_PRESSURE_OUT1,
4431 + GIMP_PARAM_STATIC_STRINGS);
4433 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_MAIN_COLOR_PRESSURE_OUT2,
4434 + "main-color-pressure-out2", NULL,
4435 + 0.0, 1.0, MIXBRUSH_DEFAULT_PRESSURE_OUT2,
4436 + GIMP_PARAM_STATIC_STRINGS);
4438 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_CANVAS_COLOR_DENSITY,
4439 + "canvas-color-density", NULL,
4440 + 0.0, 1.0, MIXBRUSH_DEFAULT_CANVAS_COLOR_DENSITY,
4441 + GIMP_PARAM_STATIC_STRINGS);
4443 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_CANVAS_COLOR_RATE,
4444 + "canvas-color-rate", NULL,
4445 + 0.0, 1.0, MIXBRUSH_DEFAULT_CANVAS_COLOR_RATE,
4446 + GIMP_PARAM_STATIC_STRINGS);
4448 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_CANVAS_COLOR_DENSITY_PRESSURE_IN1,
4449 + "canvas-color-density-pressure-in1", NULL,
4450 + 0.0, 1.0, MIXBRUSH_DEFAULT_PRESSURE_IN1,
4451 + GIMP_PARAM_STATIC_STRINGS);
4453 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_CANVAS_COLOR_DENSITY_PRESSURE_IN2,
4454 + "canvas-color-density-pressure-in2", NULL,
4455 + 0.0, 1.0, MIXBRUSH_DEFAULT_PRESSURE_IN2,
4456 + GIMP_PARAM_STATIC_STRINGS);
4458 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_CANVAS_COLOR_DENSITY_PRESSURE_OUT1,
4459 + "canvas-color-density-pressure-out1", NULL,
4460 + 0.0, 1.0, MIXBRUSH_DEFAULT_CANVAS_PRESSURE_OUT1,
4461 + GIMP_PARAM_STATIC_STRINGS);
4463 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_CANVAS_COLOR_DENSITY_PRESSURE_OUT2,
4464 + "canvas-color-density-pressure-out2", NULL,
4465 + 0.0, 1.0, MIXBRUSH_DEFAULT_CANVAS_PRESSURE_OUT2,
4466 + GIMP_PARAM_STATIC_STRINGS);
4468 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_CANVAS_COLOR_PRESSURE_IN1,
4469 + "canvas-color-pressure-in1", NULL,
4470 + 0.0, 1.0, MIXBRUSH_DEFAULT_PRESSURE_IN1,
4471 + GIMP_PARAM_STATIC_STRINGS);
4473 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_CANVAS_COLOR_PRESSURE_IN2,
4474 + "canvas-color-pressure-in2", NULL,
4475 + 0.0, 1.0, MIXBRUSH_DEFAULT_PRESSURE_IN2,
4476 + GIMP_PARAM_STATIC_STRINGS);
4478 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_CANVAS_COLOR_PRESSURE_OUT1,
4479 + "canvas-color-pressure-out1", NULL,
4480 + 0.0, 1.0, MIXBRUSH_DEFAULT_CANVAS_PRESSURE_OUT1,
4481 + GIMP_PARAM_STATIC_STRINGS);
4483 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_CANVAS_COLOR_PRESSURE_OUT2,
4484 + "canvas-color-pressure-out2", NULL,
4485 + 0.0, 1.0, MIXBRUSH_DEFAULT_CANVAS_PRESSURE_OUT2,
4486 + GIMP_PARAM_STATIC_STRINGS);
4488 + GIMP_CONFIG_INSTALL_PROP_UINT (object_class, PROP_DRYOUT,
4490 + 0, 10000, MIXBRUSH_DEFAULT_DRYOUT,
4491 + GIMP_PARAM_STATIC_STRINGS);
4493 + GIMP_CONFIG_INSTALL_PROP_UINT (object_class, PROP_DELAY,
4495 + 0, 10, MIXBRUSH_DEFAULT_DELAY,
4496 + GIMP_PARAM_STATIC_STRINGS);
4498 + GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_TAIL,
4500 + MIXBRUSH_DEFAULT_TAIL,
4501 + GIMP_PARAM_STATIC_STRINGS);
4503 + GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_MERGED,
4505 + MIXBRUSH_DEFAULT_MERGED,
4506 + GIMP_PARAM_STATIC_STRINGS);
4508 + GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_PIGMENT,
4510 + MIXBRUSH_DEFAULT_PIGMENT,
4511 + GIMP_PARAM_STATIC_STRINGS);
4513 + GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_HIDDEN_COLOR,
4514 + "hidden-color", NULL,
4515 + GIMP_TYPE_HIDDEN_COLOR,
4516 + MIXBRUSH_DEFAULT_HIDDEN_COLOR,
4517 + GIMP_PARAM_STATIC_STRINGS);
4519 + GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_REMOVE_COLOR,
4520 + "remove-color", NULL,
4521 + MIXBRUSH_DEFAULT_REMOVE_COLOR,
4522 + GIMP_PARAM_STATIC_STRINGS);
4524 + GIMP_CONFIG_INSTALL_PROP_UINT (object_class, PROP_SAMPLE_SIZE_LIMIT,
4525 + "sample-size-limit", NULL,
4526 + 1, 50, MIXBRUSH_DEFAULT_SAMPLE_SIZE_LIMIT,
4527 + GIMP_PARAM_STATIC_STRINGS);
4529 + GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_ALPHA_CHANNEL_MIXING,
4530 + "alpha-channel-mixing", NULL,
4531 + MIXBRUSH_DEFAULT_ALPHA_CHANNEL_MIXING,
4532 + GIMP_PARAM_STATIC_STRINGS);
4534 + GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_APPLICATION_MODE,
4535 + "mixbrush-application-mode", NULL,
4536 + GIMP_TYPE_PAINT_APPLICATION_MODE,
4537 + MIXBRUSH_DEFAULT_APPLICATION_MODE,
4538 + GIMP_PARAM_STATIC_STRINGS);
4540 + g_object_class_override_property (object_class, PROP_APPLICATION_MODE, "application-mode");
4544 +gimp_mixbrush_options_init (GimpMixbrushOptions *options)
4546 + options->texture_options = g_slice_new0 (GimpTextureOptions);
4550 +gimp_mixbrush_options_finalize (GObject *object)
4552 + GimpMixbrushOptions *options = GIMP_MIXBRUSH_OPTIONS (object);
4554 + g_slice_free (GimpTextureOptions, options->texture_options);
4556 + G_OBJECT_CLASS (parent_class)->finalize (object);
4560 +gimp_mixbrush_options_set_property (GObject *object,
4561 + guint property_id,
4562 + const GValue *value,
4563 + GParamSpec *pspec)
4565 + GimpMixbrushOptions *options = GIMP_MIXBRUSH_OPTIONS (object);
4566 + GimpTextureOptions *texture_options = options->texture_options;
4568 + switch (property_id)
4570 + case PROP_USE_TEXTURE:
4571 + texture_options->use_texture = g_value_get_boolean (value);
4573 + case PROP_TEXTURE_FRINGE:
4574 + texture_options->fringe = g_value_get_boolean (value);
4576 + case PROP_TEXTURE_FRINGE_CONTRAST:
4577 + texture_options->fringe_contrast = g_value_get_double (value);
4579 + case PROP_TEXTURE_GRAIN:
4580 + texture_options->grain = g_value_get_double (value);
4582 + case PROP_TEXTURE_GRAIN_PRESSURE_IN1:
4583 + texture_options->grain_pressure_in1 = g_value_get_double (value);
4585 + case PROP_TEXTURE_GRAIN_PRESSURE_IN2:
4586 + texture_options->grain_pressure_in2 = g_value_get_double (value);
4588 + case PROP_TEXTURE_GRAIN_PRESSURE_OUT1:
4589 + texture_options->grain_pressure_out1 = g_value_get_double (value);
4591 + case PROP_TEXTURE_GRAIN_PRESSURE_OUT2:
4592 + texture_options->grain_pressure_out2 = g_value_get_double (value);
4594 + case PROP_TEXTURE_JITTER:
4595 + texture_options->jitter = g_value_get_uint (value);
4597 + case PROP_MAIN_COLOR_DENSITY:
4598 + options->main_color_density = g_value_get_double (value);
4600 + case PROP_MAIN_COLOR_RATE:
4601 + options->main_color_rate = g_value_get_double (value);
4603 + case PROP_MAIN_COLOR_DENSITY_PRESSURE_IN1:
4604 + options->main_color_density_pressure_in1 = g_value_get_double (value);
4606 + case PROP_MAIN_COLOR_DENSITY_PRESSURE_IN2:
4607 + options->main_color_density_pressure_in2 = g_value_get_double (value);
4609 + case PROP_MAIN_COLOR_DENSITY_PRESSURE_OUT1:
4610 + options->main_color_density_pressure_out1 = g_value_get_double (value);
4612 + case PROP_MAIN_COLOR_DENSITY_PRESSURE_OUT2:
4613 + options->main_color_density_pressure_out2 = g_value_get_double (value);
4615 + case PROP_MAIN_COLOR_PRESSURE_IN1:
4616 + options->main_color_pressure_in1 = g_value_get_double (value);
4618 + case PROP_MAIN_COLOR_PRESSURE_IN2:
4619 + options->main_color_pressure_in2 = g_value_get_double (value);
4621 + case PROP_MAIN_COLOR_PRESSURE_OUT1:
4622 + options->main_color_pressure_out1 = g_value_get_double (value);
4624 + case PROP_MAIN_COLOR_PRESSURE_OUT2:
4625 + options->main_color_pressure_out2 = g_value_get_double (value);
4627 + case PROP_CANVAS_COLOR_DENSITY:
4628 + options->canvas_color_density = g_value_get_double (value);
4630 + case PROP_CANVAS_COLOR_RATE:
4631 + options->canvas_color_rate = g_value_get_double (value);
4633 + case PROP_CANVAS_COLOR_DENSITY_PRESSURE_IN1:
4634 + options->canvas_color_density_pressure_in1 = g_value_get_double (value);
4636 + case PROP_CANVAS_COLOR_DENSITY_PRESSURE_IN2:
4637 + options->canvas_color_density_pressure_in2 = g_value_get_double (value);
4639 + case PROP_CANVAS_COLOR_DENSITY_PRESSURE_OUT1:
4640 + options->canvas_color_density_pressure_out1 = g_value_get_double (value);
4642 + case PROP_CANVAS_COLOR_DENSITY_PRESSURE_OUT2:
4643 + options->canvas_color_density_pressure_out2 = g_value_get_double (value);
4645 + case PROP_CANVAS_COLOR_PRESSURE_IN1:
4646 + options->canvas_color_pressure_in1 = g_value_get_double (value);
4648 + case PROP_CANVAS_COLOR_PRESSURE_IN2:
4649 + options->canvas_color_pressure_in2 = g_value_get_double (value);
4651 + case PROP_CANVAS_COLOR_PRESSURE_OUT1:
4652 + options->canvas_color_pressure_out1 = g_value_get_double (value);
4654 + case PROP_CANVAS_COLOR_PRESSURE_OUT2:
4655 + options->canvas_color_pressure_out2 = g_value_get_double (value);
4658 + options->dryout = g_value_get_uint (value);
4661 + options->delay = g_value_get_uint (value);
4664 + options->tail = g_value_get_boolean (value);
4667 + options->merged = g_value_get_boolean (value);
4669 + case PROP_PIGMENT:
4670 + options->pigment = g_value_get_boolean (value);
4672 + case PROP_HIDDEN_COLOR:
4673 + options->hidden_color = g_value_get_enum (value);
4675 + case PROP_REMOVE_COLOR:
4676 + options->remove_color = g_value_get_boolean (value);
4678 + case PROP_SAMPLE_SIZE_LIMIT:
4679 + options->sample_size_limit = g_value_get_uint (value);
4681 + case PROP_ALPHA_CHANNEL_MIXING:
4682 + options->alpha_channel_mixing = g_value_get_boolean (value);
4684 + case PROP_APPLICATION_MODE:
4685 + GIMP_PAINT_OPTIONS (options)->application_mode = g_value_get_enum (value);
4688 + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
4694 +gimp_mixbrush_options_get_property (GObject *object,
4695 + guint property_id,
4697 + GParamSpec *pspec)
4699 + GimpMixbrushOptions *options = GIMP_MIXBRUSH_OPTIONS (object);
4700 + GimpTextureOptions *texture_options = options->texture_options;
4702 + switch (property_id)
4704 + case PROP_USE_TEXTURE:
4705 + g_value_set_boolean (value, texture_options->use_texture);
4707 + case PROP_TEXTURE_FRINGE:
4708 + g_value_set_boolean (value, texture_options->fringe);
4710 + case PROP_TEXTURE_FRINGE_CONTRAST:
4711 + g_value_set_double (value, texture_options->fringe_contrast);
4713 + case PROP_TEXTURE_GRAIN:
4714 + g_value_set_double (value, texture_options->grain);
4716 + case PROP_TEXTURE_GRAIN_PRESSURE_IN1:
4717 + g_value_set_double (value, texture_options->grain_pressure_in1);
4719 + case PROP_TEXTURE_GRAIN_PRESSURE_IN2:
4720 + g_value_set_double (value, texture_options->grain_pressure_in2);
4722 + case PROP_TEXTURE_GRAIN_PRESSURE_OUT1:
4723 + g_value_set_double (value, texture_options->grain_pressure_out1);
4725 + case PROP_TEXTURE_GRAIN_PRESSURE_OUT2:
4726 + g_value_set_double (value, texture_options->grain_pressure_out2);
4728 + case PROP_TEXTURE_JITTER:
4729 + g_value_set_uint (value, texture_options->jitter);
4731 + case PROP_MAIN_COLOR_DENSITY:
4732 + g_value_set_double (value, options->main_color_density);
4734 + case PROP_MAIN_COLOR_RATE:
4735 + g_value_set_double (value, options->main_color_rate);
4737 + case PROP_MAIN_COLOR_DENSITY_PRESSURE_IN1:
4738 + g_value_set_double (value, options->main_color_density_pressure_in1);
4740 + case PROP_MAIN_COLOR_DENSITY_PRESSURE_IN2:
4741 + g_value_set_double (value, options->main_color_density_pressure_in2);
4743 + case PROP_MAIN_COLOR_DENSITY_PRESSURE_OUT1:
4744 + g_value_set_double (value, options->main_color_density_pressure_out1);
4746 + case PROP_MAIN_COLOR_DENSITY_PRESSURE_OUT2:
4747 + g_value_set_double (value, options->main_color_density_pressure_out2);
4749 + case PROP_MAIN_COLOR_PRESSURE_IN1:
4750 + g_value_set_double (value, options->main_color_pressure_in1);
4752 + case PROP_MAIN_COLOR_PRESSURE_IN2:
4753 + g_value_set_double (value, options->main_color_pressure_in2);
4755 + case PROP_MAIN_COLOR_PRESSURE_OUT1:
4756 + g_value_set_double (value, options->main_color_pressure_out1);
4758 + case PROP_MAIN_COLOR_PRESSURE_OUT2:
4759 + g_value_set_double (value, options->main_color_pressure_out2);
4761 + case PROP_CANVAS_COLOR_DENSITY:
4762 + g_value_set_double (value, options->canvas_color_density);
4764 + case PROP_CANVAS_COLOR_RATE:
4765 + g_value_set_double (value, options->canvas_color_rate);
4767 + case PROP_CANVAS_COLOR_DENSITY_PRESSURE_IN1:
4768 + g_value_set_double (value, options->canvas_color_density_pressure_in1);
4770 + case PROP_CANVAS_COLOR_DENSITY_PRESSURE_IN2:
4771 + g_value_set_double (value, options->canvas_color_density_pressure_in2);
4773 + case PROP_CANVAS_COLOR_DENSITY_PRESSURE_OUT1:
4774 + g_value_set_double (value, options->canvas_color_density_pressure_out1);
4776 + case PROP_CANVAS_COLOR_DENSITY_PRESSURE_OUT2:
4777 + g_value_set_double (value, options->canvas_color_density_pressure_out2);
4779 + case PROP_CANVAS_COLOR_PRESSURE_IN1:
4780 + g_value_set_double (value, options->canvas_color_pressure_in1);
4782 + case PROP_CANVAS_COLOR_PRESSURE_IN2:
4783 + g_value_set_double (value, options->canvas_color_pressure_in2);
4785 + case PROP_CANVAS_COLOR_PRESSURE_OUT1:
4786 + g_value_set_double (value, options->canvas_color_pressure_out1);
4788 + case PROP_CANVAS_COLOR_PRESSURE_OUT2:
4789 + g_value_set_double (value, options->canvas_color_pressure_out2);
4792 + g_value_set_uint (value, options->dryout);
4795 + g_value_set_uint (value, options->delay);
4798 + g_value_set_boolean (value, options->tail);
4801 + g_value_set_boolean (value, options->merged);
4803 + case PROP_PIGMENT:
4804 + g_value_set_boolean (value, options->pigment);
4806 + case PROP_HIDDEN_COLOR:
4807 + g_value_set_enum (value, options->hidden_color);
4809 + case PROP_REMOVE_COLOR:
4810 + g_value_set_boolean (value, options->remove_color);
4812 + case PROP_SAMPLE_SIZE_LIMIT:
4813 + g_value_set_uint (value, options->sample_size_limit);
4815 + case PROP_ALPHA_CHANNEL_MIXING:
4816 + g_value_set_boolean (value, options->alpha_channel_mixing);
4818 + case PROP_APPLICATION_MODE:
4819 + g_value_set_enum (value, GIMP_PAINT_OPTIONS (options)->application_mode);
4822 + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
4829 +gimp_hidden_color_get_type (void)
4831 + static const GEnumValue values[] =
4833 + { GIMP_HIDDEN_COLOR_NORMAL, "GIMP_HIDDEN_COLOR_NORMAL", "normal" },
4834 + { GIMP_HIDDEN_COLOR_WHITE, "GIMP_HIDDEN_COLOR_WHITE", "white" },
4835 + { GIMP_HIDDEN_COLOR_BACKGROUND, "GIMP_HIDDEN_COLOR_BACKGROUND", "background color" },
4839 + static const GimpEnumDesc descs[] =
4841 + { GIMP_HIDDEN_COLOR_NORMAL, "normal", NULL },
4842 + { GIMP_HIDDEN_COLOR_WHITE, "white", NULL },
4843 + { GIMP_HIDDEN_COLOR_BACKGROUND, "background color", NULL },
4847 + static GType type = 0;
4851 + type = g_enum_register_static ("GimpHiddenColor", values);
4852 + gimp_enum_set_value_descriptions (type, descs);
4857 --- gimp-2.6.6/app/paint/gimpmixbrushoptions.h 1970-01-01 09:00:00 +0900
4858 +++ gimp-painter--2.6.6-20100627/app/paint/gimpmixbrushoptions.h 2010-06-27 02:14:18 +0900
4860 +/* GIMP - The GNU Image Manipulation Program
4861 + * Copyright (C) 1995 Spencer Kimball and Peter Mattis
4863 + * This program is free software; you can redistribute it and/or modify
4864 + * it under the terms of the GNU General Public License as published by
4865 + * the Free Software Foundation; either version 2 of the License, or
4866 + * (at your option) any later version.
4868 + * This program is distributed in the hope that it will be useful,
4869 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
4870 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4871 + * GNU General Public License for more details.
4873 + * You should have received a copy of the GNU General Public License
4874 + * along with this program; if not, write to the Free Software
4875 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
4878 +#ifndef __GIMP_MIXBRUSH_OPTIONS_H__
4879 +#define __GIMP_MIXBRUSH_OPTIONS_H__
4882 +#include "gimppaintoptions.h"
4889 + GIMP_HIDDEN_COLOR_NORMAL,
4890 + GIMP_HIDDEN_COLOR_WHITE,
4891 + GIMP_HIDDEN_COLOR_BACKGROUND
4894 +#define GIMP_TYPE_HIDDEN_COLOR (gimp_hidden_color_get_type ())
4896 +GType gimp_hidden_color_get_type (void) G_GNUC_CONST;
4900 +#define GIMP_TYPE_MIXBRUSH_OPTIONS (gimp_mixbrush_options_get_type ())
4901 +#define GIMP_MIXBRUSH_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_MIXBRUSH_OPTIONS, GimpMixbrushOptions))
4902 +#define GIMP_MIXBRUSH_OPTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_MIXBRUSH_OPTIONS, GimpMixbrushOptionsClass))
4903 +#define GIMP_IS_MIXBRUSH_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_MIXBRUSH_OPTIONS))
4904 +#define GIMP_IS_MIXBRUSH_OPTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_MIXBRUSH_OPTIONS))
4905 +#define GIMP_MIXBRUSH_OPTIONS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_MIXBRUSH_OPTIONS, GimpMixbrushOptionsClass))
4908 +typedef struct _GimpMixbrushOptionsClass GimpMixbrushOptionsClass;
4910 +typedef struct _GimpTextureOptions
4912 + gboolean use_texture;
4914 + gdouble fringe_contrast;
4916 + gdouble grain_pressure_in1;
4917 + gdouble grain_pressure_in2;
4918 + gdouble grain_pressure_out1;
4919 + gdouble grain_pressure_out2;
4921 +} GimpTextureOptions;
4923 +struct _GimpMixbrushOptions
4925 + GimpPaintOptions parent_instance;
4927 + GimpTextureOptions *texture_options;
4928 + gdouble main_color_density; /* 塗料の量 */
4929 + gdouble main_color_rate; /* 塗料に前回の塗り色が混じる割合(実際は1-rate) */
4930 + gdouble main_color_density_pressure_in1;
4931 + gdouble main_color_density_pressure_in2;
4932 + gdouble main_color_density_pressure_out1;
4933 + gdouble main_color_density_pressure_out2;
4934 + gdouble main_color_pressure_in1;
4935 + gdouble main_color_pressure_in2;
4936 + gdouble main_color_pressure_out1;
4937 + gdouble main_color_pressure_out2;
4938 + gdouble canvas_color_density; /* 地の色が混じる量 */
4939 + gdouble canvas_color_rate; /* 着色前の地の色が混じる割合(実際は1-rate) */
4940 + gdouble canvas_color_density_pressure_in1;
4941 + gdouble canvas_color_density_pressure_in2;
4942 + gdouble canvas_color_density_pressure_out1;
4943 + gdouble canvas_color_density_pressure_out2;
4944 + gdouble canvas_color_pressure_in1;
4945 + gdouble canvas_color_pressure_in2;
4946 + gdouble canvas_color_pressure_out1;
4947 + gdouble canvas_color_pressure_out2;
4948 + guint dryout; /* main_color_densityが完全に尽きる距離(pixel) */
4953 + GimpHiddenColor hidden_color;
4954 + gboolean remove_color;
4955 + guint sample_size_limit;
4956 + gboolean alpha_channel_mixing;
4959 +struct _GimpMixbrushOptionsClass
4961 + GimpPaintOptionsClass parent_class;
4965 +GType gimp_mixbrush_options_get_type (void) G_GNUC_CONST;
4968 +#endif /* __GIMP_MIXBRUSH_OPTIONS_H__ */
4969 --- gimp-2.6.6/app/paint/gimppaintbrush.c 2008-11-21 07:43:08 +0900
4970 +++ gimp-painter--2.6.6-20100627/app/paint/gimppaintbrush.c 2010-06-27 02:14:18 +0900
4972 _gimp_paintbrush_motion (GimpPaintCore *paint_core,
4973 GimpDrawable *drawable,
4974 GimpPaintOptions *paint_options,
4978 GimpBrushCore *brush_core = GIMP_BRUSH_CORE (paint_core);
4979 GimpContext *context = GIMP_CONTEXT (paint_options);
4980 @@ -114,11 +114,12 @@
4981 GimpPaintApplicationMode paint_appl_mode;
4986 image = gimp_item_get_image (GIMP_ITEM (drawable));
4988 - opacity *= gimp_paint_options_get_fade (paint_options, image,
4989 - paint_core->pixel_dist);
4990 + opacity = gimp_paint_options_get_fade (paint_options, image,
4991 + paint_core->pixel_dist);
4999 + col[area->bytes - 1] = OPAQUE_OPACITY;
5001 gimp_image_transform_color (image, gimp_drawable_type (drawable), pixel,
5005 area->width * area->height,
5008 - paint_appl_mode = GIMP_PAINT_INCREMENTAL;
5009 + /* paint_appl_mode = GIMP_PAINT_INCREMENTAL; */
5011 /* otherwise check if the brush has a pixmap and use that to color the area */
5012 else if (brush_core->brush && brush_core->brush->pixmap)
5015 gimp_paint_options_get_brush_mode (paint_options));
5017 - paint_appl_mode = GIMP_PAINT_INCREMENTAL;
5018 + /*paint_appl_mode = GIMP_PAINT_INCREMENTAL;*/
5020 /* otherwise fill the area with the foreground color */
5022 @@ -183,15 +185,19 @@
5023 opacity *= gimp_paint_options_get_dynamic_opacity (paint_options,
5024 &paint_core->cur_coords);
5026 + flow *= gimp_context_get_flow (context);
5028 hardness = gimp_paint_options_get_dynamic_hardness (paint_options,
5029 &paint_core->cur_coords);
5031 /* finally, let the brush core paste the colored area on the canvas */
5032 gimp_brush_core_paste_canvas (brush_core, drawable,
5033 MIN (opacity, GIMP_OPACITY_OPAQUE),
5035 gimp_context_get_opacity (context),
5036 gimp_context_get_paint_mode (context),
5037 gimp_paint_options_get_brush_mode (paint_options),
5041 + paint_options->update_freq_options);
5043 --- gimp-2.6.6/app/paint/gimppaintbrush.h 2008-11-21 07:43:08 +0900
5044 +++ gimp-painter--2.6.6-20100627/app/paint/gimppaintbrush.h 2010-06-27 02:14:18 +0900
5046 void _gimp_paintbrush_motion (GimpPaintCore *paint_core,
5047 GimpDrawable *drawable,
5048 GimpPaintOptions *paint_options,
5053 #endif /* __GIMP_PAINTBRUSH_H__ */
5054 --- gimp-2.6.6/app/paint/gimppaintcore.c 2008-12-28 08:13:04 +0900
5055 +++ gimp-painter--2.6.6-20100627/app/paint/gimppaintcore.c 2010-06-27 02:14:18 +0900
5056 @@ -101,12 +101,17 @@
5058 static void paint_mask_to_canvas_tiles (GimpPaintCore *core,
5059 PixelRegion *paint_maskPR,
5060 + gdouble paint_opacity_limit,
5061 gdouble paint_opacity);
5062 static void paint_mask_to_canvas_buf (GimpPaintCore *core,
5063 PixelRegion *paint_maskPR,
5064 gdouble paint_opacity);
5065 static void canvas_tiles_to_canvas_buf (GimpPaintCore *core);
5067 +static inline void drawable_update_reduced_freq (GimpDrawable *drawable,
5068 + GimpPaintCore *core,
5069 + GimpUpdateFreqOptions *update_freq_options);
5072 G_DEFINE_TYPE (GimpPaintCore, gimp_paint_core, GIMP_TYPE_OBJECT)
5076 core->undo_tiles = NULL;
5077 core->saved_proj_tiles = NULL;
5078 + core->color_tiles = NULL;
5079 core->canvas_tiles = NULL;
5081 core->orig_buf = NULL;
5082 @@ -322,7 +328,14 @@
5086 - core_class->post_paint (core, drawable,
5087 + if (paint_state == GIMP_PAINT_STATE_FINISH && ! core->updated)
5088 + gimp_drawable_update (drawable,
5091 + core->_x2 - core->_x1 + 1,
5092 + core->_y2 - core->_y1 + 1);
5094 + core_class->post_paint (core, drawable,
5098 @@ -380,6 +393,14 @@
5099 tile_manager_bpp (tiles));
5102 + /* Allocate the color blocks structure */
5103 + if (core->color_tiles)
5104 + tile_manager_unref (core->color_tiles);
5106 + core->color_tiles = tile_manager_new (gimp_item_width (item),
5107 + gimp_item_height (item),
5108 + gimp_drawable_bytes_without_alpha (drawable));
5110 /* Allocate the canvas blocks structure */
5111 if (core->canvas_tiles)
5112 tile_manager_unref (core->canvas_tiles);
5113 @@ -443,6 +464,26 @@
5114 tile_manager_unref (core->saved_proj_tiles);
5115 core->saved_proj_tiles = NULL;
5118 + if (core->canvas_tiles)
5120 + TileManager *tm = core->canvas_tiles;
5121 + gint w = tile_manager_width (tm);
5122 + gint h = tile_manager_height (tm);
5123 + gint bytes = tile_manager_bpp (tm);
5124 + gint len = w * h * bytes;
5125 + guchar *buf = g_new (guchar, len);
5127 + read_pixel_data (tm, 0, 0, w - 1, h - 1, buf, w * bytes );
5129 + g_file_set_contents ("out.raw", buf, len, NULL);
5132 + g_printerr ("wrote out.raw w:%d h:%d bpp:%d\n",w,h,bytes);
5135 + g_printerr ("has no color tiles!\n");
5138 gimp_viewable_preview_thaw (GIMP_VIEWABLE (drawable));
5140 @@ -539,6 +580,12 @@
5141 core->saved_proj_tiles = NULL;
5144 + if (core->color_tiles)
5146 + tile_manager_unref (core->color_tiles);
5147 + core->color_tiles = NULL;
5150 if (core->canvas_tiles)
5152 tile_manager_unref (core->canvas_tiles);
5153 @@ -787,14 +834,18 @@
5154 return core->orig_proj_buf;
5157 +/* paint_opacity_limitが従来のpaint_opacityにあたる */
5158 +/* paint_opacityはPaintbrushのFlowパラメータのために使う */
5160 gimp_paint_core_paste (GimpPaintCore *core,
5161 PixelRegion *paint_maskPR,
5162 GimpDrawable *drawable,
5163 + gdouble paint_opacity_limit,
5164 gdouble paint_opacity,
5165 gdouble image_opacity,
5166 GimpLayerModeEffects paint_mode,
5167 - GimpPaintApplicationMode mode)
5168 + GimpPaintApplicationMode mode,
5169 + GimpUpdateFreqOptions *update_freq_options)
5171 TileManager *alt = NULL;
5173 @@ -843,13 +894,123 @@
5174 if (paint_maskPR->tiles != core->canvas_tiles)
5176 /* initialize any invalid canvas tiles */
5178 +/* These macros came from paint-funcs-generic.c */
5179 +#define INT_MULT(a,b,t) ((t) = (a) * (b) + 0x80, ((((t) >> 8) + (t)) >> 8))
5180 +#define INT_BLEND(a,b,alpha,tmp) (INT_MULT((a) - (b), alpha, tmp) + (b))
5182 gimp_paint_core_validate_canvas_tiles (core,
5183 core->canvas_buf->x,
5184 core->canvas_buf->y,
5185 core->canvas_buf->width,
5186 core->canvas_buf->height);
5188 - paint_mask_to_canvas_tiles (core, paint_maskPR, paint_opacity);
5190 + static gint count = 0;
5191 + if ((count = (++count) % 500) == 0)
5193 + TileManager *tm = core->canvas_tiles;
5194 + gint w = tile_manager_width (tm);
5195 + gint h = tile_manager_height (tm);
5196 + gint bytes = tile_manager_bpp (tm);
5197 + gint len = w * h * bytes;
5198 + guchar *buf = g_new (guchar, len);
5200 + read_pixel_data (tm, 0, 0, w - 1, h - 1, buf, w * bytes );
5202 + g_file_set_contents ("r:\\out.raw", buf, len, NULL);
5205 + g_printerr ("wrote out.raw w:%d h:%d bpp:%d\n",w,h,bytes);
5208 + g_printerr ("count => %d\n", count);
5210 + /* Update the color tiles */
5212 + PixelRegion canvas_bufPR, canvas_tilesPR, color_tilesPR, maskPR;
5216 + x = core->canvas_buf->x;
5217 + y = core->canvas_buf->y;
5218 + w = core->canvas_buf->width;
5219 + h = core->canvas_buf->height;
5221 + pixel_region_init (&color_tilesPR, core->color_tiles,
5224 + pixel_region_init (&canvas_tilesPR, core->canvas_tiles,
5227 + pixel_region_init_temp_buf (&canvas_bufPR,
5231 + g_memmove (&maskPR, paint_maskPR, sizeof (maskPR));
5233 + for (iter = pixel_regions_register (4, &color_tilesPR,
5238 + iter = pixel_regions_process (iter))
5240 + guchar *canvas_tiles = canvas_tilesPR.data;
5241 + guchar *paint_mask = maskPR.data;
5242 + guchar *color_tiles = color_tilesPR.data;
5243 + guchar *canvas_buf = canvas_bufPR.data;
5246 + for (i = 0; i < canvas_bufPR.h; i++)
5248 + for (j = 0;j < canvas_bufPR.w; j++)
5250 + guchar ct = canvas_tiles[j];
5251 + guchar pm = paint_mask[j];
5252 + gint color_offset = j * color_tilesPR.bytes;
5253 + gint canvas_offset = j * canvas_bufPR.bytes;
5255 + gint tmp, blend_op;
5258 + if ((blend_op = pm + ct))
5260 + blend_op = CLAMP (pm * 255 / blend_op, 0, 255);
5262 + for (k = 0; k < color_tilesPR.bytes; k++)
5264 + value = INT_BLEND (canvas_buf[canvas_offset + k],
5265 + color_tiles[color_offset + k],
5267 + value = INT_BLEND (canvas_buf[canvas_offset + k],
5271 + canvas_buf[canvas_offset + k] = value;
5272 + color_tiles[color_offset + k] = value;
5276 + canvas_tiles += canvas_tilesPR.rowstride;
5277 + canvas_buf += canvas_bufPR.rowstride;
5278 + paint_mask += maskPR.rowstride;
5279 + color_tiles += color_tilesPR.rowstride;
5285 + paint_mask_to_canvas_tiles (core, paint_maskPR, paint_opacity_limit, paint_opacity);
5287 + gimp_paint_core_validate_canvas_tiles (core,
5288 + core->canvas_buf->x,
5289 + core->canvas_buf->y,
5290 + core->canvas_buf->width,
5291 + core->canvas_buf->height);
5293 + paint_mask_to_canvas_tiles (core, paint_maskPR, paint_opacity_limit, paint_opacity);
5297 canvas_tiles_to_canvas_buf (core);
5298 @@ -860,7 +1021,7 @@
5302 - paint_mask_to_canvas_buf (core, paint_maskPR, paint_opacity);
5303 + paint_mask_to_canvas_buf (core, paint_maskPR, paint_opacity_limit);
5306 /* intialize canvas buf source pixel regions */
5307 @@ -884,11 +1045,14 @@
5308 core->y2 = MAX (core->y2, core->canvas_buf->y + core->canvas_buf->height);
5310 /* Update the drawable */
5311 - gimp_drawable_update (drawable,
5312 - core->canvas_buf->x,
5313 - core->canvas_buf->y,
5314 - core->canvas_buf->width,
5315 - core->canvas_buf->height);
5316 + if (update_freq_options->reduce_update_freq)
5317 + drawable_update_reduced_freq (drawable, core, update_freq_options);
5319 + gimp_drawable_update (drawable,
5320 + core->canvas_buf->x,
5321 + core->canvas_buf->y,
5322 + core->canvas_buf->width,
5323 + core->canvas_buf->height);
5326 /* This works similarly to gimp_paint_core_paste. However, instead of
5327 @@ -905,7 +1069,8 @@
5328 GimpDrawable *drawable,
5329 gdouble paint_opacity,
5330 gdouble image_opacity,
5331 - GimpPaintApplicationMode mode)
5332 + GimpPaintApplicationMode mode,
5333 + GimpUpdateFreqOptions *update_freq_options)
5337 @@ -913,8 +1078,10 @@
5339 gimp_paint_core_paste (core, paint_maskPR, drawable,
5341 + GIMP_OPACITY_OPAQUE,
5342 image_opacity, GIMP_NORMAL_MODE,
5345 + update_freq_options);
5349 @@ -940,7 +1107,7 @@
5350 core->canvas_buf->height);
5352 /* combine the paint mask and the canvas tiles */
5353 - paint_mask_to_canvas_tiles (core, paint_maskPR, paint_opacity);
5354 + paint_mask_to_canvas_tiles (core, paint_maskPR, paint_opacity, GIMP_OPACITY_OPAQUE);
5356 /* initialize the maskPR from the canvas tiles */
5357 pixel_region_init (paint_maskPR, core->canvas_tiles,
5358 @@ -977,11 +1144,15 @@
5359 core->y2 = MAX (core->y2, core->canvas_buf->y + core->canvas_buf->height) ;
5361 /* Update the drawable */
5362 - gimp_drawable_update (drawable,
5363 - core->canvas_buf->x,
5364 - core->canvas_buf->y,
5365 - core->canvas_buf->width,
5366 - core->canvas_buf->height);
5367 + if (update_freq_options->reduce_update_freq)
5368 + drawable_update_reduced_freq (drawable, core, update_freq_options);
5370 + gimp_drawable_update (drawable,
5371 + core->canvas_buf->x,
5372 + core->canvas_buf->y,
5373 + core->canvas_buf->width,
5374 + core->canvas_buf->height);
5379 @@ -1010,6 +1181,7 @@
5381 paint_mask_to_canvas_tiles (GimpPaintCore *core,
5382 PixelRegion *paint_maskPR,
5383 + gdouble paint_opacity_limit,
5384 gdouble paint_opacity)
5387 @@ -1023,8 +1195,13 @@
5390 /* combine the mask to the canvas tiles */
5391 - combine_mask_and_region (&srcPR, paint_maskPR,
5392 - paint_opacity * 255.999, GIMP_IS_AIRBRUSH (core));
5393 + if (GIMP_IS_PAINTBRUSH (core))
5394 + combine_mask_and_region_limit (&srcPR, paint_maskPR,
5395 + paint_opacity_limit * 255.999,
5396 + paint_opacity * 255.999);
5398 + combine_mask_and_region (&srcPR, paint_maskPR,
5399 + paint_opacity_limit * 255.999, FALSE);
5403 @@ -1150,3 +1327,58 @@
5410 +drawable_update_reduced_freq (GimpDrawable *drawable,
5411 + GimpPaintCore *core,
5412 + GimpUpdateFreqOptions *update_freq_options)
5418 + v = core->cur_coords.velocity - update_freq_options->v_threshold;
5419 + r = (core->canvas_buf->width + core->canvas_buf->height) / 2.0;
5421 + if (v > 0 && r > update_freq_options->s_threshold)
5425 + m = MIN (n * faster_pow (r / update_freq_options->s_threshold,
5426 + update_freq_options->gamma),
5427 + update_freq_options->max_n_dabs);
5428 + //g_printerr ("velo : %f / n : %f / threshold %d\n", core->cur_coords.velocity, n, (gint)(MIN (n, 25.0 - sqrt (r))));
5433 + if (core->update_count)
5435 + core->_x1 = MIN (core->_x1, core->canvas_buf->x);
5436 + core->_y1 = MIN (core->_y1, core->canvas_buf->y);
5437 + core->_x2 = MAX (core->_x2, core->canvas_buf->x + core->canvas_buf->width - 1);
5438 + core->_y2 = MAX (core->_y2, core->canvas_buf->y + core->canvas_buf->height - 1);
5442 + core->_x1 = core->canvas_buf->x;
5443 + core->_x2 = core->canvas_buf->x + core->canvas_buf->width - 1;
5444 + core->_y1 = core->canvas_buf->y;
5445 + core->_y2 = core->canvas_buf->y + core->canvas_buf->height - 1;
5448 + if (++core->update_count >= m)
5450 + core->update_count = 0;
5451 + core->updated = TRUE;
5453 + gimp_drawable_update (drawable,
5456 + core->_x2 - core->_x1 + 1,
5457 + core->_y2 - core->_y1 + 1);
5460 + core->updated = FALSE;
5462 --- gimp-2.6.6/app/paint/gimppaintcore.h 2008-11-21 07:43:08 +0900
5463 +++ gimp-painter--2.6.6-20100627/app/paint/gimppaintcore.h 2010-06-27 02:14:18 +0900
5465 #include "libgimpmath/gimpvector.h"
5466 #include "core/gimpobject.h"
5468 +#include "gimppaintoptions.h"
5471 #define GIMP_TYPE_PAINT_CORE (gimp_paint_core_get_type ())
5472 #define GIMP_PAINT_CORE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_PAINT_CORE, GimpPaintCore))
5475 TileManager *undo_tiles; /* tiles which have been modified */
5476 TileManager *saved_proj_tiles; /* proj tiles which have been modified */
5477 + TileManager *color_tiles; /* the buffer to paint the color to */
5478 TileManager *canvas_tiles; /* the buffer to paint the mask to */
5480 TempBuf *orig_buf; /* the unmodified drawable pixels */
5481 TempBuf *orig_proj_buf; /* the unmodified projection pixels */
5482 TempBuf *canvas_buf; /* the buffer to paint pixels to */
5484 + /* to reduce update frequency */
5485 + gint update_count;
5491 struct _GimpPaintCoreClass
5492 @@ -154,16 +163,19 @@
5493 void gimp_paint_core_paste (GimpPaintCore *core,
5494 PixelRegion *paint_maskPR,
5495 GimpDrawable *drawable,
5496 + gdouble paint_opacity_limit,
5497 gdouble paint_opacity,
5498 gdouble image_opacity,
5499 GimpLayerModeEffects paint_mode,
5500 - GimpPaintApplicationMode mode);
5501 + GimpPaintApplicationMode mode,
5502 + GimpUpdateFreqOptions *update_freq_options);
5503 void gimp_paint_core_replace (GimpPaintCore *core,
5504 PixelRegion *paint_maskPR,
5505 GimpDrawable *drawable,
5506 gdouble paint_opacity,
5507 gdouble image_opacity,
5508 - GimpPaintApplicationMode mode);
5509 + GimpPaintApplicationMode mode,
5510 + GimpUpdateFreqOptions *update_freq_options);
5512 void gimp_paint_core_validate_undo_tiles (GimpPaintCore *core,
5513 GimpDrawable *drawable,
5514 @@ -184,4 +196,20 @@
5518 +/* Utility function(s) */
5519 +static inline gdouble faster_pow (gdouble a, gdouble b)
5521 + guchar n[8] = "\0\0\0\0\0\0\0\0";
5524 + (*((gdouble *)n)) = a;
5525 + i = (*((guint64 *)n)) >> 32;
5527 + i = (guint32)(b * ((gint32)i - 1072632447) + 1072632447);
5528 + (*((guint64 *)n)) = (guint64)i << 32;
5530 + return (*((gdouble *)n));
5534 #endif /* __GIMP_PAINT_CORE_H__ */
5535 --- gimp-2.6.6/app/paint/gimppaintoptions.c 2008-11-21 07:43:08 +0900
5536 +++ gimp-painter--2.6.6-20100627/app/paint/gimppaintoptions.c 2010-06-27 02:14:18 +0900
5538 #include "gimppaintoptions.h"
5541 -#define DEFAULT_BRUSH_SCALE 1.0
5542 -#define DEFAULT_APPLICATION_MODE GIMP_PAINT_CONSTANT
5543 -#define DEFAULT_HARD FALSE
5545 -#define DEFAULT_DYNAMICS_EXPANDED FALSE
5547 -#define DEFAULT_PRESSURE_OPACITY TRUE
5548 -#define DEFAULT_PRESSURE_HARDNESS FALSE
5549 -#define DEFAULT_PRESSURE_RATE FALSE
5550 -#define DEFAULT_PRESSURE_SIZE FALSE
5551 -#define DEFAULT_PRESSURE_INVERSE_SIZE FALSE
5552 -#define DEFAULT_PRESSURE_COLOR FALSE
5553 -#define DEFAULT_PRESSURE_PRESCALE 1.0
5555 -#define DEFAULT_VELOCITY_OPACITY FALSE
5556 -#define DEFAULT_VELOCITY_HARDNESS FALSE
5557 -#define DEFAULT_VELOCITY_RATE FALSE
5558 -#define DEFAULT_VELOCITY_SIZE FALSE
5559 -#define DEFAULT_VELOCITY_INVERSE_SIZE FALSE
5560 -#define DEFAULT_VELOCITY_COLOR FALSE
5561 -#define DEFAULT_VELOCITY_PRESCALE 1.0
5563 -#define DEFAULT_RANDOM_OPACITY FALSE
5564 -#define DEFAULT_RANDOM_HARDNESS FALSE
5565 -#define DEFAULT_RANDOM_RATE FALSE
5566 -#define DEFAULT_RANDOM_SIZE FALSE
5567 -#define DEFAULT_RANDOM_INVERSE_SIZE FALSE
5568 -#define DEFAULT_RANDOM_COLOR FALSE
5569 -#define DEFAULT_RANDOM_PRESCALE 1.0
5571 -#define DEFAULT_USE_FADE FALSE
5572 -#define DEFAULT_FADE_LENGTH 100.0
5573 -#define DEFAULT_FADE_UNIT GIMP_UNIT_PIXEL
5575 -#define DEFAULT_USE_JITTER FALSE
5576 -#define DEFAULT_JITTER_AMOUNT 0.2
5578 -#define DEFAULT_USE_GRADIENT FALSE
5579 -#define DEFAULT_GRADIENT_REVERSE FALSE
5580 -#define DEFAULT_GRADIENT_REPEAT GIMP_REPEAT_TRIANGULAR
5581 -#define DEFAULT_GRADIENT_LENGTH 100.0
5582 -#define DEFAULT_GRADIENT_UNIT GIMP_UNIT_PIXEL
5583 +#define DEFAULT_BRUSH_SCALE 1.0
5584 +#define DEFAULT_APPLICATION_MODE GIMP_PAINT_CONSTANT
5585 +#define DEFAULT_HARD FALSE
5587 +#define DEFAULT_DYNAMICS_EXPANDED FALSE
5589 +#define DEFAULT_PRESSURE_OPACITY TRUE
5590 +#define DEFAULT_PRESSURE_HARDNESS FALSE
5591 +#define DEFAULT_PRESSURE_RATE FALSE
5592 +#define DEFAULT_PRESSURE_SIZE FALSE
5593 +#define DEFAULT_PRESSURE_INVERSE_SIZE FALSE
5594 +#define DEFAULT_PRESSURE_COLOR FALSE
5595 +#define DEFAULT_PRESSURE_PRESCALE 1.0
5596 +#define DEFAULT_PRESSURE_MIN_SCALE 0
5597 +#define DEFAULT_PRESSURE_POWER_SIZE 0.5
5599 +#define DEFAULT_VELOCITY_OPACITY FALSE
5600 +#define DEFAULT_VELOCITY_HARDNESS FALSE
5601 +#define DEFAULT_VELOCITY_RATE FALSE
5602 +#define DEFAULT_VELOCITY_SIZE FALSE
5603 +#define DEFAULT_VELOCITY_INVERSE_SIZE FALSE
5604 +#define DEFAULT_VELOCITY_COLOR FALSE
5605 +#define DEFAULT_VELOCITY_PRESCALE 1.0
5607 +#define DEFAULT_RANDOM_OPACITY FALSE
5608 +#define DEFAULT_RANDOM_HARDNESS FALSE
5609 +#define DEFAULT_RANDOM_RATE FALSE
5610 +#define DEFAULT_RANDOM_SIZE FALSE
5611 +#define DEFAULT_RANDOM_INVERSE_SIZE FALSE
5612 +#define DEFAULT_RANDOM_COLOR FALSE
5613 +#define DEFAULT_RANDOM_PRESCALE 1.0
5615 +#define DEFAULT_USE_FADE FALSE
5616 +#define DEFAULT_FADE_LENGTH 100.0
5617 +#define DEFAULT_FADE_UNIT GIMP_UNIT_PIXEL
5619 +#define DEFAULT_USE_JITTER FALSE
5620 +#define DEFAULT_JITTER_AMOUNT 0.2
5622 +#define DEFAULT_USE_GRADIENT FALSE
5623 +#define DEFAULT_GRADIENT_REVERSE FALSE
5624 +#define DEFAULT_GRADIENT_REPEAT GIMP_REPEAT_TRIANGULAR
5625 +#define DEFAULT_GRADIENT_LENGTH 100.0
5626 +#define DEFAULT_GRADIENT_UNIT GIMP_UNIT_PIXEL
5628 +#define DEFAULT_REDUCE_UPDATE_FREQ FALSE
5629 +#define DEFAULT_UPDATE_FREQ_S_THRESHOLD 30.0
5630 +#define DEFAULT_UPDATE_FREQ_V_THRESHOLD 0.015
5631 +#define DEFAULT_UPDATE_FREQ_GAMMA 1.35
5632 +#define DEFAULT_UPDATE_FREQ_MAX_N_DABS 18
5634 +#define DEFAULT_MAX_COORD_SMOOTH 0.8
5639 PROP_PRESSURE_INVERSE_SIZE,
5640 PROP_PRESSURE_COLOR,
5641 PROP_PRESSURE_PRESCALE,
5642 + PROP_PRESSURE_MIN_SCALE,
5643 + PROP_PRESSURE_POWER_SIZE,
5645 PROP_VELOCITY_OPACITY,
5646 PROP_VELOCITY_HARDNESS,
5647 @@ -131,7 +143,15 @@
5648 PROP_PATTERN_VIEW_TYPE,
5649 PROP_PATTERN_VIEW_SIZE,
5650 PROP_GRADIENT_VIEW_TYPE,
5651 - PROP_GRADIENT_VIEW_SIZE
5652 + PROP_GRADIENT_VIEW_SIZE,
5654 + PROP_REDUCE_UPDATE_FREQ,
5655 + PROP_UPDATE_FREQ_S_THRESHOLD,
5656 + PROP_UPDATE_FREQ_V_THRESHOLD,
5657 + PROP_UPDATE_FREQ_GAMMA,
5658 + PROP_UPDATE_FREQ_MAX_N_DABS,
5660 + PROP_MAX_COORD_SMOOTH
5664 @@ -224,6 +244,14 @@
5665 "pressure-prescale", NULL,
5666 0.0, 1.0, DEFAULT_PRESSURE_PRESCALE,
5667 GIMP_PARAM_STATIC_STRINGS);
5668 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_PRESSURE_MIN_SCALE,
5669 + "pressure-min-scale", NULL,
5670 + 0.0, 1.0, DEFAULT_PRESSURE_MIN_SCALE,
5671 + GIMP_PARAM_STATIC_STRINGS);
5672 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_PRESSURE_POWER_SIZE,
5673 + "pressure-power-size", NULL,
5674 + 0.1, 10.0, DEFAULT_PRESSURE_POWER_SIZE,
5675 + GIMP_PARAM_STATIC_STRINGS);
5677 GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_VELOCITY_OPACITY,
5678 "velocity-opacity", NULL,
5679 @@ -362,6 +390,34 @@
5680 GIMP_VIEWABLE_MAX_BUTTON_SIZE,
5681 GIMP_VIEW_SIZE_LARGE,
5682 GIMP_PARAM_STATIC_STRINGS);
5684 + GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_REDUCE_UPDATE_FREQ,
5685 + "reduce-update-frequency", NULL,
5686 + DEFAULT_REDUCE_UPDATE_FREQ,
5687 + GIMP_PARAM_STATIC_STRINGS | GIMP_CONFIG_PARAM_DONT_RESTORE_SECONDARY);
5688 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_UPDATE_FREQ_S_THRESHOLD,
5689 + "update-freq-size-threshold", NULL,
5690 + 0.1, 100.0, DEFAULT_UPDATE_FREQ_S_THRESHOLD,
5691 + GIMP_PARAM_STATIC_STRINGS | GIMP_CONFIG_PARAM_DONT_RESTORE_SECONDARY);
5692 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_UPDATE_FREQ_V_THRESHOLD,
5693 + "update-freq-velo-threshold", NULL,
5694 + 0.001, 0.1, DEFAULT_UPDATE_FREQ_V_THRESHOLD,
5695 + GIMP_PARAM_STATIC_STRINGS | GIMP_CONFIG_PARAM_DONT_RESTORE_SECONDARY);
5696 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_UPDATE_FREQ_GAMMA,
5697 + "update-freq-gamma", NULL,
5698 + 0.1, 2.5, DEFAULT_UPDATE_FREQ_GAMMA,
5699 + GIMP_PARAM_STATIC_STRINGS | GIMP_CONFIG_PARAM_DONT_RESTORE_SECONDARY);
5700 + GIMP_CONFIG_INSTALL_PROP_INT (object_class, PROP_UPDATE_FREQ_MAX_N_DABS,
5701 + "update-freq-max-n-dabs", NULL,
5702 + 5, 40, DEFAULT_UPDATE_FREQ_MAX_N_DABS,
5703 + GIMP_PARAM_STATIC_STRINGS | GIMP_CONFIG_PARAM_DONT_RESTORE_SECONDARY);
5705 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_MAX_COORD_SMOOTH,
5706 + "paint-max-coord-smooth", NULL,
5707 + 0.0, 1.0, DEFAULT_MAX_COORD_SMOOTH,
5708 + GIMP_PARAM_STATIC_STRINGS | GIMP_CONFIG_PARAM_DONT_RESTORE);
5710 + g_object_class_override_property (object_class, PROP_MAX_COORD_SMOOTH, "max-coord-smooth");
5714 @@ -369,12 +425,13 @@
5716 options->application_mode_save = DEFAULT_APPLICATION_MODE;
5718 - options->pressure_options = g_slice_new0 (GimpDynamicOptions);
5719 - options->velocity_options = g_slice_new0 (GimpDynamicOptions);
5720 - options->random_options = g_slice_new0 (GimpDynamicOptions);
5721 - options->fade_options = g_slice_new0 (GimpFadeOptions);
5722 - options->jitter_options = g_slice_new0 (GimpJitterOptions);
5723 - options->gradient_options = g_slice_new0 (GimpGradientOptions);
5724 + options->pressure_options = g_slice_new0 (GimpDynamicOptions);
5725 + options->velocity_options = g_slice_new0 (GimpDynamicOptions);
5726 + options->random_options = g_slice_new0 (GimpDynamicOptions);
5727 + options->fade_options = g_slice_new0 (GimpFadeOptions);
5728 + options->jitter_options = g_slice_new0 (GimpJitterOptions);
5729 + options->gradient_options = g_slice_new0 (GimpGradientOptions);
5730 + options->update_freq_options = g_slice_new0 (GimpUpdateFreqOptions);
5734 @@ -385,12 +442,13 @@
5735 if (options->paint_info)
5736 g_object_unref (options->paint_info);
5738 - g_slice_free (GimpDynamicOptions, options->pressure_options);
5739 - g_slice_free (GimpDynamicOptions, options->velocity_options);
5740 - g_slice_free (GimpDynamicOptions, options->random_options);
5741 - g_slice_free (GimpFadeOptions, options->fade_options);
5742 - g_slice_free (GimpJitterOptions, options->jitter_options);
5743 - g_slice_free (GimpGradientOptions, options->gradient_options);
5744 + g_slice_free (GimpDynamicOptions, options->pressure_options);
5745 + g_slice_free (GimpDynamicOptions, options->velocity_options);
5746 + g_slice_free (GimpDynamicOptions, options->random_options);
5747 + g_slice_free (GimpFadeOptions, options->fade_options);
5748 + g_slice_free (GimpJitterOptions, options->jitter_options);
5749 + g_slice_free (GimpGradientOptions, options->gradient_options);
5750 + g_slice_free (GimpUpdateFreqOptions, options->update_freq_options);
5752 G_OBJECT_CLASS (parent_class)->finalize (object);
5754 @@ -401,13 +459,14 @@
5755 const GValue *value,
5758 - GimpPaintOptions *options = GIMP_PAINT_OPTIONS (object);
5759 - GimpDynamicOptions *pressure_options = options->pressure_options;
5760 - GimpDynamicOptions *velocity_options = options->velocity_options;
5761 - GimpDynamicOptions *random_options = options->random_options;
5762 - GimpFadeOptions *fade_options = options->fade_options;
5763 - GimpJitterOptions *jitter_options = options->jitter_options;
5764 - GimpGradientOptions *gradient_options = options->gradient_options;
5765 + GimpPaintOptions *options = GIMP_PAINT_OPTIONS (object);
5766 + GimpDynamicOptions *pressure_options = options->pressure_options;
5767 + GimpDynamicOptions *velocity_options = options->velocity_options;
5768 + GimpDynamicOptions *random_options = options->random_options;
5769 + GimpFadeOptions *fade_options = options->fade_options;
5770 + GimpJitterOptions *jitter_options = options->jitter_options;
5771 + GimpGradientOptions *gradient_options = options->gradient_options;
5772 + GimpUpdateFreqOptions *update_freq_options = options->update_freq_options;
5774 switch (property_id)
5776 @@ -459,6 +518,14 @@
5777 pressure_options->prescale = g_value_get_double (value);
5780 + case PROP_PRESSURE_MIN_SCALE:
5781 + pressure_options->min_scale = g_value_get_double (value);
5784 + case PROP_PRESSURE_POWER_SIZE:
5785 + pressure_options->power_size = g_value_get_double (value);
5788 case PROP_VELOCITY_OPACITY:
5789 velocity_options->opacity = g_value_get_boolean (value);
5791 @@ -579,6 +646,26 @@
5792 options->gradient_view_size = g_value_get_int (value);
5795 + case PROP_REDUCE_UPDATE_FREQ:
5796 + update_freq_options->reduce_update_freq = g_value_get_boolean (value);
5798 + case PROP_UPDATE_FREQ_S_THRESHOLD:
5799 + update_freq_options->s_threshold = g_value_get_double (value);
5801 + case PROP_UPDATE_FREQ_V_THRESHOLD:
5802 + update_freq_options->v_threshold = g_value_get_double (value);
5804 + case PROP_UPDATE_FREQ_GAMMA:
5805 + update_freq_options->gamma = g_value_get_double (value);
5807 + case PROP_UPDATE_FREQ_MAX_N_DABS:
5808 + update_freq_options->max_n_dabs = g_value_get_int (value);
5811 + case PROP_MAX_COORD_SMOOTH:
5812 + GIMP_TOOL_OPTIONS (options)->max_coord_smooth = g_value_get_double (value);
5816 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
5818 @@ -591,13 +678,14 @@
5822 - GimpPaintOptions *options = GIMP_PAINT_OPTIONS (object);
5823 - GimpDynamicOptions *pressure_options = options->pressure_options;
5824 - GimpDynamicOptions *velocity_options = options->velocity_options;
5825 - GimpDynamicOptions *random_options = options->random_options;
5826 - GimpFadeOptions *fade_options = options->fade_options;
5827 - GimpJitterOptions *jitter_options = options->jitter_options;
5828 - GimpGradientOptions *gradient_options = options->gradient_options;
5829 + GimpPaintOptions *options = GIMP_PAINT_OPTIONS (object);
5830 + GimpDynamicOptions *pressure_options = options->pressure_options;
5831 + GimpDynamicOptions *velocity_options = options->velocity_options;
5832 + GimpDynamicOptions *random_options = options->random_options;
5833 + GimpFadeOptions *fade_options = options->fade_options;
5834 + GimpJitterOptions *jitter_options = options->jitter_options;
5835 + GimpGradientOptions *gradient_options = options->gradient_options;
5836 + GimpUpdateFreqOptions *update_freq_options = options->update_freq_options;
5838 switch (property_id)
5840 @@ -649,6 +737,14 @@
5841 g_value_set_double (value, pressure_options->prescale);
5844 + case PROP_PRESSURE_MIN_SCALE:
5845 + g_value_set_double (value, pressure_options->min_scale);
5848 + case PROP_PRESSURE_POWER_SIZE:
5849 + g_value_set_double (value, pressure_options->power_size);
5852 case PROP_VELOCITY_OPACITY:
5853 g_value_set_boolean (value, velocity_options->opacity);
5855 @@ -769,6 +865,26 @@
5856 g_value_set_int (value, options->gradient_view_size);
5859 + case PROP_REDUCE_UPDATE_FREQ:
5860 + g_value_set_boolean (value, update_freq_options->reduce_update_freq);
5862 + case PROP_UPDATE_FREQ_S_THRESHOLD:
5863 + g_value_set_double (value, update_freq_options->s_threshold);
5865 + case PROP_UPDATE_FREQ_V_THRESHOLD:
5866 + g_value_set_double (value, update_freq_options->v_threshold);
5868 + case PROP_UPDATE_FREQ_GAMMA:
5869 + g_value_set_double (value, update_freq_options->gamma);
5871 + case PROP_UPDATE_FREQ_MAX_N_DABS:
5872 + g_value_set_int (value, update_freq_options->max_n_dabs);
5875 + case PROP_MAX_COORD_SMOOTH:
5876 + g_value_set_double (value, GIMP_TOOL_OPTIONS (options)->max_coord_smooth);
5880 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
5883 gimp_paint_options_notify (GObject *object,
5886 - GimpPaintOptions *options = GIMP_PAINT_OPTIONS (object);
5887 + /*GimpPaintOptions *options = GIMP_PAINT_OPTIONS (object);
5889 if (pspec->param_id == PROP_USE_GRADIENT)
5894 if (G_OBJECT_CLASS (parent_class)->notify)
5895 - G_OBJECT_CLASS (parent_class)->notify (object, pspec);
5896 + G_OBJECT_CLASS (parent_class)->notify (object, pspec);*/
5900 @@ -1081,8 +1197,9 @@
5901 gboolean use_dynamics)
5903 gdouble scale = 1.0;
5904 + gdouble min_scale = paint_options->pressure_options->min_scale;
5907 + if (use_dynamics && min_scale < 1.0)
5909 gdouble pressure = -1.0;
5910 gdouble velocity = -1.0;
5911 @@ -1122,14 +1239,18 @@
5913 paint_options->random_options->prescale);
5915 - if (scale < 1 / 64.0)
5918 - scale = sqrt (scale);
5919 + scale = pow (scale, paint_options->pressure_options->power_size);
5921 + if (min_scale > 0)
5922 + scale = min_scale + (1.0 - min_scale) * scale;
5924 + //scale = MAX (scale, 1 / 8.0);
5927 scale *= paint_options->brush_scale;
5929 + //g_printerr ("Result of modefied code: %f, pressure: %f\n",scale, coords->pressure);
5934 --- gimp-2.6.6/app/paint/gimppaintoptions.h 2008-11-21 07:43:08 +0900
5935 +++ gimp-painter--2.6.6-20100627/app/paint/gimppaintoptions.h 2010-06-27 02:14:18 +0900
5937 typedef struct _GimpFadeOptions GimpFadeOptions;
5938 typedef struct _GimpJitterOptions GimpJitterOptions;
5939 typedef struct _GimpGradientOptions GimpGradientOptions;
5940 +typedef struct _GimpUpdateFreqOptions GimpUpdateFreqOptions;
5942 struct _GimpDynamicOptions
5945 gboolean inverse_size;
5948 + gdouble min_scale;
5949 + gdouble power_size;
5952 struct _GimpFadeOptions
5954 GimpRepeatMode gradient_repeat;
5957 +struct _GimpUpdateFreqOptions
5959 + gboolean reduce_update_freq;
5960 + gdouble s_threshold;
5961 + gdouble v_threshold;
5967 #define GIMP_TYPE_PAINT_OPTIONS (gimp_paint_options_get_type ())
5968 #define GIMP_PAINT_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_PAINT_OPTIONS, GimpPaintOptions))
5970 GimpViewSize pattern_view_size;
5971 GimpViewType gradient_view_type;
5972 GimpViewSize gradient_view_size;
5974 + GimpUpdateFreqOptions *update_freq_options;
5977 struct _GimpPaintOptionsClass
5978 --- gimp-2.6.6/app/paint/gimpsmudge.c 2008-11-21 07:43:08 +0900
5979 +++ gimp-painter--2.6.6-20100627/app/paint/gimpsmudge.c 2010-06-27 02:14:18 +0900
5981 gimp_context_get_opacity (context),
5982 gimp_paint_options_get_brush_mode (paint_options),
5984 - GIMP_PAINT_INCREMENTAL);
5985 + GIMP_PAINT_INCREMENTAL,
5986 + paint_options->update_freq_options);
5990 --- gimp-2.6.6/app/paint/paint-types.h 2008-11-21 07:43:08 +0900
5991 +++ gimp-painter--2.6.6-20100627/app/paint/paint-types.h 2010-06-27 02:14:18 +0900
5993 typedef struct _GimpPencil GimpPencil;
5994 typedef struct _GimpPerspectiveClone GimpPerspectiveClone;
5995 typedef struct _GimpSmudge GimpSmudge;
5996 +typedef struct _GimpInk2 GimpInk2;
5997 +typedef struct _GimpMixbrush GimpMixbrush;
6002 typedef struct _GimpPencilOptions GimpPencilOptions;
6003 typedef struct _GimpPerspectiveCloneOptions GimpPerspectiveCloneOptions;
6004 typedef struct _GimpSmudgeOptions GimpSmudgeOptions;
6005 +typedef struct _GimpInk2Options GimpInk2Options;
6006 +typedef struct _GimpMixbrushOptions GimpMixbrushOptions;
6011 typedef struct _GimpPaintCoreUndo GimpPaintCoreUndo;
6012 typedef struct _GimpInkUndo GimpInkUndo;
6013 +typedef struct _GimpInk2Undo GimpInk2Undo;
6017 --- gimp-2.6.6/app/paint-funcs/paint-funcs-generic.h 2008-11-21 07:43:00 +0900
6018 +++ gimp-painter--2.6.6-20100627/app/paint-funcs/paint-funcs-generic.h 2010-06-27 02:14:19 +0900
6019 @@ -1533,6 +1533,48 @@
6023 +combine_mask_and_alpha_channel_stroke_limit (guchar *src,
6024 + const guchar *mask,
6030 + /* align with alpha channel */
6033 + if (opacity != 255 || limit != 255)
6036 + gint _opacity = INT_MULT (opacity, limit, tmp);
6042 + gint mask_val = INT_MULT (*mask, _opacity, tmp);
6044 + *src = *src + INT_MULT ((limit - *src) , mask_val, tmp);
6056 + *src = *src + INT_MULT ((255 - *src) , *mask, tmp);
6065 copy_gray_to_inten_a_pixels (const guchar *src,
6068 --- gimp-2.6.6/app/paint-funcs/paint-funcs.c 2008-11-21 07:43:00 +0900
6069 +++ gimp-painter--2.6.6-20100627/app/paint-funcs/paint-funcs.c 2010-06-27 02:14:19 +0900
6070 @@ -3906,6 +3906,26 @@
6075 +combine_mask_and_sub_region_stroke_limit (guint *param,
6077 + PixelRegion *mask)
6079 + guchar *s = src->data;
6080 + const guchar *m = mask->data;
6082 + guint limit = param[0];
6083 + guint opacity = param[1];
6087 + combine_mask_and_alpha_channel_stroke_limit (s, m, limit, opacity, src->w, src->bytes);
6088 + s += src->rowstride;
6089 + m += mask->rowstride;
6095 combine_mask_and_region (PixelRegion *src,
6097 @@ -3924,6 +3944,23 @@
6101 +combine_mask_and_region_limit (PixelRegion *src,
6102 + PixelRegion *mask,
6109 + param[1] = opacity;
6111 + pixel_regions_process_parallel ((PixelProcessorFunc)
6112 + combine_mask_and_sub_region_stroke_limit,
6113 + param, 2, src, mask);
6118 copy_gray_to_region (PixelRegion *src,
6121 --- gimp-2.6.6/app/paint-funcs/paint-funcs.h 2008-11-21 07:43:00 +0900
6122 +++ gimp-painter--2.6.6-20100627/app/paint-funcs/paint-funcs.h 2010-06-27 02:14:19 +0900
6123 @@ -444,6 +444,11 @@
6127 +void combine_mask_and_region_limit (PixelRegion *src,
6128 + PixelRegion *mask,
6132 /* Copy a gray image to an intensity-alpha region */
6133 void copy_gray_to_region (PixelRegion *src,
6135 --- gimp-2.6.6/app/tools/Makefile.am 2008-11-21 07:42:59 +0900
6136 +++ gimp-painter--2.6.6-20100627/app/tools/Makefile.am 2010-06-27 02:14:19 +0900
6137 @@ -189,7 +189,13 @@
6138 gimpvectoroptions.c \
6139 gimpvectoroptions.h \
6142 + gimpvectortool.h \
6143 + gimpink2options-gui.c \
6144 + gimpink2options-gui.h \
6147 + gimpmixbrushtool.c \
6148 + gimpmixbrushtool.h
6150 libapptools_a_built_sources = tools-enums.c
6152 --- gimp-2.6.6/app/tools/Makefile.in 2009-03-16 05:58:05 +0900
6153 +++ gimp-painter--2.6.6-20100627/app/tools/Makefile.in 2010-06-27 02:14:19 +0900
6155 gimptoolcontrol.$(OBJEXT) gimptooloptions-gui.$(OBJEXT) \
6156 gimptransformoptions.$(OBJEXT) gimptransformtool.$(OBJEXT) \
6157 gimptransformtoolundo.$(OBJEXT) gimpvectoroptions.$(OBJEXT) \
6158 - gimpvectortool.$(OBJEXT)
6159 + gimpvectortool.$(OBJEXT) \
6160 + gimpinktool2.$(OBJEXT) gimpink2options-gui.$(OBJEXT) \
6161 + gimpmixbrushtool.$(OBJEXT)
6162 am_libapptools_a_OBJECTS = $(am__objects_1) $(am__objects_2)
6163 libapptools_a_OBJECTS = $(am_libapptools_a_OBJECTS)
6164 DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
6165 @@ -611,7 +613,13 @@
6166 gimpvectoroptions.c \
6167 gimpvectoroptions.h \
6170 + gimpvectortool.h \
6173 + gimpink2options-gui.c \
6174 + gimpink2options-gui.h \
6175 + gimpmixbrushtool.c \
6176 + gimpmixbrushtool.h
6178 libapptools_a_built_sources = tools-enums.c
6179 libapptools_a_SOURCES = $(libapptools_a_built_sources) $(libapptools_a_sources)
6181 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tool_manager.Po@am__quote@
6182 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tools-enums.Po@am__quote@
6183 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tools-utils.Po@am__quote@
6184 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpink2options-gui.Po@am__quote@
6185 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpinktool2.Po@am__quote@
6186 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpmixbrushtool.Po@am__quote@
6189 @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
6190 --- gimp-2.6.6/app/tools/gimp-tools.c 2008-11-21 07:42:59 +0900
6191 +++ gimp-painter--2.6.6-20100627/app/tools/gimp-tools.c 2010-06-27 02:14:19 +0900
6193 #include "gimpsmudgetool.h"
6194 #include "gimptexttool.h"
6195 #include "gimpvectortool.h"
6196 +#include "gimpinktool2.h"
6197 +#include "gimpmixbrushtool.h"
6199 #include "gimp-intl.h"
6202 gimp_blend_tool_register,
6203 gimp_bucket_fill_tool_register,
6204 gimp_text_tool_register,
6205 + gimp_ink2_tool_register,
6206 + gimp_mixbrush_tool_register,
6208 /* transform tools */
6210 @@ -506,6 +510,14 @@
6212 paint_core_name = "gimp-ink";
6214 + else if (tool_type == GIMP_TYPE_INK2_TOOL)
6216 + paint_core_name = "gimp-ink2";
6218 + else if (tool_type == GIMP_TYPE_MIXBRUSH_TOOL)
6220 + paint_core_name = "gimp-mixbrush";
6224 paint_core_name = "gimp-paintbrush";
6225 --- gimp-2.6.6/app/tools/gimpink2options-gui.c 1970-01-01 09:00:00 +0900
6226 +++ gimp-painter--2.6.6-20100627/app/tools/gimpink2options-gui.c 2010-06-27 02:14:19 +0900
6228 +/* GIMP - The GNU Image Manipulation Program
6229 + * Copyright (C) 1995 Spencer Kimball and Peter Mattis
6231 + * This program is free software; you can redistribute it and/or modify
6232 + * it under the terms of the GNU General Public License as published by
6233 + * the Free Software Foundation; either version 2 of the License, or
6234 + * (at your option) any later version.
6236 + * This program is distributed in the hope that it will be useful,
6237 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
6238 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6239 + * GNU General Public License for more details.
6241 + * You should have received a copy of the GNU General Public License
6242 + * along with this program; if not, write to the Free Software
6243 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
6246 +#include "config.h"
6248 +#include <gtk/gtk.h>
6250 +#include "libgimpwidgets/gimpwidgets.h"
6252 +#include "tools-types.h"
6254 +#include "config/gimpconfig-utils.h"
6256 +#include "paint/gimpink2options.h"
6257 +#include "paint/gimpink2.h"
6259 +#include "widgets/gimpblobeditor.h"
6261 +#include "gimpink2options-gui.h"
6262 +#include "gimppaintoptions-gui.h"
6264 +#include "gimp-intl.h"
6267 +static GtkWidget * blob_image_new (GimpInkBlobType blob_type);
6271 +gimp_ink2_options_gui (GimpToolOptions *tool_options)
6273 + GObject *config = G_OBJECT (tool_options);
6274 + GimpInk2Options *ink_options = GIMP_INK2_OPTIONS (tool_options);
6275 + GtkWidget *vbox = gimp_paint_options_gui (tool_options);
6278 + GtkWidget *blob_vbox;
6280 + GtkWidget *editor;
6282 + GtkWidget *compensate_box;
6283 + GtkWidget *compensate_vbox;
6284 + GtkWidget *checkbox;
6286 + /* adjust sliders */
6287 + frame = gimp_frame_new (_("Adjustment"));
6288 + gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 0);
6289 + gtk_widget_show (frame);
6291 + table = gtk_table_new (2, 3, FALSE);
6292 + gtk_table_set_col_spacings (GTK_TABLE (table), 2);
6293 + gtk_container_add (GTK_CONTAINER (frame), table);
6294 + gtk_widget_show (table);
6297 + adj = gimp_prop_scale_entry_new (config, "size",
6298 + GTK_TABLE (table), 0, 0,
6302 + gimp_scale_entry_set_logarithmic (adj, TRUE);
6304 + /* angle adjust slider */
6305 + gimp_prop_scale_entry_new (config, "tilt-angle",
6306 + GTK_TABLE (table), 0, 1,
6311 + /* sens sliders */
6312 + frame = gimp_frame_new (_("Sensitivity"));
6313 + gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 0);
6314 + gtk_widget_show (frame);
6316 + table = gtk_table_new (3, 3, FALSE);
6317 + gtk_table_set_col_spacings (GTK_TABLE (table), 2);
6318 + gtk_container_add (GTK_CONTAINER (frame), table);
6319 + gtk_widget_show (table);
6321 + /* size sens slider */
6322 + gimp_prop_scale_entry_new (config, "size-sensitivity",
6323 + GTK_TABLE (table), 0, 0,
6328 + /* tilt sens slider */
6329 + gimp_prop_scale_entry_new (config, "tilt-sensitivity",
6330 + GTK_TABLE (table), 0, 1,
6335 + /* velocity sens slider */
6336 + gimp_prop_scale_entry_new (config, "vel-sensitivity",
6337 + GTK_TABLE (table), 0, 2,
6342 + /* compensate at last checkbox */
6343 + compensate_box = gtk_frame_new (_("Pointer Adjustment"));
6344 + gtk_box_pack_start (GTK_BOX (vbox), compensate_box, FALSE, TRUE, 0);
6345 + gtk_widget_show(compensate_box);
6346 + compensate_vbox = gtk_vbox_new (FALSE, 2);
6347 + gtk_container_add (GTK_CONTAINER (compensate_box), compensate_vbox);
6348 + gtk_widget_show (compensate_vbox);
6350 + table = gtk_table_new (3, 3, FALSE);
6351 + gtk_table_set_col_spacings (GTK_TABLE (table), 2);
6352 + gtk_box_pack_start (GTK_VBOX (compensate_vbox), table, TRUE, TRUE, 0);
6353 + gtk_widget_show (table);
6355 + /* compensation history size slider */
6356 + gimp_prop_scale_entry_new (config, "compensation-history-size",
6357 + GTK_TABLE (table), 0, 0,
6360 + FALSE, 1.0, INK2_HISTORY_BUFFER);
6362 + /* pointer tracking rate slider */
6363 + adj = gimp_prop_scale_entry_new (config, "compensation-rate-temperature",
6364 + GTK_TABLE (table), 0, 1,
6368 + gimp_scale_entry_set_logarithmic (adj, TRUE);
6371 + gimp_prop_check_button_new (config, "compensate-at-last",
6372 + _("Draw pen line to finished point:"));
6373 + gtk_box_pack_start (GTK_VBOX (compensate_vbox), checkbox, FALSE, FALSE, 0);
6374 + gtk_widget_show(checkbox);
6377 + hbox = gtk_hbox_new (FALSE, 2);
6378 + gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
6379 + gtk_widget_show (hbox);
6381 + /* Blob type radiobuttons */
6382 + frame = gimp_prop_enum_radio_frame_new (config, "blob-type",
6384 + gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0);
6385 + gtk_widget_show (frame);
6390 + GimpInkBlobType blob_type;
6393 + gtk_container_get_children (GTK_CONTAINER (GTK_BIN (frame)->child));
6395 + for (list = children, blob_type = GIMP_INK_BLOB_TYPE_ELLIPSE;
6397 + list = g_list_next (list), blob_type++)
6399 + GtkWidget *radio = GTK_WIDGET (list->data);
6402 + gtk_container_remove (GTK_CONTAINER (radio), GTK_BIN (radio)->child);
6404 + blob = blob_image_new (blob_type);
6405 + gtk_container_add (GTK_CONTAINER (radio), blob);
6406 + gtk_widget_show (blob);
6409 + g_list_free (children);
6412 + /* Blob shape widget */
6413 + frame = gimp_frame_new (_("Shape"));
6414 + gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0);
6415 + gtk_widget_show (frame);
6417 + blob_vbox = gtk_vbox_new (FALSE, 2);
6418 + gtk_container_add (GTK_CONTAINER (frame), blob_vbox);
6419 + gtk_widget_show (blob_vbox);
6421 + frame = gtk_aspect_frame_new (NULL, 0.0, 0.5, 1.0, FALSE);
6422 + gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
6423 + gtk_box_pack_start (GTK_BOX (blob_vbox), frame, TRUE, TRUE, 0);
6424 + gtk_widget_show (frame);
6426 + editor = gimp_blob_editor_new (ink_options->blob_type,
6427 + ink_options->blob_aspect,
6428 + ink_options->blob_angle);
6429 + gtk_widget_set_size_request (editor, 60, 60);
6430 + gtk_container_add (GTK_CONTAINER (frame), editor);
6431 + gtk_widget_show (editor);
6433 + gimp_config_connect (config, G_OBJECT (editor), NULL);
6439 +blob_image_new (GimpInkBlobType blob_type)
6441 + const gchar *stock_id = NULL;
6443 + switch (blob_type)
6445 + case GIMP_INK_BLOB_TYPE_ELLIPSE:
6446 + stock_id = GIMP_STOCK_SHAPE_CIRCLE;
6449 + case GIMP_INK_BLOB_TYPE_SQUARE:
6450 + stock_id = GIMP_STOCK_SHAPE_SQUARE;
6453 + case GIMP_INK_BLOB_TYPE_DIAMOND:
6454 + stock_id = GIMP_STOCK_SHAPE_DIAMOND;
6458 + return gtk_image_new_from_stock (stock_id, GTK_ICON_SIZE_MENU);
6460 --- gimp-2.6.6/app/tools/gimpink2options-gui.h 1970-01-01 09:00:00 +0900
6461 +++ gimp-painter--2.6.6-20100627/app/tools/gimpink2options-gui.h 2010-06-27 02:14:19 +0900
6463 +/* GIMP - The GNU Image Manipulation Program
6464 + * Copyright (C) 1995 Spencer Kimball and Peter Mattis
6466 + * This program is free software; you can redistribute it and/or modify
6467 + * it under the terms of the GNU General Public License as published by
6468 + * the Free Software Foundation; either version 2 of the License, or
6469 + * (at your option) any later version.
6471 + * This program is distributed in the hope that it will be useful,
6472 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
6473 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6474 + * GNU General Public License for more details.
6476 + * You should have received a copy of the GNU General Public License
6477 + * along with this program; if not, write to the Free Software
6478 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
6481 +#ifndef __GIMP_INK2_OPTIONS_GUI_H__
6482 +#define __GIMP_INK2_OPTIONS_GUI_H__
6485 +GtkWidget * gimp_ink2_options_gui (GimpToolOptions *tool_options);
6488 +#endif /* __GIMP_INK2_OPTIONS_GUI_H__ */
6489 --- gimp-2.6.6/app/tools/gimpinktool2.c 1970-01-01 09:00:00 +0900
6490 +++ gimp-painter--2.6.6-20100627/app/tools/gimpinktool2.c 2010-06-27 02:14:19 +0900
6492 +/* GIMP - The GNU Image Manipulation Program
6493 + * Copyright (C) 1995 Spencer Kimball and Peter Mattis
6495 + * This program is free software; you can redistribute it and/or modify
6496 + * it under the terms of the GNU General Public License as published by
6497 + * the Free Software Foundation; either version 2 of the License, or
6498 + * (at your option) any later version.
6500 + * This program is distributed in the hope that it will be useful,
6501 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
6502 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6503 + * GNU General Public License for more details.
6505 + * You should have received a copy of the GNU General Public License
6506 + * along with this program; if not, write to the Free Software
6507 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
6510 +#include "config.h"
6512 +#include <gtk/gtk.h>
6514 +#include "libgimpwidgets/gimpwidgets.h"
6516 +#include "tools-types.h"
6518 +#include "paint/gimpink2options.h"
6520 +#include "widgets/gimphelp-ids.h"
6522 +#include "gimpink2options-gui.h"
6523 +#include "gimpinktool2.h"
6524 +#include "gimptoolcontrol.h"
6526 +#include "gimp-intl.h"
6529 +G_DEFINE_TYPE (GimpInk2Tool, gimp_ink2_tool, GIMP_TYPE_PAINT_TOOL)
6531 +#define parent_class gimp_ink2_tool_parent_class
6535 +gimp_ink2_tool_register (GimpToolRegisterCallback callback,
6538 + (* callback) (GIMP_TYPE_INK2_TOOL,
6539 + GIMP_TYPE_INK2_OPTIONS,
6540 + gimp_ink2_options_gui,
6541 + GIMP_CONTEXT_FOREGROUND_MASK |
6542 + GIMP_CONTEXT_BACKGROUND_MASK |
6543 + GIMP_CONTEXT_OPACITY_MASK |
6544 + GIMP_CONTEXT_PAINT_MODE_MASK,
6547 + _("Draw in G-pen -2-"),
6549 + NULL, GIMP_HELP_TOOL_INK,
6550 + GIMP_STOCK_TOOL_INK,
6555 +gimp_ink2_tool_class_init (GimpInk2ToolClass *klass)
6560 +gimp_ink2_tool_init (GimpInk2Tool *ink_tool)
6562 + GimpTool *tool = GIMP_TOOL (ink_tool);
6564 + gimp_tool_control_set_tool_cursor (tool->control, GIMP_TOOL_CURSOR_INK);
6565 + gimp_tool_control_set_action_value_2 (tool->control,
6566 + "tools/tools-ink-blob-size-set");
6567 + gimp_tool_control_set_action_value_3 (tool->control,
6568 + "tools/tools-ink-blob-aspect-set");
6569 + gimp_tool_control_set_action_value_4 (tool->control,
6570 + "tools/tools-ink-blob-angle-set");
6572 + gimp_paint_tool_enable_color_picker (GIMP_PAINT_TOOL (ink_tool),
6573 + GIMP_COLOR_PICK_MODE_FOREGROUND);
6575 + /* G-Pen uses the own smoothing routin, so disable the GimpDisplayShell's one */
6576 + tool->max_coord_smooth = 0.0;
6578 --- gimp-2.6.6/app/tools/gimpinktool2.h 1970-01-01 09:00:00 +0900
6579 +++ gimp-painter--2.6.6-20100627/app/tools/gimpinktool2.h 2010-06-27 02:14:19 +0900
6581 +/* GIMP - The GNU Image Manipulation Program
6582 + * Copyright (C) 1995 Spencer Kimball and Peter Mattis
6584 + * This program is free software; you can redistribute it and/or modify
6585 + * it under the terms of the GNU General Public License as published by
6586 + * the Free Software Foundation; either version 2 of the License, or
6587 + * (at your option) any later version.
6589 + * This program is distributed in the hope that it will be useful,
6590 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
6591 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6592 + * GNU General Public License for more details.
6594 + * You should have received a copy of the GNU General Public License
6595 + * along with this program; if not, write to the Free Software
6596 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
6599 +#ifndef __GIMP_INK2_TOOL_H__
6600 +#define __GIMP_INK2_TOOL_H__
6603 +#include "gimppainttool.h"
6606 +#define GIMP_TYPE_INK2_TOOL (gimp_ink2_tool_get_type ())
6607 +#define GIMP_INK2_TOOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_INK2_TOOL, GimpInk2Tool))
6608 +#define GIMP_INK2_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_INK2_TOOL, GimpInk2ToolClass))
6609 +#define GIMP_IS_INK2_TOOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_INK2_TOOL))
6610 +#define GIMP_IS_INK2_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_INK2_TOOL))
6611 +#define GIMP_INK2_TOOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_INK2_TOOL, GimpInk2ToolClass))
6614 +typedef struct _GimpInk2Tool GimpInk2Tool;
6615 +typedef struct _GimpInk2ToolClass GimpInk2ToolClass;
6617 +struct _GimpInk2Tool
6619 + GimpPaintTool parent_instance;
6622 +struct _GimpInk2ToolClass
6624 + GimpPaintToolClass parent_class;
6628 +void gimp_ink2_tool_register (GimpToolRegisterCallback callback,
6631 +GType gimp_ink2_tool_get_type (void) G_GNUC_CONST;
6634 +#endif /* __GIMP_INK2_TOOL_H__ */
6635 --- gimp-2.6.6/app/tools/gimpmixbrushtool.c 1970-01-01 09:00:00 +0900
6636 +++ gimp-painter--2.6.6-20100627/app/tools/gimpmixbrushtool.c 2010-06-27 02:14:19 +0900
6638 +/* GIMP - The GNU Image Manipulation Program
6639 + * Copyright (C) 1995 Spencer Kimball and Peter Mattis
6641 + * This program is free software; you can redistribute it and/or modify
6642 + * it under the terms of the GNU General Public License as published by
6643 + * the Free Software Foundation; either version 2 of the License, or
6644 + * (at your option) any later version.
6646 + * This program is distributed in the hope that it will be useful,
6647 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
6648 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6649 + * GNU General Public License for more details.
6651 + * You should have received a copy of the GNU General Public License
6652 + * along with this program; if not, write to the Free Software
6653 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
6656 +#include "config.h"
6658 +#include <gtk/gtk.h>
6660 +#include "libgimpwidgets/gimpwidgets.h"
6662 +#include "tools-types.h"
6664 +#include "paint/gimpmixbrushoptions.h"
6666 +#include "widgets/gimphelp-ids.h"
6667 +#include "widgets/gimppropwidgets.h"
6668 +#include "widgets/gimpviewablebox.h"
6670 +#include "gimpmixbrushtool.h"
6671 +#include "gimppaintoptions-gui.h"
6672 +#include "gimptoolcontrol.h"
6674 +#include "gimp-intl.h"
6677 +static GtkWidget * gimp_mixbrush_options_gui (GimpToolOptions *tool_options);
6680 +G_DEFINE_TYPE (GimpMixbrushTool, gimp_mixbrush_tool, GIMP_TYPE_PAINTBRUSH_TOOL)
6684 +gimp_mixbrush_tool_register (GimpToolRegisterCallback callback,
6687 + (* callback) (GIMP_TYPE_MIXBRUSH_TOOL,
6688 + GIMP_TYPE_MIXBRUSH_OPTIONS,
6689 + gimp_mixbrush_options_gui,
6690 + GIMP_PAINT_OPTIONS_CONTEXT_MASK |
6691 + GIMP_CONTEXT_PATTERN_MASK |
6692 + GIMP_CONTEXT_GRADIENT_MASK,
6693 + "gimp-mixbrush-tool",
6695 + _("Mixbrush Tool: Brush with mixing color feature"),
6696 + N_("_Mixbrush"), "W",
6697 + NULL, GIMP_HELP_TOOL_PAINTBRUSH,
6698 + GIMP_STOCK_TOOL_PAINTBRUSH,
6703 +gimp_mixbrush_tool_class_init (GimpMixbrushToolClass *klass)
6708 +gimp_mixbrush_tool_init (GimpMixbrushTool *mixbrush)
6710 + GimpTool *tool = GIMP_TOOL (mixbrush);
6712 + gimp_tool_control_set_tool_cursor (tool->control, GIMP_TOOL_CURSOR_PAINTBRUSH);
6714 + gimp_paint_tool_enable_color_picker (GIMP_PAINT_TOOL (mixbrush),
6715 + GIMP_COLOR_PICK_MODE_FOREGROUND);
6719 +/* tool options stuff */
6722 +gimp_mixbrush_options_gui (GimpToolOptions *tool_options)
6724 + GObject *config = G_OBJECT (tool_options);
6725 + GtkWidget *vbox = gimp_paint_options_gui (tool_options);
6727 + GtkWidget *mixbrush_box;
6728 + GtkWidget *mixbrush_vbox;
6729 + GtkWidget *mixbrush_button;
6730 + GtkWidget *mixbrush_frame;
6733 + /* Texture configurations */
6735 + table = gtk_table_new (3, 7, FALSE);
6736 + gtk_table_set_col_spacings (GTK_TABLE (table), 2);
6738 + mixbrush_frame = gimp_prop_expanding_frame_new (config, "use-texture", "Use texture", table, NULL);
6740 + mixbrush_box = gimp_prop_pattern_box_new (NULL, GIMP_CONTEXT (tool_options), 2,
6741 + "pattern-view-type", "pattern-view-size");
6742 + gtk_table_attach (GTK_TABLE (table), mixbrush_box, 0, 3, 1, 2,
6743 + GTK_EXPAND | GTK_FILL, GTK_SHRINK | GTK_FILL,
6745 + gtk_widget_show (mixbrush_box);
6747 + gimp_prop_scale_entry_new (config, "texture-grain",
6748 + GTK_TABLE (table), 0, 2,
6751 + FALSE, -1.0, 1.0);
6754 + GtkWidget *expander = gtk_expander_new (_("Pressure"));
6755 + GtkWidget *inner_table = gtk_table_new (3, 4, FALSE);
6757 + gtk_container_add (GTK_CONTAINER (expander), inner_table);
6758 + gtk_table_attach (GTK_TABLE (table), expander, 0, 3, 3, 4,
6759 + GTK_EXPAND | GTK_FILL, GTK_SHRINK | GTK_FILL,
6762 + gimp_prop_scale_entry_new (config, "texture-grain-pressure-in1",
6763 + GTK_TABLE (inner_table), 0, 0,
6767 + gimp_prop_scale_entry_new (config, "texture-grain-pressure-in2",
6768 + GTK_TABLE (inner_table), 0, 1,
6772 + gimp_prop_scale_entry_new (config, "texture-grain-pressure-out1",
6773 + GTK_TABLE (inner_table), 0, 2,
6777 + gimp_prop_scale_entry_new (config, "texture-grain-pressure-out2",
6778 + GTK_TABLE (inner_table), 0, 3,
6783 + gtk_widget_show_all (expander);
6786 + gimp_prop_scale_entry_new (config, "texture-jitter",
6787 + GTK_TABLE (table), 0, 4,
6792 + mixbrush_button = gimp_prop_check_button_new (config, "texture-fringe", _("Apply fringe"));
6793 + gtk_table_attach (GTK_TABLE (table), mixbrush_button, 0, 3, 5, 6,
6794 + GTK_EXPAND | GTK_FILL, GTK_SHRINK | GTK_FILL,
6796 + gtk_widget_show (mixbrush_button);
6798 + gimp_prop_scale_entry_new (config, "texture-fringe-contrast",
6799 + GTK_TABLE (table), 0, 6,
6802 + FALSE, 1.0, 10.0);
6804 + gtk_box_pack_start (GTK_BOX (vbox), mixbrush_frame, FALSE, FALSE, 0);
6805 + gtk_widget_show (mixbrush_frame);
6808 + mixbrush_button = gimp_prop_check_button_new (config, "alpha-channel-mixing", _("Alpha channel mixing"));
6809 + gtk_box_pack_start (GTK_BOX (vbox), mixbrush_button, FALSE, TRUE, 0);
6810 + gtk_widget_show (mixbrush_button);
6812 + /* Main color configurations */
6813 + mixbrush_box = gtk_frame_new (_("Main Color"));
6814 + gtk_box_pack_start (GTK_BOX (vbox), mixbrush_box, FALSE, TRUE, 0);
6815 + gtk_widget_show(mixbrush_box);
6816 + mixbrush_vbox = gtk_vbox_new (FALSE, 2);
6817 + gtk_container_add (GTK_CONTAINER (mixbrush_box), mixbrush_vbox);
6818 + gtk_widget_show (mixbrush_vbox);
6820 + table = gtk_table_new (3, 6, FALSE);
6821 + gtk_table_set_col_spacings (GTK_TABLE (table), 2);
6822 + gtk_box_pack_start (GTK_BOX (mixbrush_vbox), table, TRUE, TRUE, 0);
6823 + gtk_widget_show (table);
6825 + mixbrush_button = gimp_prop_check_button_new (config, "pigment", _("Paint with pigment"));
6826 + gtk_table_attach (GTK_TABLE (table), mixbrush_button, 0, 3, 0, 1,
6827 + GTK_EXPAND | GTK_FILL, GTK_SHRINK | GTK_FILL,
6829 + gtk_widget_show (mixbrush_button);
6831 + gimp_prop_scale_entry_new (config, "main-color-density",
6832 + GTK_TABLE (table), 0, 1,
6838 + GtkWidget *expander = gtk_expander_new (_("Pressure"));
6839 + GtkWidget *inner_table = gtk_table_new (3, 4, FALSE);
6841 + gtk_container_add (GTK_CONTAINER (expander), inner_table);
6842 + gtk_table_attach (GTK_TABLE (table), expander, 0, 3, 2, 3,
6843 + GTK_EXPAND | GTK_FILL, GTK_SHRINK | GTK_FILL,
6846 + gimp_prop_scale_entry_new (config, "main-color-density-pressure-in1",
6847 + GTK_TABLE (inner_table), 0, 0,
6851 + gimp_prop_scale_entry_new (config, "main-color-density-pressure-in2",
6852 + GTK_TABLE (inner_table), 0, 1,
6856 + gimp_prop_scale_entry_new (config, "main-color-density-pressure-out1",
6857 + GTK_TABLE (inner_table), 0, 2,
6861 + gimp_prop_scale_entry_new (config, "main-color-density-pressure-out2",
6862 + GTK_TABLE (inner_table), 0, 3,
6867 + gtk_widget_show_all (expander);
6870 + adj = gimp_prop_scale_entry_new (config, "main-color-rate",
6871 + GTK_TABLE (table), 0, 3,
6875 + gimp_scale_entry_set_logarithmic (adj, TRUE);
6878 + GtkWidget *expander = gtk_expander_new (_("Pressure"));
6879 + GtkWidget *inner_table = gtk_table_new (3, 4, FALSE);
6881 + gtk_container_add (GTK_CONTAINER (expander), inner_table);
6882 + gtk_table_attach (GTK_TABLE (table), expander, 0, 3, 4, 5,
6883 + GTK_EXPAND | GTK_FILL, GTK_SHRINK | GTK_FILL,
6886 + gimp_prop_scale_entry_new (config, "main-color-pressure-in1",
6887 + GTK_TABLE (inner_table), 0, 0,
6891 + gimp_prop_scale_entry_new (config, "main-color-pressure-in2",
6892 + GTK_TABLE (inner_table), 0, 1,
6896 + gimp_prop_scale_entry_new (config, "main-color-pressure-out1",
6897 + GTK_TABLE (inner_table), 0, 2,
6901 + gimp_prop_scale_entry_new (config, "main-color-pressure-out2",
6902 + GTK_TABLE (inner_table), 0, 3,
6907 + gtk_widget_show_all (expander);
6910 + gimp_prop_scale_entry_new (config, "dryout",
6911 + GTK_TABLE (table), 0, 5,
6914 + TRUE, 0.0, 10000);
6916 + /* Canvas Color Picking Configurations */
6917 + mixbrush_box = gtk_frame_new (_("Canvas Color"));
6918 + gtk_box_pack_start (GTK_BOX (vbox), mixbrush_box, FALSE, TRUE, 0);
6919 + gtk_widget_show(mixbrush_box);
6920 + mixbrush_vbox = gtk_vbox_new (FALSE, 2);
6921 + gtk_container_add (GTK_CONTAINER (mixbrush_box), mixbrush_vbox);
6922 + gtk_widget_show (mixbrush_vbox);
6924 + table = gtk_table_new (3, 5, FALSE);
6925 + gtk_table_set_col_spacings (GTK_TABLE (table), 2);
6926 + gtk_box_pack_start (GTK_BOX (mixbrush_vbox), table, TRUE, TRUE, 0);
6927 + gtk_widget_show (table);
6929 + gimp_prop_scale_entry_new (config, "canvas-color-density",
6930 + GTK_TABLE (table), 0, 0,
6936 + GtkWidget *expander = gtk_expander_new (_("Pressure"));
6937 + GtkWidget *inner_table = gtk_table_new (3, 4, FALSE);
6939 + gtk_container_add (GTK_CONTAINER (expander), inner_table);
6940 + gtk_table_attach (GTK_TABLE (table), expander, 0, 3, 1, 2,
6941 + GTK_EXPAND | GTK_FILL, GTK_SHRINK | GTK_FILL,
6944 + gimp_prop_scale_entry_new (config, "canvas-color-density-pressure-in1",
6945 + GTK_TABLE (inner_table), 0, 0,
6949 + gimp_prop_scale_entry_new (config, "canvas-color-density-pressure-in2",
6950 + GTK_TABLE (inner_table), 0, 1,
6954 + gimp_prop_scale_entry_new (config, "canvas-color-density-pressure-out1",
6955 + GTK_TABLE (inner_table), 0, 2,
6959 + gimp_prop_scale_entry_new (config, "canvas-color-density-pressure-out2",
6960 + GTK_TABLE (inner_table), 0, 3,
6965 + gtk_widget_show_all (expander);
6968 + gimp_prop_scale_entry_new (config, "canvas-color-rate",
6969 + GTK_TABLE (table), 0, 2,
6975 + GtkWidget *expander = gtk_expander_new (_("Pressure"));
6976 + GtkWidget *inner_table = gtk_table_new (3, 4, FALSE);
6978 + gtk_container_add (GTK_CONTAINER (expander), inner_table);
6979 + gtk_table_attach (GTK_TABLE (table), expander, 0, 3, 3, 4,
6980 + GTK_EXPAND | GTK_FILL, GTK_SHRINK | GTK_FILL,
6983 + gimp_prop_scale_entry_new (config, "canvas-color-pressure-in1",
6984 + GTK_TABLE (inner_table), 0, 0,
6988 + gimp_prop_scale_entry_new (config, "canvas-color-pressure-in2",
6989 + GTK_TABLE (inner_table), 0, 1,
6993 + gimp_prop_scale_entry_new (config, "canvas-color-pressure-out1",
6994 + GTK_TABLE (inner_table), 0, 2,
6998 + gimp_prop_scale_entry_new (config, "canvas-color-pressure-out2",
6999 + GTK_TABLE (inner_table), 0, 3,
7004 + gtk_widget_show_all (expander);
7008 + mixbrush_box = gtk_frame_new (_("Pick up"));
7009 + gtk_box_pack_start (GTK_BOX (vbox), mixbrush_box, FALSE, TRUE, 0);
7010 + gtk_widget_show(mixbrush_box);
7011 + mixbrush_vbox = gtk_vbox_new (FALSE, 2);
7012 + gtk_container_add (GTK_CONTAINER (mixbrush_box), mixbrush_vbox);
7013 + gtk_widget_show (mixbrush_vbox);
7015 + table = gtk_table_new (3, 1, FALSE);
7016 + gtk_table_set_col_spacings (GTK_TABLE (table), 2);
7017 + gtk_box_pack_start (GTK_BOX (mixbrush_vbox), table, TRUE, TRUE, 0);
7018 + gtk_widget_show (table);
7020 + gimp_prop_scale_entry_new (config, "sample-size-limit",
7021 + GTK_TABLE (table), 0, 0,
7022 + _("Sample size:"),
7024 + TRUE, 1.0, 100.0);
7026 + /*mixbrush_button = gimp_prop_check_button_new (config, "merged", _("Pick up underlying color"));*/
7027 + mixbrush_button = gimp_prop_check_button_new (config, "merged", _("Use merged color"));
7028 + gtk_box_pack_start (GTK_BOX (mixbrush_vbox), mixbrush_button, TRUE, TRUE, 0);
7029 + gtk_widget_show (mixbrush_button);
7031 + table = gtk_table_new (3, 1, FALSE);
7032 + gtk_table_set_col_spacings (GTK_TABLE (table), 2);
7033 + gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0);
7034 + gtk_widget_show (table);
7036 + gimp_prop_scale_entry_new (config, "delay",
7037 + GTK_TABLE (table), 0, 0,
7042 + mixbrush_button = gimp_prop_check_button_new (config, "tail", _("Paint the tail of stroke (delay > 0)"));
7043 + gtk_box_pack_start (GTK_BOX (vbox), mixbrush_button, FALSE, TRUE, 0);
7044 + gtk_widget_show (mixbrush_button);
7046 + mixbrush_frame = gimp_prop_enum_radio_frame_new (config, "hidden-color",
7047 + _("Assume that the hidden color is:"),
7049 + gtk_box_pack_start (GTK_BOX (vbox), mixbrush_frame, FALSE, TRUE, 0);
7050 + gtk_widget_show (mixbrush_frame);
7052 + /*mixbrush_button = gimp_prop_check_button_new (config, "remove-color", _("Remove background color"));
7053 + gtk_box_pack_start (GTK_BOX (vbox), mixbrush_button, FALSE, TRUE, 0);
7054 + gtk_widget_show (mixbrush_button);*/
7058 --- gimp-2.6.6/app/tools/gimpmixbrushtool.h 1970-01-01 09:00:00 +0900
7059 +++ gimp-painter--2.6.6-20100627/app/tools/gimpmixbrushtool.h 2010-06-27 02:14:19 +0900
7061 +/* GIMP - The GNU Image Manipulation Program
7062 + * Copyright (C) 1995 Spencer Kimball and Peter Mattis
7064 + * This program is free software; you can redistribute it and/or modify
7065 + * it under the terms of the GNU General Public License as published by
7066 + * the Free Software Foundation; either version 2 of the License, or
7067 + * (at your option) any later version.
7069 + * This program is distributed in the hope that it will be useful,
7070 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
7071 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7072 + * GNU General Public License for more details.
7074 + * You should have received a copy of the GNU General Public License
7075 + * along with this program; if not, write to the Free Software
7076 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
7079 +#ifndef __GIMP_MIXBRUSH_TOOL_H__
7080 +#define __GIMP_MIXBRUSH_TOOL_H__
7083 +#include "gimppaintbrushtool.h"
7086 +#define GIMP_TYPE_MIXBRUSH_TOOL (gimp_mixbrush_tool_get_type ())
7087 +#define GIMP_MIXBRUSH_TOOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_MIXBRUSH_TOOL, GimpMixbrushTool))
7088 +#define GIMP_MIXBRUSH_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_MIXBRUSH_TOOL, GimpMixbrushToolClass))
7089 +#define GIMP_IS_MIXBRUSH_TOOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_MIXBRUSH_TOOL))
7090 +#define GIMP_IS_MIXBRUSH_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_MIXBRUSH_TOOL))
7091 +#define GIMP_MIXBRUSH_TOOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_MIXBRUSH_TOOL, GimpMixbrushToolClass))
7094 +typedef struct _GimpMixbrushTool GimpMixbrushTool;
7095 +typedef struct _GimpMixbrushToolClass GimpMixbrushToolClass;
7097 +struct _GimpMixbrushTool
7099 + GimpPaintbrushTool parent_instance;
7102 +struct _GimpMixbrushToolClass
7104 + GimpPaintbrushToolClass parent_class;
7108 +void gimp_mixbrush_tool_register (GimpToolRegisterCallback callback,
7111 +GType gimp_mixbrush_tool_get_type (void) G_GNUC_CONST;
7114 +#endif /* __GIMP_MIXBRUSH_TOOL_H__ */
7115 --- gimp-2.6.6/app/tools/gimppaintoptions-gui.c 2008-11-21 07:42:59 +0900
7116 +++ gimp-painter--2.6.6-20100627/app/tools/gimppaintoptions-gui.c 2010-06-27 02:14:19 +0900
7118 #include "widgets/gimpwidgets-utils.h"
7120 #include "gimpairbrushtool.h"
7121 +#include "gimpblendtool.h"
7122 +#include "gimpbucketfilltool.h"
7123 #include "gimpclonetool.h"
7124 #include "gimpconvolvetool.h"
7125 #include "gimpdodgeburntool.h"
7127 #include "gimppenciltool.h"
7128 #include "gimpperspectiveclonetool.h"
7129 #include "gimpsmudgetool.h"
7130 +#include "gimpinktool2.h"
7131 +#include "gimpmixbrushtool.h"
7132 #include "gimptooloptions-gui.h"
7134 #include "gimp-intl.h"
7136 static gboolean tool_has_size_dynamics (GType tool_type);
7137 static gboolean tool_has_color_dynamics (GType tool_type);
7139 -static void pressure_options_gui (GimpPaintOptions *paint_options,
7143 - GtkWidget *labels[]);
7144 -static void velocity_options_gui (GimpPaintOptions *paint_options,
7148 -static void random_options_gui (GimpPaintOptions *paint_options,
7152 -static GtkWidget * fade_options_gui (GimpPaintOptions *paint_options,
7154 -static GtkWidget * gradient_options_gui (GimpPaintOptions *paint_options,
7156 - GtkWidget *incremental_toggle);
7157 -static GtkWidget * jitter_options_gui (GimpPaintOptions *paint_options,
7159 +static void pressure_options_gui (GimpPaintOptions *paint_options,
7163 + GtkWidget *labels[]);
7164 +static void velocity_options_gui (GimpPaintOptions *paint_options,
7168 +static void random_options_gui (GimpPaintOptions *paint_options,
7172 +static GtkWidget * fade_options_gui (GimpPaintOptions *paint_options,
7174 +static GtkWidget * gradient_options_gui (GimpPaintOptions *paint_options,
7176 + GtkWidget *incremental_toggle);
7177 +static GtkWidget * jitter_options_gui (GimpPaintOptions *paint_options,
7179 +static GtkWidget * update_freq_options_gui (GimpUpdateFreqOptions *update_freq,
7180 + GimpPaintOptions *paint_options,
7184 /* public functions */
7185 @@ -125,6 +132,24 @@
7186 gimp_prop_opacity_entry_new (config, "opacity",
7187 GTK_TABLE (table), 0, table_row++,
7189 + /* the flow scale */
7190 + if (g_type_is_a (tool_type, GIMP_TYPE_PAINTBRUSH_TOOL) &&
7191 + tool_type != GIMP_TYPE_AIRBRUSH_TOOL)
7192 + gimp_prop_opacity_entry_new (config, "flow",
7193 + GTK_TABLE (table), 0, table_row++,
7195 + /* coords smoothing */
7196 + if (tool_type != GIMP_TYPE_INK2_TOOL &&
7197 + tool_type != GIMP_TYPE_BLEND_TOOL &&
7198 + tool_type != GIMP_TYPE_BUCKET_FILL_TOOL)
7200 + gimp_prop_scale_entry_new (config, "max-coord-smooth",
7201 + GTK_TABLE (table), 0, table_row++,
7209 if (g_type_is_a (tool_type, GIMP_TYPE_BRUSH_TOOL))
7210 @@ -143,6 +168,19 @@
7213 gimp_scale_entry_set_logarithmic (adj, TRUE);
7215 + gimp_prop_scale_entry_new (config, "pressure-min-scale",
7216 + GTK_TABLE (table), 0, table_row++,
7217 + _("Minimum scale:"),
7221 + adj = gimp_prop_scale_entry_new (config, "pressure-power-size",
7222 + GTK_TABLE (table), 0, table_row++,
7226 + gimp_scale_entry_set_logarithmic (adj, TRUE);
7229 if (tool_has_opacity_dynamics (tool_type))
7231 /* the "incremental" toggle */
7232 if (tool_type == GIMP_TYPE_PENCIL_TOOL ||
7233 tool_type == GIMP_TYPE_PAINTBRUSH_TOOL ||
7234 + tool_type == GIMP_TYPE_MIXBRUSH_TOOL ||
7235 tool_type == GIMP_TYPE_ERASER_TOOL)
7237 incremental_toggle =
7238 @@ -289,6 +328,14 @@
7239 gtk_widget_show (frame);
7242 + frame = update_freq_options_gui (options->update_freq_options,
7243 + options, tool_type);
7246 + gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
7247 + gtk_widget_show (frame);
7254 tool_type == GIMP_TYPE_ERASER_TOOL ||
7255 tool_type == GIMP_TYPE_DODGE_BURN_TOOL ||
7256 tool_type == GIMP_TYPE_PAINTBRUSH_TOOL ||
7257 + tool_type == GIMP_TYPE_MIXBRUSH_TOOL ||
7258 tool_type == GIMP_TYPE_SMUDGE_TOOL);
7261 @@ -631,13 +679,13 @@
7262 _("Use color from gradient"),
7265 - if (incremental_toggle)
7266 + /*if (incremental_toggle)
7268 gtk_widget_set_sensitive (incremental_toggle,
7269 ! paint_options->gradient_options->use_gradient);
7270 g_object_set_data (G_OBJECT (button), "inverse_sensitive",
7271 incremental_toggle);
7275 /* the gradient view */
7276 button = gimp_prop_gradient_box_new (NULL, GIMP_CONTEXT (config), 2,
7277 @@ -674,3 +722,52 @@
7283 +update_freq_options_gui (GimpUpdateFreqOptions *update_freq,
7284 + GimpPaintOptions *paint_options,
7287 + GObject *config = G_OBJECT (paint_options);
7288 + GtkWidget *frame = NULL;
7290 + if (tool_type != GIMP_TYPE_PERSPECTIVE_CLONE_TOOL &&
7291 + tool_type != GIMP_TYPE_BLEND_TOOL &&
7292 + tool_type != GIMP_TYPE_BUCKET_FILL_TOOL)
7296 + table = gtk_table_new (3, 5, FALSE);
7297 + gtk_table_set_col_spacings (GTK_TABLE (table), 2);
7299 + frame = gimp_prop_expanding_frame_new (config, "reduce-update-frequency",
7300 + _("Reduce update frequency"),
7303 + gimp_prop_scale_entry_new (config, "update-freq-size-threshold",
7304 + GTK_TABLE (table), 0, 0,
7307 + TRUE, 0.1, 100.0);
7309 + gimp_prop_scale_entry_new (config, "update-freq-velo-threshold",
7310 + GTK_TABLE (table), 0, 1,
7313 + TRUE, 0.001, 0.1);
7315 + gimp_prop_scale_entry_new (config, "update-freq-gamma",
7316 + GTK_TABLE (table), 0, 2,
7321 + gimp_prop_scale_entry_new (config, "update-freq-max-n-dabs",
7322 + GTK_TABLE (table), 0, 3,
7330 --- gimp-2.6.6/app/widgets/gimptooloptionseditor.c 2008-11-21 07:43:05 +0900
7331 +++ gimp-painter--2.6.6-20100627/app/widgets/gimptooloptionseditor.c 2010-06-27 02:14:19 +0900
7333 GimpToolPresets *presets);
7334 static void gimp_tool_options_editor_save_presets (GimpToolOptionsEditor *editor);
7336 +static void gimp_tool_options_editor_style_set (GtkWidget *widget,
7337 + GtkStyle *prev_style);
7340 G_DEFINE_TYPE_WITH_CODE (GimpToolOptionsEditor, gimp_tool_options_editor,
7342 @@ -97,10 +100,21 @@
7344 GObjectClass *object_class = G_OBJECT_CLASS (klass);
7345 GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (klass);
7346 + GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
7348 object_class->constructor = gimp_tool_options_editor_constructor;
7350 gtk_object_class->destroy = gimp_tool_options_editor_destroy;
7352 + widget_class->style_set = gimp_tool_options_editor_style_set;
7354 + gtk_widget_class_install_style_property (widget_class,
7355 + g_param_spec_int ("content-border",
7360 + GIMP_PARAM_READABLE));
7364 @@ -523,3 +537,20 @@
7365 gtk_widget_set_sensitive (editor->delete_button, delete_sensitive);
7366 gtk_widget_set_sensitive (editor->reset_button, reset_sensitive);
7371 +gimp_tool_options_editor_style_set (GtkWidget *widget,
7372 + GtkStyle *prev_style)
7374 + GimpToolOptionsEditor *editor = GIMP_TOOL_OPTIONS_EDITOR (widget);
7375 + gint content_border;
7377 + //GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
7379 + gtk_widget_style_get (widget,
7380 + "content-border", &content_border,
7383 + gtk_container_set_border_width (GTK_CONTAINER (editor->options_vbox), content_border);