--- gimp-painter--2.6.6.orig/app/dialogs/about-dialog.c Sat Mar 21 06:11:06 2009 +++ gimp-painter--2.6.6/app/dialogs/about-dialog.c Sat Mar 21 01:51:02 2009 @@ -609,7 +609,7 @@ gtk_widget_show (label); #endif - label = gtk_label_new (_("gimp-painter- (release 20090317)")); + label = gtk_label_new (_("gimp-painter- (release 20090321)")); gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0); gtk_box_reorder_child (GTK_BOX (vbox), label, 2); gtk_widget_show (label); --- gimp-painter--2.6.6.orig/app/paint/gimpbrushcore.c Sat Mar 21 06:11:06 2009 +++ gimp-painter--2.6.6/app/paint/gimpbrushcore.c Wed Mar 18 18:46:15 2009 @@ -828,6 +828,7 @@ gimp_brush_core_paste_canvas (GimpBrushCore *core, GimpDrawable *drawable, gdouble brush_opacity, + gdouble brush_flow, gdouble image_opacity, GimpLayerModeEffects paint_mode, GimpBrushApplicationMode brush_hardness, @@ -860,7 +861,7 @@ paint_core->canvas_buf->height); gimp_paint_core_paste (paint_core, &brush_maskPR, drawable, - brush_opacity, + brush_opacity, brush_flow, image_opacity, paint_mode, mode, update_freq_options); } --- gimp-painter--2.6.6.orig/app/paint/gimpbrushcore.h Sat Mar 21 06:11:06 2009 +++ gimp-painter--2.6.6/app/paint/gimpbrushcore.h Wed Mar 18 18:40:48 2009 @@ -108,6 +108,7 @@ void gimp_brush_core_paste_canvas (GimpBrushCore *core, GimpDrawable *drawable, gdouble brush_opacity, + gdouble brush_flow, gdouble image_opacity, GimpLayerModeEffects paint_mode, GimpBrushApplicationMode brush_hardness, --- gimp-painter--2.6.6.orig/app/paint/gimpclone.c Sat Mar 21 06:11:06 2009 +++ gimp-painter--2.6.6/app/paint/gimpclone.c Thu Mar 19 06:54:56 2009 @@ -244,6 +244,7 @@ gimp_brush_core_paste_canvas (GIMP_BRUSH_CORE (paint_core), drawable, MIN (opacity, GIMP_OPACITY_OPAQUE), + GIMP_OPACITY_OPAQUE, gimp_context_get_opacity (context), gimp_context_get_paint_mode (context), gimp_paint_options_get_brush_mode (paint_options), --- gimp-painter--2.6.6.orig/app/paint/gimperaser.c Sat Mar 21 06:11:06 2009 +++ gimp-painter--2.6.6/app/paint/gimperaser.c Thu Mar 19 06:56:21 2009 @@ -139,6 +139,7 @@ gimp_brush_core_paste_canvas (GIMP_BRUSH_CORE (paint_core), drawable, MIN (opacity, GIMP_OPACITY_OPAQUE), + GIMP_OPACITY_OPAQUE, gimp_context_get_opacity (context), (options->anti_erase ? GIMP_ANTI_ERASE_MODE : GIMP_ERASE_MODE), --- gimp-painter--2.6.6.orig/app/paint/gimpink.c Sat Mar 21 06:11:06 2009 +++ gimp-painter--2.6.6/app/paint/gimpink.c Wed Mar 18 19:45:32 2009 @@ -327,6 +327,7 @@ gimp_paint_core_paste (paint_core, &blob_maskPR, drawable, GIMP_OPACITY_OPAQUE, + GIMP_OPACITY_OPAQUE, gimp_context_get_opacity (context), gimp_context_get_paint_mode (context), GIMP_PAINT_CONSTANT, --- gimp-painter--2.6.6.orig/app/paint/gimpink2.c Sat Mar 21 06:11:06 2009 +++ gimp-painter--2.6.6/app/paint/gimpink2.c Wed Mar 18 19:52:11 2009 @@ -422,6 +422,7 @@ gimp_paint_core_paste (paint_core, &blob_maskPR, drawable, GIMP_OPACITY_OPAQUE, + GIMP_OPACITY_OPAQUE, gimp_context_get_opacity (context), gimp_context_get_paint_mode (context), GIMP_PAINT_CONSTANT, --- gimp-painter--2.6.6.orig/app/paint/gimpmixbrush.c Sat Mar 21 06:11:06 2009 +++ gimp-painter--2.6.6/app/paint/gimpmixbrush.c Wed Mar 18 18:41:56 2009 @@ -705,8 +705,8 @@ history->opacity *= last_color->a; gimp_brush_core_paste_canvas (brush_core, drawable, - MIN (history->opacity * gimp_context_get_flow (context), - GIMP_OPACITY_OPAQUE), + MIN (history->opacity, GIMP_OPACITY_OPAQUE), + gimp_context_get_flow (context), gimp_context_get_opacity (context), gimp_context_get_paint_mode (context), gimp_paint_options_get_brush_mode (paint_options), --- gimp-painter--2.6.6.orig/app/paint/gimppaintbrush.c Sat Mar 21 06:11:06 2009 +++ gimp-painter--2.6.6/app/paint/gimppaintbrush.c Sat Mar 21 01:59:38 2009 @@ -103,7 +103,7 @@ _gimp_paintbrush_motion (GimpPaintCore *paint_core, GimpDrawable *drawable, GimpPaintOptions *paint_options, - gdouble opacity) + gdouble flow) { GimpBrushCore *brush_core = GIMP_BRUSH_CORE (paint_core); GimpContext *context = GIMP_CONTEXT (paint_options); @@ -114,11 +114,12 @@ GimpPaintApplicationMode paint_appl_mode; gdouble grad_point; gdouble hardness; + gdouble opacity; image = gimp_item_get_image (GIMP_ITEM (drawable)); - opacity *= gimp_paint_options_get_fade (paint_options, image, - paint_core->pixel_dist); + opacity = gimp_paint_options_get_fade (paint_options, image, + paint_core->pixel_dist); if (opacity == 0.0) return; @@ -177,13 +178,15 @@ opacity *= gimp_paint_options_get_dynamic_opacity (paint_options, &paint_core->cur_coords); + flow *= gimp_context_get_flow (context); + hardness = gimp_paint_options_get_dynamic_hardness (paint_options, &paint_core->cur_coords); /* finally, let the brush core paste the colored area on the canvas */ gimp_brush_core_paste_canvas (brush_core, drawable, - MIN (opacity * gimp_context_get_flow (context), - GIMP_OPACITY_OPAQUE), + MIN (opacity, GIMP_OPACITY_OPAQUE), + flow, gimp_context_get_opacity (context), gimp_context_get_paint_mode (context), gimp_paint_options_get_brush_mode (paint_options), --- gimp-painter--2.6.6.orig/app/paint/gimppaintbrush.h Sat Mar 21 06:10:52 2009 +++ gimp-painter--2.6.6/app/paint/gimppaintbrush.h Sat Mar 21 01:59:38 2009 @@ -55,7 +55,7 @@ void _gimp_paintbrush_motion (GimpPaintCore *paint_core, GimpDrawable *drawable, GimpPaintOptions *paint_options, - gdouble opacity); + gdouble flow); #endif /* __GIMP_PAINTBRUSH_H__ */ --- gimp-painter--2.6.6.orig/app/paint/gimppaintcore.c Sat Mar 21 06:11:06 2009 +++ gimp-painter--2.6.6/app/paint/gimppaintcore.c Fri Mar 20 05:21:43 2009 @@ -101,13 +101,14 @@ static void paint_mask_to_canvas_tiles (GimpPaintCore *core, PixelRegion *paint_maskPR, + gdouble paint_opacity_limit, gdouble paint_opacity); static void paint_mask_to_canvas_buf (GimpPaintCore *core, PixelRegion *paint_maskPR, gdouble paint_opacity); static void canvas_tiles_to_canvas_buf (GimpPaintCore *core); -static inline gdouble drawable_update_reduced_freq (GimpDrawable *drawable, +static inline void drawable_update_reduced_freq (GimpDrawable *drawable, GimpPaintCore *core, GimpUpdateFreqOptions *update_freq_options); @@ -822,10 +823,13 @@ return core->orig_proj_buf; } +/* paint_opacity_limitが従来のpaint_opacityにあたる */ +/* paint_opacityはPaintbrushのFlowパラメータのために使う */ void gimp_paint_core_paste (GimpPaintCore *core, PixelRegion *paint_maskPR, GimpDrawable *drawable, + gdouble paint_opacity_limit, gdouble paint_opacity, gdouble image_opacity, GimpLayerModeEffects paint_mode, @@ -986,7 +990,7 @@ } } - paint_mask_to_canvas_tiles (core, paint_maskPR, paint_opacity); + paint_mask_to_canvas_tiles (core, paint_maskPR, paint_opacity_limit, paint_opacity); #else gimp_paint_core_validate_canvas_tiles (core, core->canvas_buf->x, @@ -994,7 +998,7 @@ core->canvas_buf->width, core->canvas_buf->height); - paint_mask_to_canvas_tiles (core, paint_maskPR, paint_opacity); + paint_mask_to_canvas_tiles (core, paint_maskPR, paint_opacity_limit, paint_opacity); #endif } @@ -1006,7 +1010,7 @@ */ else { - paint_mask_to_canvas_buf (core, paint_maskPR, paint_opacity); + paint_mask_to_canvas_buf (core, paint_maskPR, paint_opacity_limit); } /* intialize canvas buf source pixel regions */ @@ -1063,6 +1067,7 @@ { gimp_paint_core_paste (core, paint_maskPR, drawable, paint_opacity, + GIMP_OPACITY_OPAQUE, image_opacity, GIMP_NORMAL_MODE, mode, update_freq_options); @@ -1091,7 +1096,7 @@ core->canvas_buf->height); /* combine the paint mask and the canvas tiles */ - paint_mask_to_canvas_tiles (core, paint_maskPR, paint_opacity); + paint_mask_to_canvas_tiles (core, paint_maskPR, paint_opacity, GIMP_OPACITY_OPAQUE); /* initialize the maskPR from the canvas tiles */ pixel_region_init (paint_maskPR, core->canvas_tiles, @@ -1165,6 +1170,7 @@ static void paint_mask_to_canvas_tiles (GimpPaintCore *core, PixelRegion *paint_maskPR, + gdouble paint_opacity_limit, gdouble paint_opacity) { PixelRegion srcPR; @@ -1178,8 +1184,13 @@ TRUE); /* combine the mask to the canvas tiles */ - combine_mask_and_region (&srcPR, paint_maskPR, - paint_opacity * 255.999, GIMP_IS_PAINTBRUSH (core)); + if (GIMP_IS_PAINTBRUSH (core)) + combine_mask_and_region_limit (&srcPR, paint_maskPR, + paint_opacity_limit * 255.999, + paint_opacity * 255.999); + else + combine_mask_and_region (&srcPR, paint_maskPR, + paint_opacity_limit * 255.999, FALSE); } static void @@ -1307,7 +1318,7 @@ } -static inline gdouble +static inline void drawable_update_reduced_freq (GimpDrawable *drawable, GimpPaintCore *core, GimpUpdateFreqOptions *update_freq_options) --- gimp-painter--2.6.6.orig/app/paint/gimppaintcore.h Sat Mar 21 06:11:06 2009 +++ gimp-painter--2.6.6/app/paint/gimppaintcore.h Wed Mar 18 18:51:52 2009 @@ -163,6 +163,7 @@ void gimp_paint_core_paste (GimpPaintCore *core, PixelRegion *paint_maskPR, GimpDrawable *drawable, + gdouble paint_opacity_limit, gdouble paint_opacity, gdouble image_opacity, GimpLayerModeEffects paint_mode, --- gimp-painter--2.6.6.orig/app/paint-funcs/paint-funcs-generic.h Sat Mar 21 06:10:52 2009 +++ gimp-painter--2.6.6/app/paint-funcs/paint-funcs-generic.h Thu Mar 19 07:34:59 2009 @@ -1533,6 +1533,48 @@ inline void +combine_mask_and_alpha_channel_stroke_limit (guchar *src, + const guchar *mask, + guint limit, + guint opacity, + guint length, + guint bytes) +{ + /* align with alpha channel */ + src += bytes - 1; + + if (opacity != 255 || limit != 255) + { + gint tmp; + gint _opacity = INT_MULT (opacity, limit, tmp); + + while (length --) + { + if (limit > *src) + { + gint mask_val = INT_MULT (*mask, _opacity, tmp); + + *src = *src + INT_MULT ((limit - *src) , mask_val, tmp); + } + + src += bytes; + mask++; + } + } + else + while (length --) + { + gint tmp; + + *src = *src + INT_MULT ((255 - *src) , *mask, tmp); + + src += bytes; + mask++; + } +} + + +inline void copy_gray_to_inten_a_pixels (const guchar *src, guchar *dest, guint length, --- gimp-painter--2.6.6.orig/app/paint-funcs/paint-funcs.c Sat Mar 21 06:10:52 2009 +++ gimp-painter--2.6.6/app/paint-funcs/paint-funcs.c Wed Mar 18 21:13:06 2009 @@ -3906,6 +3906,26 @@ } +static void +combine_mask_and_sub_region_stroke_limit (guint *param, + PixelRegion *src, + PixelRegion *mask) +{ + guchar *s = src->data; + const guchar *m = mask->data; + gint h = src->h; + guint limit = param[0]; + guint opacity = param[1]; + + while (h--) + { + combine_mask_and_alpha_channel_stroke_limit (s, m, limit, opacity, src->w, src->bytes); + s += src->rowstride; + m += mask->rowstride; + } +} + + void combine_mask_and_region (PixelRegion *src, PixelRegion *mask, @@ -3920,6 +3940,23 @@ pixel_regions_process_parallel ((PixelProcessorFunc) combine_mask_and_sub_region_stroke, &opacity, 2, src, mask); +} + + +void +combine_mask_and_region_limit (PixelRegion *src, + PixelRegion *mask, + guint limit, + guint opacity) +{ + guint param[2]; + + param[0] = limit; + param[1] = opacity; + + pixel_regions_process_parallel ((PixelProcessorFunc) + combine_mask_and_sub_region_stroke_limit, + param, 2, src, mask); } --- gimp-painter--2.6.6.orig/app/paint-funcs/paint-funcs.h Sat Mar 21 06:10:52 2009 +++ gimp-painter--2.6.6/app/paint-funcs/paint-funcs.h Wed Mar 18 21:13:01 2009 @@ -444,6 +444,11 @@ guint opacity, gboolean stipple); +void combine_mask_and_region_limit (PixelRegion *src, + PixelRegion *mask, + guint limit, + guint opacity); + /* Copy a gray image to an intensity-alpha region */ void copy_gray_to_region (PixelRegion *src, PixelRegion *dest); --- gimp-painter--2.6.6.orig/app/tools/gimppaintoptions-gui.c Sat Mar 21 06:11:07 2009 +++ gimp-painter--2.6.6/app/tools/gimppaintoptions-gui.c Sat Mar 21 03:47:06 2009 @@ -133,7 +133,8 @@ GTK_TABLE (table), 0, table_row++, _("Opacity:")); /* the flow scale */ - if (g_type_is_a (tool_type, GIMP_TYPE_PAINTBRUSH_TOOL)) + if (g_type_is_a (tool_type, GIMP_TYPE_PAINTBRUSH_TOOL) && + tool_type != GIMP_TYPE_AIRBRUSH_TOOL) gimp_prop_opacity_entry_new (config, "flow", GTK_TABLE (table), 0, table_row++, _("Flow:"));