Windows 8.1 Store App内截屏

在开发Windows Store App中,对应用程序进行截图是经常面临的一个问题。但是由于API的限制,我们没有办法对Windows Store App进行截屏。不过,Windows 8.1的出现带来了新的希望: Rendering the XAML tree to a bitmap WebView for JavaScirpt 接下来我将要用简单的代码来演示一下这两个新的API。 Rendering the XAML tree to a bitmap Windows 8.1的runtime在Windows.UI.Xaml.Media.Imaging中新加入了RenderTargetBitmap,而这里有两个非常重要的方法: RenderTargetBitmap.RenderAsync:把UIElement渲染成图片。 RenderTargetBitmap.GetPixelsAsync:把RenderTargetBitmap图片保存成BGRA8格式的流文件。 下面是在XAML render to bitmap 示例中找的一份C#代码,具体的代码可以在示例中下载: Render XAML Tree to image source 1: RenderTargetBitmap renderTargetBitmap = new RenderTargetBitmap(); 2: await renderTargetBitmap.RenderAsync(RenderedGrid); 3: RenderedImage.Source = renderTargetBitmap; Render XAML Tree…

0

Capturing Snapshot in Windows 8.1 Store App

During development in Windows Store App, to capture a snapshot is one of the most common requests developers will face with. By the API restrictions in previous WinRT, there was no way for a Windows Store App to capture screenshots, neither XAML nor JavaScript could do this. But in Window 8.1 Apps, we could take…

4