So I'm creating a UWP app which includes an InkCanvas
, as such, I want to store the contents as a variable so that I can show a preview of the canvas in the menu.
My question is, what is the best bitmap
to use, as there appear to be a number of options.
The SoftwareBitmap
is included in Windows.Graphics.Imaging
, whereas the BitmapImage
is part of Windows.UI.XAML.Media.Imaging
, both of which are available in a UWP app.
Can the UWP Image
class for displaying images use either of these formats?
Which is most appropriate in my case?
答案 0 :(得分:1)
所以做了很多实验,似乎与Image
的{{1}}控件一起使用,Windows.UI.XAML.Controls
工作得相当好。
如果SoftwareBitmap
有SoftwareBitmapSource
和Image.Source
(或SoftwareBitmap
),则BitmapPixelFormat.Bgra8
可以分配到BitmapAlphaMode.Premultiplied
。来自SoftwareBitmapSource页面上的备注部分:
XAML应用中显示的SoftwareBitmap必须采用BGRA像素格式,并预先乘以alpha值
一切正常,现在可以缩小位图,因为BitmapAlphaMode.None
和InkCanvas
之间的大小差异会使缩略图/预览看起来很差。