I would like to do something like this http://weblogs.asp.net/broux/archive/2011/02/08/silverlight-how-to-watermark-a-writeablebitmapimage-with-a-text.aspx. I am having a tough time getting this to work in WinRT. I am using the WriteableBitmap extensions to "render" some text but I want it to look exactly like it looks in this example. Any suggestions or help?
Asked
Active
Viewed 1,249 times
2 Answers
0
You could render that text to a png asset and blit it on top of the bitmap. Unless the text needs to be dynamic - then you'd need DirectWrite. WinRT XAML Toolkit has an extension method you could use to render text to a WriteableBitmap.

Filip Skakun
- 31,624
- 6
- 74
- 100
-
Filip is right. You can use a static PNG you prepare before and then use the WriteableBitmapEx Blit method. – Rene Schulte Jan 17 '13 at 04:08
-
Unfortunately all of it is dynamic. – Emmie Lewis-Briggman Jan 17 '13 at 09:44
-
Well then DirectWrite is what you need. – Filip Skakun Jan 17 '13 at 15:16
-
Can you show me an example what you mean? Can I do this through SharpDx? – Emmie Lewis-Briggman Jan 18 '13 at 09:06
-
Yes, you can use DirectWrite with SharpDx. There is an example for doing this here: http://www.codeproject.com/Articles/513187/Paste-Date-Time-Stamp-While-Capturing-Image-in-Win – Filip Skakun Jan 21 '13 at 03:17
-
I will try this later. If this works then I will add it to your answer and mark it correct. – Emmie Lewis-Briggman Jan 22 '13 at 11:54
0
This gets the job done visually:
<Grid>
<Image Source="{Binding MyImage}" />
<Image Source="{Binding MyWatermark}" />
</Grid>
It's certainly the same effect without all the work. If you are wanting to get it to literally make the watermark part of the original image, offloading to a service is your only current option. Without the Render()
method on the WriteableBitmap
there is no other option for you. Not even the XAML Toolkit solves this problem. It's a common request.
But depending on your use case, this might just be exactly what you want!
I hope it is. Best of luck.

Jerry Nixon
- 31,313
- 14
- 117
- 233
-
I want to do all of it dynamically and then get a copy of the image in memory. – Emmie Lewis-Briggman Jan 24 '13 at 23:32