What is BitmapData.reserved?

BitmapData has a Reserved property that returns a 32-bit signed integer . The Microsoft documentation does not use this property. If we will not use it; then why is he there? Why exactly?

+4
source share
3 answers

Reserved fields and properties can have many uses. One fairly common use is to assume that more complex types of BitmapData may need to store certain types of information in the future, for which the present structure does not provide any conditions. If no one used the Reserved field for anything, future implementations could use this field to store a pointer or handle to another structure containing additional information.

+4
source

Interestingly, a mistake. This is actually IntPtr, you can specify from your own ad the GdiPlusImaging.h header file in the SDK (c: \ program files \ microsoft sdks \ windows \ v6.0a \ include for VS2008). The error is not a byte, because GDI + creates an instance of this file.

Which makes it probable that the field stores a pointer or handle. I would have guessed in a handle to an object with memory mapping. It is cheaper to store it in a client state object, having to maintain a dictionary in order to find it in the UnlockBits () function. Do not mess with him.

+3
source

There are a lot of them in older Microsoft APIs, and they come from the time when it was customary to place space in property sets for future development efforts. They serve the same purpose as the big red button that no one should press. Maybe someone wants to press a button in the future, and then, well, we already have it right here!

+1
source

All Articles