SharpDX Bitmap.FromWicBitmap wrong result

I am using SharpDX for my WinRT application. For pixel shaders, I am trying to load an image using 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 great in a simulator or on tablets with an Intel processor (e.g. Acer Iconia). But I have a strange error on tablets with an ARM processor (Windows Surface, Asus). Bitmap.FromWicBitmap returns a Bitmap object, it is not null, has the correct DPI and PixelFormat, but Size.Width and Size.Height are 0. Nothing happened, but the downloaded Bitmap has no data (-> black image), Images to upload are normal jpg or png files and are small in size (e.g. 256x1 pix). Did I forget something? Thanks for answers.

+4
source share

All Articles