src/Foundation/Media/Gimela.Media.Imaging/Filters/BaseUsingCopyPartialFilter.cs
/// <summary>
/// Apply filter to an image or its part.
/// </summary>
/// 
/// <param name="image">Image to apply filter to.</param>
/// <param name="rect">Image rectangle for processing by the filter.</param>
/// 
/// <remarks>The method applies the filter directly to the provided source image.</remarks>
/// 
/// <exception cref="UnsupportedImageFormatException">Unsupported pixel format of the source image.</exception>
/// 
Apply filter to an image or its part.
Apply filter to an image or its part .
public void ApplyInPlace(Bitmap image, Rectangle rect)
    {
      BitmapData data = image.LockBits(
          new Rectangle(0, 0, image.Width, image.Height),
          ImageLockMode.ReadWrite, image.PixelFormat);
      try
      {
        ApplyInPlace(new UnmanagedImage(data), rect);
      }
      finally
      {
        image.UnlockBits(data);
      }
    }
public void ApplyInPlace ( Bitmap image , Rectangle rect ) { BitmapData data = image . LockBits ( new Rectangle ( 0 , 0 , image . Width , image . Height ) , ImageLockMode . ReadWrite , image . PixelFormat ) ; try { ApplyInPlace ( new UnmanagedImage ( data ) , rect ) ; } finally { image . UnlockBits ( data ) ; } }
Apply filter to an image or its part.
Apply filter to an image or its part .
// lock source bitmap data // apply the filter // unlock image
Unsupported pixel format of the source image.
Unsupported pixel format of the source image .
image
Bitmap
Image to apply filter to.
Image to apply filter to .
rect
Rectangle
Image rectangle for processing by the filter.
Image rectangle for processing by the filter .
remarks
The method applies the filter directly to the provided source image.
The method applies the filter directly to the provided source image .