EDIT: Upon re-reading my original question I realized very quickly that it was very poorly worded, ambiguous, and too confusing to ever get a decent answer. That's what I get for rushing out a question at the end of my lunch break. Hopefully this will be clearer:
I am trying to expose a simple C structure to Python (3.x) as a PyBuffer so I can retrieve a MemoryView from it. The structure I want to expose is similar to this:
struct ImageBuffer {
void* bytes;
int row_count;
int bytes_per_row;
};
and it is my desire to allow the script writer to access the data like so:
img_buffer = img.get_buffer()
img_buffer[1::4] = 255 # Set every Red component to full intensity
Unfortunately the existing documentation about the C API for these structures is pretty sparse, self contradictory in places, and outright wrong in others (documented function signatures do not match those in the headers, etc.) As such I don't have a very good idea about how to best expose this. Also, I would like to avoid including third party libs to achieve functionality that should be part of the core libs, but it feels to me like the PyBuffer functionality is still fairly immature, and perhaps something like NumPy would be a better choice.
Does anyone have any advice on this?