Load BitmapImage into WriteableBitmap but no method existing

前端 未结 2 708
醉酒成梦
醉酒成梦 2021-01-16 11:39

The constructor of WriteableBitmap class with Windows 8 only takes two arguments: the height and the width of this object. Meanwhile with Silverlight it accepts

2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-16 12:10

    Thanks for your help, I succeed to blur my image. Here is the sample in order to link the BitmapImage into the WriteableBitmap object :

    BitmapImage bi = new BitmapImage(new Uri(filename, UriKind.RelativeOrAbsolute));
    WriteableBitmap wb = new WriteableBitmap(bi.PixelWidth, bi.PixelHeight);
    
    var streamFile = await GetFileStream(myFile);
    await wb.SetSourceAsync(streamFile);
    wb = wb.Convolute(WriteableBitmapExtensions.KernelGaussianBlur5x5);
    

    Then just write the WriteableBitmap into the LocalStorage !

提交回复
热议问题