【发布时间】:2017-10-03 15:36:55
【问题描述】:
大家好,我想将像素缓冲区转换为图像并打印出来。这是我在程序中的信息: PixelBuffer:int 宽度,int 高度,IntPtr 缓冲区,步幅。由于一些组装错误,这就是我无法做到的:
Windows.UI.Xaml.Controls.Image image = new Windows.UI.Xaml.Controls.Image();
System.Windows.Media.Imaging.BitmapFrame frame = System.Windows.Media.Imaging.BitmapFrame.Create(System.Windows.Media.Imaging.BitmapSource.Create(
(int)pr.pixelBuffer.width,
(int)pr.pixelBuffer.height,
96,
96,
System.Windows.Media.PixelFormats.Rgb24,
null,
pr.pixelBuffer.buffer,
(int)(pr.pixelBuffer.stride * pr.pixelBuffer.height),
(int)pr.pixelBuffer.stride));
Windows.UI.Xaml.Media.Imaging.BitmapImage bitmapImage = new Windows.UI.Xaml.Media.Imaging.BitmapImage(frame.BaseUri);
image.Source = bitmapImage;//frame;
stackPanel.Children.Add(image)
没有 System.Windowxs.Media.Imaging 有什么方法可以做到这一点?仅使用 Windows.UI.Xaml 吗?
谢谢!
【问题讨论】:
-
你试过用BitmapEncoder代替位图框吗?
-
WriteableImage 可以设置像素。