I have searched the forums and came across this Getting an array of bytes out of Windows::Storage::Streams::IBuffer but I wasn't able to get anything out of it. It may be a bit too convuluted for me to figure out.
The crux of my problem is that I have an IBuffer from calling RenderTargetBitmap->GetPixelsAsync(). I now need to create a CanvasBitmap from this data by using the function provided here http://microsoft.github.io/Win2D/html/M_Microsoft_Graphics_Canvas_CanvasBitmap_CreateFromBytes.htm
I have found no way of getting the data from the IBuffer to an array that will work. I found a way to get the data into a vector
//convert IBuffer to byte array
auto reader = ::Windows::Storage::Streams::DataReader::FromBuffer(buf);
std::vector<unsigned char> data(reader->UnconsumedBufferLength);
if (!data.empty())
reader->ReadBytes(
::Platform::ArrayReference<unsigned char>(
&data[0], data.size()));
But from this point on, I have found no way to get this into an array. I have attempted to use all the ideas from How to convert vector to array in C++ to no avail. Any help would be greatly appreciated