[Sample Of Jan 1st] Windows Store app: How to access data in an IBuffer in C++

 

Homepage image
RSS Feed

Sample Download: https://code.msdn.microsoft.com/CppWindowsStoreAppManipulat-2e5e4c7b

IBuffers are returned in several places (WriteableBitmap::PixelBuffer being the most common request) and it isn't clear how to manipulate them. We have samples of how to do this in .Net Framework with the AsStream extension method, but not in C++. You can create a DataReader from an IBuffer using the static FromBuffer method, and this allows you to read raw data from the IBuffer. However, DataWriter doesn't allow you to write the raw data to IBuffer. This example demonstrates methods to extract pixels from a WriteableBitmap by getting its IBufferByteAccess interface, edit its pixels, and then dynamically update it.

 

imageYou can find more code samples that demonstrate the most typical programming scenarios by using Microsoft All-In-One Code Framework Sample Browser or Sample Browser Visual Studio extension. They give you the flexibility to search samples, download samples on demand, manage the downloaded samples in a centralized place, and automatically be notified about sample updates. If it is the first time that you hear about Microsoft All-In-One Code Framework, please watch the introduction video on Microsoft Showcase, or read the introduction on our homepage https://1code.codeplex.com/.