Hi all, struggling with a problem in a game I'm working on.

I need to find the most efficient way to update individual pixels on the screen.

Assume on any given frame I'll be updating about 20% of the pixels and the rest of the screen stays the same.

Here's what I've tried:
1) getting a pixel buffer from the screen's gc. When I try to update it I get an access violation.
2) Creating a pixel buffer the size of the screen, updating it, creating an image from it and rendering it to the screen. This works but is extremely slow.

One of the problems I've had is I can see how to make an image from a pixel buffer but I can't figure out how to go the other way around. Is there a member function on an Image to get the pixel_buffer? If so, I can't seem to find it. I can create an Image from a pixel_buffer but how about the other way around?

Also, I can't figure out how to update an image with a new pixel_buffer, just create one. So I have to create a whole new image each time which seems inefficient as hell.

Any help would be greatly appreciated.