I have the following code: BitmapSource bitmap = _bitmapSource; if (_bitmapSource.Format != PixelFormats.Bgra32) bitmap = new FormatConvertedBitmap(_bitmapSource, PixelFormats.Bgra32, null, 0); int bytesPerPixel = (bitmap.Format.BitsPerPixel + 7) / 8; int pixelWidth = bitmap.PixelWidth; int pixelHeight = bitmap.PixelHeight; int stride = bytesPerPixel * pixelWidth; int pixelCount = pixelWidth * pixelHeight; var pixelBytes [...] read more
I'm trying to use WIC to load images in C#, with SharpDX as a wrapper (this is a Direct2D application written in .NET). I can load my image perfectly fine by creating a BitmapDecoder like so: C# Code: new BitmapDecoder(Factory, fileName, NativeFileAccess.Read, DecodeOptions.CacheOnLoad) C++ Equivalent: hr = m_pIWICFactory->CreateDecoderFromFilename( fileName, NULL, [...] read more