4

I'm using SharpDX for my WinRT application. For the pixel shaders I try to load the image with this code

private Bitmap LoadImage(System.IO.Stream stream)
{
  var bitmapDecoder = new SharpDX.WIC.BitmapDecoder(
        this.deviceManager.WICFactory,
        stream,
        SharpDX.WIC.DecodeOptions.CacheOnLoad);

  var converter = new SharpDX.WIC.FormatConverter(this.deviceManager.WICFactory);
  converter.Initialize(
        bitmapDecoder.GetFrame(0),
        SharpDX.WIC.PixelFormat.Format32bppPBGRA,
        SharpDX.WIC.BitmapDitherType.None,
        null,
        0.0f,
        SharpDX.WIC.BitmapPaletteType.Custom);

  return Bitmap.FromWicBitmap(this.deviceManager.ContextDirect2D, converter);
}

It works perfect within simulator or on the tablets with Intel CPU (for example Acer Iconia). But I have a strange error on tablets with ARM processor (Windows Surface, Asus). The Bitmap.FromWicBitmap returns a Bitmap object, it is not null, has right DPI and PixelFormat informations, but the Size.Width and Size.Height are 0. No exception occurred, but the loaded Bitmap has no data (-> black image). The images to load are normal jpg or png files and have a small size (f.e. 256x1 pix). Do I forget something? Thanks for the answers.

Re Flex
  • 41
  • 1
  • Same issue on 8.1 phone. ShaprDX v2.6.3. Seems to be a bug in 'FromWicBitmap' function. – x2. Feb 27 '17 at 15:21

0 Answers0