How do you draw a string to an image in winRT
? In WinForms that could be done using drawstring()
method inside the system.drawing
name
You will have to use DirectX. You can do so in C# by using SharpDx.
In Windows 8.1 they finally support rendering of XAML controls to bitmap. Now you can use
var renderTargetBitmap = new RenderTargetBitmap();
await renderTargetBitmap.RenderAsync(uiElement, width, height));
var buffer = await renderTargetBitmap.GetPixelsAsync();
var tmpWbm = new WriteableBitmap(renderTargetBitmap.PixelWidth, renderTargetBitmap.PixelHeight);
Google for 'Metro CSharp using Direct2D and DirectWrite for Graphics'. It's one of their code samples. It's not the most concise example I've ever seen, but it does work. Using SharpDX to do the same thing will be cleaner.
Direct2D is a replacement for GDI in WinRT. So you'll have to use C++/CX with DirectX for drawing text.
I don't have any examples for you, but maybe this link (and the links included) can help you on your way.
You can't - there is unfortunately no such API :-(