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