Hi,
You can actually change a surface''s characteristics by giving it a new SURFACEDESC.
What you do is :
1. fill in all nessescary field in the surfacedesc, set the lpSurface member to the address of
your memorybuffer.
coede ex)
===================================================
// create a 320*200 16bpp buffer
unsigned short *buffer = new unsigned short[64000];
// load a picture into the buffer
LoadMyFileFormatPicture("hoppsan.jpg",buffer);
// this assumes you have a temporary surfaca already set-up.
// now create a new surfaceDesc
// and make it use your buffer as surface data area
DDSURFACEDESC2 surfaceDesc;
memset(surfaceDesc)
surfaceDesc.dwSize = sizeof(surfaceDesc);
surfaceDesc.dwWidth = WIDTH;
surfaceDesc.dwHeight= HEIGHT;
surfaceDesc.lpSurface = myBuffer;
// then, you activate you new surfacedesc by calling
// the method :
myDD7TempSurface->SetSurfaceDesc(&surfaceDesc,0);
===================================================
Now you can blit your buffer back and forth onto other Direct Draw surfaces by just using Blt.
Hope this help, otherwise respond and I will try to explain further.
/Tooon
Memory buffer to Surface?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement