locked
Can I build a out-of-process WinRT component which has its own window

    Question

  • Hi,

    I'm developing on a Metro client using JavaScript, now I have to add picture rendering module into the client. The picture data I got from network is in RGB format, so currently I use canvas in JavaScript to render the picture, but the performance is low(the picture size is large and refresh quite often).

    Can I build a out-of-process WinRT component to render the picture? That means the JS app just  supply basic interaction with user. Then run the out-process-component when the client need to receive picture data from network and render it to the window.  Can the component has its own window for rendering? 

    Another question is about the JS app run in backgroud. When the out-process-component is running at the front end, the JS app will be pushed to background, but the JS app has to communicate with the component. So are there any possibility that the JS app run in background suspended even killed by the system  ?

    Thanks.

    Dong.

    Tuesday, April 16, 2013 8:48 AM

Answers

  • There is no way to do this. Your entire UI is JavaScript. Other components (in or out of proc) cannot draw on top of it.

    You could write a Windows Runtime Component to render into an offscreen bitmap, but you would need to pass it back to the JavaScript layer to display it in the Canvas. Whether this will help depends on where the app is slow. It could help if the problem is calculating the pixels, but marshaling large pixel buffer between layers will likely be a bottleneck.

    --Rob

    • Marked as answer by wd0623 Monday, April 22, 2013 1:40 AM
    Thursday, April 18, 2013 4:21 PM
    Owner

All replies

  • Hi,

    For the image download from the network, you can use WriteableBitmap class to save it. You can change the pixel of it and set it as the source in JavaScript.

    For the background download problem, you can try to use the BackgroundDownloader class. It will be managed by the system.
    http://msdn.microsoft.com/en-us/library/windows/apps/xaml/Hh452975(v=win.10).aspx

    Or you can use Background task
    http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh977055.aspx, which need more codes to control the download.

    Best regards,
    Jesse


    Jesse Jiang
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, April 17, 2013 6:11 AM
  • Hi,

    For the image download from the network, you can use WriteableBitmap class to save it. You can change the pixel of it and set it as the source in JavaScript.

    For the background download problem, you can try to use the BackgroundDownloader class. It will be managed by the system.
    http://msdn.microsoft.com/en-us/library/windows/apps/xaml/Hh452975(v=win.10).aspx

    Or you can use Background task
    http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh977055.aspx, which need more codes to control the download.

    Best regards,
    Jesse


    Jesse Jiang
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Hi Jesse,

    Thanks for your information, but the problem in my solution is not downloading but the performance of rendering.

    Because of some reason, I can not totally turn to C++, I have to put the rendering in native code, so I'm wondering whether I can build a DirectX project as a component for the solution. If so, the JS part supply the UI for interaction, the Directx component (in-process or out process) render the picture.

    The picture data I got from the network if actually bit stream in private format from a peer. The key point of my problem is whether we can create a window for rendering picture in runtime component.

    Thanks,

    Dong.

     

    Wednesday, April 17, 2013 8:46 AM
  • We cannot use Direct X from JavaScript. We should use Direct X in XAML C# or C++.

    In JavaScript, we can use HTML5 elements to do the game programming. Please take a look of http://msdn.microsoft.com/en-us/library/windows/apps/hh465158.aspx

    Best regards,
    Jesse


    Jesse Jiang
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, April 18, 2013 2:34 AM
  • We cannot use Direct X from JavaScript. We should use Direct X in XAML C# or C++.

    In JavaScript, we can use HTML5 elements to do the game programming. Please take a look of http://msdn.microsoft.com/en-us/library/windows/apps/hh465158.aspx

    Best regards,
    Jesse


    Jesse Jiang
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Yes, currently I'm using HTML5 canvas for rendering the pictures, but the performance can not meet our needs. So I want to build a separate project to handle the rendering work,  the project can be a runtime component  of the solution and will run in the same app container with the JS project . I know we can not use DirectX in js code.   So I'm wondering the possibility of building a in-process or out-process component.

    Thursday, April 18, 2013 7:35 AM
  • There is no way to do this. Your entire UI is JavaScript. Other components (in or out of proc) cannot draw on top of it.

    You could write a Windows Runtime Component to render into an offscreen bitmap, but you would need to pass it back to the JavaScript layer to display it in the Canvas. Whether this will help depends on where the app is slow. It could help if the problem is calculating the pixels, but marshaling large pixel buffer between layers will likely be a bottleneck.

    --Rob

    • Marked as answer by wd0623 Monday, April 22, 2013 1:40 AM
    Thursday, April 18, 2013 4:21 PM
    Owner
  • Thanks, Rob.
    Monday, April 22, 2013 1:40 AM