--- gimp-painter--2.4.6.old/app/paint/gimpmixbrush.c Sun Jun 8 01:37:08 2008 +++ gimp-painter--2.4.6/app/paint/gimpmixbrush.c Sun Jun 8 02:03:33 2008 @@ -142,6 +142,7 @@ GimpRGB *paint_color, gdouble opacity, gboolean fringe, + gdouble fringe_contrast, gdouble grain, GimpUpdateFreqOptions *update_freq_options); @@ -163,6 +164,7 @@ gint drawable_x, gint drawable_y, gboolean fringe, + gdouble fringe_contrast, gdouble grain, const gboolean is_rgb, const gboolean has_alpha, @@ -650,6 +652,7 @@ texture, last_color, op, mixbrush_options->texture_options->fringe, + mixbrush_options->texture_options->fringe_contrast, grain, paint_options->update_freq_options); } @@ -1019,6 +1022,7 @@ GimpRGB *paint_color, gdouble opacity, gboolean fringe, + gdouble fringe_contrast, gdouble grain, GimpUpdateFreqOptions *update_freq_options) { @@ -1080,6 +1084,7 @@ x, y, dx, dy, fringe, + fringe_contrast, grain, is_rgb, has_alpha, @@ -1248,13 +1253,16 @@ if (has_alpha && active_components[src_bytes - 1]) { + gfloat n; + guint32 _n; + src_op = _src_data[src_bytes - 1] / 255.0; /* workaround against insufficiency of opacity */ /*if (paint_color->a > src_op) op = pow (opacity, 1.0 / 1.5) * mask_op;*/ - gfloat n = paint_color->a - src_op; - guint32 _n = (*(guint32 *) &n) >> 31; + n = paint_color->a - src_op; + _n = (*(guint32 *) &n) >> 31; op = (opacity * _n + adjusted_opacity * (1 - _n)) * mask_op; component = (paint_color->a * op + src_op * (1.0 - op)) * 255.0/* + error.a*/; @@ -1324,6 +1332,7 @@ gint drawable_x, gint drawable_y, gboolean fringe, + gdouble fringe_contrast, gdouble grain, const gboolean is_rgb, const gboolean has_alpha, @@ -1338,6 +1347,7 @@ guchar *texture_data; GimpRGB _paint_color; gdouble adjusted_opacity = pow (opacity, 1.0 / 1.5); + gdouble fringe_contrast_offset = (fringe_contrast - 1.0) * 0.5; /*static GimpRGB error = {0.0, 0.0, 0.0, 0.0}; GimpRGB _error = {0.0, 0.0, 0.0, 0.0};*/ @@ -1400,22 +1410,27 @@ if (fringe) { - gdouble _mask_op = faster_pow (mask_op, 1.5); - texture_op = (texture_op * (1.0 - _mask_op) + _mask_op); + texture_op = (texture_op * (1.0 - mask_op) + mask_op); + mask_op = CLAMP (mask_op * texture_op * fringe_contrast - fringe_contrast_offset, 0.0, 1.0); } + else + mask_op *= texture_op; - if (texture_op) + if (mask_op) { if (has_alpha && active_components[src_bytes - 1]) { + gfloat n; + guint32 _n; + src_op = _src_data[src_bytes - 1] / 255.0; /* workaround against insufficiency of opacity */ /*if (paint_color->a > src_op) op = pow (opacity, 1.0 / 1.5) * mask_op;*/ - gfloat n = paint_color->a - src_op; - guint32 _n = (*(guint32 *) &n) >> 31; - op = (opacity * _n + adjusted_opacity * (1 - _n)) * mask_op * texture_op; + n = paint_color->a - src_op; + _n = (*(guint32 *) &n) >> 31; + op = (opacity * _n + adjusted_opacity * (1 - _n)) * mask_op; component = (paint_color->a * op + src_op * (1.0 - op)) * 255.0/* + error.a*/; _src_data[src_bytes - 1] = component + .5; @@ -1424,7 +1439,7 @@ else src_op = 1.0; - op = opacity * mask_op * texture_op; + op = opacity * mask_op; paint_color_op = paint_color->a * op; if (paint_color_op > 0.0) --- gimp-painter--2.4.6.old/app/paint/gimpmixbrushoptions.c Sun Jun 8 01:37:09 2008 +++ gimp-painter--2.4.6/app/paint/gimpmixbrushoptions.c Sun Jun 8 00:56:07 2008 @@ -30,6 +30,7 @@ #define MIXBRUSH_DEFAULT_USE_TEXTURE FALSE #define MIXBRUSH_DEFAULT_TEXTURE_FRINGE FALSE +#define MIXBRUSH_DEFAULT_TEXTURE_FRINGE_CONTRAST 1.0 #define MIXBRUSH_DEFAULT_TEXTURE_GRAIN 0.0 #define MIXBRUSH_DEFAULT_MAIN_COLOR_DENSITY 0.5 @@ -59,6 +60,7 @@ PROP_0, PROP_USE_TEXTURE, PROP_TEXTURE_FRINGE, + PROP_TEXTURE_FRINGE_CONTRAST, PROP_TEXTURE_GRAIN, PROP_TEXTURE_GRAIN_PRESSURE_IN1, PROP_TEXTURE_GRAIN_PRESSURE_IN2, @@ -134,6 +136,11 @@ MIXBRUSH_DEFAULT_TEXTURE_FRINGE, GIMP_PARAM_STATIC_STRINGS); + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_TEXTURE_FRINGE_CONTRAST, + "texture-fringe-contrast", NULL, + 1.0, 10.0, MIXBRUSH_DEFAULT_TEXTURE_FRINGE_CONTRAST, + GIMP_PARAM_STATIC_STRINGS); + GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_TEXTURE_GRAIN, "texture-grain", NULL, -1.0, 1.0, MIXBRUSH_DEFAULT_TEXTURE_GRAIN, @@ -347,6 +354,9 @@ case PROP_TEXTURE_FRINGE: texture_options->fringe = g_value_get_boolean (value); break; + case PROP_TEXTURE_FRINGE_CONTRAST: + texture_options->fringe_contrast = g_value_get_double (value); + break; case PROP_TEXTURE_GRAIN: texture_options->grain = g_value_get_double (value); break; @@ -474,6 +484,9 @@ break; case PROP_TEXTURE_FRINGE: g_value_set_boolean (value, texture_options->fringe); + break; + case PROP_TEXTURE_FRINGE_CONTRAST: + g_value_set_double (value, texture_options->fringe_contrast); break; case PROP_TEXTURE_GRAIN: g_value_set_double (value, texture_options->grain); --- gimp-painter--2.4.6.old/app/paint/gimpmixbrushoptions.h Sun Jun 8 01:37:09 2008 +++ gimp-painter--2.4.6/app/paint/gimpmixbrushoptions.h Sun Jun 8 00:17:14 2008 @@ -52,6 +52,7 @@ { gboolean use_texture; gboolean fringe; + gdouble fringe_contrast; gdouble grain; gdouble grain_pressure_in1; gdouble grain_pressure_in2; --- gimp-painter--2.4.6.old/app/tools/gimpmixbrushtool.c Sun Jun 8 01:37:09 2008 +++ gimp-painter--2.4.6/app/tools/gimpmixbrushtool.c Sun Jun 8 00:56:28 2008 @@ -92,7 +92,7 @@ /* Texture configurations */ { - table = gtk_table_new (3, 5, FALSE); + table = gtk_table_new (3, 6, FALSE); gtk_table_set_col_spacings (GTK_TABLE (table), 2); mixbrush_frame = gimp_prop_expanding_frame_new (config, "use-texture", "Use texture", table, NULL); @@ -104,14 +104,8 @@ 0, 0); gtk_widget_show (mixbrush_box); - mixbrush_button = gimp_prop_check_button_new (config, "texture-fringe", _("Apply fringe")); - gtk_table_attach (GTK_TABLE (table), mixbrush_button, 0, 3, 2, 3, - GTK_EXPAND | GTK_FILL, GTK_SHRINK | GTK_FILL, - 0, 0); - gtk_widget_show (mixbrush_button); - gimp_prop_scale_entry_new (config, "texture-grain", - GTK_TABLE (table), 0, 3, + GTK_TABLE (table), 0, 2, _("Grain:"), 0.01, 0.1, 2, FALSE, -1.0, 1.0); @@ -121,7 +115,7 @@ GtkWidget *inner_table = gtk_table_new (3, 4, FALSE); gtk_container_add (GTK_CONTAINER (expander), inner_table); - gtk_table_attach (GTK_TABLE (table), expander, 0, 3, 4, 5, + gtk_table_attach (GTK_TABLE (table), expander, 0, 3, 3, 4, GTK_EXPAND | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0); @@ -148,6 +142,18 @@ gtk_widget_show_all (expander); } + + mixbrush_button = gimp_prop_check_button_new (config, "texture-fringe", _("Apply fringe")); + gtk_table_attach (GTK_TABLE (table), mixbrush_button, 0, 3, 4, 5, + GTK_EXPAND | GTK_FILL, GTK_SHRINK | GTK_FILL, + 0, 0); + gtk_widget_show (mixbrush_button); + + gimp_prop_scale_entry_new (config, "texture-fringe-contrast", + GTK_TABLE (table), 0, 5, + _("Contrast:"), + 0.5, 1.0, 1, + FALSE, 1.0, 10.0); gtk_box_pack_start (GTK_BOX (vbox), mixbrush_frame, FALSE, FALSE, 0); gtk_widget_show (mixbrush_frame);