private static IBitmapSource <ColorPbgra32> CreateBufferedTileScaler(IImagingFactory imagingFactory, IBitmapSource <ColorBgra32> source, int dstWidth, int dstHeight, BitmapInterpolationMode interpolationMode) { IBitmapSource <ColorPbgra32> source5; using (IBitmap <ColorBgra32> bitmap = BitmapAllocator.Bgra32.Allocate <ColorBgra32>(source.Size.Width, imagingFactory.GetBufferBitmapHeight(source, 7), AllocationOptions.Default)) { using (IBitmapSource <ColorBgra32> source2 = imagingFactory.CreateBufferedBitmap <ColorBgra32>(source, bitmap, 7)) { using (IBitmapSource <ColorPbgra32> source3 = imagingFactory.CreateFormatConvertedBitmap <ColorPbgra32>(source2)) { source5 = imagingFactory.CreateBitmapScaler <ColorPbgra32>(source3, dstWidth, dstHeight, interpolationMode); } } } return(source5); }
public static IBitmapSource <TPixel> CreateBitmapScaler <TPixel>(this IImagingFactory factory, IBitmapSource <TPixel> source, int dstWidth, int dstHeight, BitmapInterpolationMode mode) where TPixel : struct, INaturalPixelInfo => ((IBitmapSource <TPixel>)factory.CreateBitmapScaler(source, dstWidth, dstHeight, mode));