public Bitmap Apply( Bitmap image )
{
// lock source bitmap data
BitmapData imageData = image.LockBits(
new Rectangle( 0, 0, image.Width, image.Height ),
ImageLockMode.ReadOnly, image.PixelFormat );
// apply the filter
Bitmap dstImage = Apply( imageData );
// unlock source image
image.UnlockBits( imageData );
return dstImage;
}