public static IComObject <IWICBitmap> CreateBitmapFromSourceRect(this IWICImagingFactory factory, IWICBitmapSource source, int x, int y, int width, int height) { if (factory == null) { throw new ArgumentNullException(nameof(factory)); } if (source == null) { throw new ArgumentNullException(nameof(source)); } factory.CreateBitmapFromSourceRect(source, x, y, width, height, out var value).ThrowOnError(); return(new ComObject <IWICBitmap>(value)); }
public static IWICBitmap CreateBitmapFromSourceRect(this IWICImagingFactory imagingFactory, IWICBitmapSource pIBitmapSource, WICRect rect) { return(imagingFactory.CreateBitmapFromSourceRect(pIBitmapSource, rect.X, rect.Y, rect.Width, rect.Height)); }