How to get Pixel value of Image in Metro WPF using C++


  • Hi, Buddies,

    Recently I am making a color picker in Metro WPF using C++, I searched the forum, and I found WriteableBitmap might be a good try, when I used the class, it needs to set the source like WriteableBitmap::SetSource(Windows::Storage::Streams::IRandomAccessStream ^streamSource), I have no idea how to pass the IRandomAccessStream parameter to the method, here is a sample http://social.msdn.microsoft.com/Forums/en-US/winappswithcsharp/thread/490fbb2c-9987-484e-bb7b-dd3b8993122b which was using C# and FileOpenPicker, I am wondering is there some way that we can load a image as a IRandomAccessStream directly, then pass it to the WriteableBitmap::SetSource method, after that we can read the bytes from WriteableBitmap::PixelBuffer. Any short working sample code is very helpful. Thanks.

    Wednesday, June 13, 2012 11:56 PM


All replies