rendertargetbitmap

How to render InkCanvas to an image in UWP Windows 10 application?

北城以北 提交于 2019-12-17 12:17:47
问题 The RenderTargetBitmap class worked with simple Canvas + InkManager (in Windows 8.1) to render ink strokes to an image. UWP introduced InkCanvas and a new Inking API. However, it seems like the RenderTargetBitmap does not work with that. When I try to capture ink strokes with RenderAsync method, no ink strokes get rendered only other objects like Rectangle and so on. Is it a bug or this new API is not meant to be used this way? If not, then how can I render an image out of InkCanvas ? Thanks!

How to render InkCanvas to an image in UWP Windows 10 application?

岁酱吖の 提交于 2019-12-17 12:17:09
问题 The RenderTargetBitmap class worked with simple Canvas + InkManager (in Windows 8.1) to render ink strokes to an image. UWP introduced InkCanvas and a new Inking API. However, it seems like the RenderTargetBitmap does not work with that. When I try to capture ink strokes with RenderAsync method, no ink strokes get rendered only other objects like Rectangle and so on. Is it a bug or this new API is not meant to be used this way? If not, then how can I render an image out of InkCanvas ? Thanks!

Asynchronously render a WPF visual to a bitmap

一世执手 提交于 2019-12-13 19:49:00
问题 I saw that the WinRT RenderTargetBitmap is able to render a Visual asynchronously via the "RenderAsync(visual);" method. Unfortunately the .net RendertargetBitmap does not have a RenderAsync method. Is there any workaround or entension for the .net RenderTargetBitmap to allow async rendering of WPF visuals? Thanks for help in advance! 回答1: I wrote a method to render a visual to bitmap via the BitBlt function. In heavy UIs like in my case this method is 20 times fastern than RenderTargetBitmap

Convert RenderTargetBitmap into System.Drawing.Image

最后都变了- 提交于 2019-12-10 14:59:19
问题 I have 3D WPF visual that I want to pass into an Excel cell (via clipboard buffer). With "normal" BMP images it works but I do not know how to convert a RenderTargetBitmap . My code looks like this: System.Windows.Media.Imaging.RenderTargetBitmap renderTarget = myParent.GetViewPortAsImage(DiagramSizeX, DiagramSizeY); System.Windows.Controls.Image myImage = new System.Windows.Controls.Image(); myImage.Source = renderTarget; System.Drawing.Bitmap pg = new System.Drawing.Bitmap(DiagramSizeX,

Can't render pixel shader to RenderTargetBitmap! Please help!

眉间皱痕 提交于 2019-12-07 21:43:15
问题 I wrote a very simple WPF application to test the ability to render a control that has an associated pixel shader to a RenderTargetBitmap. I then write the bitmap to file (jpeg). The control is rendered onto the bitmap, however the pixel shader effect is not applied to the control. The code and the XAML is below: namespace TestPixelShader { /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow : Window { public MainWindow() {

Can't render pixel shader to RenderTargetBitmap! Please help!

不问归期 提交于 2019-12-06 08:05:47
I wrote a very simple WPF application to test the ability to render a control that has an associated pixel shader to a RenderTargetBitmap. I then write the bitmap to file (jpeg). The control is rendered onto the bitmap, however the pixel shader effect is not applied to the control. The code and the XAML is below: namespace TestPixelShader { /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); } private void OnSaveSnapshot(object sender, RoutedEventArgs e) { SaveFileDialog dlg = new

Windows update KB4040972/73 causes black images with WPF classes

你说的曾经没有我的故事 提交于 2019-12-05 18:39:07
问题 I have an application relying on Deep zoom images (convertion from a PNG to a pyramid of JPGs in various scale) which we use DeepZoomTools.dll for. This is relying on PresentationCore.dll and has been working fine for years. After the rollout of KB4040972 and KB4040973, the conversion from PNG to JPG generates (depending on coordinates) black images instead of the image it should contain. If the below code is run in a console or desktop app, it works. It ONLY doesn't work if run under high

Error using using RenderTargetBitmap in UWP

浪子不回头ぞ 提交于 2019-12-05 08:36:49
I'm trying to create a bitmap image, and have the following code: RenderTargetBitmap renderTargetBitmap = new RenderTargetBitmap(); await renderTargetBitmap.RenderAsync(uielement); IBuffer pixels = await renderTargetBitmap.GetPixelsAsync(); . . . var pixelArray = pixels.ToArray(); In order to get a ToArray() extension, I came across this question. So I added: using System.Runtime.InteropServices.WindowsRuntime; // For ToArray To my code. However, when I run, I get the following error: Exception thrown: 'System.ArgumentException' in System.Runtime.WindowsRuntime.dll Additional information: The

Convert an IBuffer to a byte array in Windows Phone 8.1, how?

≯℡__Kan透↙ 提交于 2019-12-04 16:09:37
问题 I'm writing an application for Windows Phone 8.1. I need to save an UIElement as an image file (I'd prefer JPG or PNG). I'm using RenderTargetBitmap class to do this. After calling the method RenderAsync on my UIElement I create an IBuffer that contains the result of the method GetPixelsAsync() of my RenderTargetBitmap. Now I need to call the method ToArray() to convert my IBuffer in a byte array to save my image using something like BitmapEncoder, but it seems that on Windows Phone 8.1 there

How do you capture current frame from a MediaElement in WinRT (8.1)?

孤街醉人 提交于 2019-12-04 13:48:45
I am trying to implement a screenshot functionality in a WinRT app that shows Video via a MediaElement. I have the following code, it saves a screenshot that's the size of the MediaElement but the image is empty (completely black). Tried with various types of Media files. If I do a Win Key + Vol Down on Surface RT, the screen shot includes the Media frame content, but if I use the following code, it's blackness all around :( private async Task SaveCurrentFrame() { RenderTargetBitmap renderTargetBitmap = new RenderTargetBitmap(); await renderTargetBitmap.RenderAsync(Player); var pixelBuffer =