1 --- gimp-2.6.6/app/actions/tool-options-commands.c 2008-11-21 07:43:04 +0900
2 +++ gimp-painter--2.6.6/app/actions/tool-options-commands.c 2009-03-17 10:42:37 +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/config/gimpguiconfig.c 2008-11-21 07:43:04 +0900
81 +++ gimp-painter--2.6.6/app/config/gimpguiconfig.c 2009-06-16 02:25:02 +0900
83 PROP_DOCK_WINDOW_HINT,
86 + PROP_SYSTEM_COORDS_STYLUS,
87 + PROP_SYSTEM_COORDS_PUCK,
89 /* ignored, only for backward compatibility: */
90 PROP_INFO_WINDOW_PER_DISPLAY,
92 GIMP_TYPE_CURSOR_FORMAT,
93 GIMP_CURSOR_FORMAT_PIXBUF,
94 GIMP_PARAM_STATIC_STRINGS);
95 + GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SYSTEM_COORDS_STYLUS,
96 + "system-coords-stylus",
97 + SYSTEM_COORDS_STYLUS_BLURB,
99 + GIMP_PARAM_STATIC_STRINGS);
100 + GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SYSTEM_COORDS_PUCK,
101 + "system-coords-puck",
102 + SYSTEM_COORDS_PUCK_BLURB,
104 + GIMP_PARAM_STATIC_STRINGS);
106 /* only for backward compatibility: */
107 GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_INFO_WINDOW_PER_DISPLAY,
109 case PROP_CURSOR_FORMAT:
110 gui_config->cursor_format = g_value_get_enum (value);
112 + case PROP_SYSTEM_COORDS_STYLUS:
113 + gui_config->system_coords_stylus = g_value_get_boolean (value);
115 + case PROP_SYSTEM_COORDS_PUCK:
116 + gui_config->system_coords_puck = g_value_get_boolean (value);
119 case PROP_INFO_WINDOW_PER_DISPLAY:
120 case PROP_SHOW_TOOL_TIPS:
122 case PROP_CURSOR_FORMAT:
123 g_value_set_enum (value, gui_config->cursor_format);
125 + case PROP_SYSTEM_COORDS_STYLUS:
126 + g_value_set_boolean (value, gui_config->system_coords_stylus);
128 + case PROP_SYSTEM_COORDS_PUCK:
129 + g_value_set_boolean (value, gui_config->system_coords_puck);
132 case PROP_INFO_WINDOW_PER_DISPLAY:
133 case PROP_SHOW_TOOL_TIPS:
134 --- gimp-2.6.6/app/config/gimpguiconfig.h 2008-11-21 07:43:04 +0900
135 +++ gimp-painter--2.6.6/app/config/gimpguiconfig.h 2009-06-16 02:34:32 +0900
137 GimpWindowHint dock_window_hint;
138 gboolean transient_docks;
139 GimpCursorFormat cursor_format;
140 + gboolean system_coords_stylus;
141 + gboolean system_coords_puck;
143 gint last_tip; /* saved in sessionrc */
145 --- gimp-2.6.6/app/config/gimprc-blurbs.h 2008-11-21 07:43:04 +0900
146 +++ gimp-painter--2.6.6/app/config/gimprc-blurbs.h 2009-06-16 02:32:26 +0900
148 #define ZOOM_QUALITY_BLURB \
149 "There's a tradeoff between speed and quality of the zoomed-out display."
151 +#define SYSTEM_COORDS_STYLUS_BLURB \
152 +"Try to turn on when the cursor position is not correctly with stylus pen."
154 +#define SYSTEM_COORDS_PUCK_BLURB \
155 +"Try to turn on when the cursor position is not correctly with tablet mouse."
158 #endif /* __GIMP_RC_BLURBS_H__ */
159 --- gimp-2.6.6/app/core/core-enums.h 2008-11-21 07:42:58 +0900
160 +++ gimp-painter--2.6.6/app/core/core-enums.h 2009-03-17 10:42:37 +0900
161 @@ -603,15 +603,16 @@
162 GIMP_CONTEXT_PROP_FOREGROUND = 6,
163 GIMP_CONTEXT_PROP_BACKGROUND = 7,
164 GIMP_CONTEXT_PROP_OPACITY = 8,
165 - GIMP_CONTEXT_PROP_PAINT_MODE = 9,
166 - GIMP_CONTEXT_PROP_BRUSH = 10,
167 - GIMP_CONTEXT_PROP_PATTERN = 11,
168 - GIMP_CONTEXT_PROP_GRADIENT = 12,
169 - GIMP_CONTEXT_PROP_PALETTE = 13,
170 - GIMP_CONTEXT_PROP_FONT = 14,
171 - GIMP_CONTEXT_PROP_BUFFER = 15,
172 - GIMP_CONTEXT_PROP_IMAGEFILE = 16,
173 - GIMP_CONTEXT_PROP_TEMPLATE = 17,
174 + GIMP_CONTEXT_PROP_FLOW = 9,
175 + GIMP_CONTEXT_PROP_PAINT_MODE = 10,
176 + GIMP_CONTEXT_PROP_BRUSH = 11,
177 + GIMP_CONTEXT_PROP_PATTERN = 12,
178 + GIMP_CONTEXT_PROP_GRADIENT = 13,
179 + GIMP_CONTEXT_PROP_PALETTE = 14,
180 + GIMP_CONTEXT_PROP_FONT = 15,
181 + GIMP_CONTEXT_PROP_BUFFER = 16,
182 + GIMP_CONTEXT_PROP_IMAGEFILE = 17,
183 + GIMP_CONTEXT_PROP_TEMPLATE = 18,
185 GIMP_CONTEXT_LAST_PROP = GIMP_CONTEXT_PROP_TEMPLATE
186 } GimpContextPropType;
187 @@ -626,20 +627,22 @@
188 GIMP_CONTEXT_FOREGROUND_MASK = 1 << 6,
189 GIMP_CONTEXT_BACKGROUND_MASK = 1 << 7,
190 GIMP_CONTEXT_OPACITY_MASK = 1 << 8,
191 - GIMP_CONTEXT_PAINT_MODE_MASK = 1 << 9,
192 - GIMP_CONTEXT_BRUSH_MASK = 1 << 10,
193 - GIMP_CONTEXT_PATTERN_MASK = 1 << 11,
194 - GIMP_CONTEXT_GRADIENT_MASK = 1 << 12,
195 - GIMP_CONTEXT_PALETTE_MASK = 1 << 13,
196 - GIMP_CONTEXT_FONT_MASK = 1 << 14,
197 - GIMP_CONTEXT_BUFFER_MASK = 1 << 15,
198 - GIMP_CONTEXT_IMAGEFILE_MASK = 1 << 16,
199 - GIMP_CONTEXT_TEMPLATE_MASK = 1 << 17,
200 + GIMP_CONTEXT_FLOW_MASK = 1 << 9,
201 + GIMP_CONTEXT_PAINT_MODE_MASK = 1 << 10,
202 + GIMP_CONTEXT_BRUSH_MASK = 1 << 11,
203 + GIMP_CONTEXT_PATTERN_MASK = 1 << 12,
204 + GIMP_CONTEXT_GRADIENT_MASK = 1 << 13,
205 + GIMP_CONTEXT_PALETTE_MASK = 1 << 14,
206 + GIMP_CONTEXT_FONT_MASK = 1 << 15,
207 + GIMP_CONTEXT_BUFFER_MASK = 1 << 16,
208 + GIMP_CONTEXT_IMAGEFILE_MASK = 1 << 17,
209 + GIMP_CONTEXT_TEMPLATE_MASK = 1 << 18,
212 GIMP_CONTEXT_PAINT_PROPS_MASK = (GIMP_CONTEXT_FOREGROUND_MASK |
213 GIMP_CONTEXT_BACKGROUND_MASK |
214 GIMP_CONTEXT_OPACITY_MASK |
215 + GIMP_CONTEXT_FLOW_MASK |
216 GIMP_CONTEXT_PAINT_MODE_MASK |
217 GIMP_CONTEXT_BRUSH_MASK |
218 GIMP_CONTEXT_PATTERN_MASK |
219 --- gimp-2.6.6/app/core/gimpbrushgenerated.c 2008-11-21 07:42:58 +0900
220 +++ gimp-painter--2.6.6/app/core/gimpbrushgenerated.c 2009-03-17 10:43:51 +0900
222 #include "gimpbrushgenerated-save.h"
225 -#define OVERSAMPLING 4
226 +#define MAX_OVERSAMPLING 32
227 +#define MIN_OVERSAMPLING 4 /* original value */
228 +#define OVERSAMPLING (_oversampling)
230 +static gint _oversampling;
238 - gdouble buffer[OVERSAMPLING];
239 + gdouble buffer[MAX_OVERSAMPLING];
241 + _oversampling = MAX (MAX_OVERSAMPLING - (radius - 0.5), MIN_OVERSAMPLING);
243 length = OVERSAMPLING * ceil (1 + sqrt (2 * SQR (ceil (radius + 1.0))));
245 --- gimp-2.6.6/app/core/gimpcontext.c 2008-11-21 07:42:58 +0900
246 +++ gimp-painter--2.6.6/app/core/gimpcontext.c 2009-03-17 10:42:37 +0900
248 static void gimp_context_real_set_opacity (GimpContext *context,
252 +static void gimp_context_real_set_flow (GimpContext *context,
256 static void gimp_context_real_set_paint_mode (GimpContext *context,
257 GimpLayerModeEffects paint_mode);
286 + gimp_context_signals[FLOW_CHANGED] =
287 + g_signal_new ("flow-changed",
288 + G_TYPE_FROM_CLASS (klass),
289 + G_SIGNAL_RUN_FIRST,
290 + G_STRUCT_OFFSET (GimpContextClass, flow_changed),
292 + gimp_marshal_VOID__DOUBLE,
296 gimp_context_signals[PAINT_MODE_CHANGED] =
297 g_signal_new ("paint-mode-changed",
298 G_TYPE_FROM_CLASS (klass),
300 klass->foreground_changed = NULL;
301 klass->background_changed = NULL;
302 klass->opacity_changed = NULL;
303 + klass->flow_changed = NULL;
304 klass->paint_mode_changed = NULL;
305 klass->brush_changed = NULL;
306 klass->pattern_changed = NULL;
307 @@ -581,13 +599,13 @@
308 gimp_context_prop_names[GIMP_CONTEXT_PROP_FOREGROUND],
311 - GIMP_PARAM_STATIC_STRINGS);
312 + GIMP_PARAM_STATIC_STRINGS | GIMP_CONFIG_PARAM_DONT_RESTORE);
314 GIMP_CONFIG_INSTALL_PROP_RGB (object_class, GIMP_CONTEXT_PROP_BACKGROUND,
315 gimp_context_prop_names[GIMP_CONTEXT_PROP_BACKGROUND],
318 - GIMP_PARAM_STATIC_STRINGS);
319 + GIMP_PARAM_STATIC_STRINGS | GIMP_CONFIG_PARAM_DONT_RESTORE);
321 GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, GIMP_CONTEXT_PROP_OPACITY,
322 gimp_context_prop_names[GIMP_CONTEXT_PROP_OPACITY],
323 @@ -597,42 +615,50 @@
325 GIMP_PARAM_STATIC_STRINGS);
327 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, GIMP_CONTEXT_PROP_FLOW,
328 + gimp_context_prop_names[GIMP_CONTEXT_PROP_FLOW],
330 + GIMP_OPACITY_TRANSPARENT,
331 + GIMP_OPACITY_OPAQUE,
332 + GIMP_OPACITY_OPAQUE,
333 + GIMP_PARAM_STATIC_STRINGS);
335 GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, GIMP_CONTEXT_PROP_PAINT_MODE,
336 gimp_context_prop_names[GIMP_CONTEXT_PROP_PAINT_MODE],
338 GIMP_TYPE_LAYER_MODE_EFFECTS,
340 - GIMP_PARAM_STATIC_STRINGS);
341 + GIMP_PARAM_STATIC_STRINGS | GIMP_CONFIG_PARAM_DONT_RESTORE_SECONDARY);
343 GIMP_CONFIG_INSTALL_PROP_OBJECT (object_class, GIMP_CONTEXT_PROP_BRUSH,
344 gimp_context_prop_names[GIMP_CONTEXT_PROP_BRUSH],
347 - GIMP_PARAM_STATIC_STRINGS);
348 + GIMP_PARAM_STATIC_STRINGS | GIMP_CONFIG_PARAM_DONT_RESTORE_SECONDARY);
350 GIMP_CONFIG_INSTALL_PROP_OBJECT (object_class, GIMP_CONTEXT_PROP_PATTERN,
351 gimp_context_prop_names[GIMP_CONTEXT_PROP_PATTERN],
354 - GIMP_PARAM_STATIC_STRINGS);
355 + GIMP_PARAM_STATIC_STRINGS | GIMP_CONFIG_PARAM_DONT_RESTORE);
357 GIMP_CONFIG_INSTALL_PROP_OBJECT (object_class, GIMP_CONTEXT_PROP_GRADIENT,
358 gimp_context_prop_names[GIMP_CONTEXT_PROP_GRADIENT],
361 - GIMP_PARAM_STATIC_STRINGS);
362 + GIMP_PARAM_STATIC_STRINGS | GIMP_CONFIG_PARAM_DONT_RESTORE);
364 GIMP_CONFIG_INSTALL_PROP_OBJECT (object_class, GIMP_CONTEXT_PROP_PALETTE,
365 gimp_context_prop_names[GIMP_CONTEXT_PROP_PALETTE],
368 - GIMP_PARAM_STATIC_STRINGS);
369 + GIMP_PARAM_STATIC_STRINGS | GIMP_CONFIG_PARAM_DONT_RESTORE);
371 GIMP_CONFIG_INSTALL_PROP_OBJECT (object_class, GIMP_CONTEXT_PROP_FONT,
372 gimp_context_prop_names[GIMP_CONTEXT_PROP_FONT],
375 - GIMP_PARAM_STATIC_STRINGS);
376 + GIMP_PARAM_STATIC_STRINGS | GIMP_CONFIG_PARAM_DONT_RESTORE);
378 g_object_class_install_property (object_class, GIMP_CONTEXT_PROP_BUFFER,
379 g_param_spec_object (gimp_context_prop_names[GIMP_CONTEXT_PROP_BUFFER],
381 case GIMP_CONTEXT_PROP_OPACITY:
382 gimp_context_set_opacity (context, g_value_get_double (value));
384 + case GIMP_CONTEXT_PROP_FLOW:
385 + gimp_context_set_flow (context, g_value_get_double (value));
387 case GIMP_CONTEXT_PROP_PAINT_MODE:
388 gimp_context_set_paint_mode (context, g_value_get_enum (value));
390 @@ -1049,6 +1078,9 @@
391 case GIMP_CONTEXT_PROP_OPACITY:
392 g_value_set_double (value, gimp_context_get_opacity (context));
394 + case GIMP_CONTEXT_PROP_FLOW:
395 + g_value_set_double (value, gimp_context_get_flow (context));
397 case GIMP_CONTEXT_PROP_PAINT_MODE:
398 g_value_set_enum (value, gimp_context_get_paint_mode (context));
400 @@ -1478,6 +1510,10 @@
401 gimp_context_real_set_opacity (dest, src->opacity);
404 + case GIMP_CONTEXT_PROP_FLOW:
405 + gimp_context_real_set_flow (dest, src->flow);
408 case GIMP_CONTEXT_PROP_PAINT_MODE:
409 gimp_context_real_set_paint_mode (dest, src->paint_mode);
411 @@ -2233,6 +2269,50 @@
412 gimp_context_opacity_changed (context);
415 +/*****************************************************************************/
416 +/* flow ********************************************************************/
419 +gimp_context_get_flow (GimpContext *context)
421 + g_return_val_if_fail (GIMP_IS_CONTEXT (context), GIMP_OPACITY_OPAQUE);
423 + return context->flow;
427 +gimp_context_set_flow (GimpContext *context,
430 + g_return_if_fail (GIMP_IS_CONTEXT (context));
431 + context_find_defined (context, GIMP_CONTEXT_PROP_FLOW);
433 + gimp_context_real_set_flow (context, flow);
437 +gimp_context_flow_changed (GimpContext *context)
439 + g_return_if_fail (GIMP_IS_CONTEXT (context));
441 + g_signal_emit (context,
442 + gimp_context_signals[FLOW_CHANGED], 0,
447 +gimp_context_real_set_flow (GimpContext *context,
450 + if (context->flow == flow)
453 + context->flow = flow;
455 + g_object_notify (G_OBJECT (context), "flow");
456 + gimp_context_flow_changed (context);
460 /*****************************************************************************/
461 /* paint mode **************************************************************/
462 --- gimp-2.6.6/app/core/gimpcontext.h 2008-11-21 07:42:58 +0900
463 +++ gimp-painter--2.6.6/app/core/gimpcontext.h 2009-03-17 10:42:37 +0900
465 #include "gimpobject.h"
468 +/* Definitions of special GParamFlags for restoring the tool presets */
469 +#define GIMP_CONFIG_PARAM_DONT_RESTORE (1 << (6 + G_PARAM_USER_SHIFT))
470 +#define GIMP_CONFIG_PARAM_DONT_RESTORE_SECONDARY (1 << (7 + G_PARAM_USER_SHIFT))
473 #define GIMP_TYPE_CONTEXT (gimp_context_get_type ())
474 #define GIMP_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_CONTEXT, GimpContext))
475 #define GIMP_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST (klass, GIMP_TYPE_CONTEXT, GimpContextClass))
481 GimpLayerModeEffects paint_mode;
486 void (* opacity_changed) (GimpContext *context,
488 + void (* flow_changed) (GimpContext *context,
490 void (* paint_mode_changed) (GimpContext *context,
491 GimpLayerModeEffects paint_mode);
492 void (* brush_changed) (GimpContext *context,
494 void gimp_context_opacity_changed (GimpContext *context);
498 +gdouble gimp_context_get_flow (GimpContext *context);
499 +void gimp_context_set_flow (GimpContext *context,
501 +void gimp_context_flow_changed (GimpContext *context);
506 gimp_context_get_paint_mode (GimpContext *context);
507 --- gimp-2.6.6/app/core/gimpprojection.c 2008-11-21 07:42:58 +0900
508 +++ gimp-painter--2.6.6/app/core/gimpprojection.c 2009-03-17 10:42:37 +0900
512 /* halfway between G_PRIORITY_HIGH_IDLE and G_PRIORITY_DEFAULT_IDLE */
513 -#define GIMP_PROJECTION_IDLE_PRIORITY 150
514 +#define GIMP_PROJECTION_IDLE_PRIORITY G_PRIORITY_HIGH_IDLE
518 --- gimp-2.6.6/app/core/gimptooloptions.c 2008-11-21 07:42:58 +0900
519 +++ gimp-painter--2.6.6/app/core/gimptooloptions.c 2009-03-17 10:42:37 +0900
526 + PROP_MAX_COORD_SMOOTH
532 GIMP_PARAM_READWRITE));
534 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_MAX_COORD_SMOOTH,
535 + "max-coord-smooth", NULL,
537 + GIMP_PARAM_STATIC_STRINGS);
545 + case PROP_MAX_COORD_SMOOTH:
546 + options->max_coord_smooth = g_value_get_double (value);
550 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
553 g_value_set_object (value, options->tool_info);
556 + case PROP_MAX_COORD_SMOOTH:
557 + g_value_set_double (value, options->max_coord_smooth);
561 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
563 --- gimp-2.6.6/app/core/gimptooloptions.h 2008-11-21 07:42:58 +0900
564 +++ gimp-painter--2.6.6/app/core/gimptooloptions.h 2009-03-17 10:42:37 +0900
566 GimpContext parent_instance;
568 GimpToolInfo *tool_info;
570 + gdouble max_coord_smooth;
573 struct _GimpToolOptionsClass
574 --- gimp-2.6.6/app/dialogs/about-dialog.c 2008-11-21 07:43:00 +0900
575 +++ gimp-painter--2.6.6/app/dialogs/about-dialog.c 2009-07-15 15:52:17 +0900
578 about_dialog_add_message (GtkWidget *vbox)
580 -#ifdef GIMP_UNSTABLE
583 +#ifdef GIMP_UNSTABLE
584 label = gtk_label_new (_("This is an unstable development release."));
585 gimp_label_set_attributes (GTK_LABEL (label),
586 PANGO_ATTR_STYLE, PANGO_STYLE_ITALIC,
588 gtk_box_reorder_child (GTK_BOX (vbox), label, 2);
589 gtk_widget_show (label);
592 + label = gtk_label_new (_("gimp-painter- (release 20090715)"));
593 + gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
594 + gtk_box_reorder_child (GTK_BOX (vbox), label, 2);
595 + gtk_widget_show (label);
598 --- gimp-2.6.6/app/dialogs/preferences-dialog.c 2008-12-28 08:13:02 +0900
599 +++ gimp-painter--2.6.6/app/dialogs/preferences-dialog.c 2009-06-25 05:02:47 +0900
600 @@ -1978,6 +1978,11 @@
601 vbox2 = prefs_frame_new (_("Appearance"),
602 GTK_CONTAINER (vbox), FALSE);
604 + prefs_check_button_add_with_icon (object, "toolbox-wilber",
607 + GTK_BOX (vbox2), size_group);
609 prefs_check_button_add_with_icon (object, "toolbox-color-area",
610 _("Show _foreground & background color"),
611 GIMP_STOCK_DEFAULT_COLORS,
612 @@ -2412,6 +2417,14 @@
613 g_object_unref (size_group);
617 + vbox2 = prefs_frame_new (_("Zoomed-out View"), GTK_CONTAINER (vbox), FALSE);
618 + table = prefs_table_new (1, GTK_CONTAINER (vbox2));
620 + prefs_enum_combo_box_add (object, "zoom-quality", 0, 0,
622 + GTK_TABLE (table), 0, NULL);
625 /**********************/
626 /* Color Management */
627 @@ -2589,6 +2602,23 @@
629 g_object_set_data (G_OBJECT (button), "clear-button", button2);
631 + /* Device coords */
632 + vbox2 = prefs_frame_new (_("Use System Coords"),
633 + GTK_CONTAINER (vbox), FALSE);
635 + button = prefs_check_button_add (object, "system-coords-stylus",
636 + _("_Stylus and Eraser"),
639 + button2 = prefs_check_button_add (object, "system-coords-puck",
640 + _("_Mouse and Lens Cursor"),
644 + gtk_widget_set_sensitive (button, FALSE);
645 + gtk_widget_set_sensitive (button2, FALSE);
649 /****************************/
650 /* Additional Controllers */
651 @@ -2636,7 +2666,7 @@
652 _("Hint for other _docks:"),
653 GTK_TABLE (table), 1, size_group);
655 -#ifdef GIMP_UNSTABLE
657 prefs_check_button_add (object, "transient-docks",
658 _("Toolbox and other docks are transient "
659 "to the active image window"),
660 --- gimp-2.6.6/app/display/gimpdisplay.c 2008-11-21 07:43:04 +0900
661 +++ gimp-painter--2.6.6/app/display/gimpdisplay.c 2009-06-16 04:59:10 +0900
663 #include "tools/tools-types.h"
665 #include "config/gimpdisplayconfig.h"
666 +#include "config/gimpguiconfig.h"
668 #include "core/gimp.h"
669 #include "core/gimparea.h"
672 display->gimp = g_value_get_object (value); /* don't ref the gimp */
673 display->config = GIMP_DISPLAY_CONFIG (display->gimp->config);
674 + display->gui_config = GIMP_GUI_CONFIG (display->gimp->config);
678 --- gimp-2.6.6/app/display/gimpdisplay.h 2008-11-21 07:43:04 +0900
679 +++ gimp-painter--2.6.6/app/display/gimpdisplay.h 2009-06-16 04:52:32 +0900
682 Gimp *gimp; /* global gimp instance */
683 GimpDisplayConfig *config;
684 + GimpGuiConfig *gui_config;
686 GimpImage *image; /* pointer to the associated image */
687 gint instance; /* the instance # of this display as */
688 --- gimp-2.6.6/app/display/gimpdisplayshell-callbacks.c 2008-11-21 07:43:04 +0900
689 +++ gimp-painter--2.6.6/app/display/gimpdisplayshell-callbacks.c 2009-06-25 03:35:00 +0900
691 #include "tools/tools-types.h"
693 #include "config/gimpdisplayconfig.h"
694 +#include "config/gimpguiconfig.h"
696 #include "core/gimp.h"
697 #include "core/gimpcontext.h"
699 #include "core/gimpimage-quick-mask.h"
700 #include "core/gimplayer.h"
701 #include "core/gimptoolinfo.h"
702 +#include "core/gimptooloptions.h"
704 #include "tools/gimpimagemaptool.h"
705 #include "tools/gimpmovetool.h"
706 @@ -1201,6 +1203,11 @@
708 GdkTimeCoord **history_events;
709 gint n_history_events;
710 + gdouble max_coord_smooth = 0;
711 + GimpToolOptions *active_tool_options;
713 + if ((active_tool_options = GIMP_TOOL_GET_OPTIONS (active_tool)))
714 + max_coord_smooth = active_tool_options->max_coord_smooth;
716 /* if the first mouse button is down, check for automatic
718 @@ -1262,7 +1269,7 @@
720 if (gimp_display_shell_eval_event (shell,
722 - active_tool->max_coord_smooth,
724 history_events[i]->time))
726 tool_manager_motion_active (gimp,
727 @@ -1283,7 +1290,7 @@
729 if (gimp_display_shell_eval_event (shell,
731 - active_tool->max_coord_smooth,
735 tool_manager_motion_active (gimp,
736 @@ -1745,6 +1752,30 @@
741 +gimp_display_shell_motion_notify (GimpDisplayShell *shell,
742 + GdkEventMotion *event)
744 + GimpGuiConfig *gui_config = shell->display->gui_config;
745 + GdkDevice *device = event->device;
747 + if ((gui_config->system_coords_stylus &&
748 + (device->source == GDK_SOURCE_PEN || device->source == GDK_SOURCE_ERASER))||
749 + (gui_config->system_coords_puck && device->source == GDK_SOURCE_CURSOR))
751 + GdkDevice *core_pointer = gdk_device_get_core_pointer ();
752 + gdouble axes[GDK_AXIS_LAST];
754 + gdk_device_get_state (core_pointer, shell->canvas->window, axes, NULL);
756 + gdk_device_get_axis (core_pointer, axes, GDK_AXIS_X, &event->x);
757 + gdk_device_get_axis (core_pointer, axes, GDK_AXIS_Y, &event->y);
764 /* private functions */
767 --- gimp-2.6.6/app/display/gimpdisplayshell-callbacks.h 2008-11-21 07:43:04 +0900
768 +++ gimp-painter--2.6.6/app/display/gimpdisplayshell-callbacks.h 2009-06-24 16:51:00 +0900
770 GdkEventButton *bevent,
771 GimpDisplayShell *shell);
773 +gboolean gimp_display_shell_motion_notify (GimpDisplayShell *shell,
774 + GdkEventMotion *event);
777 #endif /* __GIMP_DISPLAY_SHELL_CALLBACKS_H__ */
778 --- gimp-2.6.6/app/display/gimpdisplayshell-coords.c 2008-11-21 07:43:04 +0900
779 +++ gimp-painter--2.6.6/app/display/gimpdisplayshell-coords.c 2009-06-25 03:20:02 +0900
782 #include "display-types.h"
784 +#include "config/gimpguiconfig.h"
786 +#include "gimpdisplay.h"
787 #include "gimpdisplayshell.h"
788 #include "gimpdisplayshell-coords.h"
792 if (gdk_event_get_axis (event, GDK_AXIS_X, &coords->x))
795 + GimpGuiConfig *gui_config = shell->display->gui_config;
797 + if ((gui_config->system_coords_stylus &&
798 + (device->source == GDK_SOURCE_PEN || device->source == GDK_SOURCE_ERASER))||
799 + (gui_config->system_coords_puck && device->source == GDK_SOURCE_CURSOR))
801 + GdkDevice *core_pointer = gdk_device_get_core_pointer ();
802 + gdouble axes[GDK_AXIS_LAST];
804 + gdk_device_get_state (core_pointer, shell->canvas->window, axes, NULL);
806 + gdk_device_get_axis (core_pointer, axes, GDK_AXIS_X, &coords->x);
807 + gdk_device_get_axis (core_pointer, axes, GDK_AXIS_Y, &coords->y);
809 + event->motion.x = coords->x;
810 + event->motion.y = coords->y;
813 + gdk_event_get_axis (event, GDK_AXIS_Y, &coords->y);
815 gdk_event_get_axis (event, GDK_AXIS_Y, &coords->y);
818 /* CLAMP() the return value of each *_get_axis() call to be safe
819 * against buggy XInput drivers. Provide default values if the
822 gdouble axes[GDK_AXIS_LAST];
825 + GimpGuiConfig *gui_config = shell->display->gui_config;
828 gdk_device_get_state (device, shell->canvas->window, axes, NULL);
831 + if ((gui_config->system_coords_stylus &&
832 + (device->source == GDK_SOURCE_PEN || device->source == GDK_SOURCE_ERASER)) ||
833 + (gui_config->system_coords_puck && device->source == GDK_SOURCE_CURSOR))
835 + gdk_device_get_state (gdk_device_get_core_pointer (),
836 + shell->canvas->window, axes, NULL);
840 gdk_device_get_axis (device, axes, GDK_AXIS_X, &coords->x);
841 gdk_device_get_axis (device, axes, GDK_AXIS_Y, &coords->y);
843 --- gimp-2.6.6/app/display/gimpdisplayshell.c 2009-03-18 01:51:59 +0900
844 +++ gimp-painter--2.6.6/app/display/gimpdisplayshell.c 2009-06-25 18:03:38 +0900
845 @@ -1044,11 +1044,24 @@
846 gimp_display_shell_dnd_init (shell);
847 gimp_display_shell_selection_init (shell);
850 + /* Modify the x-y coords of motion event before invoking rulers'
852 + g_signal_connect_swapped (shell->canvas, "motion-notify-event",
853 + G_CALLBACK (gimp_display_shell_motion_notify),
857 /* the horizontal ruler */
858 shell->hrule = gimp_ruler_new (GTK_ORIENTATION_HORIZONTAL);
859 gtk_widget_set_events (GTK_WIDGET (shell->hrule),
860 GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
863 + g_signal_connect_swapped (shell->hrule, "motion-notify-event",
864 + G_CALLBACK (gimp_display_shell_motion_notify),
867 g_signal_connect_swapped (shell->canvas, "motion-notify-event",
868 G_CALLBACK (GTK_WIDGET_GET_CLASS (shell->hrule)->motion_notify_event),
870 @@ -1063,6 +1076,11 @@
871 gtk_widget_set_events (GTK_WIDGET (shell->vrule),
872 GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
875 + g_signal_connect_swapped (shell->vrule, "motion-notify-event",
876 + G_CALLBACK (gimp_display_shell_motion_notify),
879 g_signal_connect_swapped (shell->canvas, "motion-notify-event",
880 G_CALLBACK (GTK_WIDGET_GET_CLASS (shell->vrule)->motion_notify_event),
882 --- gimp-2.6.6/app/paint/Makefile.am 2008-11-21 07:43:08 +0900
883 +++ gimp-painter--2.6.6/app/paint/Makefile.am 2009-03-17 10:42:37 +0900
887 gimpsourceoptions.c \
888 - gimpsourceoptions.h
889 + gimpsourceoptions.h \
894 + gimpink2options.c \
895 + gimpink2options.h \
898 + gimpmixbrushoptions.c \
899 + gimpmixbrushoptions.h
901 libapppaint_a_built_sources = paint-enums.c
903 --- gimp-2.6.6/app/paint/Makefile.in 2009-03-16 05:58:04 +0900
904 +++ gimp-painter--2.6.6/app/paint/Makefile.in 2009-03-17 10:42:37 +0900
906 gimppaintbrush.$(OBJEXT) gimpperspectiveclone.$(OBJEXT) \
907 gimpperspectivecloneoptions.$(OBJEXT) gimpsmudge.$(OBJEXT) \
908 gimpsmudgeoptions.$(OBJEXT) gimpsourcecore.$(OBJEXT) \
909 - gimpsourceoptions.$(OBJEXT)
910 + gimpsourceoptions.$(OBJEXT) \
911 + gimpink2.$(OBJEXT) gimpink2options.$(OBJEXT) gimpink2undo.$(OBJEXT) \
912 + gimpmixbrush.$(OBJEXT) gimpmixbrushoptions.$(OBJEXT)
913 am_libapppaint_a_OBJECTS = $(am__objects_1) $(am__objects_2)
914 libapppaint_a_OBJECTS = $(am_libapppaint_a_OBJECTS)
915 DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
919 gimpsourceoptions.c \
920 - gimpsourceoptions.h
921 + gimpsourceoptions.h \
924 + gimpink2options.c \
925 + gimpink2options.h \
930 + gimpmixbrushoptions.c \
931 + gimpmixbrushoptions.h
933 libapppaint_a_built_sources = paint-enums.c
934 libapppaint_a_SOURCES = $(libapppaint_a_built_sources) $(libapppaint_a_sources)
936 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpsourcecore.Po@am__quote@
937 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpsourceoptions.Po@am__quote@
938 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/paint-enums.Po@am__quote@
939 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpink2.Po@am__quote@
940 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpink2options.Po@am__quote@
941 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpink2undo.Po@am__quote@
942 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpmixbrush.Po@am__quote@
943 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpmixbrushoptions.Po@am__quote@
946 @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
947 --- gimp-2.6.6/app/paint/gimp-paint.c 2008-11-21 07:43:08 +0900
948 +++ gimp-painter--2.6.6/app/paint/gimp-paint.c 2009-03-17 10:42:37 +0900
950 #include "gimppencil.h"
951 #include "gimpperspectiveclone.h"
952 #include "gimpsmudge.h"
953 +#include "gimpink2.h"
954 +#include "gimpmixbrush.h"
957 /* local function prototypes */
959 gimp_airbrush_register,
960 gimp_eraser_register,
961 gimp_paintbrush_register,
962 - gimp_pencil_register
963 + gimp_pencil_register,
964 + gimp_ink2_register,
965 + gimp_mixbrush_register
969 --- gimp-2.6.6/app/paint/gimpbrushcore.c 2008-11-21 07:43:08 +0900
970 +++ gimp-painter--2.6.6/app/paint/gimpbrushcore.c 2009-03-18 18:46:15 +0900
971 @@ -828,11 +828,13 @@
972 gimp_brush_core_paste_canvas (GimpBrushCore *core,
973 GimpDrawable *drawable,
974 gdouble brush_opacity,
975 + gdouble brush_flow,
976 gdouble image_opacity,
977 GimpLayerModeEffects paint_mode,
978 GimpBrushApplicationMode brush_hardness,
979 gdouble dynamic_hardness,
980 - GimpPaintApplicationMode mode)
981 + GimpPaintApplicationMode mode,
982 + GimpUpdateFreqOptions *update_freq_options)
984 TempBuf *brush_mask = gimp_brush_core_get_brush_mask (core,
987 paint_core->canvas_buf->height);
989 gimp_paint_core_paste (paint_core, &brush_maskPR, drawable,
991 + brush_opacity, brush_flow,
992 image_opacity, paint_mode,
994 + mode, update_freq_options);
999 gdouble image_opacity,
1000 GimpBrushApplicationMode brush_hardness,
1001 gdouble dynamic_hardness,
1002 - GimpPaintApplicationMode mode)
1003 + GimpPaintApplicationMode mode,
1004 + GimpUpdateFreqOptions *update_freq_options)
1006 TempBuf *brush_mask = gimp_brush_core_get_brush_mask (core,
1009 gimp_paint_core_replace (paint_core, &brush_maskPR, drawable,
1013 + mode, update_freq_options);
1017 --- gimp-2.6.6/app/paint/gimpbrushcore.h 2008-11-21 07:43:08 +0900
1018 +++ gimp-painter--2.6.6/app/paint/gimpbrushcore.h 2009-03-18 18:40:48 +0900
1019 @@ -108,18 +108,21 @@
1020 void gimp_brush_core_paste_canvas (GimpBrushCore *core,
1021 GimpDrawable *drawable,
1022 gdouble brush_opacity,
1023 + gdouble brush_flow,
1024 gdouble image_opacity,
1025 GimpLayerModeEffects paint_mode,
1026 GimpBrushApplicationMode brush_hardness,
1027 gdouble dynamic_hardness,
1028 - GimpPaintApplicationMode mode);
1029 + GimpPaintApplicationMode mode,
1030 + GimpUpdateFreqOptions *update_freq_options);
1031 void gimp_brush_core_replace_canvas (GimpBrushCore *core,
1032 GimpDrawable *drawable,
1033 gdouble brush_opacity,
1034 gdouble image_opacity,
1035 GimpBrushApplicationMode brush_hardness,
1036 gdouble dynamic_hardness,
1037 - GimpPaintApplicationMode mode);
1038 + GimpPaintApplicationMode mode,
1039 + GimpUpdateFreqOptions *update_freq_options);
1041 void gimp_brush_core_color_area_with_pixmap
1042 (GimpBrushCore *core,
1043 --- gimp-2.6.6/app/paint/gimpclone.c 2008-11-21 07:43:08 +0900
1044 +++ gimp-painter--2.6.6/app/paint/gimpclone.c 2009-03-19 06:54:56 +0900
1047 gimp_brush_core_paste_canvas (GIMP_BRUSH_CORE (paint_core), drawable,
1048 MIN (opacity, GIMP_OPACITY_OPAQUE),
1049 + GIMP_OPACITY_OPAQUE,
1050 gimp_context_get_opacity (context),
1051 gimp_context_get_paint_mode (context),
1052 gimp_paint_options_get_brush_mode (paint_options),
1055 source_options->align_mode ==
1056 GIMP_SOURCE_ALIGN_FIXED ?
1057 - GIMP_PAINT_INCREMENTAL : GIMP_PAINT_CONSTANT);
1058 + GIMP_PAINT_INCREMENTAL : GIMP_PAINT_CONSTANT,
1059 + paint_options->update_freq_options);
1063 --- gimp-2.6.6/app/paint/gimpconvolve.c 2008-11-21 07:43:08 +0900
1064 +++ gimp-painter--2.6.6/app/paint/gimpconvolve.c 2009-03-17 10:42:37 +0900
1066 gimp_context_get_opacity (context),
1067 gimp_paint_options_get_brush_mode (paint_options),
1069 - GIMP_PAINT_INCREMENTAL);
1070 + GIMP_PAINT_INCREMENTAL,
1071 + paint_options->update_freq_options);
1075 --- gimp-2.6.6/app/paint/gimpdodgeburn.c 2008-11-21 07:43:08 +0900
1076 +++ gimp-painter--2.6.6/app/paint/gimpdodgeburn.c 2009-03-17 10:42:37 +0900
1078 gimp_context_get_opacity (context),
1079 gimp_paint_options_get_brush_mode (paint_options),
1081 - GIMP_PAINT_CONSTANT);
1082 + GIMP_PAINT_CONSTANT,
1083 + paint_options->update_freq_options);
1087 --- gimp-2.6.6/app/paint/gimperaser.c 2008-11-21 07:43:08 +0900
1088 +++ gimp-painter--2.6.6/app/paint/gimperaser.c 2009-03-19 06:56:21 +0900
1089 @@ -139,10 +139,12 @@
1091 gimp_brush_core_paste_canvas (GIMP_BRUSH_CORE (paint_core), drawable,
1092 MIN (opacity, GIMP_OPACITY_OPAQUE),
1093 + GIMP_OPACITY_OPAQUE,
1094 gimp_context_get_opacity (context),
1095 (options->anti_erase ?
1096 GIMP_ANTI_ERASE_MODE : GIMP_ERASE_MODE),
1097 gimp_paint_options_get_brush_mode (paint_options),
1099 - paint_options->application_mode);
1100 + paint_options->application_mode,
1101 + paint_options->update_freq_options);
1103 --- gimp-2.6.6/app/paint/gimpheal.c 2008-11-21 07:43:08 +0900
1104 +++ gimp-painter--2.6.6/app/paint/gimpheal.c 2009-03-17 10:42:37 +0900
1106 gimp_context_get_opacity (context),
1107 gimp_paint_options_get_brush_mode (paint_options),
1109 - GIMP_PAINT_INCREMENTAL);
1110 + GIMP_PAINT_INCREMENTAL,
1111 + paint_options->update_freq_options);
1113 --- gimp-2.6.6/app/paint/gimpink.c 2008-11-21 07:43:08 +0900
1114 +++ gimp-painter--2.6.6/app/paint/gimpink.c 2009-03-18 19:45:32 +0900
1115 @@ -327,9 +327,11 @@
1117 gimp_paint_core_paste (paint_core, &blob_maskPR, drawable,
1118 GIMP_OPACITY_OPAQUE,
1119 + GIMP_OPACITY_OPAQUE,
1120 gimp_context_get_opacity (context),
1121 gimp_context_get_paint_mode (context),
1122 - GIMP_PAINT_CONSTANT);
1123 + GIMP_PAINT_CONSTANT,
1124 + paint_options->update_freq_options);
1127 g_free (blob_union);
1128 --- gimp-2.6.6/app/paint/gimpink2.c 1970-01-01 09:00:00 +0900
1129 +++ gimp-painter--2.6.6/app/paint/gimpink2.c 2009-03-18 19:52:11 +0900
1131 +/* GIMP - The GNU Image Manipulation Program
1132 + * Copyright (C) 1995 Spencer Kimball and Peter Mattis
1134 + * This program is free software; you can redistribute it and/or modify
1135 + * it under the terms of the GNU General Public License as published by
1136 + * the Free Software Foundation; either version 2 of the License, or
1137 + * (at your option) any later version.
1139 + * This program is distributed in the hope that it will be useful,
1140 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1141 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1142 + * GNU General Public License for more details.
1144 + * You should have received a copy of the GNU General Public License
1145 + * along with this program; if not, write to the Free Software
1146 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1149 +#include "config.h"
1151 +#include <string.h>
1153 +#include <glib-object.h>
1155 +#include "libgimpmath/gimpmath.h"
1157 +#include "paint-types.h"
1159 +#include "base/pixel-region.h"
1160 +#include "base/temp-buf.h"
1161 +#include "base/tile.h"
1162 +#include "base/tile-manager.h"
1164 +#include "paint-funcs/paint-funcs.h"
1166 +#include "core/gimpdrawable.h"
1167 +#include "core/gimpimage.h"
1168 +#include "core/gimpimage-undo.h"
1170 +#include "gimpink2options.h"
1171 +#include "gimpink2.h"
1172 +#include "gimpink-blob.h"
1173 +#include "gimpink2undo.h"
1175 +#include "gimp-intl.h"
1178 +#define SUBSAMPLE 8
1181 +/* local function prototypes */
1183 +static void gimp_ink2_finalize (GObject *object);
1185 +static void gimp_ink2_paint (GimpPaintCore *paint_core,
1186 + GimpDrawable *drawable,
1187 + GimpPaintOptions *paint_options,
1188 + GimpPaintState paint_state,
1190 +static TempBuf * gimp_ink2_get_paint_area (GimpPaintCore *paint_core,
1191 + GimpDrawable *drawable,
1192 + GimpPaintOptions *paint_options);
1193 +static GimpUndo* gimp_ink2_push_undo (GimpPaintCore *core,
1195 + const gchar *undo_desc);
1197 +static void gimp_ink2_motion (GimpPaintCore *paint_core,
1198 + GimpDrawable *drawable,
1199 + GimpPaintOptions *paint_options,
1201 + gboolean at_last);
1203 +static Blob * ink2_pen_ellipse (GimpInk2Options *options,
1209 + gdouble velocity);
1211 +static void time_smoother_add (GimpInk2 *ink,
1213 +static guint32 time_smoother_result (GimpInk2 *ink);
1214 +static void time_smoother_init (GimpInk2 *ink,
1217 +static void dist_smoother_add (GimpInk2 *ink,
1219 +static gdouble dist_smoother_result (GimpInk2 *ink);
1220 +static void dist_smoother_init (GimpInk2 *ink,
1223 +static void render_blob (Blob *blob,
1224 + PixelRegion *dest);
1226 +/* Ink2 additional functions */
1227 +static void hist_init (GimpInk2 *ink, GimpCoords* coords);
1228 +static void hist_add (GimpInk2 *ink, GimpCoords* coords, gdouble speed);
1229 +static GimpCoords hist_result (GimpInk2 *ink, GimpInk2Options *options);
1235 +G_DEFINE_TYPE (GimpInk2, gimp_ink2, GIMP_TYPE_PAINT_CORE)
1237 +#define parent_class gimp_ink2_parent_class
1241 +gimp_ink2_register (Gimp *gimp,
1242 + GimpPaintRegisterCallback callback)
1244 + (* callback) (gimp,
1246 + GIMP_TYPE_INK2_OPTIONS,
1249 + "gimp-tool-ink2");
1253 +gimp_ink2_class_init (GimpInk2Class *klass)
1255 + GObjectClass *object_class = G_OBJECT_CLASS (klass);
1256 + GimpPaintCoreClass *paint_core_class = GIMP_PAINT_CORE_CLASS (klass);
1258 + object_class->finalize = gimp_ink2_finalize;
1260 + paint_core_class->paint = gimp_ink2_paint;
1261 + paint_core_class->get_paint_area = gimp_ink2_get_paint_area;
1262 + paint_core_class->push_undo = gimp_ink2_push_undo;
1264 + /* initialize internal variables */
1269 +gimp_ink2_init (GimpInk2 *ink)
1274 +gimp_ink2_finalize (GObject *object)
1276 + GimpInk2 *ink = GIMP_INK2 (object);
1278 + if (ink->start_blob)
1280 + g_free (ink->start_blob);
1281 + ink->start_blob = NULL;
1284 + if (ink->last_blob)
1286 + g_free (ink->last_blob);
1287 + ink->last_blob = NULL;
1290 + G_OBJECT_CLASS (parent_class)->finalize (object);
1294 +gimp_ink2_paint (GimpPaintCore *paint_core,
1295 + GimpDrawable *drawable,
1296 + GimpPaintOptions *paint_options,
1297 + GimpPaintState paint_state,
1300 + GimpInk2 *ink = GIMP_INK2 (paint_core);
1302 + switch (paint_state)
1304 + case GIMP_PAINT_STATE_INIT:
1305 + if (paint_core->cur_coords.x == paint_core->last_coords.x &&
1306 + paint_core->cur_coords.y == paint_core->last_coords.y)
1308 + /* start with new blobs if we're not interpolating */
1310 + if (ink->start_blob)
1312 + g_free (ink->start_blob);
1313 + ink->start_blob = NULL;
1316 + if (ink->last_blob)
1318 + g_free (ink->last_blob);
1319 + ink->last_blob = NULL;
1322 + else if (ink->last_blob)
1324 + /* save the start blob of the line for undo otherwise */
1326 + if (ink->start_blob)
1327 + g_free (ink->start_blob);
1329 + ink->start_blob = blob_duplicate (ink->last_blob);
1333 + case GIMP_PAINT_STATE_MOTION:
1334 + gimp_ink2_motion (paint_core, drawable, paint_options, time, FALSE);
1337 + case GIMP_PAINT_STATE_FINISH:
1338 + gimp_ink2_motion (paint_core, drawable, paint_options, time, TRUE);
1339 + /*g_printf("\n");*/
1345 +gimp_ink2_get_paint_area (GimpPaintCore *paint_core,
1346 + GimpDrawable *drawable,
1347 + GimpPaintOptions *paint_options)
1349 + GimpInk2 *ink = GIMP_INK2 (paint_core);
1351 + gint width, height;
1352 + gint dwidth, dheight;
1353 + gint x1, y1, x2, y2;
1356 + bytes = gimp_drawable_bytes_with_alpha (drawable);
1358 + blob_bounds (ink->cur_blob, &x, &y, &width, &height);
1360 + dwidth = gimp_item_width (GIMP_ITEM (drawable));
1361 + dheight = gimp_item_height (GIMP_ITEM (drawable));
1363 + x1 = CLAMP (x / SUBSAMPLE - 1, 0, dwidth);
1364 + y1 = CLAMP (y / SUBSAMPLE - 1, 0, dheight);
1365 + x2 = CLAMP ((x + width) / SUBSAMPLE + 2, 0, dwidth);
1366 + y2 = CLAMP ((y + height) / SUBSAMPLE + 2, 0, dheight);
1368 + /* configure the canvas buffer */
1369 + if ((x2 - x1) && (y2 - y1))
1370 + paint_core->canvas_buf = temp_buf_resize (paint_core->canvas_buf, bytes,
1372 + (x2 - x1), (y2 - y1));
1376 + return paint_core->canvas_buf;
1380 +gimp_ink2_push_undo (GimpPaintCore *core,
1382 + const gchar *undo_desc)
1384 + return gimp_image_undo_push (image, GIMP_TYPE_INK2_UNDO,
1385 + GIMP_UNDO_INK, undo_desc,
1387 + "paint-core", core,
1392 +gimp_ink2_motion (GimpPaintCore *paint_core,
1393 + GimpDrawable *drawable,
1394 + GimpPaintOptions *paint_options,
1398 + GimpInk2 *ink = GIMP_INK2 (paint_core);
1399 + GimpInk2Options *options = GIMP_INK2_OPTIONS (paint_options);
1400 + GimpContext *context = GIMP_CONTEXT (paint_options);
1402 + Blob *blob_union = NULL;
1403 + Blob *blob_to_render;
1405 + guchar col[MAX_CHANNELS];
1406 + PixelRegion blob_maskPR;
1408 + if (at_last && !options->compensate_at_last)
1411 + image = gimp_item_get_image (GIMP_ITEM (drawable));
1413 + if (! ink->last_blob)
1415 + ink->last_blob = ink2_pen_ellipse (options,
1416 + paint_core->cur_coords.x,
1417 + paint_core->cur_coords.y,
1418 + paint_core->cur_coords.pressure,
1419 + paint_core->cur_coords.xtilt,
1420 + paint_core->cur_coords.ytilt,
1423 + if (ink->start_blob)
1424 + g_free (ink->start_blob);
1426 + ink->start_blob = blob_duplicate (ink->last_blob);
1428 + time_smoother_init (ink, time);
1429 + ink->last_time = time;
1431 + dist_smoother_init (ink, 0.0);
1432 + ink->init_velocity = TRUE;
1434 + hist_init (ink, &paint_core->cur_coords);
1436 + blob_to_render = ink->last_blob;
1443 + guint32 lasttime = ink->last_time;
1445 + GimpCoords average_hist;
1446 + GimpCoords average_velocity;
1448 + time_smoother_add (ink, time);
1449 + thistime = ink->last_time = time_smoother_result (ink);
1451 + /* The time resolution on X-based GDK motion events is bloody
1452 + * awful, hence the use of the smoothing function. Sadly this
1453 + * also means that there is always the chance of having an
1454 + * indeterminite velocity since this event and the previous
1455 + * several may still appear to issue at the same
1458 + if (thistime == lasttime)
1459 + thistime = lasttime + 1;
1461 + dist = sqrt ((paint_core->last_coords.x - paint_core->cur_coords.x) *
1462 + (paint_core->last_coords.x - paint_core->cur_coords.x) +
1463 + (paint_core->last_coords.y - paint_core->cur_coords.y) *
1464 + (paint_core->last_coords.y - paint_core->cur_coords.y));
1466 + if (ink->init_velocity)
1468 + dist_smoother_init (ink, dist);
1469 + ink->init_velocity = FALSE;
1473 + dist_smoother_add (ink, dist);
1474 + dist = dist_smoother_result (ink);
1477 + velocity = 10.0 * sqrt ((dist) / (gdouble) (thistime - lasttime));
1479 + /* g_printf("%f, %f, %f\n", paint_core->cur_coords.x, paint_core->cur_coords.y, velocity); */
1481 + if (!at_last && options->compensation_hist_size > 1)
1483 + hist_add(ink, &paint_core->cur_coords, velocity);
1484 + average_hist = hist_result(ink, options);
1485 + blob = ink2_pen_ellipse (options,
1488 + paint_core->cur_coords.pressure,
1489 + paint_core->cur_coords.xtilt,
1490 + paint_core->cur_coords.ytilt,
1492 + ink->last_point = average_hist;
1496 + blob = ink2_pen_ellipse (options,
1497 + paint_core->cur_coords.x,
1498 + paint_core->cur_coords.y,
1499 + paint_core->cur_coords.pressure,
1500 + paint_core->cur_coords.xtilt,
1501 + paint_core->cur_coords.ytilt,
1505 + blob_union = blob_convex_union (ink->last_blob, blob);
1506 + g_free (ink->last_blob);
1507 + ink->last_blob = blob;
1509 + blob_to_render = blob_union;
1512 + /* Get the buffer */
1513 + ink->cur_blob = blob_to_render;
1514 + area = gimp_paint_core_get_paint_area (paint_core, drawable, paint_options);
1515 + ink->cur_blob = NULL;
1520 + gimp_image_get_foreground (image, context, gimp_drawable_type (drawable), col);
1522 + /* set the alpha channel */
1523 + col[paint_core->canvas_buf->bytes - 1] = OPAQUE_OPACITY;
1525 + /* color the pixels */
1526 + color_pixels (temp_buf_data (paint_core->canvas_buf), col,
1527 + area->width * area->height, area->bytes);
1529 + gimp_paint_core_validate_canvas_tiles (paint_core,
1530 + paint_core->canvas_buf->x,
1531 + paint_core->canvas_buf->y,
1532 + paint_core->canvas_buf->width,
1533 + paint_core->canvas_buf->height);
1535 + /* draw the blob directly to the canvas_tiles */
1536 + pixel_region_init (&blob_maskPR, paint_core->canvas_tiles,
1537 + paint_core->canvas_buf->x,
1538 + paint_core->canvas_buf->y,
1539 + paint_core->canvas_buf->width,
1540 + paint_core->canvas_buf->height,
1543 + render_blob (blob_to_render, &blob_maskPR);
1545 + /* draw the canvas_buf using the just rendered canvas_tiles as mask */
1546 + pixel_region_init (&blob_maskPR, paint_core->canvas_tiles,
1547 + paint_core->canvas_buf->x,
1548 + paint_core->canvas_buf->y,
1549 + paint_core->canvas_buf->width,
1550 + paint_core->canvas_buf->height,
1553 + gimp_paint_core_paste (paint_core, &blob_maskPR, drawable,
1554 + GIMP_OPACITY_OPAQUE,
1555 + GIMP_OPACITY_OPAQUE,
1556 + gimp_context_get_opacity (context),
1557 + gimp_context_get_paint_mode (context),
1558 + GIMP_PAINT_CONSTANT,
1559 + paint_options->update_freq_options);
1562 + g_free (blob_union);
1566 +ink2_pen_ellipse (GimpInk2Options *options,
1574 + BlobFunc blob_function;
1576 + gdouble tsin, tcos;
1577 + gdouble aspect, radmin;
1583 + /* Adjust the size depending on pressure. */
1585 + size = options->size * (1.0 + options->size_sensitivity *
1586 + (2.0 * pressure - 1.0));
1588 + /* Adjust the size further depending on pointer velocity and
1589 + * velocity-sensitivity. These 'magic constants' are 'feels
1590 + * natural' tigert-approved. --ADM
1593 + if (velocity < 3.0)
1597 + g_printerr ("%g (%g) -> ", size, velocity);
1600 + size = (options->vel_sensitivity *
1601 + ((4.5 * size) / (1.0 + options->vel_sensitivity * (2.0 * velocity)))
1602 + + (1.0 - options->vel_sensitivity) * size);
1605 + g_printerr ("%g\n", (gfloat) size);
1608 + /* Clamp resulting size to sane limits */
1610 + if (size > options->size * (1.0 + options->size_sensitivity))
1611 + size = options->size * (1.0 + options->size_sensitivity);
1613 + if (size * SUBSAMPLE < 1.0)
1614 + size = 1.0 / SUBSAMPLE;
1616 + /* Add brush angle/aspect to tilt vectorially */
1618 + /* I'm not happy with the way the brush widget info is combined with
1619 + * tilt info from the brush. My personal feeling is that
1620 + * representing both as affine transforms would make the most
1624 + tscale = options->tilt_sensitivity * 10.0;
1625 + tscale_c = tscale * cos (gimp_deg_to_rad (options->tilt_angle));
1626 + tscale_s = tscale * sin (gimp_deg_to_rad (options->tilt_angle));
1628 + x = (options->blob_aspect * cos (options->blob_angle) +
1629 + xtilt * tscale_c - ytilt * tscale_s);
1630 + y = (options->blob_aspect * sin (options->blob_angle) +
1631 + ytilt * tscale_c + xtilt * tscale_s);
1634 + g_printerr ("angle %g aspect %g; %g %g; %g %g\n",
1635 + options->blob_angle, options->blob_aspect,
1636 + tscale_c, tscale_s, x, y);
1639 + aspect = sqrt (x * x + y * y);
1643 + tcos = x / aspect;
1644 + tsin = y / aspect;
1648 + tsin = sin (options->blob_angle);
1649 + tcos = cos (options->blob_angle);
1652 + aspect = CLAMP (aspect, 1.0, 10.0);
1654 + radmin = MAX (1.0, SUBSAMPLE * size / aspect);
1656 + switch (options->blob_type)
1658 + case GIMP_INK_BLOB_TYPE_ELLIPSE:
1659 + blob_function = blob_ellipse;
1662 + case GIMP_INK_BLOB_TYPE_SQUARE:
1663 + blob_function = blob_square;
1666 + case GIMP_INK_BLOB_TYPE_DIAMOND:
1667 + blob_function = blob_diamond;
1671 + g_return_val_if_reached (NULL);
1675 + return (* blob_function) (x_center * SUBSAMPLE,
1676 + y_center * SUBSAMPLE,
1677 + radmin * aspect * tcos,
1678 + radmin * aspect * tsin,
1685 +time_smoother_init (GimpInk2 *ink,
1690 + ink->ts_index = 0;
1692 + for (i = 0; i < INK2_TIME_SMOOTHER_BUFFER; i++)
1693 + ink->ts_buffer[i] = initval;
1697 +time_smoother_result (GimpInk2 *ink)
1700 + guint64 result = 0;
1702 + for (i = 0; i < INK2_TIME_SMOOTHER_BUFFER; i++)
1703 + result += ink->ts_buffer[i];
1705 + return (result / (guint64) INK2_TIME_SMOOTHER_BUFFER);
1709 +time_smoother_add (GimpInk2 *ink,
1712 + guint64 long_value = (guint64) value;
1714 + /* handle wrap-around of time values */
1715 + if (long_value < ink->ts_buffer[ink->ts_index])
1716 + long_value += (guint64) + G_MAXUINT32;
1718 + ink->ts_buffer[ink->ts_index++] = long_value;
1720 + ink->ts_buffer[ink->ts_index++] = value;
1722 + if (ink->ts_index == INK2_TIME_SMOOTHER_BUFFER)
1723 + ink->ts_index = 0;
1728 +dist_smoother_init (GimpInk2 *ink,
1733 + ink->dt_index = 0;
1735 + for (i = 0; i < INK2_DIST_SMOOTHER_BUFFER; i++)
1736 + ink->dt_buffer[i] = initval;
1740 +dist_smoother_result (GimpInk2 *ink)
1743 + gdouble result = 0.0;
1745 + for (i = 0; i < INK2_DIST_SMOOTHER_BUFFER; i++)
1746 + result += ink->dt_buffer[i];
1748 + return (result / (gdouble) INK2_DIST_SMOOTHER_BUFFER);
1752 +dist_smoother_add (GimpInk2 *ink,
1755 + ink->dt_buffer[ink->dt_index++] = value;
1757 + if (ink->dt_index == INK2_DIST_SMOOTHER_BUFFER)
1758 + ink->dt_index = 0;
1761 +/**************************************************************/
1764 +hist_init(GimpInk2 * ink, GimpCoords* coords)
1766 + ink->hist_index = 0;
1767 + ink->hist_count = 0;
1769 + hist_add(ink, coords, 0);
1772 +#define HIST_IGNORE_THRESHOULD 0.0001
1775 +hist_add(GimpInk2 *ink, GimpCoords* coords, gdouble speed)
1779 + if (ink->hist_count > 0) {
1780 + gint prev_index = (ink->hist_index + INK2_HISTORY_BUFFER - 1) % INK2_HISTORY_BUFFER;
1781 + gdouble dist_x = coords->x - ink->hist_buffer[prev_index].x;
1782 + gdouble dist_y = coords->y - ink->hist_buffer[prev_index].y;
1783 + dist = sqrt(dist_x * dist_x + dist_y * dist_y);
1784 + if (dist < HIST_IGNORE_THRESHOULD)
1787 + ink->hist_buffer[ink->hist_index] = *coords;
1788 + ink->hist_dist_buffer[ink->hist_index] = speed;
1789 + ink->hist_index ++;
1791 + if (ink->hist_count < INK2_HISTORY_BUFFER)
1792 + ink->hist_count ++;
1794 + if (ink->hist_index == INK2_HISTORY_BUFFER)
1795 + ink->hist_index = 0;
1800 +hist_result(GimpInk2 *ink, GimpInk2Options* options)
1803 + GimpCoords result;
1804 + result.x = result.y = 0.0;
1805 + gdouble scale_sum = 0.0;
1807 + if (ink->hist_count > 0) {
1808 + gint max_hist_count = MIN(ink->hist_count, options->compensation_hist_size);
1809 + gint cur_index = (ink->hist_index + INK2_HISTORY_BUFFER - 1) % INK2_HISTORY_BUFFER;
1811 + gdouble gaussian_weight = 0.0;
1812 + gdouble gaussian_weight2 = SQR (options->compensation_rate_temperature);
1813 + gdouble velocity_sum = 0.0;
1815 + if (gaussian_weight2 != 0.0)
1816 + gaussian_weight = 1 / (sqrt (2 * PI) * options->compensation_rate_temperature);
1818 + for (i = 0; i < max_hist_count; i ++, cur_index --)
1821 + if (cur_index == -1)
1822 + cur_index = INK2_HISTORY_BUFFER - 1;
1824 + if (gaussian_weight2 != 0)
1826 + /* We use gaussian function with velocity as a window function */
1827 + velocity_sum += ink->hist_dist_buffer[cur_index];
1828 + rate = gaussian_weight * exp (-velocity_sum*velocity_sum / (2 * gaussian_weight2));
1829 + /* If i == 0 && rate == 0.0, resulting value becomes zero.
1830 + * To avoid this, we treat this as a special case.
1832 + if (i == 0 && rate == 0.0)
1837 + rate = (i == 0) ? 1.0 : 0.0;
1839 + scale_sum += rate;
1840 + result.x += rate * ink->hist_buffer[cur_index].x;
1841 + result.y += rate * ink->hist_buffer[cur_index].y;
1844 + if (scale_sum != 0.0)
1846 + result.x /= scale_sum;
1847 + result.y /= scale_sum;
1853 +/**************************************************************/
1855 +/*********************************/
1856 +/* Rendering functions */
1857 +/*********************************/
1859 +/* Some of this stuff should probably be combined with the
1860 + * code it was copied from in paint_core.c; but I wanted
1861 + * to learn this stuff, so I've kept it simple.
1863 + * The following only supports CONSTANT mode. Incremental
1864 + * would, I think, interact strangely with the way we
1865 + * do things. But it wouldn't be hard to implement at all.
1868 +enum { ROW_START, ROW_STOP };
1870 +/* The insertion sort here, for SUBSAMPLE = 8, tends to beat out
1871 + * qsort() by 4x with CFLAGS=-O2, 2x with CFLAGS=-g
1874 +insert_sort (gint *data,
1880 + for (i = 2; i < 2 * n; i += 2)
1883 + tmp2 = data[i + 1];
1885 + while (data[j] < tmp1)
1888 + for (k = i; k > j; k -= 2)
1890 + data[k] = data[k - 2];
1891 + data[k + 1] = data[k - 1];
1895 + data[j + 1] = tmp2;
1900 +fill_run (guchar *dest,
1906 + memset (dest, 255, w);
1912 + *dest = MAX (*dest, alpha);
1919 +render_blob_line (Blob *blob,
1925 + gint buf[4 * SUBSAMPLE];
1929 + gint current = 0; /* number of filled rows at this point
1930 + * in the scan line
1934 + /* Sort start and ends for all lines */
1936 + j = y * SUBSAMPLE - blob->y;
1937 + for (i = 0; i < SUBSAMPLE; i++)
1939 + if (j >= blob->height)
1942 + if ((j > 0) && (blob->data[j].left <= blob->data[j].right))
1944 + data[2 * n] = blob->data[j].left;
1945 + data[2 * n + 1] = ROW_START;
1946 + data[2 * SUBSAMPLE + 2 * n] = blob->data[j].right;
1947 + data[2 * SUBSAMPLE + 2 * n + 1] = ROW_STOP;
1953 + /* If we have less than SUBSAMPLE rows, compress */
1954 + if (n < SUBSAMPLE)
1956 + for (i = 0; i < 2 * n; i++)
1957 + data[2 * n + i] = data[2 * SUBSAMPLE + i];
1960 + /* Now count start and end separately */
1963 + insert_sort (data, n);
1965 + /* Discard portions outside of tile */
1967 + while ((n > 0) && (data[0] < SUBSAMPLE*x))
1969 + if (data[1] == ROW_START)
1977 + while ((n > 0) && (data[2*(n-1)] >= SUBSAMPLE*(x+width)))
1980 + /* Render the row */
1983 + for (i = 0; i < n;)
1985 + gint cur_x = data[2 * i] / SUBSAMPLE - x;
1988 + /* Fill in portion leading up to this pixel */
1989 + if (current && cur_x != last_x)
1990 + fill_run (dest + last_x, (255 * current) / SUBSAMPLE, cur_x - last_x);
1992 + /* Compute the value for this pixel */
1993 + pixel = current * SUBSAMPLE;
1997 + gint tmp_x = data[2 * i] / SUBSAMPLE;
1999 + if (tmp_x - x != cur_x)
2002 + if (data[2 * i + 1] == ROW_START)
2005 + pixel += ((tmp_x + 1) * SUBSAMPLE) - data[2 * i];
2010 + pixel -= ((tmp_x + 1) * SUBSAMPLE) - data[2 * i];
2016 + dest[cur_x] = MAX (dest[cur_x], (pixel * 255) / (SUBSAMPLE * SUBSAMPLE));
2018 + last_x = cur_x + 1;
2022 + fill_run (dest + last_x, (255 * current)/ SUBSAMPLE, width - last_x);
2026 +render_blob (Blob *blob,
2027 + PixelRegion *dest)
2034 + for (pr = pixel_regions_register (1, dest);
2036 + pr = pixel_regions_process (pr))
2041 + for (i=0; i<h; i++)
2043 + render_blob_line (blob, s,
2044 + dest->x, dest->y + i, dest->w);
2045 + s += dest->rowstride;
2049 --- gimp-2.6.6/app/paint/gimpink2.h 1970-01-01 09:00:00 +0900
2050 +++ gimp-painter--2.6.6/app/paint/gimpink2.h 2009-03-17 10:42:37 +0900
2052 +/* GIMP - The GNU Image Manipulation Program
2053 + * Copyright (C) 1995 Spencer Kimball and Peter Mattis
2055 + * This program is free software; you can redistribute it and/or modify
2056 + * it under the terms of the GNU General Public License as published by
2057 + * the Free Software Foundation; either version 2 of the License, or
2058 + * (at your option) any later version.
2060 + * This program is distributed in the hope that it will be useful,
2061 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2062 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2063 + * GNU General Public License for more details.
2065 + * You should have received a copy of the GNU General Public License
2066 + * along with this program; if not, write to the Free Software
2067 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2070 +#ifndef __GIMP_INK2_H__
2071 +#define __GIMP_INK2_H__
2074 +#include "gimppaintcore.h"
2075 +#include "gimpink-blob.h"
2078 +#define INK2_DIST_SMOOTHER_BUFFER 10
2079 +#define INK2_TIME_SMOOTHER_BUFFER 10
2080 +#define INK2_HISTORY_BUFFER 20
2083 +#define GIMP_TYPE_INK2 (gimp_ink2_get_type ())
2084 +#define GIMP_INK2(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_INK2, GimpInk2))
2085 +#define GIMP_INK2_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_INK2, GimpInk2Class))
2086 +#define GIMP_IS_INK2(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_INK2))
2087 +#define GIMP_IS_INK2_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_INK2))
2088 +#define GIMP_INK2_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_INK2, GimpInk2Class))
2091 +typedef struct _GimpInk2Class GimpInk2Class;
2095 + GimpPaintCore parent_instance;
2097 + Blob *start_blob; /* starting blob (for undo) */
2099 + Blob *cur_blob; /* current blob */
2100 + Blob *last_blob; /* blob for last cursor position */
2102 + /* circular distance history buffer */
2103 + gdouble dt_buffer[INK2_DIST_SMOOTHER_BUFFER];
2106 + /* circular timing history buffer */
2107 + guint32 ts_buffer[INK2_TIME_SMOOTHER_BUFFER];
2110 + GimpCoords hist_buffer[INK2_HISTORY_BUFFER];
2111 + gdouble hist_dist_buffer[INK2_HISTORY_BUFFER];
2115 + guint32 last_time; /* previous time of a motion event */
2117 + GimpCoords last_point; /* last compensated position */
2119 + gboolean init_velocity;
2122 +struct _GimpInk2Class
2124 + GimpPaintCoreClass parent_class;
2128 +void gimp_ink2_register (Gimp *gimp,
2129 + GimpPaintRegisterCallback callback);
2131 +GType gimp_ink2_get_type (void) G_GNUC_CONST;
2134 +#endif /* __GIMP_INK2_H__ */
2135 --- gimp-2.6.6/app/paint/gimpink2options.c 1970-01-01 09:00:00 +0900
2136 +++ gimp-painter--2.6.6/app/paint/gimpink2options.c 2009-03-17 10:42:37 +0900
2138 +/* GIMP - The GNU Image Manipulation Program
2139 + * Copyright (C) 1995 Spencer Kimball and Peter Mattis
2141 + * This program is free software; you can redistribute it and/or modify
2142 + * it under the terms of the GNU General Public License as published by
2143 + * the Free Software Foundation; either version 2 of the License, or
2144 + * (at your option) any later version.
2146 + * This program is distributed in the hope that it will be useful,
2147 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2148 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2149 + * GNU General Public License for more details.
2151 + * You should have received a copy of the GNU General Public License
2152 + * along with this program; if not, write to the Free Software
2153 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2156 +#include "config.h"
2158 +#include <glib-object.h>
2160 +#include "libgimpconfig/gimpconfig.h"
2162 +#include "paint-types.h"
2164 +#include "core/gimp.h"
2165 +#include "core/gimpdrawable.h"
2166 +#include "core/gimppaintinfo.h"
2168 +#include "gimpink2.h"
2169 +#include "gimpink2options.h"
2170 +#include "gimpink-blob.h"
2172 +#include "gimp-intl.h"
2180 + PROP_SIZE_SENSITIVITY,
2181 + PROP_VEL_SENSITIVITY,
2182 + PROP_TILT_SENSITIVITY,
2186 + PROP_COMPENSATION_HIST_SIZE,
2187 + PROP_COMPENSATE_AT_LAST,
2188 + PROP_COMPENSATION_RATE_TEMPERATURE,
2190 + PROP_MAX_COORD_SMOOTH
2194 +static void gimp_ink2_options_set_property (GObject *object,
2195 + guint property_id,
2196 + const GValue *value,
2197 + GParamSpec *pspec);
2198 +static void gimp_ink2_options_get_property (GObject *object,
2199 + guint property_id,
2201 + GParamSpec *pspec);
2204 +G_DEFINE_TYPE (GimpInk2Options, gimp_ink2_options, GIMP_TYPE_PAINT_OPTIONS)
2208 +gimp_ink2_options_class_init (GimpInk2OptionsClass *klass)
2210 + GObjectClass *object_class = G_OBJECT_CLASS (klass);
2212 + object_class->set_property = gimp_ink2_options_set_property;
2213 + object_class->get_property = gimp_ink2_options_get_property;
2215 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_SIZE,
2218 + GIMP_PARAM_STATIC_STRINGS);
2219 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_TILT_ANGLE,
2220 + "tilt-angle", NULL,
2222 + GIMP_PARAM_STATIC_STRINGS);
2224 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_SIZE_SENSITIVITY,
2225 + "size-sensitivity", NULL,
2227 + GIMP_PARAM_STATIC_STRINGS);
2228 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_VEL_SENSITIVITY,
2229 + "vel-sensitivity", NULL,
2231 + GIMP_PARAM_STATIC_STRINGS);
2232 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_TILT_SENSITIVITY,
2233 + "tilt-sensitivity", NULL,
2235 + GIMP_PARAM_STATIC_STRINGS);
2237 + GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_BLOB_TYPE,
2238 + "blob-type", NULL,
2239 + GIMP_TYPE_INK_BLOB_TYPE,
2240 + GIMP_INK_BLOB_TYPE_ELLIPSE,
2241 + GIMP_PARAM_STATIC_STRINGS);
2242 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_BLOB_ASPECT,
2243 + "blob-aspect", NULL,
2245 + GIMP_PARAM_STATIC_STRINGS);
2246 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_BLOB_ANGLE,
2247 + "blob-angle", NULL,
2249 + GIMP_PARAM_STATIC_STRINGS);
2251 + GIMP_CONFIG_INSTALL_PROP_INT (object_class, PROP_COMPENSATION_HIST_SIZE,
2252 + "compensation-history-size", NULL,
2253 + 1, INK2_HISTORY_BUFFER, MIN(20, INK2_HISTORY_BUFFER), 0);
2254 + GIMP_CONFIG_INSTALL_PROP_BOOLEAN(object_class, PROP_COMPENSATE_AT_LAST,
2255 + "compensate-at-last", NULL,
2257 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_COMPENSATION_RATE_TEMPERATURE,
2258 + "compensation-rate-temperature", NULL,
2262 + /* G-Pen uses the own smoothing routin, so disable the GimpDisplayShell's one */
2263 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_MAX_COORD_SMOOTH,
2264 + "ink2-max-coord-smooth", NULL,
2266 + GIMP_PARAM_STATIC_STRINGS);
2268 + g_object_class_override_property (object_class, PROP_MAX_COORD_SMOOTH, "paint-max-coord-smooth");
2272 +gimp_ink2_options_init (GimpInk2Options *options)
2277 +gimp_ink2_options_set_property (GObject *object,
2278 + guint property_id,
2279 + const GValue *value,
2280 + GParamSpec *pspec)
2282 + GimpInk2Options *options = GIMP_INK2_OPTIONS (object);
2284 + switch (property_id)
2287 + options->size = g_value_get_double (value);
2289 + case PROP_TILT_ANGLE:
2290 + options->tilt_angle = g_value_get_double (value);
2292 + case PROP_SIZE_SENSITIVITY:
2293 + options->size_sensitivity = g_value_get_double (value);
2295 + case PROP_VEL_SENSITIVITY:
2296 + options->vel_sensitivity = g_value_get_double (value);
2298 + case PROP_TILT_SENSITIVITY:
2299 + options->tilt_sensitivity = g_value_get_double (value);
2301 + case PROP_BLOB_TYPE:
2302 + options->blob_type = g_value_get_enum (value);
2304 + case PROP_BLOB_ASPECT:
2305 + options->blob_aspect = g_value_get_double (value);
2307 + case PROP_BLOB_ANGLE:
2308 + options->blob_angle = g_value_get_double (value);
2310 + case PROP_COMPENSATION_HIST_SIZE:
2311 + options->compensation_hist_size = g_value_get_int (value);
2313 + case PROP_COMPENSATE_AT_LAST:
2314 + options->compensate_at_last = g_value_get_boolean (value);
2316 + case PROP_COMPENSATION_RATE_TEMPERATURE:
2317 + options->compensation_rate_temperature = g_value_get_double (value);
2320 + case PROP_MAX_COORD_SMOOTH:
2321 + GIMP_TOOL_OPTIONS (options)->max_coord_smooth = g_value_get_double (value);
2325 + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
2331 +gimp_ink2_options_get_property (GObject *object,
2332 + guint property_id,
2334 + GParamSpec *pspec)
2336 + GimpInk2Options *options = GIMP_INK2_OPTIONS (object);
2338 + switch (property_id)
2341 + g_value_set_double (value, options->size);
2343 + case PROP_TILT_ANGLE:
2344 + g_value_set_double (value, options->tilt_angle);
2346 + case PROP_SIZE_SENSITIVITY:
2347 + g_value_set_double (value, options->size_sensitivity);
2349 + case PROP_VEL_SENSITIVITY:
2350 + g_value_set_double (value, options->vel_sensitivity);
2352 + case PROP_TILT_SENSITIVITY:
2353 + g_value_set_double (value, options->tilt_sensitivity);
2355 + case PROP_BLOB_TYPE:
2356 + g_value_set_enum (value, options->blob_type);
2358 + case PROP_BLOB_ASPECT:
2359 + g_value_set_double (value, options->blob_aspect);
2361 + case PROP_BLOB_ANGLE:
2362 + g_value_set_double (value, options->blob_angle);
2364 + case PROP_COMPENSATION_HIST_SIZE:
2365 + g_value_set_int (value, options->compensation_hist_size);
2367 + case PROP_COMPENSATE_AT_LAST:
2368 + g_value_set_boolean (value, options->compensate_at_last);
2370 + case PROP_COMPENSATION_RATE_TEMPERATURE:
2371 + g_value_set_double (value, options->compensation_rate_temperature);
2374 + case PROP_MAX_COORD_SMOOTH:
2375 + g_value_set_double (value, GIMP_TOOL_OPTIONS (options)->max_coord_smooth);
2379 + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
2383 --- gimp-2.6.6/app/paint/gimpink2options.h 1970-01-01 09:00:00 +0900
2384 +++ gimp-painter--2.6.6/app/paint/gimpink2options.h 2009-03-17 10:42:37 +0900
2386 +/* GIMP - The GNU Image Manipulation Program
2387 + * Copyright (C) 1995 Spencer Kimball and Peter Mattis
2389 + * This program is free software; you can redistribute it and/or modify
2390 + * it under the terms of the GNU General Public License as published by
2391 + * the Free Software Foundation; either version 2 of the License, or
2392 + * (at your option) any later version.
2394 + * This program is distributed in the hope that it will be useful,
2395 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2396 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2397 + * GNU General Public License for more details.
2399 + * You should have received a copy of the GNU General Public License
2400 + * along with this program; if not, write to the Free Software
2401 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2404 +#ifndef __GIMP_INK2_OPTIONS_H__
2405 +#define __GIMP_INK2_OPTIONS_H__
2408 +#include "gimppaintoptions.h"
2411 +#define GIMP_TYPE_INK2_OPTIONS (gimp_ink2_options_get_type ())
2412 +#define GIMP_INK2_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_INK2_OPTIONS, GimpInk2Options))
2413 +#define GIMP_INK2_OPTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_INK2_OPTIONS, GimpInk2OptionsClass))
2414 +#define GIMP_IS_INK2_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_INK2_OPTIONS))
2415 +#define GIMP_IS_INK2_OPTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_INK2_OPTIONS))
2416 +#define GIMP_INK2_OPTIONS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_INK2_OPTIONS, GimpInk2OptionsClass))
2419 +typedef struct _GimpInk2OptionsClass GimpInk2OptionsClass;
2421 +struct _GimpInk2Options
2423 + GimpPaintOptions parent_instance;
2426 + gdouble tilt_angle;
2428 + gdouble size_sensitivity;
2429 + gdouble vel_sensitivity;
2430 + gdouble tilt_sensitivity;
2432 + GimpInkBlobType blob_type;
2433 + gdouble blob_aspect;
2434 + gdouble blob_angle;
2436 + gint compensation_hist_size;
2437 + gboolean compensate_at_last;
2438 + gdouble compensation_rate_temperature;
2441 +struct _GimpInk2OptionsClass
2443 + GimpPaintOptionsClass parent_instance;
2447 +GType gimp_ink2_options_get_type (void) G_GNUC_CONST;
2450 +#endif /* __GIMP_INK2_OPTIONS_H__ */
2451 --- gimp-2.6.6/app/paint/gimpink2undo.c 1970-01-01 09:00:00 +0900
2452 +++ gimp-painter--2.6.6/app/paint/gimpink2undo.c 2009-03-17 10:42:37 +0900
2454 +/* GIMP - The GNU Image Manipulation Program
2455 + * Copyright (C) 1995 Spencer Kimball and Peter Mattis
2457 + * This program is free software; you can redistribute it and/or modify
2458 + * it under the terms of the GNU General Public License as published by
2459 + * the Free Software Foundation; either version 2 of the License, or
2460 + * (at your option) any later version.
2462 + * This program is distributed in the hope that it will be useful,
2463 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2464 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2465 + * GNU General Public License for more details.
2467 + * You should have received a copy of the GNU General Public License
2468 + * along with this program; if not, write to the Free Software
2469 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2472 +#include "config.h"
2474 +#include <string.h>
2476 +#include <glib-object.h>
2478 +#include "paint-types.h"
2480 +#include "gimpink2.h"
2481 +#include "gimpink-blob.h"
2482 +#include "gimpink2undo.h"
2485 +static GObject * gimp_ink2_undo_constructor (GType type,
2487 + GObjectConstructParam *params);
2489 +static void gimp_ink2_undo_pop (GimpUndo *undo,
2490 + GimpUndoMode undo_mode,
2491 + GimpUndoAccumulator *accum);
2492 +static void gimp_ink2_undo_free (GimpUndo *undo,
2493 + GimpUndoMode undo_mode);
2496 +G_DEFINE_TYPE (GimpInk2Undo, gimp_ink2_undo, GIMP_TYPE_PAINT_CORE_UNDO)
2498 +#define parent_class gimp_ink2_undo_parent_class
2502 +gimp_ink2_undo_class_init (GimpInk2UndoClass *klass)
2504 + GObjectClass *object_class = G_OBJECT_CLASS (klass);
2505 + GimpUndoClass *undo_class = GIMP_UNDO_CLASS (klass);
2507 + object_class->constructor = gimp_ink2_undo_constructor;
2509 + undo_class->pop = gimp_ink2_undo_pop;
2510 + undo_class->free = gimp_ink2_undo_free;
2514 +gimp_ink2_undo_init (GimpInk2Undo *undo)
2519 +gimp_ink2_undo_constructor (GType type,
2521 + GObjectConstructParam *params)
2524 + GimpInk2Undo *ink_undo;
2527 + object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params);
2529 + ink_undo = GIMP_INK2_UNDO (object);
2531 + g_assert (GIMP_IS_INK2 (GIMP_PAINT_CORE_UNDO (ink_undo)->paint_core));
2533 + ink = GIMP_INK2 (GIMP_PAINT_CORE_UNDO (ink_undo)->paint_core);
2535 + if (ink->start_blob)
2536 + ink_undo->last_blob = blob_duplicate (ink->start_blob);
2542 +gimp_ink2_undo_pop (GimpUndo *undo,
2543 + GimpUndoMode undo_mode,
2544 + GimpUndoAccumulator *accum)
2546 + GimpInk2Undo *ink_undo = GIMP_INK2_UNDO (undo);
2548 + GIMP_UNDO_CLASS (parent_class)->pop (undo, undo_mode, accum);
2550 + if (GIMP_PAINT_CORE_UNDO (ink_undo)->paint_core)
2552 + GimpInk2 *ink = GIMP_INK2 (GIMP_PAINT_CORE_UNDO (ink_undo)->paint_core);
2555 + tmp_blob = ink->last_blob;
2556 + ink->last_blob = ink_undo->last_blob;
2557 + ink_undo->last_blob = tmp_blob;
2562 +gimp_ink2_undo_free (GimpUndo *undo,
2563 + GimpUndoMode undo_mode)
2565 + GimpInk2Undo *ink_undo = GIMP_INK2_UNDO (undo);
2567 + if (ink_undo->last_blob)
2569 + g_free (ink_undo->last_blob);
2570 + ink_undo->last_blob = NULL;
2573 + GIMP_UNDO_CLASS (parent_class)->free (undo, undo_mode);
2575 --- gimp-2.6.6/app/paint/gimpink2undo.h 1970-01-01 09:00:00 +0900
2576 +++ gimp-painter--2.6.6/app/paint/gimpink2undo.h 2009-03-17 10:42:37 +0900
2578 +/* GIMP - The GNU Image Manipulation Program
2579 + * Copyright (C) 1995 Spencer Kimball and Peter Mattis
2581 + * This program is free software; you can redistribute it and/or modify
2582 + * it under the terms of the GNU General Public License as published by
2583 + * the Free Software Foundation; either version 2 of the License, or
2584 + * (at your option) any later version.
2586 + * This program is distributed in the hope that it will be useful,
2587 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2588 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2589 + * GNU General Public License for more details.
2591 + * You should have received a copy of the GNU General Public License
2592 + * along with this program; if not, write to the Free Software
2593 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2596 +#ifndef __GIMP_INK2_UNDO_H__
2597 +#define __GIMP_INK2_UNDO_H__
2600 +#include "gimppaintcoreundo.h"
2601 +#include "gimpink2.h"
2604 +#define GIMP_TYPE_INK2_UNDO (gimp_ink2_undo_get_type ())
2605 +#define GIMP_INK2_UNDO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_INK2_UNDO, GimpInk2Undo))
2606 +#define GIMP_INK2_UNDO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_INK2_UNDO, GimpInk2UndoClass))
2607 +#define GIMP_IS_INK2_UNDO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_INK2_UNDO))
2608 +#define GIMP_IS_INK2_UNDO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_INK2_UNDO))
2609 +#define GIMP_INK2_UNDO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_INK2_UNDO, GimpInk2UndoClass))
2612 +typedef struct _GimpInk2UndoClass GimpInk2UndoClass;
2614 +struct _GimpInk2Undo
2616 + GimpPaintCoreUndo parent_instance;
2621 +struct _GimpInk2UndoClass
2623 + GimpPaintCoreUndoClass parent_class;
2627 +GType gimp_ink2_undo_get_type (void) G_GNUC_CONST;
2630 +#endif /* __GIMP_INK2_UNDO_H__ */
2631 --- gimp-2.6.6/app/paint/gimpmixbrush.c 1970-01-01 09:00:00 +0900
2632 +++ gimp-painter--2.6.6/app/paint/gimpmixbrush.c 2009-07-15 15:05:55 +0900
2634 +/* GIMP - The GNU Image Manipulation Program
2635 + * Copyright (C) 1995 Spencer Kimball and Peter Mattis
2637 + * This program is free software; you can redistribute it and/or modify
2638 + * it under the terms of the GNU General Public License as published by
2639 + * the Free Software Foundation; either version 2 of the License, or
2640 + * (at your option) any later version.
2642 + * This program is distributed in the hope that it will be useful,
2643 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2644 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2645 + * GNU General Public License for more details.
2647 + * You should have received a copy of the GNU General Public License
2648 + * along with this program; if not, write to the Free Software
2649 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2653 +#include "config.h"
2655 +#include <glib-object.h>
2657 +#include "libgimpcolor/gimpcolor.h"
2658 +#include "libgimpmath/gimpmath.h"
2659 +#include "libgimpbase/gimpbase.h"
2661 +#include "paint-types.h"
2663 +#include "base/pixel-region.h"
2664 +#include "base/temp-buf.h"
2666 +#include "base/pixel-processor.h"
2668 +#include "paint-funcs/paint-funcs.h"
2670 +#include "core/gimp.h"
2671 +#include "core/gimpbrush.h"
2672 +#include "core/gimpdrawable.h"
2673 +#include "core/gimplayer.h"
2674 +#include "core/gimpgradient.h"
2675 +#include "core/gimppattern.h"
2676 +#include "core/gimpimage.h"
2677 +#include "core/gimppickable.h"
2678 +#include "core/gimpprojection.h"
2680 +#include "gimpmixbrush.h"
2681 +#include "gimpmixbrushoptions.h"
2683 +#ifdef GIMP_MIXBRUSH_COMPOSITE
2684 +#include "gimpmixbrush-composite.h"
2687 +#include "gimp-intl.h"
2690 +/* Coords history */
2692 +typedef struct _CoordsHistory
2694 + GimpCoords coords;
2695 + GimpCoords prev_coords;
2696 + gdouble pixel_dist;
2703 +/* Params of composite functions */
2705 +typedef struct _CompositeDabParam
2707 + GimpRGB paint_color;
2708 + GimpRGB _paint_color;
2710 + gdouble adjusted_opacity;
2716 + gdouble fringe_contrast;
2717 + gdouble fringe_contrast_offset;
2719 + gint texture_jitter_x;
2720 + gint texture_jitter_y;
2722 + gboolean has_alpha;
2723 + gboolean active_components[MAX_CHANNELS];
2725 + guchar *texture_data;
2726 + gint texture_bytes;
2727 + gint texture_width;
2728 + gint texture_height;
2729 + gint texture_stride;
2730 +} CompositeDabParam;
2733 +static void gimp_mixbrush_finalize (GObject *object);
2735 +static void gimp_mixbrush_paint (GimpPaintCore *paint_core,
2736 + GimpDrawable *drawable,
2737 + GimpPaintOptions *paint_options,
2738 + GimpPaintState paint_state,
2741 +static void gimp_mixbrush_motion (GimpPaintCore *paint_core,
2742 + GimpDrawable *drawable,
2743 + GimpPaintOptions *paint_options);
2745 +static void gimp_mixbrush_start (GimpPaintCore *paint_core,
2746 + GimpDrawable *drawable,
2747 + GimpPaintOptions *paint_options);
2749 +static void gimp_mixbrush_finish (GimpPaintCore *paint_core,
2750 + GimpDrawable *drawable,
2751 + GimpPaintOptions *paint_options);
2754 +static void gimp_mixbrush_paste_canvas (GimpPaintCore *paint_core,
2755 + GimpDrawable *drawable,
2756 + GimpPaintOptions *paint_options);
2758 +static void coords_history_free (CoordsHistory *history,
2761 +static inline gboolean get_canvas_color (GimpImage *image,
2762 + GimpDrawable *drawable,
2763 + GimpPaintCore *paint_core,
2766 + guint sample_size_limit,
2770 +static inline gboolean pick_up_avarage_color (GimpPickable *pickable,
2771 + GimpBrushCore *brush_core,
2777 +static inline void color_to_alpha (GimpRGB *src,
2778 + const GimpRGB *color);
2780 +static inline void composite_rgba (const GimpRGB *color1,
2782 + const GimpRGB *color2,
2785 + gboolean use_alt_alpha_op);
2787 +static inline void blend_rgba (const GimpRGB *color1,
2789 + const GimpRGB *color2,
2792 + gboolean use_alt_alpha_op);
2794 +static inline void calc_pressure_params (PressureParams *params,
2800 +static inline gdouble calc_pressure (gdouble value,
2801 + PressureParams *params);
2803 +#ifndef GIMP_MIXBRUSH_COMPOSITE
2804 +void paste_canvas (GimpPaintCore *core,
2805 + GimpDrawable *drawable,
2806 + GimpPattern *texture,
2807 + GimpRGB *paint_color,
2809 + GimpBrushApplicationMode hardness_mode,
2812 + gdouble fringe_contrast,
2815 + GimpUpdateFreqOptions *update_freq_options);
2817 +static void composite_dab (CompositeDabParam *params,
2818 + PixelRegion *srcPR,
2819 + PixelRegion *maskPR);
2821 +static void composite_textured_dab (CompositeDabParam *params,
2822 + PixelRegion *srcPR,
2823 + PixelRegion *maskPR);
2825 +static void composite_dab_selection (CompositeDabParam *params,
2826 + PixelRegion *srcPR,
2827 + PixelRegion *maskPR,
2828 + PixelRegion *selPR);
2830 +static void composite_textured_dab_selection (CompositeDabParam *params,
2831 + PixelRegion *srcPR,
2832 + PixelRegion *maskPR,
2833 + PixelRegion *selPR);
2838 +G_DEFINE_TYPE (GimpMixbrush, gimp_mixbrush, GIMP_TYPE_PAINTBRUSH)
2840 +#define parent_class gimp_mixbrush_parent_class
2844 +gimp_mixbrush_register (Gimp *gimp,
2845 + GimpPaintRegisterCallback callback)
2847 + (* callback) (gimp,
2848 + GIMP_TYPE_MIXBRUSH,
2849 + GIMP_TYPE_MIXBRUSH_OPTIONS,
2852 + "gimp-tool-mixbrush");
2856 +gimp_mixbrush_class_init (GimpMixbrushClass *klass)
2858 + GimpPaintCoreClass *paint_core_class = GIMP_PAINT_CORE_CLASS (klass);
2859 + GimpBrushCoreClass *brush_core_class = GIMP_BRUSH_CORE_CLASS (klass);
2861 + paint_core_class->paint = gimp_mixbrush_paint;
2862 + G_OBJECT_CLASS (klass)->finalize = gimp_mixbrush_finalize;
2864 + brush_core_class->handles_changing_brush = TRUE;
2868 +gimp_mixbrush_init (GimpMixbrush *mixbrush)
2870 + mixbrush->history = NULL;
2871 + mixbrush->mask = NULL;
2873 +#ifdef GIMP_MIXBRUSH_COMPOSITE
2874 + gimp_mixbrush_composite_init ();
2879 +gimp_mixbrush_finalize (GObject *object)
2881 + GimpMixbrush *mixbrush = GIMP_MIXBRUSH (object);
2883 + if (mixbrush->history) {
2884 + g_list_foreach (mixbrush->history, (GFunc)coords_history_free, NULL);
2885 + g_list_free (mixbrush->history);
2887 + if (mixbrush->mask)
2888 + temp_buf_free (mixbrush->mask);
2890 + G_OBJECT_CLASS (parent_class)->finalize (object);
2894 +gimp_mixbrush_paint (GimpPaintCore *paint_core,
2895 + GimpDrawable *drawable,
2896 + GimpPaintOptions *paint_options,
2897 + GimpPaintState paint_state,
2902 + static gdouble total_time = 0;
2903 + static guint count = 0;
2905 + switch (paint_state)
2907 + case GIMP_PAINT_STATE_INIT:
2912 + gimp_mixbrush_start (paint_core, drawable, paint_options);
2913 + GIMP_PAINT_CORE_CLASS (parent_class)->paint (paint_core, drawable,
2915 + paint_state, time);
2918 + case GIMP_PAINT_STATE_MOTION:
2920 + timer = g_timer_new ();
2921 + g_timer_start (timer);
2922 + gimp_mixbrush_motion (paint_core, drawable, paint_options);
2923 + g_timer_stop (timer);
2924 + total_time += g_timer_elapsed (timer, NULL);
2925 + g_timer_destroy (timer);
2928 + gimp_mixbrush_motion (paint_core, drawable, paint_options);
2932 + case GIMP_PAINT_STATE_FINISH:
2934 + g_printerr ("average time:%f\n", total_time / count);
2936 + gimp_mixbrush_finish (paint_core, drawable, paint_options);
2937 + GIMP_PAINT_CORE_CLASS (parent_class)->paint (paint_core, drawable,
2939 + paint_state, time);
2948 +gimp_mixbrush_start (GimpPaintCore *paint_core,
2949 + GimpDrawable *drawable,
2950 + GimpPaintOptions *paint_options)
2952 + GimpMixbrush *mixbrush = GIMP_MIXBRUSH (paint_core);
2953 + GimpMixbrushOptions *mixbrush_options = GIMP_MIXBRUSH_OPTIONS (paint_options);
2955 + guchar color_uchar[MAX_CHANNELS];
2957 + image = gimp_item_get_image (GIMP_ITEM (drawable));
2959 + mixbrush->use_alt_alpha_op =
2960 + (mixbrush_options->alpha_channel_mixing && gimp_drawable_has_alpha (drawable));
2962 + /* Init the pressure params */
2963 + calc_pressure_params (&mixbrush->pr_texture_grain,
2964 + mixbrush_options->texture_options->grain_pressure_in1,
2965 + mixbrush_options->texture_options->grain_pressure_in2,
2966 + mixbrush_options->texture_options->grain_pressure_out1,
2967 + mixbrush_options->texture_options->grain_pressure_out2);
2968 + calc_pressure_params (&mixbrush->pr_main_density,
2969 + mixbrush_options->main_color_density_pressure_in1,
2970 + mixbrush_options->main_color_density_pressure_in2,
2971 + mixbrush_options->main_color_density_pressure_out1,
2972 + mixbrush_options->main_color_density_pressure_out2);
2973 + calc_pressure_params (&mixbrush->pr_main_rate,
2974 + mixbrush_options->main_color_pressure_in1,
2975 + mixbrush_options->main_color_pressure_in2,
2976 + mixbrush_options->main_color_pressure_out1,
2977 + mixbrush_options->main_color_pressure_out2);
2978 + calc_pressure_params (&mixbrush->pr_canvas_density,
2979 + mixbrush_options->canvas_color_density_pressure_in1,
2980 + mixbrush_options->canvas_color_density_pressure_in2,
2981 + mixbrush_options->canvas_color_density_pressure_out1,
2982 + mixbrush_options->canvas_color_density_pressure_out2);
2983 + calc_pressure_params (&mixbrush->pr_canvas_rate,
2984 + mixbrush_options->canvas_color_pressure_in1,
2985 + mixbrush_options->canvas_color_pressure_in2,
2986 + mixbrush_options->canvas_color_pressure_out1,
2987 + mixbrush_options->canvas_color_pressure_out2);
2989 + /* Get the index of the alpha component */
2990 + switch (gimp_drawable_type_without_alpha (drawable))
2993 + mixbrush->alpha_pix = ALPHA_PIX;
2996 + mixbrush->alpha_pix = ALPHA_G_PIX;
2998 + case GIMP_INDEXED:
3000 + mixbrush->alpha_pix = ALPHA_I_PIX;
3003 + /* Setup the paint(foreground) color */
3004 + gimp_image_get_foreground (image, GIMP_CONTEXT (paint_options),
3005 + gimp_drawable_type (drawable),
3008 + if (mixbrush->alpha_pix == ALPHA_PIX)
3009 + gimp_rgba_set_uchar (&mixbrush->paint_color,
3015 + gimp_rgba_set_uchar (&mixbrush->paint_color,
3021 + mixbrush->paint_color.a = 1.0;
3023 + /* Setup the last color */
3024 + if (mixbrush->use_alt_alpha_op)
3026 + get_canvas_color (image, drawable, paint_core,
3027 + (gint) paint_core->cur_coords.x, (gint) paint_core->cur_coords.y,
3028 + mixbrush_options->sample_size_limit,
3029 + mixbrush_options->merged,
3030 + &mixbrush->last_color);
3031 + mixbrush->last_color.a *= mixbrush_options->canvas_color_density *
3032 + calc_pressure (paint_core->cur_coords.pressure, &mixbrush->pr_canvas_density);
3035 + mixbrush->last_color.a = 0.0;
3037 + /* Setup the hidden color */
3038 + mixbrush->hidden_color.a = 0.0;
3040 + if (gimp_drawable_has_alpha (drawable))
3042 + switch (mixbrush_options->hidden_color)
3044 + case GIMP_HIDDEN_COLOR_WHITE:
3045 + gimp_rgba_set (&mixbrush->hidden_color, 1.0, 1.0, 1.0, 1.0);
3047 + case GIMP_HIDDEN_COLOR_BACKGROUND:
3048 + gimp_image_get_background (image, GIMP_CONTEXT (paint_options),
3049 + gimp_drawable_type (drawable),
3052 + gimp_rgba_set_uchar (&mixbrush->hidden_color,
3058 + mixbrush->hidden_color.a = 1.0;
3063 + /* Reset the rounding error */
3064 + gimp_rgba_set (&mixbrush->error, 0, 0, 0, 0);
3068 +gimp_mixbrush_finish (GimpPaintCore *paint_core,
3069 + GimpDrawable *drawable,
3070 + GimpPaintOptions *paint_options)
3072 + GimpMixbrush *mixbrush = GIMP_MIXBRUSH (paint_core);
3074 + if (!(GIMP_MIXBRUSH_OPTIONS (paint_options)->tail) && mixbrush->history)
3076 + g_list_foreach (mixbrush->history, (GFunc)coords_history_free, NULL);
3077 + g_list_free (mixbrush->history);
3078 + mixbrush->history = NULL;
3081 + while (mixbrush->history)
3082 + gimp_mixbrush_paste_canvas (paint_core, drawable, paint_options);
3084 + if (mixbrush->mask)
3086 + temp_buf_free (mixbrush->mask);
3087 + mixbrush->mask = NULL;
3092 +gimp_mixbrush_motion (GimpPaintCore *paint_core,
3093 + GimpDrawable *drawable,
3094 + GimpPaintOptions *paint_options)
3097 + GimpMixbrush *mixbrush = GIMP_MIXBRUSH (paint_core);
3098 + GimpMixbrushOptions *mixbrush_options = GIMP_MIXBRUSH_OPTIONS (paint_options);
3099 + CoordsHistory *history;
3100 + gdouble opacity = GIMP_OPACITY_OPAQUE;
3102 + image = gimp_item_get_image (GIMP_ITEM (drawable));
3104 + opacity *= gimp_paint_options_get_fade (paint_options, image,
3105 + paint_core->pixel_dist);
3107 + /* Add history item */
3108 + history = g_new (CoordsHistory, 1);
3109 + history->coords = paint_core->cur_coords;
3110 + history->prev_coords = paint_core->last_coords;
3111 + history->pixel_dist = paint_core->pixel_dist;
3113 + /* Pick up the raw canvas color */
3114 + get_canvas_color (image, drawable, paint_core,
3115 + (gint) history->coords.x, (gint) history->coords.y,
3116 + mixbrush_options->sample_size_limit,
3117 + mixbrush_options->merged,
3120 + history->opacity = opacity;
3122 + mixbrush->history = g_list_append (mixbrush->history, history);
3124 + /* Process a history item */
3125 + if (g_list_length (mixbrush->history) > mixbrush_options->delay)
3126 + gimp_mixbrush_paste_canvas (paint_core, drawable, paint_options);
3130 +gimp_mixbrush_paste_canvas (GimpPaintCore *paint_core,
3131 + GimpDrawable *drawable,
3132 + GimpPaintOptions *paint_options)
3134 + GimpBrushCore *brush_core = GIMP_BRUSH_CORE (paint_core);
3135 + GimpContext *context = GIMP_CONTEXT (paint_options);
3136 + GimpDynamicOptions *pressure_options = paint_options->pressure_options;
3139 + GimpMixbrush *mixbrush = GIMP_MIXBRUSH (paint_core);
3140 + GimpRGB *last_color = &mixbrush->last_color;
3141 + GimpMixbrushOptions *mixbrush_options = GIMP_MIXBRUSH_OPTIONS (paint_options);
3142 + GimpPaintApplicationMode paint_appl_mode;
3143 + CoordsHistory *history;
3144 + GimpCoords orig_coords;
3145 + GimpCoords prev_coords;
3147 + if (mixbrush->history == NULL)
3150 + history = mixbrush->history->data;
3151 + mixbrush->history = g_list_delete_link (mixbrush->history, mixbrush->history);
3153 + if (history->opacity != 0.0)
3155 + image = gimp_item_get_image (GIMP_ITEM (drawable));
3157 + paint_appl_mode = paint_options->application_mode;
3159 + orig_coords = paint_core->cur_coords;
3160 + prev_coords = paint_core->last_coords;
3161 + paint_core->cur_coords = history->coords;
3162 + paint_core->last_coords = history->prev_coords;
3163 + area = gimp_paint_core_get_paint_area (paint_core, drawable, paint_options);
3166 + guchar color_uchar[MAX_CHANNELS];
3167 + GimpRGB main_color, canvas_color;
3168 + gdouble main_op, canvas_op;
3170 + /* Init the main color */
3171 + if (!gimp_paint_options_get_gradient_color (paint_options, image,
3172 + paint_core->cur_coords.pressure,
3173 + paint_core->pixel_dist,
3175 + main_color = mixbrush->paint_color;
3177 + /* Blend the main color and last color */
3178 + main_op = CLAMP (mixbrush_options->main_color_rate *
3179 + calc_pressure (paint_core->cur_coords.pressure, &mixbrush->pr_main_rate),
3182 + /*if (mixbrush_options->alpha_channel_mixing)
3183 + blend_rgba (&main_color, main_op,
3184 + last_color, 1.0 - main_op,
3185 + &main_color, FALSE);
3187 + composite_rgba (&main_color, main_op,
3189 + &main_color, FALSE);*/
3190 + composite_rgba (&main_color, main_op,
3192 + &main_color, FALSE);
3194 + /* Pick up the covered canvas color */
3195 + get_canvas_color (image, drawable, paint_core,
3196 + (gint) paint_core->cur_coords.x, (gint) paint_core->cur_coords.y,
3197 + mixbrush_options->sample_size_limit,
3198 + mixbrush_options->merged,
3201 + /* Blend the covered canvas color and the raw canvas color */
3202 + canvas_op = CLAMP (mixbrush_options->canvas_color_rate *
3203 + calc_pressure (paint_core->cur_coords.pressure, &mixbrush->pr_canvas_rate),
3206 + /*if (mixbrush_options->alpha_channel_mixing)
3207 + blend_rgba (&canvas_color, canvas_op,
3208 + &history->color, 1.0 - canvas_op,
3209 + &canvas_color, FALSE);
3211 + composite_rgba (&canvas_color, canvas_op,
3212 + &history->color, 1.0,
3213 + &canvas_color, FALSE);*/
3214 + blend_rgba (&canvas_color, canvas_op,
3215 + &history->color, 1.0 - canvas_op,
3216 + &canvas_color, TRUE/*FALSE*/);
3218 + /* Correct the rounding error came from the last process */
3219 + gimp_rgba_add (&canvas_color, &mixbrush->error);
3221 + /* Put the hidden color below the canvas color */
3222 + if (mixbrush->hidden_color.a > 0.0)
3223 + composite_rgba (&canvas_color, 1.0, &mixbrush->hidden_color, 1.0, &canvas_color, FALSE);
3226 + /* Blend the main color and the canvas color */
3227 + main_op = mixbrush_options->main_color_density;
3229 + main_op *= calc_pressure (paint_core->cur_coords.pressure, &mixbrush->pr_main_density);
3231 + if (mixbrush_options->dryout > 0)
3232 + main_op *= 1.0 - MIN (paint_core->pixel_dist / mixbrush_options->dryout, 1.0);
3234 + canvas_op = mixbrush_options->canvas_color_density;
3236 + canvas_op *= calc_pressure (paint_core->cur_coords.pressure, &mixbrush->pr_canvas_density);
3238 + /* If the canvas color is transparent, assume that *
3239 + * the main color and the hidden color are same.
3240 + if (canvas_color.a == 0.0)
3241 + gimp_rgb_set (&canvas_color, main_color.r, main_color.g, main_color.b);*/
3243 + main_op = CLAMP (main_op, 0.0, 1.0);
3244 + canvas_op = CLAMP (canvas_op, 0.0, 1.0);
3246 +//g_printerr ("m:%f, %f, %f %f\n",canvas_color.r,canvas_color.g,canvas_color.b,canvas_color.a);
3247 +//g_printerr ("l:%f, %f, %f %f\n",history->color.r,history->color.g,history->color.b,history->color.a);
3248 + if (mixbrush_options->pigment)
3249 + composite_rgba (&main_color, main_op, &canvas_color, canvas_op,
3250 + last_color, /*FALSE*/mixbrush->use_alt_alpha_op);
3252 + blend_rgba (&main_color, main_op, &canvas_color, canvas_op,
3253 + last_color, /*FALSE*/mixbrush->use_alt_alpha_op);
3254 +//g_printerr ("r:%f, %f, %f %f\n\n",canvas_color.r,canvas_color.g,canvas_color.b,canvas_color.a);
3257 + if (mixbrush_options->remove_color &&
3258 + gimp_drawable_type_without_alpha (drawable) == GIMP_RGB_IMAGE)
3260 + /* Remove color */
3261 + GimpRGB color1, color2;
3262 + guchar paint_color[4];
3264 + gimp_rgba_set_uchar (&color1,
3265 + color[0], color[1], color[2], OPAQUE_OPACITY);
3266 + gimp_rgba_set_uchar (&color2,
3267 + hidden_color[0], hidden_color[1], hidden_color[2], OPAQUE_OPACITY);
3269 + color_to_alpha (&color1, &color2);
3271 + history->opacity *= color1.a;
3273 + gimp_rgba_get_uchar (&color1,
3274 + &paint_color[0], &paint_color[1], &paint_color[2], &paint_color[3]);
3275 + paint_color[mixbrush->alpha_pix] = OPAQUE_OPACITY;
3277 + color_pixels (temp_buf_data (area), paint_color,
3278 + area->width * area->height,
3283 + color[mixbrush->alpha_pix] = OPAQUE_OPACITY;
3285 + color_pixels (temp_buf_data (area), color,
3286 + area->width * area->height,
3294 + history->opacity *= gimp_paint_options_get_dynamic_opacity (paint_options,
3295 + &paint_core->cur_coords);
3297 + history->hardness = gimp_paint_options_get_dynamic_hardness (paint_options,
3298 + &paint_core->cur_coords);
3300 + /* finally, let the brush core paste the colored area on the canvas */
3301 + if (mixbrush_options->alpha_channel_mixing &&
3302 + paint_appl_mode == GIMP_PAINT_INCREMENTAL)
3304 + gdouble op = MIN (history->opacity, GIMP_OPACITY_OPAQUE) * gimp_context_get_opacity (context);
3305 + gdouble grain = 0.0;
3306 + GimpPattern *texture = NULL;
3308 + if (mixbrush_options->texture_options->use_texture)
3310 + grain = mixbrush_options->texture_options->grain;
3311 + grain = -1.0 + (grain + 1.0) * calc_pressure (paint_core->cur_coords.pressure,
3312 + &mixbrush->pr_texture_grain);
3314 + texture = gimp_context_get_pattern (context);
3317 + paste_canvas (paint_core, drawable,
3320 + gimp_paint_options_get_brush_mode (paint_options),
3321 + history->hardness,
3322 + mixbrush_options->texture_options->fringe,
3323 + mixbrush_options->texture_options->fringe_contrast,
3325 + mixbrush_options->texture_options->jitter,
3326 + paint_options->update_freq_options);
3330 + gimp_rgba_get_uchar (last_color,
3336 + /* Set the rounding error to mixbrush->error */
3337 + mixbrush->error.r = last_color->r - color_uchar[0] / 255.0;
3338 + mixbrush->error.g = last_color->g - color_uchar[1] / 255.0;
3339 + mixbrush->error.b = last_color->b - color_uchar[2] / 255.0;
3340 + mixbrush->error.a = last_color->a - color_uchar[3] / 255.0;
3342 + color_uchar[mixbrush->alpha_pix] = OPAQUE_OPACITY;
3344 + color_pixels (temp_buf_data (area), color_uchar,
3345 + area->width * area->height,
3348 + history->opacity *= last_color->a;
3350 + gimp_brush_core_paste_canvas (brush_core, drawable,
3351 + MIN (history->opacity, GIMP_OPACITY_OPAQUE),
3352 + gimp_context_get_flow (context),
3353 + gimp_context_get_opacity (context),
3354 + gimp_context_get_paint_mode (context),
3355 + gimp_paint_options_get_brush_mode (paint_options),
3356 + history->hardness,
3358 + paint_options->update_freq_options);
3361 + paint_core->cur_coords = orig_coords;
3362 + paint_core->last_coords = prev_coords;
3366 + last_color->a = 0.0;
3367 + gimp_rgba_set (&mixbrush->error, 0, 0, 0, 0);
3375 +coords_history_free (CoordsHistory *history, gpointer dummy)
3380 +static inline gboolean
3381 +get_canvas_color (GimpImage *image,
3382 + GimpDrawable *drawable,
3383 + GimpPaintCore *paint_core,
3386 + guint sample_size_limit,
3390 + GimpPickable *pickable;
3391 + GimpItem *item = GIMP_ITEM (drawable);
3392 + gint offset_x, offset_y;
3394 + offset_x = CLAMP (x, 0, gimp_item_width (item) - 1);
3395 + offset_y = CLAMP (y, 0, gimp_item_height (item) - 1);
3397 + if (merged && GIMP_IS_LAYER (drawable))
3399 + gint item_offset_x, item_offset_y;
3401 + gimp_item_offsets (item, &item_offset_x, &item_offset_y);
3402 + offset_x += item_offset_x;
3403 + offset_y += item_offset_y;
3405 + pickable = GIMP_PICKABLE (image->projection);
3406 + gimp_pickable_flush (pickable);
3409 + pickable = GIMP_PICKABLE (drawable);
3411 + return pick_up_avarage_color (pickable,
3412 + GIMP_BRUSH_CORE (paint_core),
3413 + offset_x, offset_y,
3414 + sample_size_limit,
3418 +static inline gboolean
3419 +pick_up_avarage_color (GimpPickable *pickable,
3420 + GimpBrushCore *brush_core,
3428 + gint width, height;
3430 + gimp_brush_scale_size (brush_core->brush, brush_core->scale, &width, &height);
3432 + result = gimp_pickable_pick_color (pickable,
3435 + CLAMP (MIN (width, height), 1, size_limit) / 2.0,
3443 +/* This function came from colortoalpha.c */
3446 +color_to_alpha (GimpRGB *src,
3447 + const GimpRGB *color)
3453 + if (color->r < 0.0001)
3455 + else if (src->r > color->r)
3456 + alpha.r = (src->r - color->r) / (1.0 - color->r);
3457 + else if (src->r < color->r)
3458 + alpha.r = (color->r - src->r) / color->r;
3459 + else alpha.r = 0.0;
3461 + if (color->g < 0.0001)
3463 + else if (src->g > color->g)
3464 + alpha.g = (src->g - color->g) / (1.0 - color->g);
3465 + else if (src->g < color->g)
3466 + alpha.g = (color->g - src->g) / (color->g);
3467 + else alpha.g = 0.0;
3469 + if (color->b < 0.0001)
3471 + else if (src->b > color->b)
3472 + alpha.b = (src->b - color->b) / (1.0 - color->b);
3473 + else if (src->b < color->b)
3474 + alpha.b = (color->b - src->b) / (color->b);
3475 + else alpha.b = 0.0;
3477 + if (alpha.r > alpha.g)
3479 + if (alpha.r > alpha.b)
3488 + else if (alpha.g > alpha.b)
3497 + if (src->a < 0.0001)
3500 + src->r = (src->r - color->r) / src->a + color->r;
3501 + src->g = (src->g - color->g) / src->a + color->g;
3502 + src->b = (src->b - color->b) / src->a + color->b;
3504 + src->a *= alpha.a;
3508 +composite_rgba (const GimpRGB *color1,
3510 + const GimpRGB *color2,
3513 + gboolean use_alt_alpha_op)
3515 + GimpRGB rgb1 = *color1, rgb2 = *color2;
3518 + rgb2.a = (1.0 - rgb1.a) * rgb2.a * op2;
3520 + if (rgb1.a == 0.0)
3522 + else if (rgb2.a > 0.0)
3524 + gdouble factor1 = rgb1.a / (rgb1.a + rgb2.a);
3525 + gdouble factor2 = 1.0 - factor1;
3527 + rgb1.r = rgb1.r * factor1 + rgb2.r * factor2;
3528 + rgb1.g = rgb1.g * factor1 + rgb2.g * factor2;
3529 + rgb1.b = rgb1.b * factor1 + rgb2.b * factor2;
3531 + } /* if (rgb1.a > 0.0 && rgb2.a == 0.0) rgb1 = rgb1; */
3533 + if (use_alt_alpha_op)
3535 + op1 = pow (op1, 1.35); /* workaround against opacity inflation */
3536 + op2 = pow (op2, 1.15);
3537 + rgb1.a = op1 + op2;
3541 + rgb1.a = op1 / rgb1.a; /* factor */
3542 + rgb1.a = color1->a * rgb1.a + color2->a * (1.0 - rgb1.a);
3543 + rgb1.a *= op1 + (1.0 - op1) * op2;
3549 + static gint count = 0;
3550 + //if ((count %= 3) == 0) {
3551 + g_printerr("1 = %f %f %f %f\n",color1->r,color1->g,color1->b,color1->a);
3552 + g_printerr("2 = %f %f %f %f\n",color2->r,color2->g,color2->b,color2->a);
3553 + g_printerr("r = %f %f %f %f\n",rgb1.r,rgb1.g,rgb1.b,rgb1.a);
3554 + g_printerr("o = %f %f\n",op1, op2);
3564 +blend_rgba (const GimpRGB *color1,
3566 + const GimpRGB *color2,
3569 + gboolean use_alt_alpha_op)
3571 + GimpRGB rgb1 = *color1, rgb2 = *color2, _result;
3573 + gdouble factor1, factor2;
3580 + else if (rgb2.a == 0)
3584 + _op3 = rgb1.a + rgb2.a;
3586 + factor1 = _op3 == 0 ? 0.5 : rgb1.a / _op3;
3587 + factor2 = 1.0 - factor1;
3589 + _result.r = rgb1.r * factor1 + rgb2.r * factor2;
3590 + _result.g = rgb1.g * factor1 + rgb2.g * factor2;
3591 + _result.b = rgb1.b * factor1 + rgb2.b * factor2;
3592 + _result.a = rgb1.a * factor1 + rgb2.a * factor2;
3595 + if (use_alt_alpha_op)
3597 + _result.a = op1 + op2;
3598 + if (_result.a != 0)
3600 + gdouble factor = op1 / _result.a;
3601 + _result.a = color1->a * factor + color2->a * (1.0 - factor);
3602 + //_result.a = MAX (_result.a, color2->a);
3607 + static gint count = 0;
3608 + //if ((count %= 3) == 1) {
3609 + g_printerr("1 = %f %f %f %f\n",color1->r,color1->g,color1->b,color1->a);
3610 + g_printerr("2 = %f %f %f %f\n",color2->r,color2->g,color2->b,color2->a);
3611 + g_printerr("r = %f %f %f %f\n",_result.r,_result.g,_result.b,_result.a);
3612 + g_printerr("o = %f %f\n",op1, op2);
3613 + g_printerr("o'= %f %f\n",_op1, _op2);
3614 + g_printerr("f = %f %f\n\n",factor1, factor2);
3620 + *result = _result;
3625 +static inline void calc_pressure_params (PressureParams *params,
3633 + params->in_min = in1;
3634 + params->in_factor = 0;
3636 + else if (in1 > in2)
3638 + params->in_min = in2;
3639 + params->in_factor = 1.0 / (in1 - in2);
3643 + params->in_min = in1;
3644 + params->in_factor = 1.0 / (in2 - in1);
3649 + params->out_min = out1;
3650 + params->out_factor = 0;
3652 + else if (out1 > out2)
3654 + params->out_min = out2;
3655 + params->out_factor = out1 - out2;
3656 + params->invert = TRUE;
3660 + params->out_min = out1;
3661 + params->out_factor = out2 - out1;
3662 + params->invert = FALSE;
3666 +static inline gdouble calc_pressure (gdouble value,
3667 + PressureParams *params)
3669 + g_return_val_if_fail (params != NULL, 1.0);
3671 + if (params->out_factor == 0)
3672 + return params->out_min;
3674 + if (params->in_factor != 0)
3676 + value = MIN (MAX (value - params->in_min, 0.0) * params->in_factor, 1.0);
3678 + if (params->invert)
3679 + value = 1.0 - value;
3682 + value = params->in_min;
3684 + return CLAMP (value * params->out_factor + params->out_min, 0.0, 1.0);
3688 +#ifndef GIMP_MIXBRUSH_COMPOSITE
3690 +paste_canvas (GimpPaintCore *core,
3691 + GimpDrawable *drawable,
3692 + GimpPattern *texture,
3693 + GimpRGB *paint_color,
3695 + GimpBrushApplicationMode hardness_mode,
3698 + gdouble fringe_contrast,
3701 + GimpUpdateFreqOptions *update_freq_options)
3703 + CompositeDabParam params;
3705 + GimpChannel *selection;
3706 + TempBuf *brush_mask;
3707 + TempBuf *canvas_buf;
3708 + gint c_x, c_y, c_w, c_h;
3709 + PixelRegion srcPR, maskPR, selPR;
3713 + selection = gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)));
3714 + /* don't apply the mask to itself and don't apply an empty mask */
3715 + if (GIMP_DRAWABLE (selection) == drawable || gimp_channel_is_empty (selection))
3718 + brush_mask = gimp_brush_core_get_brush_mask (GIMP_BRUSH_CORE (core),
3721 + canvas_buf = core->canvas_buf;
3723 + if (!brush_mask ||
3726 + (texture && !fringe && grain <= -1.0))
3729 + params.x = (gint) floor (core->cur_coords.x) - (brush_mask->width >> 1);
3730 + params.y = (gint) floor (core->cur_coords.y) - (brush_mask->height >> 1);
3732 + gimp_item_offsets (GIMP_ITEM (drawable), ¶ms.drawable_x, ¶ms.drawable_y);
3734 + c_x = canvas_buf->x;
3735 + c_y = canvas_buf->y;
3736 + c_w = canvas_buf->width;
3737 + c_h = canvas_buf->height;
3739 + /* set undo blocks */
3740 + gimp_paint_core_validate_undo_tiles (core, drawable,
3741 + c_x, c_y, c_w, c_h);
3745 + gint sel_x, sel_y, sel_x2, sel_y2;
3747 + gimp_item_offsets (GIMP_ITEM (selection), &sel_x, &sel_y);
3749 + sel_x -= params.drawable_x;
3750 + sel_y -= params.drawable_y;
3751 + sel_x2 = sel_x + gimp_item_width (GIMP_ITEM (selection));
3752 + sel_y2 = sel_y + gimp_item_height (GIMP_ITEM (selection));
3759 + off_x = sel_x - c_x;
3764 + off_y = sel_y - c_y;
3767 + c_w = MIN (x2, sel_x2) - c_x;
3768 + c_h = MIN (y2, sel_y2) - c_y;
3771 + /* init the pixel regions */
3772 + if (!off_x && (params.x < 0))
3773 + off_x = -params.x;
3774 + if (!off_y && (params.y < 0))
3775 + off_y = -params.y;
3777 + pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
3778 + c_x, c_y, c_w, c_h,
3781 + pixel_region_init_temp_buf (&maskPR, brush_mask,
3783 + brush_mask->width, brush_mask->height);
3785 + params.is_rgb = (srcPR.bytes > 2);
3786 + params.has_alpha = (srcPR.bytes == 2 || srcPR.bytes == 4);
3788 + /* configure the active channel array */
3789 + gimp_drawable_get_active_components (drawable, params.active_components);
3791 + /* setup the composite params */
3792 + params.paint_color = *paint_color;
3793 + params._paint_color.r = paint_color->r * 255.0;
3794 + if (params.is_rgb)
3796 + params._paint_color.g = paint_color->g * 255.0;
3797 + params._paint_color.b = paint_color->b * 255.0;
3799 + params.opacity = opacity;
3800 + params.adjusted_opacity = pow (opacity, 1.0 / 1.5);
3804 + params.grain = grain;
3805 + params.fringe = fringe;
3806 + params.fringe_contrast = fringe_contrast;
3807 + params.fringe_contrast_offset = (fringe_contrast - 1.0) * 0.5;
3808 + params.texture_jitter_x = g_random_int_range (-jitter, jitter + 1);
3809 + params.texture_jitter_y = g_random_int_range (-jitter, jitter + 1);
3811 + params.texture_data = temp_buf_data (texture->mask);
3812 + params.texture_bytes = texture->mask->bytes;
3813 + params.texture_width = texture->mask->width;
3814 + params.texture_height = texture->mask->height;
3815 + params.texture_stride = params.texture_width * params.texture_bytes;
3819 + pixel_region_init (&selPR,
3820 + gimp_drawable_get_tiles (GIMP_DRAWABLE (selection)),
3821 + c_x + params.drawable_x,
3822 + c_y + params.drawable_y,
3826 + pixel_regions_process_parallel ((PixelProcessorFunc) composite_textured_dab_selection,
3827 + ¶ms, 3, &srcPR, &maskPR, &selPR);
3830 + pixel_regions_process_parallel ((PixelProcessorFunc) composite_textured_dab,
3831 + ¶ms, 2, &srcPR, &maskPR);
3837 + pixel_region_init (&selPR,
3838 + gimp_drawable_get_tiles (GIMP_DRAWABLE (selection)),
3839 + c_x + params.drawable_x,
3840 + c_y + params.drawable_y,
3844 + pixel_regions_process_parallel ((PixelProcessorFunc) composite_dab_selection,
3845 + ¶ms, 3, &srcPR, &maskPR, &selPR);
3848 + pixel_regions_process_parallel ((PixelProcessorFunc) composite_dab,
3849 + ¶ms, 2, &srcPR, &maskPR);
3857 + /*g_file_set_contents ("r:\\out_canvas_buf_00.raw", temp_buf_data (canvas_buf),
3858 + canvas_buf->width * canvas_buf->height * canvas_buf->bytes,
3860 + g_file_set_contents ("r:\\out_brush_mask_00.raw", temp_buf_data (brush_mask),
3861 + brush_mask->width * brush_mask->height * brush_mask->bytes,
3864 + TileManager *tm = gimp_drawable_get_tiles (drawable);
3865 + guint stride = tile_manager_width (tm) * tile_manager_bpp (tm);
3866 + guint len = stride * tile_manager_height (tm);
3867 + guchar *buf = g_malloc(len);
3868 + read_pixel_data (tm, 0, 0,
3869 + tile_manager_width (tm) - 1,
3870 + tile_manager_height (tm) - 1,
3872 + g_file_set_contents ("r:\\out_drawable_00.raw", buf, len, NULL);
3877 + /* Update the undo extents */
3878 + core->x1 = MIN (core->x1, c_x);
3879 + core->y1 = MIN (core->y1, c_y);
3880 + core->x2 = MAX (core->x2, c_x + c_w) ;
3881 + core->y2 = MAX (core->y2, c_y + c_h) ;
3883 + /* Update the drawable */
3884 + if (update_freq_options->reduce_update_freq)
3890 + v = core->cur_coords.velocity - update_freq_options->v_threshold;
3891 + r = (core->canvas_buf->width + core->canvas_buf->height) / 2.0;
3893 + if (v > 0 && r > update_freq_options->s_threshold)
3897 + m = MIN (n * faster_pow (r / update_freq_options->s_threshold,
3898 + update_freq_options->gamma),
3899 + update_freq_options->max_n_dabs);
3900 + //g_printerr ("velo : %f / n : %f / threshold %d\n", core->cur_coords.velocity, n, (gint)(MIN (n, 25.0 - sqrt (r))));
3905 + if (core->update_count)
3907 + core->_x1 = MIN (core->_x1, c_x);
3908 + core->_y1 = MIN (core->_y1, c_y);
3909 + core->_x2 = MAX (core->_x2, c_x + c_w - 1);
3910 + core->_y2 = MAX (core->_y2, c_y + c_h - 1);
3915 + core->_x2 = c_x + c_w - 1;
3917 + core->_y2 = c_y + c_h - 1;
3920 + if (++core->update_count >= m)
3922 + core->update_count = 0;
3923 + core->updated = TRUE;
3925 + gimp_drawable_update (drawable,
3928 + core->_x2 - core->_x1 + 1,
3929 + core->_y2 - core->_y1 + 1);
3932 + core->updated = FALSE;
3935 + gimp_drawable_update (drawable, c_x, c_y, c_w, c_h);
3940 +composite_dab (CompositeDabParam *params,
3941 + PixelRegion *srcPR,
3942 + PixelRegion *maskPR)
3944 + gint width, height, bytes;
3946 + gint src_stride, mask_stride;
3947 + guchar *src_data, *_src_data;
3948 + guchar *mask_data, *_mask_data;
3952 + src_data = srcPR->data;
3953 + src_bytes = srcPR->bytes;
3954 + mask_data = maskPR->data;
3955 + width = maskPR->w;
3956 + height = maskPR->h;
3957 + bytes = maskPR->bytes;
3958 + src_stride = srcPR->rowstride;
3959 + mask_stride = maskPR->rowstride;
3961 + for (i = 0; i < height; i++)
3963 + _src_data = src_data;
3964 + _mask_data = mask_data;
3966 + for (j = 0; j < width; j++)
3968 + gdouble op, mask_op, paint_color_op, canvas_color_op, src_op;
3969 + gdouble factor1, factor2;
3970 + gdouble component;
3973 + if (j == c_w / 2 && i == c_h / 2)
3975 + g_printerr ( "\nPos : %d %d\n", j, i);
3976 + 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);
3977 + g_printerr ( "Canvas color: %d %d %d %d\n", _src_data[0], _src_data[1], _src_data[2], _src_data[3]);
3978 + g_printerr ( "Opacity : %f\n", params->opacity);
3981 + if (_mask_data[0])
3983 + mask_op = _mask_data[0] / 255.0;
3985 + if (params->has_alpha && params->active_components[src_bytes - 1])
3990 + src_op = _src_data[src_bytes - 1] / 255.0;
3992 + /* workaround against insufficiency of opacity */
3993 + /*if (params->paint_color->a > src_op)
3994 + op = pow (params->opacity, 1.0 / 1.5) * mask_op;*/
3995 + n = params->paint_color.a - src_op;
3996 + _n = (*(guint32 *) &n) >> 31;
3997 + op = (params->opacity * _n + params->adjusted_opacity * (1 - _n)) * mask_op;
3999 + component = (params->paint_color.a * op + src_op * (1.0 - op)) * 255.0/* + error.a*/;
4000 + _src_data[src_bytes - 1] = component + .5;
4001 + /*_error.a += component - _src_data[src_bytes - 1];*/
4006 + op = params->opacity * mask_op;
4007 + paint_color_op = params->paint_color.a * op;
4009 + if (paint_color_op > 0.0)
4011 + canvas_color_op = (1.0 - paint_color_op) * src_op;
4013 + factor1 = paint_color_op / (paint_color_op + canvas_color_op);
4014 + factor2 = 1.0 - factor1;
4016 + component = params->_paint_color.r * factor1 + _src_data[0] * factor2/* + error.r*/;
4017 + _src_data[0] = component + .5;
4018 + /*_error.r += component - _src_data[0];*/
4019 + if (params->is_rgb)
4021 + component = params->_paint_color.g * factor1 + _src_data[1] * factor2/* + error.g*/;
4022 + _src_data[1] = component + .5;
4023 + /*_error.g += component - _src_data[1];*/
4025 + component = params->_paint_color.b * factor1 + _src_data[2] * factor2/* + error.b*/;
4026 + _src_data[2] = component + .5;
4027 + /*_error.b += component - _src_data[2];*/
4032 + if (j == c_w / 2 && i == c_h / 2)
4034 + g_printerr ( "Result color: %d %d %d %d\n", _src_data[0], _src_data[1], _src_data[2], _src_data[3]);
4037 + _src_data += src_bytes;
4040 + src_data += src_stride;
4041 + mask_data += mask_stride;
4043 +} /* end of iteration */
4047 +composite_textured_dab (CompositeDabParam *params,
4048 + PixelRegion *srcPR,
4049 + PixelRegion *maskPR)
4051 + gint width, height, bytes;
4053 + gint src_stride, mask_stride;
4054 + guchar *src_data, *_src_data;
4055 + guchar *mask_data, *_mask_data;
4058 + gint texture_off_x, _texture_off_x, texture_off_y;
4059 + guchar *texture_row_data;
4061 + /* calc origin of texture buffer */
4062 + texture_off_x = params->drawable_x + params->x + maskPR->x + params->texture_jitter_x;
4063 + if (texture_off_x < 0)
4064 + texture_off_x = params->texture_width + (texture_off_x % params->texture_width);
4066 + texture_off_y = params->drawable_y + params->y + maskPR->y + params->texture_jitter_y;
4067 + if (texture_off_y < 0)
4068 + texture_off_y = params->texture_height + (texture_off_y % params->texture_height);
4070 + src_data = srcPR->data;
4071 + src_bytes = srcPR->bytes;
4072 + mask_data = maskPR->data;
4073 + width = maskPR->w;
4074 + height = maskPR->h;
4075 + bytes = maskPR->bytes;
4076 + src_stride = srcPR->rowstride;
4077 + mask_stride = maskPR->rowstride;
4079 +//g_printerr("<<");
4080 + for (i = 0; i < height; i++, texture_off_y++)
4082 + _src_data = src_data;
4083 + _mask_data = mask_data;
4085 + texture_off_y = texture_off_y % params->texture_height;
4086 + _texture_off_x = texture_off_x;
4087 + texture_row_data = params->texture_data + texture_off_y * params->texture_stride;
4089 + for (j = 0; j < width; j++, _texture_off_x++)
4091 + gdouble op, mask_op, paint_color_op, canvas_color_op, src_op;
4092 + gdouble texture_op;
4093 + gdouble factor1, factor2;
4094 + gdouble component;
4096 + _texture_off_x = _texture_off_x % params->texture_width;
4098 + texture_op = *(texture_row_data + _texture_off_x * params->texture_bytes) / 255.0;
4099 + texture_op = CLAMP (texture_op + params->grain, 0.0, 1.0);
4101 + if (_mask_data[0])
4103 + mask_op = _mask_data[0] / 255.0;
4106 + if (params->fringe)
4108 + texture_op = (texture_op * (1.0 - mask_op) + mask_op);
4109 + mask_op = CLAMP (mask_op * texture_op * params->fringe_contrast - params->fringe_contrast_offset, 0.0, 1.0);
4112 + mask_op *= texture_op;
4114 + if (params->fringe)
4115 + texture_op = (texture_op * (1.0 - mask_op) + mask_op);
4117 + if (params->fringe_contrast > 1.0)
4118 + mask_op = CLAMP (mask_op * texture_op * params->fringe_contrast - params->fringe_contrast_offset, 0.0, 1.0);
4120 + mask_op *= texture_op;
4125 + if (params->has_alpha && params->active_components[src_bytes - 1])
4130 + src_op = _src_data[src_bytes - 1] / 255.0;
4132 + /* workaround against insufficiency of opacity */
4133 + /*if (params->paint_color.a > src_op)
4134 + op = pow (params->opacity, 1.0 / 1.5) * mask_op;*/
4135 + n = params->paint_color.a - src_op;
4136 + _n = (*(guint32 *) &n) >> 31;
4137 + op = (params->opacity * _n + params->adjusted_opacity * (1 - _n)) * mask_op;
4139 + component = (params->paint_color.a * op + src_op * (1.0 - op)) * 255.0/* + error.a*/;
4140 + _src_data[src_bytes - 1] = component + .5;
4141 + /*_error.a += component - _src_data[src_bytes - 1];*/
4146 + op = params->opacity * mask_op;
4147 + paint_color_op = params->paint_color.a * op;
4149 + if (paint_color_op > 0.0)
4151 + canvas_color_op = (1.0 - paint_color_op) * src_op;
4153 + factor1 = paint_color_op / (paint_color_op + canvas_color_op);
4154 + factor2 = 1.0 - factor1;
4156 + component = params->_paint_color.r * factor1 + _src_data[0] * factor2/* + error.r*/;
4157 + _src_data[0] = component + .5;
4158 + /*_error.r += component - _src_data[0];*/
4159 + if (params->is_rgb)
4161 + component = params->_paint_color.g * factor1 + _src_data[1] * factor2/* + error.g*/;
4162 + _src_data[1] = component + .5;
4163 + /*_error.g += component - _src_data[1];*/
4165 + component = params->_paint_color.b * factor1 + _src_data[2] * factor2/* + error.b*/;
4166 + _src_data[2] = component + .5;
4167 + /*_error.b += component - _src_data[2];*/
4172 + _src_data += src_bytes;
4175 + src_data += src_stride;
4176 + mask_data += mask_stride;
4178 +//g_printerr(">>");
4179 +} /* end of iteration */
4181 +/* compositing with selection */
4183 +composite_dab_selection (CompositeDabParam *params,
4184 + PixelRegion *srcPR,
4185 + PixelRegion *maskPR,
4186 + PixelRegion *selPR)
4188 + gint width, height, bytes;
4190 + gint src_stride, mask_stride, sel_stride;
4191 + guchar *src_data, *_src_data;
4192 + guchar *mask_data, *_mask_data;
4193 + guchar *sel_data, *_sel_data;
4197 + src_data = srcPR->data;
4198 + src_bytes = srcPR->bytes;
4199 + mask_data = maskPR->data;
4200 + sel_data = selPR->data;
4201 + width = maskPR->w;
4202 + height = maskPR->h;
4203 + bytes = maskPR->bytes;
4204 + src_stride = srcPR->rowstride;
4205 + mask_stride = maskPR->rowstride;
4206 + sel_stride = selPR->rowstride;
4208 + for (i = 0; i < height; i++)
4210 + _src_data = src_data;
4211 + _mask_data = mask_data;
4212 + _sel_data = sel_data;
4214 + for (j = 0; j < width; j++)
4216 + gdouble op, mask_op, paint_color_op, canvas_color_op, src_op;
4217 + gdouble factor1, factor2;
4218 + gdouble component;
4220 + if (*_mask_data && *_sel_data)
4222 + mask_op = *_mask_data * *_sel_data / 65025.0;
4224 + if (params->has_alpha && params->active_components[src_bytes - 1])
4229 + src_op = _src_data[src_bytes - 1] / 255.0;
4231 + /* workaround against insufficiency of opacity */
4232 + /*if (params->paint_color->a > src_op)
4233 + op = pow (params->opacity, 1.0 / 1.5) * mask_op;*/
4234 + n = params->paint_color.a - src_op;
4235 + _n = (*(guint32 *) &n) >> 31;
4236 + op = (params->opacity * _n + params->adjusted_opacity * (1 - _n)) * mask_op;
4238 + component = (params->paint_color.a * op + src_op * (1.0 - op)) * 255.0/* + error.a*/;
4239 + _src_data[src_bytes - 1] = component + .5;
4240 + /*_error.a += component - _src_data[src_bytes - 1];*/
4245 + op = params->opacity * mask_op;
4246 + paint_color_op = params->paint_color.a * op;
4248 + if (paint_color_op > 0.0)
4250 + canvas_color_op = (1.0 - paint_color_op) * src_op;
4252 + factor1 = paint_color_op / (paint_color_op + canvas_color_op);
4253 + factor2 = 1.0 - factor1;
4255 + component = params->_paint_color.r * factor1 + _src_data[0] * factor2/* + error.r*/;
4256 + _src_data[0] = component + .5;
4257 + /*_error.r += component - _src_data[0];*/
4258 + if (params->is_rgb)
4260 + component = params->_paint_color.g * factor1 + _src_data[1] * factor2/* + error.g*/;
4261 + _src_data[1] = component + .5;
4262 + /*_error.g += component - _src_data[1];*/
4264 + component = params->_paint_color.b * factor1 + _src_data[2] * factor2/* + error.b*/;
4265 + _src_data[2] = component + .5;
4266 + /*_error.b += component - _src_data[2];*/
4270 + _src_data += src_bytes;
4274 + src_data += src_stride;
4275 + mask_data += mask_stride;
4276 + sel_data += sel_stride;
4278 +} /* end of iteration */
4281 +composite_textured_dab_selection (CompositeDabParam *params,
4282 + PixelRegion *srcPR,
4283 + PixelRegion *maskPR,
4284 + PixelRegion *selPR)
4286 + gint width, height, bytes;
4288 + gint src_stride, mask_stride, sel_stride;
4289 + guchar *src_data, *_src_data;
4290 + guchar *mask_data, *_mask_data;
4291 + guchar *sel_data, *_sel_data;
4294 + gint texture_off_x, _texture_off_x, texture_off_y;
4295 + guchar *texture_row_data;
4297 + /* calc origin of texture buffer */
4298 + texture_off_x = params->drawable_x + params->x + maskPR->x + params->texture_jitter_x;
4299 + if (texture_off_x < 0)
4300 + texture_off_x = params->texture_width + (texture_off_x % params->texture_width);
4302 + texture_off_y = params->drawable_y + params->y + maskPR->y + params->texture_jitter_y;
4303 + if (texture_off_y < 0)
4304 + texture_off_y = params->texture_height + (texture_off_y % params->texture_height);
4306 + src_data = srcPR->data;
4307 + src_bytes = srcPR->bytes;
4308 + mask_data = maskPR->data;
4309 + sel_data = selPR->data;
4310 + width = maskPR->w;
4311 + height = maskPR->h;
4312 + bytes = maskPR->bytes;
4313 + src_stride = srcPR->rowstride;
4314 + mask_stride = maskPR->rowstride;
4315 + sel_stride = selPR->rowstride;
4317 + for (i = 0; i < height; i++, texture_off_y++)
4319 + _src_data = src_data;
4320 + _mask_data = mask_data;
4321 + _sel_data = sel_data;
4323 + texture_off_y = texture_off_y % params->texture_height;
4324 + _texture_off_x = texture_off_x;
4325 + texture_row_data = params->texture_data + texture_off_y * params->texture_stride;
4327 + for (j = 0; j < width; j++, _texture_off_x++)
4329 + gdouble op, mask_op, paint_color_op, canvas_color_op, src_op;
4330 + gdouble texture_op;
4331 + gdouble factor1, factor2;
4332 + gdouble component;
4334 + _texture_off_x = _texture_off_x % params->texture_width;
4336 + texture_op = *(texture_row_data + _texture_off_x * params->texture_bytes) / 255.0;
4337 + texture_op = CLAMP (texture_op + params->grain, 0.0, 1.0);
4339 + if (*_mask_data && *_sel_data)
4341 + mask_op = *_mask_data * *_sel_data / 65025.0;
4343 + if (params->fringe)
4344 + texture_op = (texture_op * (1.0 - mask_op) + mask_op);
4346 + if (params->fringe_contrast > 1.0)
4347 + mask_op = CLAMP (mask_op * texture_op * params->fringe_contrast - params->fringe_contrast_offset, 0.0, 1.0);
4349 + mask_op *= texture_op;
4353 + if (params->has_alpha && params->active_components[src_bytes - 1])
4358 + src_op = _src_data[src_bytes - 1] / 255.0;
4360 + /* workaround against insufficiency of opacity */
4361 + /*if (params->paint_color.a > src_op)
4362 + op = pow (params->opacity, 1.0 / 1.5) * mask_op;*/
4363 + n = params->paint_color.a - src_op;
4364 + _n = (*(guint32 *) &n) >> 31;
4365 + op = (params->opacity * _n + params->adjusted_opacity * (1 - _n)) * mask_op;
4367 + component = (params->paint_color.a * op + src_op * (1.0 - op)) * 255.0/* + error.a*/;
4368 + _src_data[src_bytes - 1] = component + .5;
4369 + /*_error.a += component - _src_data[src_bytes - 1];*/
4374 + op = params->opacity * mask_op;
4375 + paint_color_op = params->paint_color.a * op;
4377 + if (paint_color_op > 0.0)
4379 + canvas_color_op = (1.0 - paint_color_op) * src_op;
4381 + factor1 = paint_color_op / (paint_color_op + canvas_color_op);
4382 + factor2 = 1.0 - factor1;
4384 + component = params->_paint_color.r * factor1 + _src_data[0] * factor2/* + error.r*/;
4385 + _src_data[0] = component + .5;
4386 + /*_error.r += component - _src_data[0];*/
4387 + if (params->is_rgb)
4389 + component = params->_paint_color.g * factor1 + _src_data[1] * factor2/* + error.g*/;
4390 + _src_data[1] = component + .5;
4391 + /*_error.g += component - _src_data[1];*/
4393 + component = params->_paint_color.b * factor1 + _src_data[2] * factor2/* + error.b*/;
4394 + _src_data[2] = component + .5;
4395 + /*_error.b += component - _src_data[2];*/
4400 + _src_data += src_bytes;
4404 + src_data += src_stride;
4405 + mask_data += mask_stride;
4406 + sel_data += sel_stride;
4408 +} /* end of iteration */
4410 --- gimp-2.6.6/app/paint/gimpmixbrush.h 1970-01-01 09:00:00 +0900
4411 +++ gimp-painter--2.6.6/app/paint/gimpmixbrush.h 2009-03-17 10:42:37 +0900
4413 +/* GIMP - The GNU Image Manipulation Program
4414 + * Copyright (C) 1995 Spencer Kimball and Peter Mattis
4416 + * This program is free software; you can redistribute it and/or modify
4417 + * it under the terms of the GNU General Public License as published by
4418 + * the Free Software Foundation; either version 2 of the License, or
4419 + * (at your option) any later version.
4421 + * This program is distributed in the hope that it will be useful,
4422 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
4423 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4424 + * GNU General Public License for more details.
4426 + * You should have received a copy of the GNU General Public License
4427 + * along with this program; if not, write to the Free Software
4428 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
4431 +#ifndef __GIMP_MIXBRUSH_H__
4432 +#define __GIMP_MIXBRUSH_H__
4435 +#include "gimppaintbrush.h"
4438 +/* Pressure control params */
4440 +typedef struct _PressureParams
4443 + gdouble in_factor;
4445 + gdouble out_factor;
4450 +#define GIMP_TYPE_MIXBRUSH (gimp_mixbrush_get_type ())
4451 +#define GIMP_MIXBRUSH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_MIXBRUSH, GimpMixbrush))
4452 +#define GIMP_MIXBRUSH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_MIXBRUSH, GimpMixbrushClass))
4453 +#define GIMP_IS_MIXBRUSH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_MIXBRUSH))
4454 +#define GIMP_IS_MIXBRUSH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_MIXBRUSH))
4455 +#define GIMP_MIXBRUSH_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_MIXBRUSH, GimpMixbrushClass))
4458 +typedef struct _GimpMixbrushClass GimpMixbrushClass;
4460 +struct _GimpMixbrush
4462 + GimpPaintbrush parent_instance;
4464 + GimpDrawable *drawable;
4465 + GimpPaintOptions *paint_options;
4467 + PressureParams pr_texture_grain;
4468 + PressureParams pr_main_density;
4469 + PressureParams pr_main_rate;
4470 + PressureParams pr_canvas_density;
4471 + PressureParams pr_canvas_rate;
4473 + GimpRGB paint_color;
4474 + GimpRGB last_color;
4475 + GimpRGB hidden_color;
4478 + gboolean use_alt_alpha_op;
4481 +struct _GimpMixbrushClass
4483 + GimpPaintbrushClass parent_class;
4487 +void gimp_mixbrush_register (Gimp *gimp,
4488 + GimpPaintRegisterCallback callback);
4490 +GType gimp_mixbrush_get_type (void) G_GNUC_CONST;
4493 +#endif /* __GIMP_MIXBRUSH_H__ */
4494 --- gimp-2.6.6/app/paint/gimpmixbrushoptions.c 1970-01-01 09:00:00 +0900
4495 +++ gimp-painter--2.6.6/app/paint/gimpmixbrushoptions.c 2009-03-17 10:42:37 +0900
4497 +/* GIMP - The GNU Image Manipulation Program
4498 + * Copyright (C) 1995 Spencer Kimball and Peter Mattis
4500 + * This program is free software; you can redistribute it and/or modify
4501 + * it under the terms of the GNU General Public License as published by
4502 + * the Free Software Foundation; either version 2 of the License, or
4503 + * (at your option) any later version.
4505 + * This program is distributed in the hope that it will be useful,
4506 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
4507 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4508 + * GNU General Public License for more details.
4510 + * You should have received a copy of the GNU General Public License
4511 + * along with this program; if not, write to the Free Software
4512 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
4515 +#include "config.h"
4517 +#include <glib-object.h>
4519 +#include "libgimpconfig/gimpconfig.h"
4521 +#include "paint-types.h"
4523 +#include "gimppaintoptions.h"
4524 +#include "gimpmixbrushoptions.h"
4527 +#define MIXBRUSH_DEFAULT_USE_TEXTURE FALSE
4528 +#define MIXBRUSH_DEFAULT_TEXTURE_FRINGE FALSE
4529 +#define MIXBRUSH_DEFAULT_TEXTURE_FRINGE_CONTRAST 1.0
4530 +#define MIXBRUSH_DEFAULT_TEXTURE_GRAIN 0.0
4531 +#define MIXBRUSH_DEFAULT_TEXTURE_JITTER 0
4533 +#define MIXBRUSH_DEFAULT_MAIN_COLOR_DENSITY 0.5
4534 +#define MIXBRUSH_DEFAULT_MAIN_COLOR_RATE 0.2
4535 +#define MIXBRUSH_DEFAULT_CANVAS_COLOR_DENSITY 1.0
4536 +#define MIXBRUSH_DEFAULT_CANVAS_COLOR_RATE 1.0
4537 +#define MIXBRUSH_DEFAULT_PRESSURE_IN1 0.0
4538 +#define MIXBRUSH_DEFAULT_PRESSURE_IN2 1.0
4539 +#define MIXBRUSH_DEFAULT_PRESSURE_OUT1 0.5
4540 +#define MIXBRUSH_DEFAULT_PRESSURE_OUT2 1.0
4541 +#define MIXBRUSH_DEFAULT_CANVAS_PRESSURE_OUT1 1.0
4542 +#define MIXBRUSH_DEFAULT_CANVAS_PRESSURE_OUT2 1.0
4543 +#define MIXBRUSH_DEFAULT_DRYOUT 0.0
4544 +#define MIXBRUSH_DEFAULT_DELAY 0
4545 +#define MIXBRUSH_DEFAULT_TAIL FALSE
4546 +#define MIXBRUSH_DEFAULT_MERGED FALSE
4547 +#define MIXBRUSH_DEFAULT_PIGMENT TRUE
4548 +#define MIXBRUSH_DEFAULT_HIDDEN_COLOR GIMP_HIDDEN_COLOR_NORMAL
4549 +#define MIXBRUSH_DEFAULT_REMOVE_COLOR FALSE
4550 +#define MIXBRUSH_DEFAULT_SAMPLE_SIZE_LIMIT 1
4551 +#define MIXBRUSH_DEFAULT_ALPHA_CHANNEL_MIXING TRUE
4552 +#define MIXBRUSH_DEFAULT_APPLICATION_MODE GIMP_PAINT_INCREMENTAL
4559 + PROP_TEXTURE_FRINGE,
4560 + PROP_TEXTURE_FRINGE_CONTRAST,
4561 + PROP_TEXTURE_GRAIN,
4562 + PROP_TEXTURE_GRAIN_PRESSURE_IN1,
4563 + PROP_TEXTURE_GRAIN_PRESSURE_IN2,
4564 + PROP_TEXTURE_GRAIN_PRESSURE_OUT1,
4565 + PROP_TEXTURE_GRAIN_PRESSURE_OUT2,
4566 + PROP_TEXTURE_JITTER,
4568 + PROP_MAIN_COLOR_DENSITY,
4569 + PROP_MAIN_COLOR_RATE,
4570 + PROP_CANVAS_COLOR_DENSITY,
4571 + PROP_CANVAS_COLOR_RATE,
4572 + PROP_MAIN_COLOR_DENSITY_PRESSURE_IN1,
4573 + PROP_MAIN_COLOR_DENSITY_PRESSURE_IN2,
4574 + PROP_MAIN_COLOR_DENSITY_PRESSURE_OUT1,
4575 + PROP_MAIN_COLOR_DENSITY_PRESSURE_OUT2,
4576 + PROP_MAIN_COLOR_PRESSURE_IN1,
4577 + PROP_MAIN_COLOR_PRESSURE_IN2,
4578 + PROP_MAIN_COLOR_PRESSURE_OUT1,
4579 + PROP_MAIN_COLOR_PRESSURE_OUT2,
4580 + PROP_CANVAS_COLOR_DENSITY_PRESSURE_IN1,
4581 + PROP_CANVAS_COLOR_DENSITY_PRESSURE_IN2,
4582 + PROP_CANVAS_COLOR_DENSITY_PRESSURE_OUT1,
4583 + PROP_CANVAS_COLOR_DENSITY_PRESSURE_OUT2,
4584 + PROP_CANVAS_COLOR_PRESSURE_IN1,
4585 + PROP_CANVAS_COLOR_PRESSURE_IN2,
4586 + PROP_CANVAS_COLOR_PRESSURE_OUT1,
4587 + PROP_CANVAS_COLOR_PRESSURE_OUT2,
4593 + PROP_HIDDEN_COLOR,
4594 + PROP_REMOVE_COLOR,
4595 + PROP_SAMPLE_SIZE_LIMIT,
4596 + PROP_ALPHA_CHANNEL_MIXING,
4597 + PROP_APPLICATION_MODE
4601 +static void gimp_mixbrush_options_finalize (GObject *object);
4602 +static void gimp_mixbrush_options_set_property (GObject *object,
4603 + guint property_id,
4604 + const GValue *value,
4605 + GParamSpec *pspec);
4606 +static void gimp_mixbrush_options_get_property (GObject *object,
4607 + guint property_id,
4609 + GParamSpec *pspec);
4612 +G_DEFINE_TYPE (GimpMixbrushOptions, gimp_mixbrush_options,
4613 + GIMP_TYPE_PAINT_OPTIONS)
4615 +#define parent_class gimp_mixbrush_options_parent_class
4619 +gimp_mixbrush_options_class_init (GimpMixbrushOptionsClass *klass)
4621 + GObjectClass *object_class = G_OBJECT_CLASS (klass);
4623 + object_class->finalize = gimp_mixbrush_options_finalize;
4624 + object_class->set_property = gimp_mixbrush_options_set_property;
4625 + object_class->get_property = gimp_mixbrush_options_get_property;
4627 + GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_USE_TEXTURE,
4628 + "use-texture", NULL,
4629 + MIXBRUSH_DEFAULT_USE_TEXTURE,
4630 + GIMP_PARAM_STATIC_STRINGS);
4632 + GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_TEXTURE_FRINGE,
4633 + "texture-fringe", NULL,
4634 + MIXBRUSH_DEFAULT_TEXTURE_FRINGE,
4635 + GIMP_PARAM_STATIC_STRINGS);
4637 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_TEXTURE_FRINGE_CONTRAST,
4638 + "texture-fringe-contrast", NULL,
4639 + 1.0, 10.0, MIXBRUSH_DEFAULT_TEXTURE_FRINGE_CONTRAST,
4640 + GIMP_PARAM_STATIC_STRINGS);
4642 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_TEXTURE_GRAIN,
4643 + "texture-grain", NULL,
4644 + -1.0, 1.0, MIXBRUSH_DEFAULT_TEXTURE_GRAIN,
4645 + GIMP_PARAM_STATIC_STRINGS);
4647 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_TEXTURE_GRAIN_PRESSURE_IN1,
4648 + "texture-grain-pressure-in1", NULL,
4649 + 0.0, 1.0, MIXBRUSH_DEFAULT_PRESSURE_IN1,
4650 + GIMP_PARAM_STATIC_STRINGS);
4652 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_TEXTURE_GRAIN_PRESSURE_IN2,
4653 + "texture-grain-pressure-in2", NULL,
4654 + 0.0, 1.0, MIXBRUSH_DEFAULT_PRESSURE_IN2,
4655 + GIMP_PARAM_STATIC_STRINGS);
4657 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_TEXTURE_GRAIN_PRESSURE_OUT1,
4658 + "texture-grain-pressure-out1", NULL,
4659 + 0.0, 1.0, MIXBRUSH_DEFAULT_PRESSURE_OUT1,
4660 + GIMP_PARAM_STATIC_STRINGS);
4662 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_TEXTURE_GRAIN_PRESSURE_OUT2,
4663 + "texture-grain-pressure-out2", NULL,
4664 + 0.0, 1.0, MIXBRUSH_DEFAULT_PRESSURE_OUT2,
4665 + GIMP_PARAM_STATIC_STRINGS);
4667 + GIMP_CONFIG_INSTALL_PROP_UINT (object_class, PROP_TEXTURE_JITTER,
4668 + "texture-jitter", NULL,
4669 + 0, 1000, MIXBRUSH_DEFAULT_TEXTURE_JITTER,
4670 + GIMP_PARAM_STATIC_STRINGS);
4672 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_MAIN_COLOR_DENSITY,
4673 + "main-color-density", NULL,
4674 + 0.0, 1.0, MIXBRUSH_DEFAULT_MAIN_COLOR_DENSITY,
4675 + GIMP_PARAM_STATIC_STRINGS);
4677 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_MAIN_COLOR_RATE,
4678 + "main-color-rate", NULL,
4679 + 0.0, 1.0, MIXBRUSH_DEFAULT_MAIN_COLOR_RATE,
4680 + GIMP_PARAM_STATIC_STRINGS);
4682 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_MAIN_COLOR_DENSITY_PRESSURE_IN1,
4683 + "main-color-density-pressure-in1", NULL,
4684 + 0.0, 1.0, MIXBRUSH_DEFAULT_PRESSURE_IN1,
4685 + GIMP_PARAM_STATIC_STRINGS);
4687 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_MAIN_COLOR_DENSITY_PRESSURE_IN2,
4688 + "main-color-density-pressure-in2", NULL,
4689 + 0.0, 1.0, MIXBRUSH_DEFAULT_PRESSURE_IN2,
4690 + GIMP_PARAM_STATIC_STRINGS);
4692 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_MAIN_COLOR_DENSITY_PRESSURE_OUT1,
4693 + "main-color-density-pressure-out1", NULL,
4694 + 0.0, 1.0, MIXBRUSH_DEFAULT_PRESSURE_OUT1,
4695 + GIMP_PARAM_STATIC_STRINGS);
4697 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_MAIN_COLOR_DENSITY_PRESSURE_OUT2,
4698 + "main-color-density-pressure-out2", NULL,
4699 + 0.0, 1.0, MIXBRUSH_DEFAULT_PRESSURE_OUT2,
4700 + GIMP_PARAM_STATIC_STRINGS);
4702 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_MAIN_COLOR_PRESSURE_IN1,
4703 + "main-color-pressure-in1", NULL,
4704 + 0.0, 1.0, MIXBRUSH_DEFAULT_PRESSURE_IN1,
4705 + GIMP_PARAM_STATIC_STRINGS);
4707 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_MAIN_COLOR_PRESSURE_IN2,
4708 + "main-color-pressure-in2", NULL,
4709 + 0.0, 1.0, MIXBRUSH_DEFAULT_PRESSURE_IN2,
4710 + GIMP_PARAM_STATIC_STRINGS);
4712 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_MAIN_COLOR_PRESSURE_OUT1,
4713 + "main-color-pressure-out1", NULL,
4714 + 0.0, 1.0, MIXBRUSH_DEFAULT_PRESSURE_OUT1,
4715 + GIMP_PARAM_STATIC_STRINGS);
4717 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_MAIN_COLOR_PRESSURE_OUT2,
4718 + "main-color-pressure-out2", NULL,
4719 + 0.0, 1.0, MIXBRUSH_DEFAULT_PRESSURE_OUT2,
4720 + GIMP_PARAM_STATIC_STRINGS);
4722 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_CANVAS_COLOR_DENSITY,
4723 + "canvas-color-density", NULL,
4724 + 0.0, 1.0, MIXBRUSH_DEFAULT_CANVAS_COLOR_DENSITY,
4725 + GIMP_PARAM_STATIC_STRINGS);
4727 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_CANVAS_COLOR_RATE,
4728 + "canvas-color-rate", NULL,
4729 + 0.0, 1.0, MIXBRUSH_DEFAULT_CANVAS_COLOR_RATE,
4730 + GIMP_PARAM_STATIC_STRINGS);
4732 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_CANVAS_COLOR_DENSITY_PRESSURE_IN1,
4733 + "canvas-color-density-pressure-in1", NULL,
4734 + 0.0, 1.0, MIXBRUSH_DEFAULT_PRESSURE_IN1,
4735 + GIMP_PARAM_STATIC_STRINGS);
4737 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_CANVAS_COLOR_DENSITY_PRESSURE_IN2,
4738 + "canvas-color-density-pressure-in2", NULL,
4739 + 0.0, 1.0, MIXBRUSH_DEFAULT_PRESSURE_IN2,
4740 + GIMP_PARAM_STATIC_STRINGS);
4742 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_CANVAS_COLOR_DENSITY_PRESSURE_OUT1,
4743 + "canvas-color-density-pressure-out1", NULL,
4744 + 0.0, 1.0, MIXBRUSH_DEFAULT_CANVAS_PRESSURE_OUT1,
4745 + GIMP_PARAM_STATIC_STRINGS);
4747 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_CANVAS_COLOR_DENSITY_PRESSURE_OUT2,
4748 + "canvas-color-density-pressure-out2", NULL,
4749 + 0.0, 1.0, MIXBRUSH_DEFAULT_CANVAS_PRESSURE_OUT2,
4750 + GIMP_PARAM_STATIC_STRINGS);
4752 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_CANVAS_COLOR_PRESSURE_IN1,
4753 + "canvas-color-pressure-in1", NULL,
4754 + 0.0, 1.0, MIXBRUSH_DEFAULT_PRESSURE_IN1,
4755 + GIMP_PARAM_STATIC_STRINGS);
4757 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_CANVAS_COLOR_PRESSURE_IN2,
4758 + "canvas-color-pressure-in2", NULL,
4759 + 0.0, 1.0, MIXBRUSH_DEFAULT_PRESSURE_IN2,
4760 + GIMP_PARAM_STATIC_STRINGS);
4762 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_CANVAS_COLOR_PRESSURE_OUT1,
4763 + "canvas-color-pressure-out1", NULL,
4764 + 0.0, 1.0, MIXBRUSH_DEFAULT_CANVAS_PRESSURE_OUT1,
4765 + GIMP_PARAM_STATIC_STRINGS);
4767 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_CANVAS_COLOR_PRESSURE_OUT2,
4768 + "canvas-color-pressure-out2", NULL,
4769 + 0.0, 1.0, MIXBRUSH_DEFAULT_CANVAS_PRESSURE_OUT2,
4770 + GIMP_PARAM_STATIC_STRINGS);
4772 + GIMP_CONFIG_INSTALL_PROP_UINT (object_class, PROP_DRYOUT,
4774 + 0, 10000, MIXBRUSH_DEFAULT_DRYOUT,
4775 + GIMP_PARAM_STATIC_STRINGS);
4777 + GIMP_CONFIG_INSTALL_PROP_UINT (object_class, PROP_DELAY,
4779 + 0, 10, MIXBRUSH_DEFAULT_DELAY,
4780 + GIMP_PARAM_STATIC_STRINGS);
4782 + GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_TAIL,
4784 + MIXBRUSH_DEFAULT_TAIL,
4785 + GIMP_PARAM_STATIC_STRINGS);
4787 + GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_MERGED,
4789 + MIXBRUSH_DEFAULT_MERGED,
4790 + GIMP_PARAM_STATIC_STRINGS);
4792 + GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_PIGMENT,
4794 + MIXBRUSH_DEFAULT_PIGMENT,
4795 + GIMP_PARAM_STATIC_STRINGS);
4797 + GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_HIDDEN_COLOR,
4798 + "hidden-color", NULL,
4799 + GIMP_TYPE_HIDDEN_COLOR,
4800 + MIXBRUSH_DEFAULT_HIDDEN_COLOR,
4801 + GIMP_PARAM_STATIC_STRINGS);
4803 + GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_REMOVE_COLOR,
4804 + "remove-color", NULL,
4805 + MIXBRUSH_DEFAULT_REMOVE_COLOR,
4806 + GIMP_PARAM_STATIC_STRINGS);
4808 + GIMP_CONFIG_INSTALL_PROP_UINT (object_class, PROP_SAMPLE_SIZE_LIMIT,
4809 + "sample-size-limit", NULL,
4810 + 1, 50, MIXBRUSH_DEFAULT_SAMPLE_SIZE_LIMIT,
4811 + GIMP_PARAM_STATIC_STRINGS);
4813 + GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_ALPHA_CHANNEL_MIXING,
4814 + "alpha-channel-mixing", NULL,
4815 + MIXBRUSH_DEFAULT_ALPHA_CHANNEL_MIXING,
4816 + GIMP_PARAM_STATIC_STRINGS);
4818 + GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_APPLICATION_MODE,
4819 + "mixbrush-application-mode", NULL,
4820 + GIMP_TYPE_PAINT_APPLICATION_MODE,
4821 + MIXBRUSH_DEFAULT_APPLICATION_MODE,
4822 + GIMP_PARAM_STATIC_STRINGS);
4824 + g_object_class_override_property (object_class, PROP_APPLICATION_MODE, "application-mode");
4828 +gimp_mixbrush_options_init (GimpMixbrushOptions *options)
4830 + options->texture_options = g_slice_new0 (GimpTextureOptions);
4834 +gimp_mixbrush_options_finalize (GObject *object)
4836 + GimpMixbrushOptions *options = GIMP_MIXBRUSH_OPTIONS (object);
4838 + g_slice_free (GimpTextureOptions, options->texture_options);
4840 + G_OBJECT_CLASS (parent_class)->finalize (object);
4844 +gimp_mixbrush_options_set_property (GObject *object,
4845 + guint property_id,
4846 + const GValue *value,
4847 + GParamSpec *pspec)
4849 + GimpMixbrushOptions *options = GIMP_MIXBRUSH_OPTIONS (object);
4850 + GimpTextureOptions *texture_options = options->texture_options;
4852 + switch (property_id)
4854 + case PROP_USE_TEXTURE:
4855 + texture_options->use_texture = g_value_get_boolean (value);
4857 + case PROP_TEXTURE_FRINGE:
4858 + texture_options->fringe = g_value_get_boolean (value);
4860 + case PROP_TEXTURE_FRINGE_CONTRAST:
4861 + texture_options->fringe_contrast = g_value_get_double (value);
4863 + case PROP_TEXTURE_GRAIN:
4864 + texture_options->grain = g_value_get_double (value);
4866 + case PROP_TEXTURE_GRAIN_PRESSURE_IN1:
4867 + texture_options->grain_pressure_in1 = g_value_get_double (value);
4869 + case PROP_TEXTURE_GRAIN_PRESSURE_IN2:
4870 + texture_options->grain_pressure_in2 = g_value_get_double (value);
4872 + case PROP_TEXTURE_GRAIN_PRESSURE_OUT1:
4873 + texture_options->grain_pressure_out1 = g_value_get_double (value);
4875 + case PROP_TEXTURE_GRAIN_PRESSURE_OUT2:
4876 + texture_options->grain_pressure_out2 = g_value_get_double (value);
4878 + case PROP_TEXTURE_JITTER:
4879 + texture_options->jitter = g_value_get_uint (value);
4881 + case PROP_MAIN_COLOR_DENSITY:
4882 + options->main_color_density = g_value_get_double (value);
4884 + case PROP_MAIN_COLOR_RATE:
4885 + options->main_color_rate = g_value_get_double (value);
4887 + case PROP_MAIN_COLOR_DENSITY_PRESSURE_IN1:
4888 + options->main_color_density_pressure_in1 = g_value_get_double (value);
4890 + case PROP_MAIN_COLOR_DENSITY_PRESSURE_IN2:
4891 + options->main_color_density_pressure_in2 = g_value_get_double (value);
4893 + case PROP_MAIN_COLOR_DENSITY_PRESSURE_OUT1:
4894 + options->main_color_density_pressure_out1 = g_value_get_double (value);
4896 + case PROP_MAIN_COLOR_DENSITY_PRESSURE_OUT2:
4897 + options->main_color_density_pressure_out2 = g_value_get_double (value);
4899 + case PROP_MAIN_COLOR_PRESSURE_IN1:
4900 + options->main_color_pressure_in1 = g_value_get_double (value);
4902 + case PROP_MAIN_COLOR_PRESSURE_IN2:
4903 + options->main_color_pressure_in2 = g_value_get_double (value);
4905 + case PROP_MAIN_COLOR_PRESSURE_OUT1:
4906 + options->main_color_pressure_out1 = g_value_get_double (value);
4908 + case PROP_MAIN_COLOR_PRESSURE_OUT2:
4909 + options->main_color_pressure_out2 = g_value_get_double (value);
4911 + case PROP_CANVAS_COLOR_DENSITY:
4912 + options->canvas_color_density = g_value_get_double (value);
4914 + case PROP_CANVAS_COLOR_RATE:
4915 + options->canvas_color_rate = g_value_get_double (value);
4917 + case PROP_CANVAS_COLOR_DENSITY_PRESSURE_IN1:
4918 + options->canvas_color_density_pressure_in1 = g_value_get_double (value);
4920 + case PROP_CANVAS_COLOR_DENSITY_PRESSURE_IN2:
4921 + options->canvas_color_density_pressure_in2 = g_value_get_double (value);
4923 + case PROP_CANVAS_COLOR_DENSITY_PRESSURE_OUT1:
4924 + options->canvas_color_density_pressure_out1 = g_value_get_double (value);
4926 + case PROP_CANVAS_COLOR_DENSITY_PRESSURE_OUT2:
4927 + options->canvas_color_density_pressure_out2 = g_value_get_double (value);
4929 + case PROP_CANVAS_COLOR_PRESSURE_IN1:
4930 + options->canvas_color_pressure_in1 = g_value_get_double (value);
4932 + case PROP_CANVAS_COLOR_PRESSURE_IN2:
4933 + options->canvas_color_pressure_in2 = g_value_get_double (value);
4935 + case PROP_CANVAS_COLOR_PRESSURE_OUT1:
4936 + options->canvas_color_pressure_out1 = g_value_get_double (value);
4938 + case PROP_CANVAS_COLOR_PRESSURE_OUT2:
4939 + options->canvas_color_pressure_out2 = g_value_get_double (value);
4942 + options->dryout = g_value_get_uint (value);
4945 + options->delay = g_value_get_uint (value);
4948 + options->tail = g_value_get_boolean (value);
4951 + options->merged = g_value_get_boolean (value);
4953 + case PROP_PIGMENT:
4954 + options->pigment = g_value_get_boolean (value);
4956 + case PROP_HIDDEN_COLOR:
4957 + options->hidden_color = g_value_get_enum (value);
4959 + case PROP_REMOVE_COLOR:
4960 + options->remove_color = g_value_get_boolean (value);
4962 + case PROP_SAMPLE_SIZE_LIMIT:
4963 + options->sample_size_limit = g_value_get_uint (value);
4965 + case PROP_ALPHA_CHANNEL_MIXING:
4966 + options->alpha_channel_mixing = g_value_get_boolean (value);
4968 + case PROP_APPLICATION_MODE:
4969 + GIMP_PAINT_OPTIONS (options)->application_mode = g_value_get_enum (value);
4972 + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
4978 +gimp_mixbrush_options_get_property (GObject *object,
4979 + guint property_id,
4981 + GParamSpec *pspec)
4983 + GimpMixbrushOptions *options = GIMP_MIXBRUSH_OPTIONS (object);
4984 + GimpTextureOptions *texture_options = options->texture_options;
4986 + switch (property_id)
4988 + case PROP_USE_TEXTURE:
4989 + g_value_set_boolean (value, texture_options->use_texture);
4991 + case PROP_TEXTURE_FRINGE:
4992 + g_value_set_boolean (value, texture_options->fringe);
4994 + case PROP_TEXTURE_FRINGE_CONTRAST:
4995 + g_value_set_double (value, texture_options->fringe_contrast);
4997 + case PROP_TEXTURE_GRAIN:
4998 + g_value_set_double (value, texture_options->grain);
5000 + case PROP_TEXTURE_GRAIN_PRESSURE_IN1:
5001 + g_value_set_double (value, texture_options->grain_pressure_in1);
5003 + case PROP_TEXTURE_GRAIN_PRESSURE_IN2:
5004 + g_value_set_double (value, texture_options->grain_pressure_in2);
5006 + case PROP_TEXTURE_GRAIN_PRESSURE_OUT1:
5007 + g_value_set_double (value, texture_options->grain_pressure_out1);
5009 + case PROP_TEXTURE_GRAIN_PRESSURE_OUT2:
5010 + g_value_set_double (value, texture_options->grain_pressure_out2);
5012 + case PROP_TEXTURE_JITTER:
5013 + g_value_set_uint (value, texture_options->jitter);
5015 + case PROP_MAIN_COLOR_DENSITY:
5016 + g_value_set_double (value, options->main_color_density);
5018 + case PROP_MAIN_COLOR_RATE:
5019 + g_value_set_double (value, options->main_color_rate);
5021 + case PROP_MAIN_COLOR_DENSITY_PRESSURE_IN1:
5022 + g_value_set_double (value, options->main_color_density_pressure_in1);
5024 + case PROP_MAIN_COLOR_DENSITY_PRESSURE_IN2:
5025 + g_value_set_double (value, options->main_color_density_pressure_in2);
5027 + case PROP_MAIN_COLOR_DENSITY_PRESSURE_OUT1:
5028 + g_value_set_double (value, options->main_color_density_pressure_out1);
5030 + case PROP_MAIN_COLOR_DENSITY_PRESSURE_OUT2:
5031 + g_value_set_double (value, options->main_color_density_pressure_out2);
5033 + case PROP_MAIN_COLOR_PRESSURE_IN1:
5034 + g_value_set_double (value, options->main_color_pressure_in1);
5036 + case PROP_MAIN_COLOR_PRESSURE_IN2:
5037 + g_value_set_double (value, options->main_color_pressure_in2);
5039 + case PROP_MAIN_COLOR_PRESSURE_OUT1:
5040 + g_value_set_double (value, options->main_color_pressure_out1);
5042 + case PROP_MAIN_COLOR_PRESSURE_OUT2:
5043 + g_value_set_double (value, options->main_color_pressure_out2);
5045 + case PROP_CANVAS_COLOR_DENSITY:
5046 + g_value_set_double (value, options->canvas_color_density);
5048 + case PROP_CANVAS_COLOR_RATE:
5049 + g_value_set_double (value, options->canvas_color_rate);
5051 + case PROP_CANVAS_COLOR_DENSITY_PRESSURE_IN1:
5052 + g_value_set_double (value, options->canvas_color_density_pressure_in1);
5054 + case PROP_CANVAS_COLOR_DENSITY_PRESSURE_IN2:
5055 + g_value_set_double (value, options->canvas_color_density_pressure_in2);
5057 + case PROP_CANVAS_COLOR_DENSITY_PRESSURE_OUT1:
5058 + g_value_set_double (value, options->canvas_color_density_pressure_out1);
5060 + case PROP_CANVAS_COLOR_DENSITY_PRESSURE_OUT2:
5061 + g_value_set_double (value, options->canvas_color_density_pressure_out2);
5063 + case PROP_CANVAS_COLOR_PRESSURE_IN1:
5064 + g_value_set_double (value, options->canvas_color_pressure_in1);
5066 + case PROP_CANVAS_COLOR_PRESSURE_IN2:
5067 + g_value_set_double (value, options->canvas_color_pressure_in2);
5069 + case PROP_CANVAS_COLOR_PRESSURE_OUT1:
5070 + g_value_set_double (value, options->canvas_color_pressure_out1);
5072 + case PROP_CANVAS_COLOR_PRESSURE_OUT2:
5073 + g_value_set_double (value, options->canvas_color_pressure_out2);
5076 + g_value_set_uint (value, options->dryout);
5079 + g_value_set_uint (value, options->delay);
5082 + g_value_set_boolean (value, options->tail);
5085 + g_value_set_boolean (value, options->merged);
5087 + case PROP_PIGMENT:
5088 + g_value_set_boolean (value, options->pigment);
5090 + case PROP_HIDDEN_COLOR:
5091 + g_value_set_enum (value, options->hidden_color);
5093 + case PROP_REMOVE_COLOR:
5094 + g_value_set_boolean (value, options->remove_color);
5096 + case PROP_SAMPLE_SIZE_LIMIT:
5097 + g_value_set_uint (value, options->sample_size_limit);
5099 + case PROP_ALPHA_CHANNEL_MIXING:
5100 + g_value_set_boolean (value, options->alpha_channel_mixing);
5102 + case PROP_APPLICATION_MODE:
5103 + g_value_set_enum (value, GIMP_PAINT_OPTIONS (options)->application_mode);
5106 + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
5113 +gimp_hidden_color_get_type (void)
5115 + static const GEnumValue values[] =
5117 + { GIMP_HIDDEN_COLOR_NORMAL, "GIMP_HIDDEN_COLOR_NORMAL", "normal" },
5118 + { GIMP_HIDDEN_COLOR_WHITE, "GIMP_HIDDEN_COLOR_WHITE", "white" },
5119 + { GIMP_HIDDEN_COLOR_BACKGROUND, "GIMP_HIDDEN_COLOR_BACKGROUND", "background color" },
5123 + static const GimpEnumDesc descs[] =
5125 + { GIMP_HIDDEN_COLOR_NORMAL, "normal", NULL },
5126 + { GIMP_HIDDEN_COLOR_WHITE, "white", NULL },
5127 + { GIMP_HIDDEN_COLOR_BACKGROUND, "background color", NULL },
5131 + static GType type = 0;
5135 + type = g_enum_register_static ("GimpHiddenColor", values);
5136 + gimp_enum_set_value_descriptions (type, descs);
5141 --- gimp-2.6.6/app/paint/gimpmixbrushoptions.h 1970-01-01 09:00:00 +0900
5142 +++ gimp-painter--2.6.6/app/paint/gimpmixbrushoptions.h 2009-03-17 10:42:37 +0900
5144 +/* GIMP - The GNU Image Manipulation Program
5145 + * Copyright (C) 1995 Spencer Kimball and Peter Mattis
5147 + * This program is free software; you can redistribute it and/or modify
5148 + * it under the terms of the GNU General Public License as published by
5149 + * the Free Software Foundation; either version 2 of the License, or
5150 + * (at your option) any later version.
5152 + * This program is distributed in the hope that it will be useful,
5153 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
5154 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5155 + * GNU General Public License for more details.
5157 + * You should have received a copy of the GNU General Public License
5158 + * along with this program; if not, write to the Free Software
5159 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
5162 +#ifndef __GIMP_MIXBRUSH_OPTIONS_H__
5163 +#define __GIMP_MIXBRUSH_OPTIONS_H__
5166 +#include "gimppaintoptions.h"
5173 + GIMP_HIDDEN_COLOR_NORMAL,
5174 + GIMP_HIDDEN_COLOR_WHITE,
5175 + GIMP_HIDDEN_COLOR_BACKGROUND
5178 +#define GIMP_TYPE_HIDDEN_COLOR (gimp_hidden_color_get_type ())
5180 +GType gimp_hidden_color_get_type (void) G_GNUC_CONST;
5184 +#define GIMP_TYPE_MIXBRUSH_OPTIONS (gimp_mixbrush_options_get_type ())
5185 +#define GIMP_MIXBRUSH_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_MIXBRUSH_OPTIONS, GimpMixbrushOptions))
5186 +#define GIMP_MIXBRUSH_OPTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_MIXBRUSH_OPTIONS, GimpMixbrushOptionsClass))
5187 +#define GIMP_IS_MIXBRUSH_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_MIXBRUSH_OPTIONS))
5188 +#define GIMP_IS_MIXBRUSH_OPTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_MIXBRUSH_OPTIONS))
5189 +#define GIMP_MIXBRUSH_OPTIONS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_MIXBRUSH_OPTIONS, GimpMixbrushOptionsClass))
5192 +typedef struct _GimpMixbrushOptionsClass GimpMixbrushOptionsClass;
5194 +typedef struct _GimpTextureOptions
5196 + gboolean use_texture;
5198 + gdouble fringe_contrast;
5200 + gdouble grain_pressure_in1;
5201 + gdouble grain_pressure_in2;
5202 + gdouble grain_pressure_out1;
5203 + gdouble grain_pressure_out2;
5205 +} GimpTextureOptions;
5207 +struct _GimpMixbrushOptions
5209 + GimpPaintOptions parent_instance;
5211 + GimpTextureOptions *texture_options;
5212 + gdouble main_color_density; /* 塗料の量 */
5213 + gdouble main_color_rate; /* 塗料に前回の塗り色が混じる割合(実際は1-rate) */
5214 + gdouble main_color_density_pressure_in1;
5215 + gdouble main_color_density_pressure_in2;
5216 + gdouble main_color_density_pressure_out1;
5217 + gdouble main_color_density_pressure_out2;
5218 + gdouble main_color_pressure_in1;
5219 + gdouble main_color_pressure_in2;
5220 + gdouble main_color_pressure_out1;
5221 + gdouble main_color_pressure_out2;
5222 + gdouble canvas_color_density; /* 地の色が混じる量 */
5223 + gdouble canvas_color_rate; /* 着色前の地の色が混じる割合(実際は1-rate) */
5224 + gdouble canvas_color_density_pressure_in1;
5225 + gdouble canvas_color_density_pressure_in2;
5226 + gdouble canvas_color_density_pressure_out1;
5227 + gdouble canvas_color_density_pressure_out2;
5228 + gdouble canvas_color_pressure_in1;
5229 + gdouble canvas_color_pressure_in2;
5230 + gdouble canvas_color_pressure_out1;
5231 + gdouble canvas_color_pressure_out2;
5232 + guint dryout; /* main_color_densityが完全に尽きる距離(pixel) */
5237 + GimpHiddenColor hidden_color;
5238 + gboolean remove_color;
5239 + guint sample_size_limit;
5240 + gboolean alpha_channel_mixing;
5243 +struct _GimpMixbrushOptionsClass
5245 + GimpPaintOptionsClass parent_class;
5249 +GType gimp_mixbrush_options_get_type (void) G_GNUC_CONST;
5252 +#endif /* __GIMP_MIXBRUSH_OPTIONS_H__ */
5253 --- gimp-2.6.6/app/paint/gimppaintbrush.c 2008-11-21 07:43:08 +0900
5254 +++ gimp-painter--2.6.6/app/paint/gimppaintbrush.c 2009-03-21 01:59:38 +0900
5256 _gimp_paintbrush_motion (GimpPaintCore *paint_core,
5257 GimpDrawable *drawable,
5258 GimpPaintOptions *paint_options,
5262 GimpBrushCore *brush_core = GIMP_BRUSH_CORE (paint_core);
5263 GimpContext *context = GIMP_CONTEXT (paint_options);
5264 @@ -114,11 +114,12 @@
5265 GimpPaintApplicationMode paint_appl_mode;
5270 image = gimp_item_get_image (GIMP_ITEM (drawable));
5272 - opacity *= gimp_paint_options_get_fade (paint_options, image,
5273 - paint_core->pixel_dist);
5274 + opacity = gimp_paint_options_get_fade (paint_options, image,
5275 + paint_core->pixel_dist);
5279 @@ -143,13 +144,14 @@
5283 - col[ALPHA_PIX] = OPAQUE_OPACITY;
5285 + col[area->bytes - 1] = OPAQUE_OPACITY;
5287 color_pixels (temp_buf_data (area), col,
5288 area->width * area->height,
5291 - paint_appl_mode = GIMP_PAINT_INCREMENTAL;
5292 + /*paint_appl_mode = GIMP_PAINT_INCREMENTAL;*/
5294 /* otherwise check if the brush has a pixmap and use that to color the area */
5295 else if (brush_core->brush && brush_core->brush->pixmap)
5298 gimp_paint_options_get_brush_mode (paint_options));
5300 - paint_appl_mode = GIMP_PAINT_INCREMENTAL;
5301 + /*paint_appl_mode = GIMP_PAINT_INCREMENTAL;*/
5303 /* otherwise fill the area with the foreground color */
5305 @@ -176,15 +178,19 @@
5306 opacity *= gimp_paint_options_get_dynamic_opacity (paint_options,
5307 &paint_core->cur_coords);
5309 + flow *= gimp_context_get_flow (context);
5311 hardness = gimp_paint_options_get_dynamic_hardness (paint_options,
5312 &paint_core->cur_coords);
5314 /* finally, let the brush core paste the colored area on the canvas */
5315 gimp_brush_core_paste_canvas (brush_core, drawable,
5316 MIN (opacity, GIMP_OPACITY_OPAQUE),
5318 gimp_context_get_opacity (context),
5319 gimp_context_get_paint_mode (context),
5320 gimp_paint_options_get_brush_mode (paint_options),
5324 + paint_options->update_freq_options);
5326 --- gimp-2.6.6/app/paint/gimppaintbrush.h 2008-11-21 07:43:08 +0900
5327 +++ gimp-painter--2.6.6/app/paint/gimppaintbrush.h 2009-03-21 01:59:38 +0900
5329 void _gimp_paintbrush_motion (GimpPaintCore *paint_core,
5330 GimpDrawable *drawable,
5331 GimpPaintOptions *paint_options,
5336 #endif /* __GIMP_PAINTBRUSH_H__ */
5337 --- gimp-2.6.6/app/paint/gimppaintcore.c 2008-12-28 08:13:04 +0900
5338 +++ gimp-painter--2.6.6/app/paint/gimppaintcore.c 2009-03-20 05:21:43 +0900
5339 @@ -101,12 +101,17 @@
5341 static void paint_mask_to_canvas_tiles (GimpPaintCore *core,
5342 PixelRegion *paint_maskPR,
5343 + gdouble paint_opacity_limit,
5344 gdouble paint_opacity);
5345 static void paint_mask_to_canvas_buf (GimpPaintCore *core,
5346 PixelRegion *paint_maskPR,
5347 gdouble paint_opacity);
5348 static void canvas_tiles_to_canvas_buf (GimpPaintCore *core);
5350 +static inline void drawable_update_reduced_freq (GimpDrawable *drawable,
5351 + GimpPaintCore *core,
5352 + GimpUpdateFreqOptions *update_freq_options);
5355 G_DEFINE_TYPE (GimpPaintCore, gimp_paint_core, GIMP_TYPE_OBJECT)
5359 core->undo_tiles = NULL;
5360 core->saved_proj_tiles = NULL;
5361 + core->color_tiles = NULL;
5362 core->canvas_tiles = NULL;
5364 core->orig_buf = NULL;
5365 @@ -322,7 +328,14 @@
5369 - core_class->post_paint (core, drawable,
5370 + if (paint_state == GIMP_PAINT_STATE_FINISH && ! core->updated)
5371 + gimp_drawable_update (drawable,
5374 + core->_x2 - core->_x1 + 1,
5375 + core->_y2 - core->_y1 + 1);
5377 + core_class->post_paint (core, drawable,
5381 @@ -380,6 +393,14 @@
5382 tile_manager_bpp (tiles));
5385 + /* Allocate the color blocks structure */
5386 + if (core->color_tiles)
5387 + tile_manager_unref (core->color_tiles);
5389 + core->color_tiles = tile_manager_new (gimp_item_width (item),
5390 + gimp_item_height (item),
5391 + gimp_drawable_bytes_without_alpha (drawable));
5393 /* Allocate the canvas blocks structure */
5394 if (core->canvas_tiles)
5395 tile_manager_unref (core->canvas_tiles);
5396 @@ -440,6 +461,26 @@
5397 tile_manager_unref (core->saved_proj_tiles);
5398 core->saved_proj_tiles = NULL;
5401 + if (core->canvas_tiles)
5403 + TileManager *tm = core->canvas_tiles;
5404 + gint w = tile_manager_width (tm);
5405 + gint h = tile_manager_height (tm);
5406 + gint bytes = tile_manager_bpp (tm);
5407 + gint len = w * h * bytes;
5408 + guchar *buf = g_new (guchar, len);
5410 + read_pixel_data (tm, 0, 0, w - 1, h - 1, buf, w * bytes );
5412 + g_file_set_contents ("out.raw", buf, len, NULL);
5415 + g_printerr ("wrote out.raw w:%d h:%d bpp:%d\n",w,h,bytes);
5418 + g_printerr ("has no color tiles!\n");
5421 gimp_viewable_preview_thaw (GIMP_VIEWABLE (drawable));
5423 @@ -528,6 +569,12 @@
5424 core->saved_proj_tiles = NULL;
5427 + if (core->color_tiles)
5429 + tile_manager_unref (core->color_tiles);
5430 + core->color_tiles = NULL;
5433 if (core->canvas_tiles)
5435 tile_manager_unref (core->canvas_tiles);
5436 @@ -776,14 +823,18 @@
5437 return core->orig_proj_buf;
5440 +/* paint_opacity_limitが従来のpaint_opacityにあたる */
5441 +/* paint_opacityはPaintbrushのFlowパラメータのために使う */
5443 gimp_paint_core_paste (GimpPaintCore *core,
5444 PixelRegion *paint_maskPR,
5445 GimpDrawable *drawable,
5446 + gdouble paint_opacity_limit,
5447 gdouble paint_opacity,
5448 gdouble image_opacity,
5449 GimpLayerModeEffects paint_mode,
5450 - GimpPaintApplicationMode mode)
5451 + GimpPaintApplicationMode mode,
5452 + GimpUpdateFreqOptions *update_freq_options)
5454 TileManager *alt = NULL;
5456 @@ -832,13 +883,123 @@
5457 if (paint_maskPR->tiles != core->canvas_tiles)
5459 /* initialize any invalid canvas tiles */
5461 +/* These macros came from paint-funcs-generic.c */
5462 +#define INT_MULT(a,b,t) ((t) = (a) * (b) + 0x80, ((((t) >> 8) + (t)) >> 8))
5463 +#define INT_BLEND(a,b,alpha,tmp) (INT_MULT((a) - (b), alpha, tmp) + (b))
5465 gimp_paint_core_validate_canvas_tiles (core,
5466 core->canvas_buf->x,
5467 core->canvas_buf->y,
5468 core->canvas_buf->width,
5469 core->canvas_buf->height);
5471 - paint_mask_to_canvas_tiles (core, paint_maskPR, paint_opacity);
5473 + static gint count = 0;
5474 + if ((count = (++count) % 500) == 0)
5476 + TileManager *tm = core->canvas_tiles;
5477 + gint w = tile_manager_width (tm);
5478 + gint h = tile_manager_height (tm);
5479 + gint bytes = tile_manager_bpp (tm);
5480 + gint len = w * h * bytes;
5481 + guchar *buf = g_new (guchar, len);
5483 + read_pixel_data (tm, 0, 0, w - 1, h - 1, buf, w * bytes );
5485 + g_file_set_contents ("r:\\out.raw", buf, len, NULL);
5488 + g_printerr ("wrote out.raw w:%d h:%d bpp:%d\n",w,h,bytes);
5491 + g_printerr ("count => %d\n", count);
5493 + /* Update the color tiles */
5495 + PixelRegion canvas_bufPR, canvas_tilesPR, color_tilesPR, maskPR;
5499 + x = core->canvas_buf->x;
5500 + y = core->canvas_buf->y;
5501 + w = core->canvas_buf->width;
5502 + h = core->canvas_buf->height;
5504 + pixel_region_init (&color_tilesPR, core->color_tiles,
5507 + pixel_region_init (&canvas_tilesPR, core->canvas_tiles,
5510 + pixel_region_init_temp_buf (&canvas_bufPR,
5514 + g_memmove (&maskPR, paint_maskPR, sizeof (maskPR));
5516 + for (iter = pixel_regions_register (4, &color_tilesPR,
5521 + iter = pixel_regions_process (iter))
5523 + guchar *canvas_tiles = canvas_tilesPR.data;
5524 + guchar *paint_mask = maskPR.data;
5525 + guchar *color_tiles = color_tilesPR.data;
5526 + guchar *canvas_buf = canvas_bufPR.data;
5529 + for (i = 0; i < canvas_bufPR.h; i++)
5531 + for (j = 0;j < canvas_bufPR.w; j++)
5533 + guchar ct = canvas_tiles[j];
5534 + guchar pm = paint_mask[j];
5535 + gint color_offset = j * color_tilesPR.bytes;
5536 + gint canvas_offset = j * canvas_bufPR.bytes;
5538 + gint tmp, blend_op;
5541 + if ((blend_op = pm + ct))
5543 + blend_op = CLAMP (pm * 255 / blend_op, 0, 255);
5545 + for (k = 0; k < color_tilesPR.bytes; k++)
5547 + value = INT_BLEND (canvas_buf[canvas_offset + k],
5548 + color_tiles[color_offset + k],
5550 + value = INT_BLEND (canvas_buf[canvas_offset + k],
5554 + canvas_buf[canvas_offset + k] = value;
5555 + color_tiles[color_offset + k] = value;
5559 + canvas_tiles += canvas_tilesPR.rowstride;
5560 + canvas_buf += canvas_bufPR.rowstride;
5561 + paint_mask += maskPR.rowstride;
5562 + color_tiles += color_tilesPR.rowstride;
5568 + paint_mask_to_canvas_tiles (core, paint_maskPR, paint_opacity_limit, paint_opacity);
5570 + gimp_paint_core_validate_canvas_tiles (core,
5571 + core->canvas_buf->x,
5572 + core->canvas_buf->y,
5573 + core->canvas_buf->width,
5574 + core->canvas_buf->height);
5576 + paint_mask_to_canvas_tiles (core, paint_maskPR, paint_opacity_limit, paint_opacity);
5580 canvas_tiles_to_canvas_buf (core);
5581 @@ -849,7 +1010,7 @@
5585 - paint_mask_to_canvas_buf (core, paint_maskPR, paint_opacity);
5586 + paint_mask_to_canvas_buf (core, paint_maskPR, paint_opacity_limit);
5589 /* intialize canvas buf source pixel regions */
5590 @@ -873,11 +1034,14 @@
5591 core->y2 = MAX (core->y2, core->canvas_buf->y + core->canvas_buf->height);
5593 /* Update the drawable */
5594 - gimp_drawable_update (drawable,
5595 - core->canvas_buf->x,
5596 - core->canvas_buf->y,
5597 - core->canvas_buf->width,
5598 - core->canvas_buf->height);
5599 + if (update_freq_options->reduce_update_freq)
5600 + drawable_update_reduced_freq (drawable, core, update_freq_options);
5602 + gimp_drawable_update (drawable,
5603 + core->canvas_buf->x,
5604 + core->canvas_buf->y,
5605 + core->canvas_buf->width,
5606 + core->canvas_buf->height);
5609 /* This works similarly to gimp_paint_core_paste. However, instead of
5610 @@ -894,7 +1058,8 @@
5611 GimpDrawable *drawable,
5612 gdouble paint_opacity,
5613 gdouble image_opacity,
5614 - GimpPaintApplicationMode mode)
5615 + GimpPaintApplicationMode mode,
5616 + GimpUpdateFreqOptions *update_freq_options)
5620 @@ -902,8 +1067,10 @@
5622 gimp_paint_core_paste (core, paint_maskPR, drawable,
5624 + GIMP_OPACITY_OPAQUE,
5625 image_opacity, GIMP_NORMAL_MODE,
5628 + update_freq_options);
5632 @@ -929,7 +1096,7 @@
5633 core->canvas_buf->height);
5635 /* combine the paint mask and the canvas tiles */
5636 - paint_mask_to_canvas_tiles (core, paint_maskPR, paint_opacity);
5637 + paint_mask_to_canvas_tiles (core, paint_maskPR, paint_opacity, GIMP_OPACITY_OPAQUE);
5639 /* initialize the maskPR from the canvas tiles */
5640 pixel_region_init (paint_maskPR, core->canvas_tiles,
5641 @@ -966,11 +1133,15 @@
5642 core->y2 = MAX (core->y2, core->canvas_buf->y + core->canvas_buf->height) ;
5644 /* Update the drawable */
5645 - gimp_drawable_update (drawable,
5646 - core->canvas_buf->x,
5647 - core->canvas_buf->y,
5648 - core->canvas_buf->width,
5649 - core->canvas_buf->height);
5650 + if (update_freq_options->reduce_update_freq)
5651 + drawable_update_reduced_freq (drawable, core, update_freq_options);
5653 + gimp_drawable_update (drawable,
5654 + core->canvas_buf->x,
5655 + core->canvas_buf->y,
5656 + core->canvas_buf->width,
5657 + core->canvas_buf->height);
5662 @@ -999,6 +1170,7 @@
5664 paint_mask_to_canvas_tiles (GimpPaintCore *core,
5665 PixelRegion *paint_maskPR,
5666 + gdouble paint_opacity_limit,
5667 gdouble paint_opacity)
5670 @@ -1012,8 +1184,13 @@
5673 /* combine the mask to the canvas tiles */
5674 - combine_mask_and_region (&srcPR, paint_maskPR,
5675 - paint_opacity * 255.999, GIMP_IS_AIRBRUSH (core));
5676 + if (GIMP_IS_PAINTBRUSH (core))
5677 + combine_mask_and_region_limit (&srcPR, paint_maskPR,
5678 + paint_opacity_limit * 255.999,
5679 + paint_opacity * 255.999);
5681 + combine_mask_and_region (&srcPR, paint_maskPR,
5682 + paint_opacity_limit * 255.999, FALSE);
5686 @@ -1139,3 +1316,58 @@
5693 +drawable_update_reduced_freq (GimpDrawable *drawable,
5694 + GimpPaintCore *core,
5695 + GimpUpdateFreqOptions *update_freq_options)
5701 + v = core->cur_coords.velocity - update_freq_options->v_threshold;
5702 + r = (core->canvas_buf->width + core->canvas_buf->height) / 2.0;
5704 + if (v > 0 && r > update_freq_options->s_threshold)
5708 + m = MIN (n * faster_pow (r / update_freq_options->s_threshold,
5709 + update_freq_options->gamma),
5710 + update_freq_options->max_n_dabs);
5711 + //g_printerr ("velo : %f / n : %f / threshold %d\n", core->cur_coords.velocity, n, (gint)(MIN (n, 25.0 - sqrt (r))));
5716 + if (core->update_count)
5718 + core->_x1 = MIN (core->_x1, core->canvas_buf->x);
5719 + core->_y1 = MIN (core->_y1, core->canvas_buf->y);
5720 + core->_x2 = MAX (core->_x2, core->canvas_buf->x + core->canvas_buf->width - 1);
5721 + core->_y2 = MAX (core->_y2, core->canvas_buf->y + core->canvas_buf->height - 1);
5725 + core->_x1 = core->canvas_buf->x;
5726 + core->_x2 = core->canvas_buf->x + core->canvas_buf->width - 1;
5727 + core->_y1 = core->canvas_buf->y;
5728 + core->_y2 = core->canvas_buf->y + core->canvas_buf->height - 1;
5731 + if (++core->update_count >= m)
5733 + core->update_count = 0;
5734 + core->updated = TRUE;
5736 + gimp_drawable_update (drawable,
5739 + core->_x2 - core->_x1 + 1,
5740 + core->_y2 - core->_y1 + 1);
5743 + core->updated = FALSE;
5745 --- gimp-2.6.6/app/paint/gimppaintcore.h 2008-11-21 07:43:08 +0900
5746 +++ gimp-painter--2.6.6/app/paint/gimppaintcore.h 2009-03-18 18:51:52 +0900
5748 #include "libgimpmath/gimpvector.h"
5749 #include "core/gimpobject.h"
5751 +#include "gimppaintoptions.h"
5754 #define GIMP_TYPE_PAINT_CORE (gimp_paint_core_get_type ())
5755 #define GIMP_PAINT_CORE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_PAINT_CORE, GimpPaintCore))
5758 TileManager *undo_tiles; /* tiles which have been modified */
5759 TileManager *saved_proj_tiles; /* proj tiles which have been modified */
5760 + TileManager *color_tiles; /* the buffer to paint the color to */
5761 TileManager *canvas_tiles; /* the buffer to paint the mask to */
5763 TempBuf *orig_buf; /* the unmodified drawable pixels */
5764 TempBuf *orig_proj_buf; /* the unmodified projection pixels */
5765 TempBuf *canvas_buf; /* the buffer to paint pixels to */
5767 + /* to reduce update frequency */
5768 + gint update_count;
5774 struct _GimpPaintCoreClass
5775 @@ -154,16 +163,19 @@
5776 void gimp_paint_core_paste (GimpPaintCore *core,
5777 PixelRegion *paint_maskPR,
5778 GimpDrawable *drawable,
5779 + gdouble paint_opacity_limit,
5780 gdouble paint_opacity,
5781 gdouble image_opacity,
5782 GimpLayerModeEffects paint_mode,
5783 - GimpPaintApplicationMode mode);
5784 + GimpPaintApplicationMode mode,
5785 + GimpUpdateFreqOptions *update_freq_options);
5786 void gimp_paint_core_replace (GimpPaintCore *core,
5787 PixelRegion *paint_maskPR,
5788 GimpDrawable *drawable,
5789 gdouble paint_opacity,
5790 gdouble image_opacity,
5791 - GimpPaintApplicationMode mode);
5792 + GimpPaintApplicationMode mode,
5793 + GimpUpdateFreqOptions *update_freq_options);
5795 void gimp_paint_core_validate_undo_tiles (GimpPaintCore *core,
5796 GimpDrawable *drawable,
5797 @@ -184,4 +196,20 @@
5801 +/* Utility function(s) */
5802 +static inline gdouble faster_pow (gdouble a, gdouble b)
5804 + guchar n[8] = "\0\0\0\0\0\0\0\0";
5807 + (*((gdouble *)n)) = a;
5808 + i = (*((guint64 *)n)) >> 32;
5810 + i = (guint32)(b * ((gint32)i - 1072632447) + 1072632447);
5811 + (*((guint64 *)n)) = (guint64)i << 32;
5813 + return (*((gdouble *)n));
5817 #endif /* __GIMP_PAINT_CORE_H__ */
5818 --- gimp-2.6.6/app/paint/gimppaintoptions.c 2008-11-21 07:43:08 +0900
5819 +++ gimp-painter--2.6.6/app/paint/gimppaintoptions.c 2009-03-18 01:56:30 +0900
5821 #include "gimppaintoptions.h"
5824 -#define DEFAULT_BRUSH_SCALE 1.0
5825 -#define DEFAULT_APPLICATION_MODE GIMP_PAINT_CONSTANT
5826 -#define DEFAULT_HARD FALSE
5828 -#define DEFAULT_DYNAMICS_EXPANDED FALSE
5830 -#define DEFAULT_PRESSURE_OPACITY TRUE
5831 -#define DEFAULT_PRESSURE_HARDNESS FALSE
5832 -#define DEFAULT_PRESSURE_RATE FALSE
5833 -#define DEFAULT_PRESSURE_SIZE FALSE
5834 -#define DEFAULT_PRESSURE_INVERSE_SIZE FALSE
5835 -#define DEFAULT_PRESSURE_COLOR FALSE
5836 -#define DEFAULT_PRESSURE_PRESCALE 1.0
5838 -#define DEFAULT_VELOCITY_OPACITY FALSE
5839 -#define DEFAULT_VELOCITY_HARDNESS FALSE
5840 -#define DEFAULT_VELOCITY_RATE FALSE
5841 -#define DEFAULT_VELOCITY_SIZE FALSE
5842 -#define DEFAULT_VELOCITY_INVERSE_SIZE FALSE
5843 -#define DEFAULT_VELOCITY_COLOR FALSE
5844 -#define DEFAULT_VELOCITY_PRESCALE 1.0
5846 -#define DEFAULT_RANDOM_OPACITY FALSE
5847 -#define DEFAULT_RANDOM_HARDNESS FALSE
5848 -#define DEFAULT_RANDOM_RATE FALSE
5849 -#define DEFAULT_RANDOM_SIZE FALSE
5850 -#define DEFAULT_RANDOM_INVERSE_SIZE FALSE
5851 -#define DEFAULT_RANDOM_COLOR FALSE
5852 -#define DEFAULT_RANDOM_PRESCALE 1.0
5854 -#define DEFAULT_USE_FADE FALSE
5855 -#define DEFAULT_FADE_LENGTH 100.0
5856 -#define DEFAULT_FADE_UNIT GIMP_UNIT_PIXEL
5858 -#define DEFAULT_USE_JITTER FALSE
5859 -#define DEFAULT_JITTER_AMOUNT 0.2
5861 -#define DEFAULT_USE_GRADIENT FALSE
5862 -#define DEFAULT_GRADIENT_REVERSE FALSE
5863 -#define DEFAULT_GRADIENT_REPEAT GIMP_REPEAT_TRIANGULAR
5864 -#define DEFAULT_GRADIENT_LENGTH 100.0
5865 -#define DEFAULT_GRADIENT_UNIT GIMP_UNIT_PIXEL
5866 +#define DEFAULT_BRUSH_SCALE 1.0
5867 +#define DEFAULT_APPLICATION_MODE GIMP_PAINT_CONSTANT
5868 +#define DEFAULT_HARD FALSE
5870 +#define DEFAULT_DYNAMICS_EXPANDED FALSE
5872 +#define DEFAULT_PRESSURE_OPACITY TRUE
5873 +#define DEFAULT_PRESSURE_HARDNESS FALSE
5874 +#define DEFAULT_PRESSURE_RATE FALSE
5875 +#define DEFAULT_PRESSURE_SIZE FALSE
5876 +#define DEFAULT_PRESSURE_INVERSE_SIZE FALSE
5877 +#define DEFAULT_PRESSURE_COLOR FALSE
5878 +#define DEFAULT_PRESSURE_PRESCALE 1.0
5879 +#define DEFAULT_PRESSURE_MIN_SCALE 0
5880 +#define DEFAULT_PRESSURE_POWER_SIZE 0.5
5882 +#define DEFAULT_VELOCITY_OPACITY FALSE
5883 +#define DEFAULT_VELOCITY_HARDNESS FALSE
5884 +#define DEFAULT_VELOCITY_RATE FALSE
5885 +#define DEFAULT_VELOCITY_SIZE FALSE
5886 +#define DEFAULT_VELOCITY_INVERSE_SIZE FALSE
5887 +#define DEFAULT_VELOCITY_COLOR FALSE
5888 +#define DEFAULT_VELOCITY_PRESCALE 1.0
5890 +#define DEFAULT_RANDOM_OPACITY FALSE
5891 +#define DEFAULT_RANDOM_HARDNESS FALSE
5892 +#define DEFAULT_RANDOM_RATE FALSE
5893 +#define DEFAULT_RANDOM_SIZE FALSE
5894 +#define DEFAULT_RANDOM_INVERSE_SIZE FALSE
5895 +#define DEFAULT_RANDOM_COLOR FALSE
5896 +#define DEFAULT_RANDOM_PRESCALE 1.0
5898 +#define DEFAULT_USE_FADE FALSE
5899 +#define DEFAULT_FADE_LENGTH 100.0
5900 +#define DEFAULT_FADE_UNIT GIMP_UNIT_PIXEL
5902 +#define DEFAULT_USE_JITTER FALSE
5903 +#define DEFAULT_JITTER_AMOUNT 0.2
5905 +#define DEFAULT_USE_GRADIENT FALSE
5906 +#define DEFAULT_GRADIENT_REVERSE FALSE
5907 +#define DEFAULT_GRADIENT_REPEAT GIMP_REPEAT_TRIANGULAR
5908 +#define DEFAULT_GRADIENT_LENGTH 100.0
5909 +#define DEFAULT_GRADIENT_UNIT GIMP_UNIT_PIXEL
5911 +#define DEFAULT_REDUCE_UPDATE_FREQ FALSE
5912 +#define DEFAULT_UPDATE_FREQ_S_THRESHOLD 30.0
5913 +#define DEFAULT_UPDATE_FREQ_V_THRESHOLD 0.015
5914 +#define DEFAULT_UPDATE_FREQ_GAMMA 1.35
5915 +#define DEFAULT_UPDATE_FREQ_MAX_N_DABS 18
5917 +#define DEFAULT_MAX_COORD_SMOOTH 0.8
5922 PROP_PRESSURE_INVERSE_SIZE,
5923 PROP_PRESSURE_COLOR,
5924 PROP_PRESSURE_PRESCALE,
5925 + PROP_PRESSURE_MIN_SCALE,
5926 + PROP_PRESSURE_POWER_SIZE,
5928 PROP_VELOCITY_OPACITY,
5929 PROP_VELOCITY_HARDNESS,
5930 @@ -131,7 +143,15 @@
5931 PROP_PATTERN_VIEW_TYPE,
5932 PROP_PATTERN_VIEW_SIZE,
5933 PROP_GRADIENT_VIEW_TYPE,
5934 - PROP_GRADIENT_VIEW_SIZE
5935 + PROP_GRADIENT_VIEW_SIZE,
5937 + PROP_REDUCE_UPDATE_FREQ,
5938 + PROP_UPDATE_FREQ_S_THRESHOLD,
5939 + PROP_UPDATE_FREQ_V_THRESHOLD,
5940 + PROP_UPDATE_FREQ_GAMMA,
5941 + PROP_UPDATE_FREQ_MAX_N_DABS,
5943 + PROP_MAX_COORD_SMOOTH
5947 @@ -224,6 +244,14 @@
5948 "pressure-prescale", NULL,
5949 0.0, 1.0, DEFAULT_PRESSURE_PRESCALE,
5950 GIMP_PARAM_STATIC_STRINGS);
5951 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_PRESSURE_MIN_SCALE,
5952 + "pressure-min-scale", NULL,
5953 + 0.0, 1.0, DEFAULT_PRESSURE_MIN_SCALE,
5954 + GIMP_PARAM_STATIC_STRINGS);
5955 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_PRESSURE_POWER_SIZE,
5956 + "pressure-power-size", NULL,
5957 + 0.1, 10.0, DEFAULT_PRESSURE_POWER_SIZE,
5958 + GIMP_PARAM_STATIC_STRINGS);
5960 GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_VELOCITY_OPACITY,
5961 "velocity-opacity", NULL,
5962 @@ -362,6 +390,34 @@
5963 GIMP_VIEWABLE_MAX_BUTTON_SIZE,
5964 GIMP_VIEW_SIZE_LARGE,
5965 GIMP_PARAM_STATIC_STRINGS);
5967 + GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_REDUCE_UPDATE_FREQ,
5968 + "reduce-update-frequency", NULL,
5969 + DEFAULT_REDUCE_UPDATE_FREQ,
5970 + GIMP_PARAM_STATIC_STRINGS | GIMP_CONFIG_PARAM_DONT_RESTORE_SECONDARY);
5971 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_UPDATE_FREQ_S_THRESHOLD,
5972 + "update-freq-size-threshold", NULL,
5973 + 0.1, 100.0, DEFAULT_UPDATE_FREQ_S_THRESHOLD,
5974 + GIMP_PARAM_STATIC_STRINGS | GIMP_CONFIG_PARAM_DONT_RESTORE_SECONDARY);
5975 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_UPDATE_FREQ_V_THRESHOLD,
5976 + "update-freq-velo-threshold", NULL,
5977 + 0.001, 0.1, DEFAULT_UPDATE_FREQ_V_THRESHOLD,
5978 + GIMP_PARAM_STATIC_STRINGS | GIMP_CONFIG_PARAM_DONT_RESTORE_SECONDARY);
5979 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_UPDATE_FREQ_GAMMA,
5980 + "update-freq-gamma", NULL,
5981 + 0.1, 2.5, DEFAULT_UPDATE_FREQ_GAMMA,
5982 + GIMP_PARAM_STATIC_STRINGS | GIMP_CONFIG_PARAM_DONT_RESTORE_SECONDARY);
5983 + GIMP_CONFIG_INSTALL_PROP_INT (object_class, PROP_UPDATE_FREQ_MAX_N_DABS,
5984 + "update-freq-max-n-dabs", NULL,
5985 + 5, 40, DEFAULT_UPDATE_FREQ_MAX_N_DABS,
5986 + GIMP_PARAM_STATIC_STRINGS | GIMP_CONFIG_PARAM_DONT_RESTORE_SECONDARY);
5988 + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_MAX_COORD_SMOOTH,
5989 + "paint-max-coord-smooth", NULL,
5990 + 0.0, 1.0, DEFAULT_MAX_COORD_SMOOTH,
5991 + GIMP_PARAM_STATIC_STRINGS | GIMP_CONFIG_PARAM_DONT_RESTORE);
5993 + g_object_class_override_property (object_class, PROP_MAX_COORD_SMOOTH, "max-coord-smooth");
5997 @@ -369,12 +425,13 @@
5999 options->application_mode_save = DEFAULT_APPLICATION_MODE;
6001 - options->pressure_options = g_slice_new0 (GimpDynamicOptions);
6002 - options->velocity_options = g_slice_new0 (GimpDynamicOptions);
6003 - options->random_options = g_slice_new0 (GimpDynamicOptions);
6004 - options->fade_options = g_slice_new0 (GimpFadeOptions);
6005 - options->jitter_options = g_slice_new0 (GimpJitterOptions);
6006 - options->gradient_options = g_slice_new0 (GimpGradientOptions);
6007 + options->pressure_options = g_slice_new0 (GimpDynamicOptions);
6008 + options->velocity_options = g_slice_new0 (GimpDynamicOptions);
6009 + options->random_options = g_slice_new0 (GimpDynamicOptions);
6010 + options->fade_options = g_slice_new0 (GimpFadeOptions);
6011 + options->jitter_options = g_slice_new0 (GimpJitterOptions);
6012 + options->gradient_options = g_slice_new0 (GimpGradientOptions);
6013 + options->update_freq_options = g_slice_new0 (GimpUpdateFreqOptions);
6017 @@ -385,12 +442,13 @@
6018 if (options->paint_info)
6019 g_object_unref (options->paint_info);
6021 - g_slice_free (GimpDynamicOptions, options->pressure_options);
6022 - g_slice_free (GimpDynamicOptions, options->velocity_options);
6023 - g_slice_free (GimpDynamicOptions, options->random_options);
6024 - g_slice_free (GimpFadeOptions, options->fade_options);
6025 - g_slice_free (GimpJitterOptions, options->jitter_options);
6026 - g_slice_free (GimpGradientOptions, options->gradient_options);
6027 + g_slice_free (GimpDynamicOptions, options->pressure_options);
6028 + g_slice_free (GimpDynamicOptions, options->velocity_options);
6029 + g_slice_free (GimpDynamicOptions, options->random_options);
6030 + g_slice_free (GimpFadeOptions, options->fade_options);
6031 + g_slice_free (GimpJitterOptions, options->jitter_options);
6032 + g_slice_free (GimpGradientOptions, options->gradient_options);
6033 + g_slice_free (GimpUpdateFreqOptions, options->update_freq_options);
6035 G_OBJECT_CLASS (parent_class)->finalize (object);
6037 @@ -401,13 +459,14 @@
6038 const GValue *value,
6041 - GimpPaintOptions *options = GIMP_PAINT_OPTIONS (object);
6042 - GimpDynamicOptions *pressure_options = options->pressure_options;
6043 - GimpDynamicOptions *velocity_options = options->velocity_options;
6044 - GimpDynamicOptions *random_options = options->random_options;
6045 - GimpFadeOptions *fade_options = options->fade_options;
6046 - GimpJitterOptions *jitter_options = options->jitter_options;
6047 - GimpGradientOptions *gradient_options = options->gradient_options;
6048 + GimpPaintOptions *options = GIMP_PAINT_OPTIONS (object);
6049 + GimpDynamicOptions *pressure_options = options->pressure_options;
6050 + GimpDynamicOptions *velocity_options = options->velocity_options;
6051 + GimpDynamicOptions *random_options = options->random_options;
6052 + GimpFadeOptions *fade_options = options->fade_options;
6053 + GimpJitterOptions *jitter_options = options->jitter_options;
6054 + GimpGradientOptions *gradient_options = options->gradient_options;
6055 + GimpUpdateFreqOptions *update_freq_options = options->update_freq_options;
6057 switch (property_id)
6059 @@ -459,6 +518,14 @@
6060 pressure_options->prescale = g_value_get_double (value);
6063 + case PROP_PRESSURE_MIN_SCALE:
6064 + pressure_options->min_scale = g_value_get_double (value);
6067 + case PROP_PRESSURE_POWER_SIZE:
6068 + pressure_options->power_size = g_value_get_double (value);
6071 case PROP_VELOCITY_OPACITY:
6072 velocity_options->opacity = g_value_get_boolean (value);
6074 @@ -579,6 +646,26 @@
6075 options->gradient_view_size = g_value_get_int (value);
6078 + case PROP_REDUCE_UPDATE_FREQ:
6079 + update_freq_options->reduce_update_freq = g_value_get_boolean (value);
6081 + case PROP_UPDATE_FREQ_S_THRESHOLD:
6082 + update_freq_options->s_threshold = g_value_get_double (value);
6084 + case PROP_UPDATE_FREQ_V_THRESHOLD:
6085 + update_freq_options->v_threshold = g_value_get_double (value);
6087 + case PROP_UPDATE_FREQ_GAMMA:
6088 + update_freq_options->gamma = g_value_get_double (value);
6090 + case PROP_UPDATE_FREQ_MAX_N_DABS:
6091 + update_freq_options->max_n_dabs = g_value_get_int (value);
6094 + case PROP_MAX_COORD_SMOOTH:
6095 + GIMP_TOOL_OPTIONS (options)->max_coord_smooth = g_value_get_double (value);
6099 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
6101 @@ -591,13 +678,14 @@
6105 - GimpPaintOptions *options = GIMP_PAINT_OPTIONS (object);
6106 - GimpDynamicOptions *pressure_options = options->pressure_options;
6107 - GimpDynamicOptions *velocity_options = options->velocity_options;
6108 - GimpDynamicOptions *random_options = options->random_options;
6109 - GimpFadeOptions *fade_options = options->fade_options;
6110 - GimpJitterOptions *jitter_options = options->jitter_options;
6111 - GimpGradientOptions *gradient_options = options->gradient_options;
6112 + GimpPaintOptions *options = GIMP_PAINT_OPTIONS (object);
6113 + GimpDynamicOptions *pressure_options = options->pressure_options;
6114 + GimpDynamicOptions *velocity_options = options->velocity_options;
6115 + GimpDynamicOptions *random_options = options->random_options;
6116 + GimpFadeOptions *fade_options = options->fade_options;
6117 + GimpJitterOptions *jitter_options = options->jitter_options;
6118 + GimpGradientOptions *gradient_options = options->gradient_options;
6119 + GimpUpdateFreqOptions *update_freq_options = options->update_freq_options;
6121 switch (property_id)
6123 @@ -649,6 +737,14 @@
6124 g_value_set_double (value, pressure_options->prescale);
6127 + case PROP_PRESSURE_MIN_SCALE:
6128 + g_value_set_double (value, pressure_options->min_scale);
6131 + case PROP_PRESSURE_POWER_SIZE:
6132 + g_value_set_double (value, pressure_options->power_size);
6135 case PROP_VELOCITY_OPACITY:
6136 g_value_set_boolean (value, velocity_options->opacity);
6138 @@ -769,6 +865,26 @@
6139 g_value_set_int (value, options->gradient_view_size);
6142 + case PROP_REDUCE_UPDATE_FREQ:
6143 + g_value_set_boolean (value, update_freq_options->reduce_update_freq);
6145 + case PROP_UPDATE_FREQ_S_THRESHOLD:
6146 + g_value_set_double (value, update_freq_options->s_threshold);
6148 + case PROP_UPDATE_FREQ_V_THRESHOLD:
6149 + g_value_set_double (value, update_freq_options->v_threshold);
6151 + case PROP_UPDATE_FREQ_GAMMA:
6152 + g_value_set_double (value, update_freq_options->gamma);
6154 + case PROP_UPDATE_FREQ_MAX_N_DABS:
6155 + g_value_set_int (value, update_freq_options->max_n_dabs);
6158 + case PROP_MAX_COORD_SMOOTH:
6159 + g_value_set_double (value, GIMP_TOOL_OPTIONS (options)->max_coord_smooth);
6163 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
6166 gimp_paint_options_notify (GObject *object,
6169 - GimpPaintOptions *options = GIMP_PAINT_OPTIONS (object);
6170 + /*GimpPaintOptions *options = GIMP_PAINT_OPTIONS (object);
6172 if (pspec->param_id == PROP_USE_GRADIENT)
6177 if (G_OBJECT_CLASS (parent_class)->notify)
6178 - G_OBJECT_CLASS (parent_class)->notify (object, pspec);
6179 + G_OBJECT_CLASS (parent_class)->notify (object, pspec);*/
6183 @@ -1081,8 +1197,9 @@
6184 gboolean use_dynamics)
6186 gdouble scale = 1.0;
6187 + gdouble min_scale = paint_options->pressure_options->min_scale;
6190 + if (use_dynamics && min_scale < 1.0)
6192 gdouble pressure = -1.0;
6193 gdouble velocity = -1.0;
6194 @@ -1122,14 +1239,18 @@
6196 paint_options->random_options->prescale);
6198 - if (scale < 1 / 64.0)
6201 - scale = sqrt (scale);
6202 + scale = pow (scale, paint_options->pressure_options->power_size);
6204 + if (min_scale > 0)
6205 + scale = min_scale + (1.0 - min_scale) * scale;
6207 + //scale = MAX (scale, 1 / 8.0);
6210 scale *= paint_options->brush_scale;
6212 + //g_printerr ("Result of modefied code: %f, pressure: %f\n",scale, coords->pressure);
6217 --- gimp-2.6.6/app/paint/gimppaintoptions.h 2008-11-21 07:43:08 +0900
6218 +++ gimp-painter--2.6.6/app/paint/gimppaintoptions.h 2009-03-17 20:25:42 +0900
6220 typedef struct _GimpFadeOptions GimpFadeOptions;
6221 typedef struct _GimpJitterOptions GimpJitterOptions;
6222 typedef struct _GimpGradientOptions GimpGradientOptions;
6223 +typedef struct _GimpUpdateFreqOptions GimpUpdateFreqOptions;
6225 struct _GimpDynamicOptions
6228 gboolean inverse_size;
6231 + gdouble min_scale;
6232 + gdouble power_size;
6235 struct _GimpFadeOptions
6237 GimpRepeatMode gradient_repeat;
6240 +struct _GimpUpdateFreqOptions
6242 + gboolean reduce_update_freq;
6243 + gdouble s_threshold;
6244 + gdouble v_threshold;
6250 #define GIMP_TYPE_PAINT_OPTIONS (gimp_paint_options_get_type ())
6251 #define GIMP_PAINT_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_PAINT_OPTIONS, GimpPaintOptions))
6253 GimpViewSize pattern_view_size;
6254 GimpViewType gradient_view_type;
6255 GimpViewSize gradient_view_size;
6257 + GimpUpdateFreqOptions *update_freq_options;
6260 struct _GimpPaintOptionsClass
6261 --- gimp-2.6.6/app/paint/gimpsmudge.c 2008-11-21 07:43:08 +0900
6262 +++ gimp-painter--2.6.6/app/paint/gimpsmudge.c 2009-03-17 10:42:37 +0900
6264 gimp_context_get_opacity (context),
6265 gimp_paint_options_get_brush_mode (paint_options),
6267 - GIMP_PAINT_INCREMENTAL);
6268 + GIMP_PAINT_INCREMENTAL,
6269 + paint_options->update_freq_options);
6273 --- gimp-2.6.6/app/paint/paint-types.h 2008-11-21 07:43:08 +0900
6274 +++ gimp-painter--2.6.6/app/paint/paint-types.h 2009-03-17 10:42:37 +0900
6276 typedef struct _GimpPencil GimpPencil;
6277 typedef struct _GimpPerspectiveClone GimpPerspectiveClone;
6278 typedef struct _GimpSmudge GimpSmudge;
6279 +typedef struct _GimpInk2 GimpInk2;
6280 +typedef struct _GimpMixbrush GimpMixbrush;
6285 typedef struct _GimpPencilOptions GimpPencilOptions;
6286 typedef struct _GimpPerspectiveCloneOptions GimpPerspectiveCloneOptions;
6287 typedef struct _GimpSmudgeOptions GimpSmudgeOptions;
6288 +typedef struct _GimpInk2Options GimpInk2Options;
6289 +typedef struct _GimpMixbrushOptions GimpMixbrushOptions;
6294 typedef struct _GimpPaintCoreUndo GimpPaintCoreUndo;
6295 typedef struct _GimpInkUndo GimpInkUndo;
6296 +typedef struct _GimpInk2Undo GimpInk2Undo;
6300 --- gimp-2.6.6/app/paint-funcs/paint-funcs-generic.h 2008-11-21 07:43:00 +0900
6301 +++ gimp-painter--2.6.6/app/paint-funcs/paint-funcs-generic.h 2009-03-19 07:34:59 +0900
6302 @@ -1533,6 +1533,48 @@
6306 +combine_mask_and_alpha_channel_stroke_limit (guchar *src,
6307 + const guchar *mask,
6313 + /* align with alpha channel */
6316 + if (opacity != 255 || limit != 255)
6319 + gint _opacity = INT_MULT (opacity, limit, tmp);
6325 + gint mask_val = INT_MULT (*mask, _opacity, tmp);
6327 + *src = *src + INT_MULT ((limit - *src) , mask_val, tmp);
6339 + *src = *src + INT_MULT ((255 - *src) , *mask, tmp);
6348 copy_gray_to_inten_a_pixels (const guchar *src,
6351 --- gimp-2.6.6/app/paint-funcs/paint-funcs.c 2008-11-21 07:43:00 +0900
6352 +++ gimp-painter--2.6.6/app/paint-funcs/paint-funcs.c 2009-03-18 21:13:06 +0900
6353 @@ -3906,6 +3906,26 @@
6358 +combine_mask_and_sub_region_stroke_limit (guint *param,
6360 + PixelRegion *mask)
6362 + guchar *s = src->data;
6363 + const guchar *m = mask->data;
6365 + guint limit = param[0];
6366 + guint opacity = param[1];
6370 + combine_mask_and_alpha_channel_stroke_limit (s, m, limit, opacity, src->w, src->bytes);
6371 + s += src->rowstride;
6372 + m += mask->rowstride;
6378 combine_mask_and_region (PixelRegion *src,
6380 @@ -3924,6 +3944,23 @@
6384 +combine_mask_and_region_limit (PixelRegion *src,
6385 + PixelRegion *mask,
6392 + param[1] = opacity;
6394 + pixel_regions_process_parallel ((PixelProcessorFunc)
6395 + combine_mask_and_sub_region_stroke_limit,
6396 + param, 2, src, mask);
6401 copy_gray_to_region (PixelRegion *src,
6404 --- gimp-2.6.6/app/paint-funcs/paint-funcs.h 2008-11-21 07:43:00 +0900
6405 +++ gimp-painter--2.6.6/app/paint-funcs/paint-funcs.h 2009-03-18 21:13:01 +0900
6406 @@ -444,6 +444,11 @@
6410 +void combine_mask_and_region_limit (PixelRegion *src,
6411 + PixelRegion *mask,
6415 /* Copy a gray image to an intensity-alpha region */
6416 void copy_gray_to_region (PixelRegion *src,
6418 --- gimp-2.6.6/app/tools/Makefile.am 2008-11-21 07:42:58 +0900
6419 +++ gimp-painter--2.6.6/app/tools/Makefile.am 2009-03-17 10:42:37 +0900
6420 @@ -189,7 +189,13 @@
6421 gimpvectoroptions.c \
6422 gimpvectoroptions.h \
6425 + gimpvectortool.h \
6426 + gimpink2options-gui.c \
6427 + gimpink2options-gui.h \
6430 + gimpmixbrushtool.c \
6431 + gimpmixbrushtool.h
6433 libapptools_a_built_sources = tools-enums.c
6435 --- gimp-2.6.6/app/tools/Makefile.in 2009-03-16 05:58:04 +0900
6436 +++ gimp-painter--2.6.6/app/tools/Makefile.in 2009-03-17 10:42:37 +0900
6438 gimptoolcontrol.$(OBJEXT) gimptooloptions-gui.$(OBJEXT) \
6439 gimptransformoptions.$(OBJEXT) gimptransformtool.$(OBJEXT) \
6440 gimptransformtoolundo.$(OBJEXT) gimpvectoroptions.$(OBJEXT) \
6441 - gimpvectortool.$(OBJEXT)
6442 + gimpvectortool.$(OBJEXT) \
6443 + gimpinktool2.$(OBJEXT) gimpink2options-gui.$(OBJEXT) \
6444 + gimpmixbrushtool.$(OBJEXT)
6445 am_libapptools_a_OBJECTS = $(am__objects_1) $(am__objects_2)
6446 libapptools_a_OBJECTS = $(am_libapptools_a_OBJECTS)
6447 DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
6448 @@ -620,7 +622,13 @@
6449 gimpvectoroptions.c \
6450 gimpvectoroptions.h \
6453 + gimpvectortool.h \
6456 + gimpink2options-gui.c \
6457 + gimpink2options-gui.h \
6458 + gimpmixbrushtool.c \
6459 + gimpmixbrushtool.h
6461 libapptools_a_built_sources = tools-enums.c
6462 libapptools_a_SOURCES = $(libapptools_a_built_sources) $(libapptools_a_sources)
6464 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tool_manager.Po@am__quote@
6465 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tools-enums.Po@am__quote@
6466 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tools-utils.Po@am__quote@
6467 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpink2options-gui.Po@am__quote@
6468 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpinktool2.Po@am__quote@
6469 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpmixbrushtool.Po@am__quote@
6472 @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
6473 --- gimp-2.6.6/app/tools/gimp-tools.c 2008-11-21 07:42:58 +0900
6474 +++ gimp-painter--2.6.6/app/tools/gimp-tools.c 2009-03-17 10:42:37 +0900
6476 #include "gimpsmudgetool.h"
6477 #include "gimptexttool.h"
6478 #include "gimpvectortool.h"
6479 +#include "gimpinktool2.h"
6480 +#include "gimpmixbrushtool.h"
6482 #include "gimp-intl.h"
6485 gimp_blend_tool_register,
6486 gimp_bucket_fill_tool_register,
6487 gimp_text_tool_register,
6488 + gimp_ink2_tool_register,
6489 + gimp_mixbrush_tool_register,
6491 /* transform tools */
6493 @@ -498,6 +502,14 @@
6495 paint_core_name = "gimp-ink";
6497 + else if (tool_type == GIMP_TYPE_INK2_TOOL)
6499 + paint_core_name = "gimp-ink2";
6501 + else if (tool_type == GIMP_TYPE_MIXBRUSH_TOOL)
6503 + paint_core_name = "gimp-mixbrush";
6507 paint_core_name = "gimp-paintbrush";
6508 --- gimp-2.6.6/app/tools/gimpink2options-gui.c 1970-01-01 09:00:00 +0900
6509 +++ gimp-painter--2.6.6/app/tools/gimpink2options-gui.c 2009-03-17 10:42:37 +0900
6511 +/* GIMP - The GNU Image Manipulation Program
6512 + * Copyright (C) 1995 Spencer Kimball and Peter Mattis
6514 + * This program is free software; you can redistribute it and/or modify
6515 + * it under the terms of the GNU General Public License as published by
6516 + * the Free Software Foundation; either version 2 of the License, or
6517 + * (at your option) any later version.
6519 + * This program is distributed in the hope that it will be useful,
6520 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
6521 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6522 + * GNU General Public License for more details.
6524 + * You should have received a copy of the GNU General Public License
6525 + * along with this program; if not, write to the Free Software
6526 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
6529 +#include "config.h"
6531 +#include <gtk/gtk.h>
6533 +#include "libgimpwidgets/gimpwidgets.h"
6535 +#include "tools-types.h"
6537 +#include "config/gimpconfig-utils.h"
6539 +#include "paint/gimpink2options.h"
6540 +#include "paint/gimpink2.h"
6542 +#include "widgets/gimpblobeditor.h"
6544 +#include "gimpink2options-gui.h"
6545 +#include "gimppaintoptions-gui.h"
6547 +#include "gimp-intl.h"
6550 +static GtkWidget * blob_image_new (GimpInkBlobType blob_type);
6554 +gimp_ink2_options_gui (GimpToolOptions *tool_options)
6556 + GObject *config = G_OBJECT (tool_options);
6557 + GimpInk2Options *ink_options = GIMP_INK2_OPTIONS (tool_options);
6558 + GtkWidget *vbox = gimp_paint_options_gui (tool_options);
6561 + GtkWidget *blob_vbox;
6563 + GtkWidget *editor;
6565 + GtkWidget *compensate_box;
6566 + GtkWidget *compensate_vbox;
6567 + GtkWidget *checkbox;
6569 + /* adjust sliders */
6570 + frame = gimp_frame_new (_("Adjustment"));
6571 + gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 0);
6572 + gtk_widget_show (frame);
6574 + table = gtk_table_new (2, 3, FALSE);
6575 + gtk_table_set_col_spacings (GTK_TABLE (table), 2);
6576 + gtk_container_add (GTK_CONTAINER (frame), table);
6577 + gtk_widget_show (table);
6580 + adj = gimp_prop_scale_entry_new (config, "size",
6581 + GTK_TABLE (table), 0, 0,
6585 + gimp_scale_entry_set_logarithmic (adj, TRUE);
6587 + /* angle adjust slider */
6588 + gimp_prop_scale_entry_new (config, "tilt-angle",
6589 + GTK_TABLE (table), 0, 1,
6594 + /* sens sliders */
6595 + frame = gimp_frame_new (_("Sensitivity"));
6596 + gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 0);
6597 + gtk_widget_show (frame);
6599 + table = gtk_table_new (3, 3, FALSE);
6600 + gtk_table_set_col_spacings (GTK_TABLE (table), 2);
6601 + gtk_container_add (GTK_CONTAINER (frame), table);
6602 + gtk_widget_show (table);
6604 + /* size sens slider */
6605 + gimp_prop_scale_entry_new (config, "size-sensitivity",
6606 + GTK_TABLE (table), 0, 0,
6611 + /* tilt sens slider */
6612 + gimp_prop_scale_entry_new (config, "tilt-sensitivity",
6613 + GTK_TABLE (table), 0, 1,
6618 + /* velocity sens slider */
6619 + gimp_prop_scale_entry_new (config, "vel-sensitivity",
6620 + GTK_TABLE (table), 0, 2,
6625 + /* compensate at last checkbox */
6626 + compensate_box = gtk_frame_new (_("Pointer Adjustment"));
6627 + gtk_box_pack_start (GTK_BOX (vbox), compensate_box, FALSE, TRUE, 0);
6628 + gtk_widget_show(compensate_box);
6629 + compensate_vbox = gtk_vbox_new (FALSE, 2);
6630 + gtk_container_add (GTK_CONTAINER (compensate_box), compensate_vbox);
6631 + gtk_widget_show (compensate_vbox);
6633 + table = gtk_table_new (3, 3, FALSE);
6634 + gtk_table_set_col_spacings (GTK_TABLE (table), 2);
6635 + gtk_box_pack_start (GTK_VBOX (compensate_vbox), table, TRUE, TRUE, 0);
6636 + gtk_widget_show (table);
6638 + /* compensation history size slider */
6639 + gimp_prop_scale_entry_new (config, "compensation-history-size",
6640 + GTK_TABLE (table), 0, 0,
6643 + FALSE, 1.0, INK2_HISTORY_BUFFER);
6645 + /* pointer tracking rate slider */
6646 + adj = gimp_prop_scale_entry_new (config, "compensation-rate-temperature",
6647 + GTK_TABLE (table), 0, 1,
6651 + gimp_scale_entry_set_logarithmic (adj, TRUE);
6654 + gimp_prop_check_button_new (config, "compensate-at-last",
6655 + _("Draw pen line to finished point:"));
6656 + gtk_box_pack_start (GTK_VBOX (compensate_vbox), checkbox, FALSE, FALSE, 0);
6657 + gtk_widget_show(checkbox);
6660 + hbox = gtk_hbox_new (FALSE, 2);
6661 + gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
6662 + gtk_widget_show (hbox);
6664 + /* Blob type radiobuttons */
6665 + frame = gimp_prop_enum_radio_frame_new (config, "blob-type",
6667 + gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0);
6668 + gtk_widget_show (frame);
6673 + GimpInkBlobType blob_type;
6676 + gtk_container_get_children (GTK_CONTAINER (GTK_BIN (frame)->child));
6678 + for (list = children, blob_type = GIMP_INK_BLOB_TYPE_ELLIPSE;
6680 + list = g_list_next (list), blob_type++)
6682 + GtkWidget *radio = GTK_WIDGET (list->data);
6685 + gtk_container_remove (GTK_CONTAINER (radio), GTK_BIN (radio)->child);
6687 + blob = blob_image_new (blob_type);
6688 + gtk_container_add (GTK_CONTAINER (radio), blob);
6689 + gtk_widget_show (blob);
6692 + g_list_free (children);
6695 + /* Blob shape widget */
6696 + frame = gimp_frame_new (_("Shape"));
6697 + gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0);
6698 + gtk_widget_show (frame);
6700 + blob_vbox = gtk_vbox_new (FALSE, 2);
6701 + gtk_container_add (GTK_CONTAINER (frame), blob_vbox);
6702 + gtk_widget_show (blob_vbox);
6704 + frame = gtk_aspect_frame_new (NULL, 0.0, 0.5, 1.0, FALSE);
6705 + gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
6706 + gtk_box_pack_start (GTK_BOX (blob_vbox), frame, TRUE, TRUE, 0);
6707 + gtk_widget_show (frame);
6709 + editor = gimp_blob_editor_new (ink_options->blob_type,
6710 + ink_options->blob_aspect,
6711 + ink_options->blob_angle);
6712 + gtk_widget_set_size_request (editor, 60, 60);
6713 + gtk_container_add (GTK_CONTAINER (frame), editor);
6714 + gtk_widget_show (editor);
6716 + gimp_config_connect (config, G_OBJECT (editor), NULL);
6722 +blob_image_new (GimpInkBlobType blob_type)
6724 + const gchar *stock_id = NULL;
6726 + switch (blob_type)
6728 + case GIMP_INK_BLOB_TYPE_ELLIPSE:
6729 + stock_id = GIMP_STOCK_SHAPE_CIRCLE;
6732 + case GIMP_INK_BLOB_TYPE_SQUARE:
6733 + stock_id = GIMP_STOCK_SHAPE_SQUARE;
6736 + case GIMP_INK_BLOB_TYPE_DIAMOND:
6737 + stock_id = GIMP_STOCK_SHAPE_DIAMOND;
6741 + return gtk_image_new_from_stock (stock_id, GTK_ICON_SIZE_MENU);
6743 --- gimp-2.6.6/app/tools/gimpink2options-gui.h 1970-01-01 09:00:00 +0900
6744 +++ gimp-painter--2.6.6/app/tools/gimpink2options-gui.h 2009-03-17 10:42:37 +0900
6746 +/* GIMP - The GNU Image Manipulation Program
6747 + * Copyright (C) 1995 Spencer Kimball and Peter Mattis
6749 + * This program is free software; you can redistribute it and/or modify
6750 + * it under the terms of the GNU General Public License as published by
6751 + * the Free Software Foundation; either version 2 of the License, or
6752 + * (at your option) any later version.
6754 + * This program is distributed in the hope that it will be useful,
6755 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
6756 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6757 + * GNU General Public License for more details.
6759 + * You should have received a copy of the GNU General Public License
6760 + * along with this program; if not, write to the Free Software
6761 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
6764 +#ifndef __GIMP_INK2_OPTIONS_GUI_H__
6765 +#define __GIMP_INK2_OPTIONS_GUI_H__
6768 +GtkWidget * gimp_ink2_options_gui (GimpToolOptions *tool_options);
6771 +#endif /* __GIMP_INK2_OPTIONS_GUI_H__ */
6772 --- gimp-2.6.6/app/tools/gimpinktool2.c 1970-01-01 09:00:00 +0900
6773 +++ gimp-painter--2.6.6/app/tools/gimpinktool2.c 2009-03-17 10:42:37 +0900
6775 +/* GIMP - The GNU Image Manipulation Program
6776 + * Copyright (C) 1995 Spencer Kimball and Peter Mattis
6778 + * This program is free software; you can redistribute it and/or modify
6779 + * it under the terms of the GNU General Public License as published by
6780 + * the Free Software Foundation; either version 2 of the License, or
6781 + * (at your option) any later version.
6783 + * This program is distributed in the hope that it will be useful,
6784 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
6785 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6786 + * GNU General Public License for more details.
6788 + * You should have received a copy of the GNU General Public License
6789 + * along with this program; if not, write to the Free Software
6790 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
6793 +#include "config.h"
6795 +#include <gtk/gtk.h>
6797 +#include "libgimpwidgets/gimpwidgets.h"
6799 +#include "tools-types.h"
6801 +#include "paint/gimpink2options.h"
6803 +#include "widgets/gimphelp-ids.h"
6805 +#include "gimpink2options-gui.h"
6806 +#include "gimpinktool2.h"
6807 +#include "gimptoolcontrol.h"
6809 +#include "gimp-intl.h"
6812 +G_DEFINE_TYPE (GimpInk2Tool, gimp_ink2_tool, GIMP_TYPE_PAINT_TOOL)
6814 +#define parent_class gimp_ink2_tool_parent_class
6818 +gimp_ink2_tool_register (GimpToolRegisterCallback callback,
6821 + (* callback) (GIMP_TYPE_INK2_TOOL,
6822 + GIMP_TYPE_INK2_OPTIONS,
6823 + gimp_ink2_options_gui,
6824 + GIMP_CONTEXT_FOREGROUND_MASK |
6825 + GIMP_CONTEXT_BACKGROUND_MASK |
6826 + GIMP_CONTEXT_OPACITY_MASK |
6827 + GIMP_CONTEXT_PAINT_MODE_MASK,
6830 + _("Draw in G-pen -2-"),
6832 + NULL, GIMP_HELP_TOOL_INK,
6833 + GIMP_STOCK_TOOL_INK,
6838 +gimp_ink2_tool_class_init (GimpInk2ToolClass *klass)
6843 +gimp_ink2_tool_init (GimpInk2Tool *ink_tool)
6845 + GimpTool *tool = GIMP_TOOL (ink_tool);
6847 + gimp_tool_control_set_tool_cursor (tool->control, GIMP_TOOL_CURSOR_INK);
6848 + gimp_tool_control_set_action_value_2 (tool->control,
6849 + "tools/tools-ink-blob-size-set");
6850 + gimp_tool_control_set_action_value_3 (tool->control,
6851 + "tools/tools-ink-blob-aspect-set");
6852 + gimp_tool_control_set_action_value_4 (tool->control,
6853 + "tools/tools-ink-blob-angle-set");
6855 + gimp_paint_tool_enable_color_picker (GIMP_PAINT_TOOL (ink_tool),
6856 + GIMP_COLOR_PICK_MODE_FOREGROUND);
6858 + /* G-Pen uses the own smoothing routin, so disable the GimpDisplayShell's one */
6859 + tool->max_coord_smooth = 0.0;
6861 --- gimp-2.6.6/app/tools/gimpinktool2.h 1970-01-01 09:00:00 +0900
6862 +++ gimp-painter--2.6.6/app/tools/gimpinktool2.h 2009-03-17 10:42:37 +0900
6864 +/* GIMP - The GNU Image Manipulation Program
6865 + * Copyright (C) 1995 Spencer Kimball and Peter Mattis
6867 + * This program is free software; you can redistribute it and/or modify
6868 + * it under the terms of the GNU General Public License as published by
6869 + * the Free Software Foundation; either version 2 of the License, or
6870 + * (at your option) any later version.
6872 + * This program is distributed in the hope that it will be useful,
6873 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
6874 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6875 + * GNU General Public License for more details.
6877 + * You should have received a copy of the GNU General Public License
6878 + * along with this program; if not, write to the Free Software
6879 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
6882 +#ifndef __GIMP_INK2_TOOL_H__
6883 +#define __GIMP_INK2_TOOL_H__
6886 +#include "gimppainttool.h"
6889 +#define GIMP_TYPE_INK2_TOOL (gimp_ink2_tool_get_type ())
6890 +#define GIMP_INK2_TOOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_INK2_TOOL, GimpInk2Tool))
6891 +#define GIMP_INK2_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_INK2_TOOL, GimpInk2ToolClass))
6892 +#define GIMP_IS_INK2_TOOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_INK2_TOOL))
6893 +#define GIMP_IS_INK2_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_INK2_TOOL))
6894 +#define GIMP_INK2_TOOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_INK2_TOOL, GimpInk2ToolClass))
6897 +typedef struct _GimpInk2Tool GimpInk2Tool;
6898 +typedef struct _GimpInk2ToolClass GimpInk2ToolClass;
6900 +struct _GimpInk2Tool
6902 + GimpPaintTool parent_instance;
6905 +struct _GimpInk2ToolClass
6907 + GimpPaintToolClass parent_class;
6911 +void gimp_ink2_tool_register (GimpToolRegisterCallback callback,
6914 +GType gimp_ink2_tool_get_type (void) G_GNUC_CONST;
6917 +#endif /* __GIMP_INK2_TOOL_H__ */
6918 --- gimp-2.6.6/app/tools/gimpmixbrushtool.c 1970-01-01 09:00:00 +0900
6919 +++ gimp-painter--2.6.6/app/tools/gimpmixbrushtool.c 2009-06-13 22:34:34 +0900
6921 +/* GIMP - The GNU Image Manipulation Program
6922 + * Copyright (C) 1995 Spencer Kimball and Peter Mattis
6924 + * This program is free software; you can redistribute it and/or modify
6925 + * it under the terms of the GNU General Public License as published by
6926 + * the Free Software Foundation; either version 2 of the License, or
6927 + * (at your option) any later version.
6929 + * This program is distributed in the hope that it will be useful,
6930 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
6931 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6932 + * GNU General Public License for more details.
6934 + * You should have received a copy of the GNU General Public License
6935 + * along with this program; if not, write to the Free Software
6936 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
6939 +#include "config.h"
6941 +#include <gtk/gtk.h>
6943 +#include "libgimpwidgets/gimpwidgets.h"
6945 +#include "tools-types.h"
6947 +#include "paint/gimpmixbrushoptions.h"
6949 +#include "widgets/gimphelp-ids.h"
6951 +#include "gimpmixbrushtool.h"
6952 +#include "gimppaintoptions-gui.h"
6953 +#include "gimptoolcontrol.h"
6955 +#include "gimp-intl.h"
6958 +static GtkWidget * gimp_mixbrush_options_gui (GimpToolOptions *tool_options);
6961 +G_DEFINE_TYPE (GimpMixbrushTool, gimp_mixbrush_tool, GIMP_TYPE_PAINTBRUSH_TOOL)
6965 +gimp_mixbrush_tool_register (GimpToolRegisterCallback callback,
6968 + (* callback) (GIMP_TYPE_MIXBRUSH_TOOL,
6969 + GIMP_TYPE_MIXBRUSH_OPTIONS,
6970 + gimp_mixbrush_options_gui,
6971 + GIMP_PAINT_OPTIONS_CONTEXT_MASK |
6972 + GIMP_CONTEXT_PATTERN_MASK |
6973 + GIMP_CONTEXT_GRADIENT_MASK,
6974 + "gimp-mixbrush-tool",
6976 + _("Mixbrush Tool: Brush with mixing color feature"),
6977 + N_("_Mixbrush"), "W",
6978 + NULL, GIMP_HELP_TOOL_PAINTBRUSH,
6979 + GIMP_STOCK_TOOL_PAINTBRUSH,
6984 +gimp_mixbrush_tool_class_init (GimpMixbrushToolClass *klass)
6989 +gimp_mixbrush_tool_init (GimpMixbrushTool *mixbrush)
6991 + GimpTool *tool = GIMP_TOOL (mixbrush);
6993 + gimp_tool_control_set_tool_cursor (tool->control, GIMP_TOOL_CURSOR_PAINTBRUSH);
6995 + gimp_paint_tool_enable_color_picker (GIMP_PAINT_TOOL (mixbrush),
6996 + GIMP_COLOR_PICK_MODE_FOREGROUND);
7000 +/* tool options stuff */
7003 +gimp_mixbrush_options_gui (GimpToolOptions *tool_options)
7005 + GObject *config = G_OBJECT (tool_options);
7006 + GtkWidget *vbox = gimp_paint_options_gui (tool_options);
7008 + GtkWidget *mixbrush_box;
7009 + GtkWidget *mixbrush_vbox;
7010 + GtkWidget *mixbrush_button;
7011 + GtkWidget *mixbrush_frame;
7014 + /* Texture configurations */
7016 + table = gtk_table_new (3, 7, FALSE);
7017 + gtk_table_set_col_spacings (GTK_TABLE (table), 2);
7019 + mixbrush_frame = gimp_prop_expanding_frame_new (config, "use-texture", "Use texture", table, NULL);
7021 + mixbrush_box = gimp_prop_pattern_box_new (NULL, GIMP_CONTEXT (tool_options), 2,
7022 + "pattern-view-type", "pattern-view-size");
7023 + gtk_table_attach (GTK_TABLE (table), mixbrush_box, 0, 3, 1, 2,
7024 + GTK_EXPAND | GTK_FILL, GTK_SHRINK | GTK_FILL,
7026 + gtk_widget_show (mixbrush_box);
7028 + gimp_prop_scale_entry_new (config, "texture-grain",
7029 + GTK_TABLE (table), 0, 2,
7032 + FALSE, -1.0, 1.0);
7035 + GtkWidget *expander = gtk_expander_new (_("Pressure"));
7036 + GtkWidget *inner_table = gtk_table_new (3, 4, FALSE);
7038 + gtk_container_add (GTK_CONTAINER (expander), inner_table);
7039 + gtk_table_attach (GTK_TABLE (table), expander, 0, 3, 3, 4,
7040 + GTK_EXPAND | GTK_FILL, GTK_SHRINK | GTK_FILL,
7043 + gimp_prop_scale_entry_new (config, "texture-grain-pressure-in1",
7044 + GTK_TABLE (inner_table), 0, 0,
7048 + gimp_prop_scale_entry_new (config, "texture-grain-pressure-in2",
7049 + GTK_TABLE (inner_table), 0, 1,
7053 + gimp_prop_scale_entry_new (config, "texture-grain-pressure-out1",
7054 + GTK_TABLE (inner_table), 0, 2,
7058 + gimp_prop_scale_entry_new (config, "texture-grain-pressure-out2",
7059 + GTK_TABLE (inner_table), 0, 3,
7064 + gtk_widget_show_all (expander);
7067 + gimp_prop_scale_entry_new (config, "texture-jitter",
7068 + GTK_TABLE (table), 0, 4,
7073 + mixbrush_button = gimp_prop_check_button_new (config, "texture-fringe", _("Apply fringe"));
7074 + gtk_table_attach (GTK_TABLE (table), mixbrush_button, 0, 3, 5, 6,
7075 + GTK_EXPAND | GTK_FILL, GTK_SHRINK | GTK_FILL,
7077 + gtk_widget_show (mixbrush_button);
7079 + gimp_prop_scale_entry_new (config, "texture-fringe-contrast",
7080 + GTK_TABLE (table), 0, 6,
7083 + FALSE, 1.0, 10.0);
7085 + gtk_box_pack_start (GTK_BOX (vbox), mixbrush_frame, FALSE, FALSE, 0);
7086 + gtk_widget_show (mixbrush_frame);
7089 + mixbrush_button = gimp_prop_check_button_new (config, "alpha-channel-mixing", _("Alpha channel mixing"));
7090 + gtk_box_pack_start (GTK_BOX (vbox), mixbrush_button, FALSE, TRUE, 0);
7091 + gtk_widget_show (mixbrush_button);
7093 + /* Main color configurations */
7094 + mixbrush_box = gtk_frame_new (_("Main Color"));
7095 + gtk_box_pack_start (GTK_BOX (vbox), mixbrush_box, FALSE, TRUE, 0);
7096 + gtk_widget_show(mixbrush_box);
7097 + mixbrush_vbox = gtk_vbox_new (FALSE, 2);
7098 + gtk_container_add (GTK_CONTAINER (mixbrush_box), mixbrush_vbox);
7099 + gtk_widget_show (mixbrush_vbox);
7101 + table = gtk_table_new (3, 6, FALSE);
7102 + gtk_table_set_col_spacings (GTK_TABLE (table), 2);
7103 + gtk_box_pack_start (GTK_BOX (mixbrush_vbox), table, TRUE, TRUE, 0);
7104 + gtk_widget_show (table);
7106 + mixbrush_button = gimp_prop_check_button_new (config, "pigment", _("Paint with pigment"));
7107 + gtk_table_attach (GTK_TABLE (table), mixbrush_button, 0, 3, 0, 1,
7108 + GTK_EXPAND | GTK_FILL, GTK_SHRINK | GTK_FILL,
7110 + gtk_widget_show (mixbrush_button);
7112 + gimp_prop_scale_entry_new (config, "main-color-density",
7113 + GTK_TABLE (table), 0, 1,
7119 + GtkWidget *expander = gtk_expander_new (_("Pressure"));
7120 + GtkWidget *inner_table = gtk_table_new (3, 4, FALSE);
7122 + gtk_container_add (GTK_CONTAINER (expander), inner_table);
7123 + gtk_table_attach (GTK_TABLE (table), expander, 0, 3, 2, 3,
7124 + GTK_EXPAND | GTK_FILL, GTK_SHRINK | GTK_FILL,
7127 + gimp_prop_scale_entry_new (config, "main-color-density-pressure-in1",
7128 + GTK_TABLE (inner_table), 0, 0,
7132 + gimp_prop_scale_entry_new (config, "main-color-density-pressure-in2",
7133 + GTK_TABLE (inner_table), 0, 1,
7137 + gimp_prop_scale_entry_new (config, "main-color-density-pressure-out1",
7138 + GTK_TABLE (inner_table), 0, 2,
7142 + gimp_prop_scale_entry_new (config, "main-color-density-pressure-out2",
7143 + GTK_TABLE (inner_table), 0, 3,
7148 + gtk_widget_show_all (expander);
7151 + adj = gimp_prop_scale_entry_new (config, "main-color-rate",
7152 + GTK_TABLE (table), 0, 3,
7156 + gimp_scale_entry_set_logarithmic (adj, TRUE);
7159 + GtkWidget *expander = gtk_expander_new (_("Pressure"));
7160 + GtkWidget *inner_table = gtk_table_new (3, 4, FALSE);
7162 + gtk_container_add (GTK_CONTAINER (expander), inner_table);
7163 + gtk_table_attach (GTK_TABLE (table), expander, 0, 3, 4, 5,
7164 + GTK_EXPAND | GTK_FILL, GTK_SHRINK | GTK_FILL,
7167 + gimp_prop_scale_entry_new (config, "main-color-pressure-in1",
7168 + GTK_TABLE (inner_table), 0, 0,
7172 + gimp_prop_scale_entry_new (config, "main-color-pressure-in2",
7173 + GTK_TABLE (inner_table), 0, 1,
7177 + gimp_prop_scale_entry_new (config, "main-color-pressure-out1",
7178 + GTK_TABLE (inner_table), 0, 2,
7182 + gimp_prop_scale_entry_new (config, "main-color-pressure-out2",
7183 + GTK_TABLE (inner_table), 0, 3,
7188 + gtk_widget_show_all (expander);
7191 + gimp_prop_scale_entry_new (config, "dryout",
7192 + GTK_TABLE (table), 0, 5,
7195 + TRUE, 0.0, 10000);
7197 + /* Canvas Color Picking Configurations */
7198 + mixbrush_box = gtk_frame_new (_("Canvas Color"));
7199 + gtk_box_pack_start (GTK_BOX (vbox), mixbrush_box, FALSE, TRUE, 0);
7200 + gtk_widget_show(mixbrush_box);
7201 + mixbrush_vbox = gtk_vbox_new (FALSE, 2);
7202 + gtk_container_add (GTK_CONTAINER (mixbrush_box), mixbrush_vbox);
7203 + gtk_widget_show (mixbrush_vbox);
7205 + table = gtk_table_new (3, 5, FALSE);
7206 + gtk_table_set_col_spacings (GTK_TABLE (table), 2);
7207 + gtk_box_pack_start (GTK_BOX (mixbrush_vbox), table, TRUE, TRUE, 0);
7208 + gtk_widget_show (table);
7210 + gimp_prop_scale_entry_new (config, "canvas-color-density",
7211 + GTK_TABLE (table), 0, 0,
7217 + GtkWidget *expander = gtk_expander_new (_("Pressure"));
7218 + GtkWidget *inner_table = gtk_table_new (3, 4, FALSE);
7220 + gtk_container_add (GTK_CONTAINER (expander), inner_table);
7221 + gtk_table_attach (GTK_TABLE (table), expander, 0, 3, 1, 2,
7222 + GTK_EXPAND | GTK_FILL, GTK_SHRINK | GTK_FILL,
7225 + gimp_prop_scale_entry_new (config, "canvas-color-density-pressure-in1",
7226 + GTK_TABLE (inner_table), 0, 0,
7230 + gimp_prop_scale_entry_new (config, "canvas-color-density-pressure-in2",
7231 + GTK_TABLE (inner_table), 0, 1,
7235 + gimp_prop_scale_entry_new (config, "canvas-color-density-pressure-out1",
7236 + GTK_TABLE (inner_table), 0, 2,
7240 + gimp_prop_scale_entry_new (config, "canvas-color-density-pressure-out2",
7241 + GTK_TABLE (inner_table), 0, 3,
7246 + gtk_widget_show_all (expander);
7249 + gimp_prop_scale_entry_new (config, "canvas-color-rate",
7250 + GTK_TABLE (table), 0, 2,
7256 + GtkWidget *expander = gtk_expander_new (_("Pressure"));
7257 + GtkWidget *inner_table = gtk_table_new (3, 4, FALSE);
7259 + gtk_container_add (GTK_CONTAINER (expander), inner_table);
7260 + gtk_table_attach (GTK_TABLE (table), expander, 0, 3, 3, 4,
7261 + GTK_EXPAND | GTK_FILL, GTK_SHRINK | GTK_FILL,
7264 + gimp_prop_scale_entry_new (config, "canvas-color-pressure-in1",
7265 + GTK_TABLE (inner_table), 0, 0,
7269 + gimp_prop_scale_entry_new (config, "canvas-color-pressure-in2",
7270 + GTK_TABLE (inner_table), 0, 1,
7274 + gimp_prop_scale_entry_new (config, "canvas-color-pressure-out1",
7275 + GTK_TABLE (inner_table), 0, 2,
7279 + gimp_prop_scale_entry_new (config, "canvas-color-pressure-out2",
7280 + GTK_TABLE (inner_table), 0, 3,
7285 + gtk_widget_show_all (expander);
7289 + mixbrush_box = gtk_frame_new (_("Pick up"));
7290 + gtk_box_pack_start (GTK_BOX (vbox), mixbrush_box, FALSE, TRUE, 0);
7291 + gtk_widget_show(mixbrush_box);
7292 + mixbrush_vbox = gtk_vbox_new (FALSE, 2);
7293 + gtk_container_add (GTK_CONTAINER (mixbrush_box), mixbrush_vbox);
7294 + gtk_widget_show (mixbrush_vbox);
7296 + table = gtk_table_new (3, 1, FALSE);
7297 + gtk_table_set_col_spacings (GTK_TABLE (table), 2);
7298 + gtk_box_pack_start (GTK_BOX (mixbrush_vbox), table, TRUE, TRUE, 0);
7299 + gtk_widget_show (table);
7301 + gimp_prop_scale_entry_new (config, "sample-size-limit",
7302 + GTK_TABLE (table), 0, 0,
7303 + _("Sample size:"),
7305 + TRUE, 1.0, 100.0);
7307 + /*mixbrush_button = gimp_prop_check_button_new (config, "merged", _("Pick up underlying color"));*/
7308 + mixbrush_button = gimp_prop_check_button_new (config, "merged", _("Use merged color"));
7309 + gtk_box_pack_start (GTK_BOX (mixbrush_vbox), mixbrush_button, TRUE, TRUE, 0);
7310 + gtk_widget_show (mixbrush_button);
7312 + table = gtk_table_new (3, 1, FALSE);
7313 + gtk_table_set_col_spacings (GTK_TABLE (table), 2);
7314 + gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0);
7315 + gtk_widget_show (table);
7317 + gimp_prop_scale_entry_new (config, "delay",
7318 + GTK_TABLE (table), 0, 0,
7323 + mixbrush_button = gimp_prop_check_button_new (config, "tail", _("Paint the tail of stroke (delay > 0)"));
7324 + gtk_box_pack_start (GTK_BOX (vbox), mixbrush_button, FALSE, TRUE, 0);
7325 + gtk_widget_show (mixbrush_button);
7327 + mixbrush_frame = gimp_prop_enum_radio_frame_new (config, "hidden-color",
7328 + _("Assume that the hidden color is:"),
7330 + gtk_box_pack_start (GTK_BOX (vbox), mixbrush_frame, FALSE, TRUE, 0);
7331 + gtk_widget_show (mixbrush_frame);
7333 + /*mixbrush_button = gimp_prop_check_button_new (config, "remove-color", _("Remove background color"));
7334 + gtk_box_pack_start (GTK_BOX (vbox), mixbrush_button, FALSE, TRUE, 0);
7335 + gtk_widget_show (mixbrush_button);*/
7339 --- gimp-2.6.6/app/tools/gimpmixbrushtool.h 1970-01-01 09:00:00 +0900
7340 +++ gimp-painter--2.6.6/app/tools/gimpmixbrushtool.h 2009-03-17 10:42:37 +0900
7342 +/* GIMP - The GNU Image Manipulation Program
7343 + * Copyright (C) 1995 Spencer Kimball and Peter Mattis
7345 + * This program is free software; you can redistribute it and/or modify
7346 + * it under the terms of the GNU General Public License as published by
7347 + * the Free Software Foundation; either version 2 of the License, or
7348 + * (at your option) any later version.
7350 + * This program is distributed in the hope that it will be useful,
7351 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
7352 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7353 + * GNU General Public License for more details.
7355 + * You should have received a copy of the GNU General Public License
7356 + * along with this program; if not, write to the Free Software
7357 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
7360 +#ifndef __GIMP_MIXBRUSH_TOOL_H__
7361 +#define __GIMP_MIXBRUSH_TOOL_H__
7364 +#include "gimppaintbrushtool.h"
7367 +#define GIMP_TYPE_MIXBRUSH_TOOL (gimp_mixbrush_tool_get_type ())
7368 +#define GIMP_MIXBRUSH_TOOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_MIXBRUSH_TOOL, GimpMixbrushTool))
7369 +#define GIMP_MIXBRUSH_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_MIXBRUSH_TOOL, GimpMixbrushToolClass))
7370 +#define GIMP_IS_MIXBRUSH_TOOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_MIXBRUSH_TOOL))
7371 +#define GIMP_IS_MIXBRUSH_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_MIXBRUSH_TOOL))
7372 +#define GIMP_MIXBRUSH_TOOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_MIXBRUSH_TOOL, GimpMixbrushToolClass))
7375 +typedef struct _GimpMixbrushTool GimpMixbrushTool;
7376 +typedef struct _GimpMixbrushToolClass GimpMixbrushToolClass;
7378 +struct _GimpMixbrushTool
7380 + GimpPaintbrushTool parent_instance;
7383 +struct _GimpMixbrushToolClass
7385 + GimpPaintbrushToolClass parent_class;
7389 +void gimp_mixbrush_tool_register (GimpToolRegisterCallback callback,
7392 +GType gimp_mixbrush_tool_get_type (void) G_GNUC_CONST;
7395 +#endif /* __GIMP_MIXBRUSH_TOOL_H__ */
7396 --- gimp-2.6.6/app/tools/gimppaintoptions-gui.c 2008-11-21 07:42:58 +0900
7397 +++ gimp-painter--2.6.6/app/tools/gimppaintoptions-gui.c 2009-03-21 03:47:06 +0900
7399 #include "widgets/gimpwidgets-utils.h"
7401 #include "gimpairbrushtool.h"
7402 +#include "gimpblendtool.h"
7403 +#include "gimpbucketfilltool.h"
7404 #include "gimpclonetool.h"
7405 #include "gimpconvolvetool.h"
7406 #include "gimpdodgeburntool.h"
7408 #include "gimppenciltool.h"
7409 #include "gimpperspectiveclonetool.h"
7410 #include "gimpsmudgetool.h"
7411 +#include "gimpinktool2.h"
7412 +#include "gimpmixbrushtool.h"
7413 #include "gimptooloptions-gui.h"
7415 #include "gimp-intl.h"
7417 static gboolean tool_has_size_dynamics (GType tool_type);
7418 static gboolean tool_has_color_dynamics (GType tool_type);
7420 -static void pressure_options_gui (GimpPaintOptions *paint_options,
7424 - GtkWidget *labels[]);
7425 -static void velocity_options_gui (GimpPaintOptions *paint_options,
7429 -static void random_options_gui (GimpPaintOptions *paint_options,
7433 -static GtkWidget * fade_options_gui (GimpPaintOptions *paint_options,
7435 -static GtkWidget * gradient_options_gui (GimpPaintOptions *paint_options,
7437 - GtkWidget *incremental_toggle);
7438 -static GtkWidget * jitter_options_gui (GimpPaintOptions *paint_options,
7440 +static void pressure_options_gui (GimpPaintOptions *paint_options,
7444 + GtkWidget *labels[]);
7445 +static void velocity_options_gui (GimpPaintOptions *paint_options,
7449 +static void random_options_gui (GimpPaintOptions *paint_options,
7453 +static GtkWidget * fade_options_gui (GimpPaintOptions *paint_options,
7455 +static GtkWidget * gradient_options_gui (GimpPaintOptions *paint_options,
7457 + GtkWidget *incremental_toggle);
7458 +static GtkWidget * jitter_options_gui (GimpPaintOptions *paint_options,
7460 +static GtkWidget * update_freq_options_gui (GimpUpdateFreqOptions *update_freq,
7461 + GimpPaintOptions *paint_options,
7465 /* public functions */
7466 @@ -125,6 +132,24 @@
7467 gimp_prop_opacity_entry_new (config, "opacity",
7468 GTK_TABLE (table), 0, table_row++,
7470 + /* the flow scale */
7471 + if (g_type_is_a (tool_type, GIMP_TYPE_PAINTBRUSH_TOOL) &&
7472 + tool_type != GIMP_TYPE_AIRBRUSH_TOOL)
7473 + gimp_prop_opacity_entry_new (config, "flow",
7474 + GTK_TABLE (table), 0, table_row++,
7476 + /* coords smoothing */
7477 + if (tool_type != GIMP_TYPE_INK2_TOOL &&
7478 + tool_type != GIMP_TYPE_BLEND_TOOL &&
7479 + tool_type != GIMP_TYPE_BUCKET_FILL_TOOL)
7481 + gimp_prop_scale_entry_new (config, "max-coord-smooth",
7482 + GTK_TABLE (table), 0, table_row++,
7490 if (g_type_is_a (tool_type, GIMP_TYPE_BRUSH_TOOL))
7491 @@ -143,6 +168,19 @@
7494 gimp_scale_entry_set_logarithmic (adj, TRUE);
7496 + gimp_prop_scale_entry_new (config, "pressure-min-scale",
7497 + GTK_TABLE (table), 0, table_row++,
7498 + _("Minimum scale:"),
7502 + adj = gimp_prop_scale_entry_new (config, "pressure-power-size",
7503 + GTK_TABLE (table), 0, table_row++,
7507 + gimp_scale_entry_set_logarithmic (adj, TRUE);
7510 if (tool_has_opacity_dynamics (tool_type))
7512 /* the "incremental" toggle */
7513 if (tool_type == GIMP_TYPE_PENCIL_TOOL ||
7514 tool_type == GIMP_TYPE_PAINTBRUSH_TOOL ||
7515 + tool_type == GIMP_TYPE_MIXBRUSH_TOOL ||
7516 tool_type == GIMP_TYPE_ERASER_TOOL)
7518 incremental_toggle =
7519 @@ -289,6 +328,14 @@
7520 gtk_widget_show (frame);
7523 + frame = update_freq_options_gui (options->update_freq_options,
7524 + options, tool_type);
7527 + gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
7528 + gtk_widget_show (frame);
7535 tool_type == GIMP_TYPE_ERASER_TOOL ||
7536 tool_type == GIMP_TYPE_DODGE_BURN_TOOL ||
7537 tool_type == GIMP_TYPE_PAINTBRUSH_TOOL ||
7538 + tool_type == GIMP_TYPE_MIXBRUSH_TOOL ||
7539 tool_type == GIMP_TYPE_SMUDGE_TOOL);
7542 @@ -631,13 +679,13 @@
7543 _("Use color from gradient"),
7546 - if (incremental_toggle)
7547 + /*if (incremental_toggle)
7549 gtk_widget_set_sensitive (incremental_toggle,
7550 ! paint_options->gradient_options->use_gradient);
7551 g_object_set_data (G_OBJECT (button), "inverse_sensitive",
7552 incremental_toggle);
7556 /* the gradient view */
7557 button = gimp_prop_gradient_box_new (NULL, GIMP_CONTEXT (config), 2,
7558 @@ -674,3 +722,52 @@
7564 +update_freq_options_gui (GimpUpdateFreqOptions *update_freq,
7565 + GimpPaintOptions *paint_options,
7568 + GObject *config = G_OBJECT (paint_options);
7569 + GtkWidget *frame = NULL;
7571 + if (tool_type != GIMP_TYPE_PERSPECTIVE_CLONE_TOOL &&
7572 + tool_type != GIMP_TYPE_BLEND_TOOL &&
7573 + tool_type != GIMP_TYPE_BUCKET_FILL_TOOL)
7577 + table = gtk_table_new (3, 5, FALSE);
7578 + gtk_table_set_col_spacings (GTK_TABLE (table), 2);
7580 + frame = gimp_prop_expanding_frame_new (config, "reduce-update-frequency",
7581 + _("Reduce update frequency"),
7584 + gimp_prop_scale_entry_new (config, "update-freq-size-threshold",
7585 + GTK_TABLE (table), 0, 0,
7588 + TRUE, 0.1, 100.0);
7590 + gimp_prop_scale_entry_new (config, "update-freq-velo-threshold",
7591 + GTK_TABLE (table), 0, 1,
7594 + TRUE, 0.001, 0.1);
7596 + gimp_prop_scale_entry_new (config, "update-freq-gamma",
7597 + GTK_TABLE (table), 0, 2,
7602 + gimp_prop_scale_entry_new (config, "update-freq-max-n-dabs",
7603 + GTK_TABLE (table), 0, 3,
7611 --- gimp-2.6.6/app/widgets/gimpdeviceinfo.c 2008-11-21 07:43:04 +0900
7612 +++ gimp-painter--2.6.6/app/widgets/gimpdeviceinfo.c 2009-06-16 01:28:34 +0900
7613 @@ -428,6 +428,18 @@
7614 device_info->num_keys = device->num_keys;
7615 device_info->keys = NULL;
7618 + //g_printerr ("- - - ->> device name : %s\n", device->name);
7620 + gchar *name = g_ascii_strdown (device->name, -1);
7622 + if (g_strrstr (name, "puck"))
7623 + gdk_device_set_source (device, GDK_SOURCE_CURSOR);
7632 --- gimp-2.6.6/app/widgets/gimptooloptionseditor.c 2008-11-21 07:43:04 +0900
7633 +++ gimp-painter--2.6.6/app/widgets/gimptooloptionseditor.c 2009-03-17 10:42:37 +0900
7635 GimpToolPresets *presets);
7636 static void gimp_tool_options_editor_save_presets (GimpToolOptionsEditor *editor);
7638 +static void gimp_tool_options_editor_style_set (GtkWidget *widget,
7639 + GtkStyle *prev_style);
7642 G_DEFINE_TYPE_WITH_CODE (GimpToolOptionsEditor, gimp_tool_options_editor,
7644 @@ -97,10 +100,21 @@
7646 GObjectClass *object_class = G_OBJECT_CLASS (klass);
7647 GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (klass);
7648 + GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
7650 object_class->constructor = gimp_tool_options_editor_constructor;
7652 gtk_object_class->destroy = gimp_tool_options_editor_destroy;
7654 + widget_class->style_set = gimp_tool_options_editor_style_set;
7656 + gtk_widget_class_install_style_property (widget_class,
7657 + g_param_spec_int ("content-border",
7662 + GIMP_PARAM_READABLE));
7666 @@ -523,3 +537,20 @@
7667 gtk_widget_set_sensitive (editor->delete_button, delete_sensitive);
7668 gtk_widget_set_sensitive (editor->reset_button, reset_sensitive);
7673 +gimp_tool_options_editor_style_set (GtkWidget *widget,
7674 + GtkStyle *prev_style)
7676 + GimpToolOptionsEditor *editor = GIMP_TOOL_OPTIONS_EDITOR (widget);
7677 + gint content_border;
7679 + //GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
7681 + gtk_widget_style_get (widget,
7682 + "content-border", &content_border,
7685 + gtk_container_set_border_width (GTK_CONTAINER (editor->options_vbox), content_border);