Grazie MItaly!!!! Ho adattato un codice trovato in quelle pagine in questo modo:
codice:
// Lock the bitmap's bits.
Rectangle rect = new Rectangle(0, 0, Form1.bmp.Width, Form1.bmp.Height);
System.Drawing.Imaging.BitmapData bmpData =
Form1.bmp.LockBits(rect, System.Drawing.Imaging.ImageLockMode.ReadWrite,
Form1.bmp.PixelFormat);
// Get the address of the first line.
IntPtr ptr = bmpData.Scan0;
// Declare an array to hold the bytes of the bitmap.
int bytes = Math.Abs(bmpData.Stride) * Form1.bmp.Height;
byte[] rgbValues = new byte[bytes];
// Copy the RGB values into the array.
System.Runtime.InteropServices.Marshal.Copy(ptr, rgbValues, 0, bytes);
/*
// Set every third value to 255. A 24bpp bitmap will look red.
for (int counter = 2; counter < rgbValues.Length; counter += 3)
rgbValues[counter] = 255;
*/
// Set every value to value - 32.
for (int counter = 0; counter < rgbValues.Length; counter++)
{
rgbValues[counter] -= 32;
if (rgbValues[counter] < 32)
rgbValues[counter] = 32;
}
// Copy the RGB values back to the bitmap
System.Runtime.InteropServices.Marshal.Copy(rgbValues, 0, ptr, bytes);
// Unlock the bits.
Form1.bmp.UnlockBits(bmpData);
P.Image = Form1.bmp;
E' molto veloce! A parte qualche brillamento negli istanti iniziali, poi procede benino. Veramente grazie, non mi rimane che studiarlo capirlo e perfezionarlo.