public Bitmap Apply( Bitmap sourceImage )
{
BitmapData data = sourceImage.LockBits( new Rectangle( 0, 0, sourceImage.Width, sourceImage.Height ),
ImageLockMode.ReadOnly, sourceImage.PixelFormat );
Bitmap result = null;
try
{
result = Apply( new UnmanagedImage( data ) );
if ( ( sourceImage.HorizontalResolution > 0 ) && ( sourceImage.VerticalResolution > 0 ) )
{
result.SetResolution( sourceImage.HorizontalResolution, sourceImage.VerticalResolution );
}
}
finally
{
sourceImage.UnlockBits( data );
}
return result;
}