Hello 2D guys.
I’ve got a special case where I in every frame first need direct access to a surface’s pixels and then I need to blit it to the primary surface with hardware acceleration enabled. I used DirectDraw a few years ago and the code would’ve looked something like this:
dds->Lock(...);
for (...)
{
// Write pixels to the surface's buffer
}
dds->Unlock(...);
ddsPrimary->Blt(...);
As I understand it, I should create a BuffferedImage to get access to the raw pixels. But the BufferedImage will be kept in system memory instead of video memory, so I won’t be able to use hardware accelerated blits with it.
Is there a way to use a video memory surface and access the pixels for a limited time only, just like I would with Lock(…)/Unlock(…), so that I can use hardware accelerated blits AND manipulate the raw pixels?
There’s an example program in the original thread that shows what I’m trying to do.
/Martin