How to access the image buffer within WinRT after image decoded by APP RRS feed

  • Question

  • Hi, I am developing a WinRT DLL which is used by a JavaScript APP.

    There is one solution that uses WIC to decode the image inside the WinRT DLL. but since WinRT is only allowed to access specific folders, and I don't want to copy the origianl images to those folders, it will cost a lot of disk I/O time.

    Is it possible to input the Image buffer to WinRT after decoded by AP, and get the processed image buffer from WinRT to AP?

    Is there a sample code for reference? Thank you.


    Monday, October 31, 2011 4:14 AM


All replies

  • Hi Greg,

    The following sample does something similar using pre-built WinRT API within Windows:


    That should give you an idea.

    Raman, Visual C++ 

    • Proposed as answer by Raman Sharma Monday, October 31, 2011 5:34 AM
    • Marked as answer by Greg Ma Wednesday, November 2, 2011 12:31 PM
    Monday, October 31, 2011 5:34 AM
  • Hi, Raman

    Thanks, now I can get the image buffer by copying PixelDataProvider's data.

    Another issue is how to put back the processed image to APP.

    Can I wrap the buffer to BitmapFrame or ImageStream? and how?



    Tuesday, November 1, 2011 7:49 AM
  • Hi Greg,

    I want to understand why you need to pass the entire image buffer from C++ to JavaScript.  I am trying to see if there can be a less expensive solution for your particular scenario.  What exactly are you trying to do?


    Tuesday, November 1, 2011 4:44 PM
  • Hi Raman,

    My WinRT component is going to do Image Processing, so the pixel values will be changed.

    I use the class lang::array as the input to resolve the eralier issue of passing image buffer to WinRT, now my problem is how to wrap the output buffer (In my case, it is a lang::array) to a JavaScript object for Saving or displaying on the screen.



    Wednesday, November 2, 2011 4:24 AM
  • Have you tried sending back an array from the WinRT side and receiving it on the JS side as an array?


    Raman Sharma | Program Manager, Visual C++ | @rasharm_msft

    (if my post has answered your question, please consider using the 'mark as answer' feature in the forums to help others)
    Wednesday, November 2, 2011 6:03 AM
  • Have you tried sending back an array from the WinRT side and receiving it on the JS side as an array?

    Yes, I can receive an array on JS side, but when I tried to do some further processing,  I can't save it as an image file or just displaying on the screen.

    I guess I need to wrap the array to a class like ImageStream or BitmapFrame in the namespace, Windows.Graphics.Imaging.

    1. How to wrap the array to a WinRT class since PixelDataProvider only provides the API to get pixel data. Any sample code for reference?

    2. Is there another way if warpping array is unnecessary?

    BTW, I can show the array by using canas, but I still wish to know how to use it as WinRT class.



    • Edited by Greg Ma Thursday, November 3, 2011 4:14 AM
    Wednesday, November 2, 2011 1:28 PM
  • Hi Greg,

    Did you ever get this resolved?


    Jeff Sanders (MSFT)

    Thursday, February 16, 2012 7:06 PM
  • Hi, Jeff,

    Yes, I resolved my problem already,



    Monday, March 19, 2012 8:20 AM