Index: gimp/app/paint/gimpairbrush.c
===================================================================
RCS file: /cvs/gnome/gimp/app/paint/gimpairbrush.c,v
retrieving revision 1.93
diff -u -p -r1.93 gimpairbrush.c
--- a/gimp/app/paint/gimpairbrush.c	15 Jul 2003 15:38:24 -0000	1.93
+++ b/gimp/app/paint/gimpairbrush.c	22 May 2004 05:53:40 -0000
@@ -155,6 +155,7 @@ gimp_airbrush_paint (GimpPaintCore      
 
       GIMP_PAINT_CORE_CLASS (parent_class)->paint (paint_core, drawable,
                                                    paint_options, paint_state);
+      paint_core->stipple = TRUE;
       break;
 
     case MOTION_PAINT:
Index: gimp/app/paint/gimpclone.c
===================================================================
RCS file: /cvs/gnome/gimp/app/paint/gimpclone.c,v
retrieving revision 1.109
diff -u -p -r1.109 gimpclone.c
--- a/gimp/app/paint/gimpclone.c	18 Jan 2004 13:19:59 -0000	1.109
+++ b/gimp/app/paint/gimpclone.c	22 May 2004 05:53:40 -0000
@@ -209,6 +209,8 @@ gimp_clone_paint (GimpPaintCore      *pa
       if (options->clone_type == GIMP_PATTERN_CLONE)
 	if (! gimp_context_get_pattern (context))
 	  g_message (_("No patterns available for this operation."));
+
+      paint_core->stipple = FALSE;
       break;
 
     case MOTION_PAINT:
Index: gimp/app/paint/gimpconvolve.c
===================================================================
RCS file: /cvs/gnome/gimp/app/paint/gimpconvolve.c,v
retrieving revision 1.89
diff -u -p -r1.89 gimpconvolve.c
--- a/gimp/app/paint/gimpconvolve.c	16 Jul 2003 11:25:37 -0000	1.89
+++ b/gimp/app/paint/gimpconvolve.c	22 May 2004 05:53:40 -0000
@@ -175,6 +175,10 @@ gimp_convolve_paint (GimpPaintCore      
 {
   switch (paint_state)
     {
+    case INIT_PAINT:
+      paint_core->stipple = TRUE;
+      break;
+
     case MOTION_PAINT:
       gimp_convolve_motion (paint_core, drawable, paint_options);
       break;
Index: gimp/app/paint/gimpdodgeburn.c
===================================================================
RCS file: /cvs/gnome/gimp/app/paint/gimpdodgeburn.c,v
retrieving revision 1.73
diff -u -p -r1.73 gimpdodgeburn.c
--- a/gimp/app/paint/gimpdodgeburn.c	16 Jul 2003 11:25:37 -0000	1.73
+++ b/gimp/app/paint/gimpdodgeburn.c	22 May 2004 05:53:40 -0000
@@ -178,6 +178,8 @@ gimp_dodge_burn_paint (GimpPaintCore    
                                  options->type,
                                  options->mode,
                                  drawable);
+
+      paint_core->stipple = FALSE;
       break;
 
     case MOTION_PAINT:
Index: gimp/app/paint/gimperaser.c
===================================================================
RCS file: /cvs/gnome/gimp/app/paint/gimperaser.c,v
retrieving revision 1.87
diff -u -p -r1.87 gimperaser.c
--- a/gimp/app/paint/gimperaser.c	16 Jul 2003 11:25:37 -0000	1.87
+++ b/gimp/app/paint/gimperaser.c	22 May 2004 05:53:40 -0000
@@ -122,6 +122,10 @@ gimp_eraser_paint (GimpPaintCore      *p
 {
   switch (paint_state)
     {
+    case INIT_PAINT:
+      paint_core->stipple = TRUE;
+      break;
+
     case MOTION_PAINT:
       gimp_eraser_motion (paint_core, drawable, paint_options);
       break;
Index: gimp/app/paint/gimppaintbrush.c
===================================================================
RCS file: /cvs/gnome/gimp/app/paint/gimppaintbrush.c,v
retrieving revision 1.45
diff -u -p -r1.45 gimppaintbrush.c
--- a/gimp/app/paint/gimppaintbrush.c	22 Jul 2003 14:23:56 -0000	1.45
+++ b/gimp/app/paint/gimppaintbrush.c	22 May 2004 05:53:40 -0000
@@ -122,6 +122,10 @@ gimp_paintbrush_paint (GimpPaintCore    
 {
   switch (paint_state)
     {
+    case INIT_PAINT:
+      paint_core->stipple = FALSE;
+      break;
+
     case MOTION_PAINT:
       _gimp_paintbrush_motion (paint_core, drawable, paint_options,
                                GIMP_OPACITY_OPAQUE);
Index: gimp/app/paint/gimppaintcore.c
===================================================================
RCS file: /cvs/gnome/gimp/app/paint/gimppaintcore.c,v
retrieving revision 1.105.2.1
diff -u -p -r1.105.2.1 gimppaintcore.c
--- a/gimp/app/paint/gimppaintcore.c	19 May 2004 10:33:25 -0000	1.105.2.1
+++ b/gimp/app/paint/gimppaintcore.c	22 May 2004 05:53:41 -0000
@@ -1881,7 +1881,8 @@ brush_to_canvas_tiles (GimpPaintCore *co
                                                    xoff * maskPR.bytes);
 
   /*  combine the mask to the canvas tiles  */
-  combine_mask_and_region (&srcPR, &maskPR, brush_opacity * 255.999);
+  combine_mask_and_region (&srcPR, &maskPR, brush_opacity * 255.999,
+                           core->stipple);
 }
 
 static void
Index: gimp/app/paint/gimppaintcore.h
===================================================================
RCS file: /cvs/gnome/gimp/app/paint/gimppaintcore.h,v
retrieving revision 1.34
diff -u -p -r1.34 gimppaintcore.h
--- a/gimp/app/paint/gimppaintcore.h	17 Sep 2003 12:05:10 -0000	1.34
+++ b/gimp/app/paint/gimppaintcore.h	22 May 2004 05:53:41 -0000
@@ -92,6 +92,8 @@ struct _GimpPaintCore
   GimpPaintCoreFlags  flags;         /*  tool flags, see ToolFlags above  */
   gboolean            use_pressure;  /*  look at coords->pressure         */
 
+  gboolean            stipple;
+
   /*  undo blocks variables  */
   TileManager        *undo_tiles;
   TileManager        *canvas_tiles;
Index: gimp/app/paint/gimpsmudge.c
===================================================================
RCS file: /cvs/gnome/gimp/app/paint/gimpsmudge.c,v
retrieving revision 1.63
diff -u -p -r1.63 gimpsmudge.c
--- a/gimp/app/paint/gimpsmudge.c	16 Jul 2003 11:25:37 -0000	1.63
+++ b/gimp/app/paint/gimpsmudge.c	22 May 2004 05:53:41 -0000
@@ -158,6 +158,10 @@ gimp_smudge_paint (GimpPaintCore      *p
 
   switch (paint_state)
     {
+    case INIT_PAINT:
+      paint_core->stipple = FALSE;
+      break;
+
     case MOTION_PAINT:
       /* initialization fails if the user starts outside the drawable */
       if (! smudge->initialized)
Index: gimp/app/paint-funcs/paint-funcs-generic.h
===================================================================
RCS file: /cvs/gnome/gimp/app/paint-funcs/paint-funcs-generic.h,v
retrieving revision 1.21
diff -u -p -r1.21 paint-funcs-generic.h
--- a/gimp/app/paint-funcs/paint-funcs-generic.h	28 Jan 2004 03:58:52 -0000	1.21
+++ b/gimp/app/paint-funcs/paint-funcs-generic.h	22 May 2004 05:53:41 -0000
@@ -1379,34 +1379,71 @@ apply_mask_to_alpha_channel (guchar     
 
 
 inline void
-combine_mask_and_alpha_channel (guchar       *src,
+combine_mask_and_alpha_channel_stipple (guchar       *src,
 				const guchar *mask,
 				guint         opacity,
 				guint         length,
 				guint         bytes)
 {
   gint mask_val;
-  gint alpha;
   gint tmp;
 
-  alpha = bytes - 1;
-  src += alpha;
+  /* align with alpha channel */
+  src += bytes - 1;
 
   if (opacity != 255)
     while (length --)
-    {
-      mask_val = INT_MULT(*mask, opacity, tmp);
-      mask++;
-      *src = *src + INT_MULT((255 - *src) , mask_val, tmp);
-      src += bytes;
-    }
+      {
+        mask_val = INT_MULT(*mask, opacity, tmp);
+        *src = *src + INT_MULT((255 - *src) , mask_val, tmp);
+
+        src += bytes;
+        mask++;
+      }
   else
     while (length --)
-    {
-      *src = *src + INT_MULT((255 - *src) , *mask, tmp);
-      src += bytes;
-      mask++;
-    }
+      {
+        *src = *src + INT_MULT((255 - *src) , *mask, tmp);
+
+        src += bytes;
+        mask++;
+      }
+}
+
+
+inline void
+combine_mask_and_alpha_channel_stroke (guchar       *src,
+				const guchar *mask,
+				guint         opacity,
+				guint         length,
+				guint         bytes)
+{
+  gint mask_val;
+  gint tmp;
+
+  /* align with alpha channel */
+  src += bytes - 1;
+
+  if (opacity != 255)
+    while (length --)
+      {
+        if (opacity > *src)
+          {
+            mask_val = INT_MULT(*mask, opacity, tmp);
+            *src = *src + INT_MULT((opacity - *src) , mask_val, tmp);
+          }
+        
+        src += bytes;
+        mask++;
+      }
+  else
+    while (length --)
+      {
+        *src = *src + INT_MULT((255 - *src) , *mask, tmp);
+
+        src += bytes;
+        mask++;
+      }
 }
 
 
Index: gimp/app/paint-funcs/paint-funcs.c
===================================================================
RCS file: /cvs/gnome/gimp/app/paint-funcs/paint-funcs.c,v
retrieving revision 1.158
diff -u -p -r1.158 paint-funcs.c
--- a/gimp/app/paint-funcs/paint-funcs.c	13 Mar 2004 11:34:45 -0000	1.158
+++ b/gimp/app/paint-funcs/paint-funcs.c	22 May 2004 05:53:42 -0000
@@ -4233,7 +4233,7 @@ apply_mask_to_region (PixelRegion *src,
 
 
 static void
-combine_mask_and_sub_region (gint        *opacityp,
+combine_mask_and_sub_region_stipple (gint        *opacityp,
 			     PixelRegion *src,
 			     PixelRegion *mask)
 {
@@ -4248,20 +4248,48 @@ combine_mask_and_sub_region (gint       
 
   while (h --)
     {
-      combine_mask_and_alpha_channel (s, m, opacity, src->w, src->bytes);
+      combine_mask_and_alpha_channel_stipple (s, m, opacity, src->w, src->bytes);
       s += src->rowstride;
       m += mask->rowstride;
     }
 }
 
+
+static void
+combine_mask_and_sub_region_stroke (gint        *opacityp,
+			     PixelRegion *src,
+			     PixelRegion *mask)
+{
+  gint    h;
+  guchar *s;
+  guchar *m;
+  gint    opacity = *opacityp;
+
+  s = src->data;
+  m = mask->data;
+  h = src->h;
+
+  while (h --)
+    {
+      combine_mask_and_alpha_channel_stroke (s, m, opacity, src->w, src->bytes);
+      s += src->rowstride;
+      m += mask->rowstride;
+    }
+}
+
+
 void
 combine_mask_and_region (PixelRegion *src,
 			 PixelRegion *mask,
-			 guint        opacity)
+			 guint        opacity,
+       gboolean     stipple)
 {
-
-  pixel_regions_process_parallel ((p_func)combine_mask_and_sub_region,
-				  &opacity, 2, src, mask);
+  if (stipple)
+    pixel_regions_process_parallel ((p_func)combine_mask_and_sub_region_stipple,
+                                    &opacity, 2, src, mask);
+  else
+    pixel_regions_process_parallel ((p_func)combine_mask_and_sub_region_stroke,
+                                    &opacity, 2, src, mask);
 }
 
 
Index: gimp/app/paint-funcs/paint-funcs.h
===================================================================
RCS file: /cvs/gnome/gimp/app/paint-funcs/paint-funcs.h,v
retrieving revision 1.42.2.1
diff -u -p -r1.42.2.1 paint-funcs.h
--- a/gimp/app/paint-funcs/paint-funcs.h	15 Apr 2004 12:42:07 -0000	1.42.2.1
+++ b/gimp/app/paint-funcs/paint-funcs.h	22 May 2004 05:53:42 -0000
@@ -340,7 +340,8 @@ void  swap_region                       
 void  apply_mask_to_region                (PixelRegion *, PixelRegion *, guint);
 
 /*  Combine a mask with an image's alpha channel  */
-void  combine_mask_and_region             (PixelRegion *, PixelRegion *, guint);
+void  combine_mask_and_region             (PixelRegion *, PixelRegion *, guint,
+                                           gboolean);
 
 /*  Copy a gray image to an intensity-alpha region  */
 void  copy_gray_to_region                 (PixelRegion *, PixelRegion *);
