Beispiel #1
0
 private static void AddNoise(ImageBuffer source, double noiseLevel)
 {
     Parallel.For(0, source.Height, (y) =>
     {
         for (int x = 0; x < source.Width; x++)
         {
             var px = source.SafeGetPixel(x, y);
             byte r = Noise.Add(px.R, noiseLevel), g = Noise.Add(px.G, noiseLevel), b = Noise.Add(px.B, noiseLevel);
             source.SafeSetPixel(x, y, Color.FromArgb(r, g, b));
         }
     });
     source.Save("noised.png", ImageFormat.Png); 
 }
Beispiel #2
0
 private static Color ReadColor(ImageBuffer source, int x, int y)
 {
     x = CutCoord(source.Width, x);
     y = CutCoord(source.Height, y);
     return source.SafeGetPixel(x, y);
 }