Patch for bug in noisify plugin

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

If you set any of the noisify parameters to 0.0, the plugin doesn't set
the destination pixel, so it just contains uninitialised data.   You can
see this by opening a new image, add an alpha channel, run noisify, move
the alpha parameter to 0.0, and go.  You should end up with a
transparent image, when it shouldn't have changed the alpha channel at
all.

--
Julian Kinraid ....... jkinraid@xxxxxxxxxxxx ....... ICQ:17257217



--- noisify.c	Mon Jan 17 13:31:56 2000
+++ noisify_new.c	Mon Jan 17 13:15:40 2000
@@ -267,15 +267,18 @@
 		  if (nvals.independent == TRUE)
 		    noise = (gint) (nvals.noise[b] * gauss() * 127);
 
-		  
-		  p = src[b] + noise;
-		  if (p < 0)
-		    p = 0;
-		  else if (p > 255)
-		    p = 255;
 		  if (nvals.noise[b] != 0)
-		    dest[b] = p;
-		  
+		    {
+		      p = src[b] + noise;
+		      if (p < 0)
+		        p = 0;
+		      else if (p > 255)
+		        p = 255;
+		      dest[b] = p;
+		    }
+		  else
+		    dest[b] = src[b];
+
 		}
 	      src += src_rgn.bpp;
 	      dest += dest_rgn.bpp;


[Index of Archives]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [GIMP for Windows]     [KDE]     [GEGL]     [Gimp's Home]     [Gimp on GUI]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux