locked
How to add text to a screenshot for the share charm?

    Question

  • I'm working on a game (developed in Unity), and it appears that the share charm in Windows 8.1 automatically sets up sharing of screenshots.  Is there a way for me to add some custom text to this default screenshot?  Or do I have to do everything myself (screenshot and text) if I want to customize the share behaviour?

    Andrea Mantler

    Thursday, February 20, 2014 11:57 PM

Answers

  • You'd have to do a custom share source.

    The default screenshot is only for apps which don't provide their own source and isn't modifiable.

    --Rob

    • Marked as answer by Andrea Mantler Friday, February 21, 2014 12:03 AM
    Friday, February 21, 2014 12:02 AM
    Owner
  • No, there's no screenshot API. You will need to capture the buffer you are rendering into.

    Unfortunately merging the Xaml and DX rendering may be a bit tricky. RenderTargetBitmap will capture the Xaml (but not the DX). I haven't tried it with an app that uses Xaml, but I believe Unity's CaptureScreenshot will capture Unity's DX rendering (but not the Xaml). You may need to run both and then post-process the bitmaps to merge them.

    --Rob

    • Marked as answer by Andrea Mantler Friday, February 21, 2014 3:14 AM
    Friday, February 21, 2014 3:05 AM
    Owner

All replies

  • You'd have to do a custom share source.

    The default screenshot is only for apps which don't provide their own source and isn't modifiable.

    --Rob

    • Marked as answer by Andrea Mantler Friday, February 21, 2014 12:03 AM
    Friday, February 21, 2014 12:02 AM
    Owner
  • Thanks Rob, that's what I suspected.

    Andrea Mantler

    Friday, February 21, 2014 12:03 AM
  • On a related note, is there a Windows Store API where I can get this screenshot?  (We're using both Unity and XAML for different parts, it would be easier if I could rely on Windows to give me a snapshot of what is currently visible.)

    Andrea Mantler

    Friday, February 21, 2014 12:19 AM
  • No, there's no screenshot API. You will need to capture the buffer you are rendering into.

    Unfortunately merging the Xaml and DX rendering may be a bit tricky. RenderTargetBitmap will capture the Xaml (but not the DX). I haven't tried it with an app that uses Xaml, but I believe Unity's CaptureScreenshot will capture Unity's DX rendering (but not the Xaml). You may need to run both and then post-process the bitmaps to merge them.

    --Rob

    • Marked as answer by Andrea Mantler Friday, February 21, 2014 3:14 AM
    Friday, February 21, 2014 3:05 AM
    Owner
  • Okay, thanks.

    For the most part, I'll be able to use one or the other (depending on whether it's showing a video or playing the game), but it does mean having to implement both solutions rather than just one.   I wasn't able to get Unity's CaptureScreenshot working before I went home for the night (saving the screenshot kept failing, and CaptureScreenshot only saves to a file... I'm not sure if it was a capabilities issue or something else), but I found an alternate Unity solution that should work with a bit more effort.

    Thanks again for the advice!


    Andrea Mantler

    Friday, February 21, 2014 3:13 AM
  • I have the Unity screen capture working well now, but I've run into a problem on the Xaml side:

    "Video content in a MediaElement or CaptureElement can't be captured using RenderTargetBitmap. That includes capturing frames from within video content."

    http://msdn.microsoft.com/library/windows/apps/dn298548

    Is there an easy way to screen capture a video in a MediaElement?


    Andrea Mantler

    Monday, February 24, 2014 11:06 PM
  • No, there's no trivial way.

    You would need to write a Media Extension MFT to extract the frame information. See the Media extensions sample to get started.

    --Rob

    Monday, February 24, 2014 11:25 PM
    Owner
  • Thanks, that's what I was worried about.  

    Andrea Mantler

    Monday, February 24, 2014 11:29 PM