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); }