locked
Can I pass an Image from a c++ component to C#?

    Question

  • I just learned c++ last week (Why I didn't need it for 28 years until now I don't know).

    So can I pass an Image from my c++/CX/DirectX component class to C# managed code?


    SB Software Developer

    Tuesday, October 09, 2012 9:50 PM

Answers

All replies

  • Hi,

    You can pass a BitmapImage class, this class can be accessed both in C++ and C#.
    http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.media.imaging.bitmapimage

    Best regards,
    Jesse


    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us

    • Marked as answer by Jesse Jiang Friday, October 12, 2012 2:07 AM
    Wednesday, October 10, 2012 8:27 AM
  • Thanks, can I convert an IStream into a BitmapImage?

    SB Software Developer

    Wednesday, October 10, 2012 10:12 AM
  • First, you should convert Istream to randomAccessStream, and then call BitmapSource.SetSource function to set it.

    Best regards,
    Jesse


    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us

    Thursday, October 11, 2012 7:52 AM
  • I have actually been trying to figure out how to do this for a few days and can't find any information on it.  How do I do this?


    SB Software Developer

    Thursday, October 11, 2012 6:29 PM
  • Thanks for the help! 
    But I realized that I should just send a IRandomAccessStream to the c++ component and that the IStream created by CreateStreamOverRandomAccessStream changes the original IRandomAccessStream.

    SB Software Developer

    • Marked as answer by Sacha Bwin Thursday, October 11, 2012 9:46 PM
    Thursday, October 11, 2012 9:44 PM