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