Ejemplo n.º 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); 
 }
Ejemplo n.º 2
0
 private static void WriteByte(ImageBuffer dest, int x, int y, byte r, byte g, byte b)
 {
     if (x < dest.Width && y < dest.Height)
     {
         dest.SafeSetPixel(x, y, Color.FromArgb(r, g, b));
     }
 }