Hi!
I want to blit a direct draw surface to another in order to change the pixel format from an unknown type (current display settings) to a rgb 24 bits. My goal is to have access to the memory directly using the lock function.
I have two Direct Draw surfaces. The first one is my source surface of unknown type, and the second one is my 24 bits rgb destination.
I've been trying to blit from one to another, but I keep getting either the UNSUPPORTED or the INVALIDPARAM error from the blt function. I guess something most be wrong with my inits or the params. Here are some samples:
When I Blit:
HRESULT hr = m_pDISurface->Blt(0, m_pDDSOffscreen, 0, DDBLT_KEYDEST | DDBLT_WAIT , 0);
if(FAILED(hr))
AfficherCodeErreur(hr);
When I lock (In case there is something wrong):
ddsd.dwSize = sizeof(ddsd);
// lock the front buffer and grab the surface memory pointer
hr = m_pDISurface->Lock(0, &ddsd, DDLOCK_WAIT | DDLOCK_SURFACEMEMORYPTR, 0);
if(FAILED(hr))
AfficherCodeErreur(hr);
Initialisations:
::ZeroMemory(&ddsd4, sizeof(ddsd4));
ddsd4.dwSize = sizeof(ddsd4);
ddsd4.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PIXELFORMAT;
ddsd4.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
ddsd4.dwHeight = ddsd.dwHeight;
ddsd4.dwWidth = ddsd.dwWidth;
ddsd4.ddpfPixelFormat.dwSi
ze = sizeof(ddsd.ddpfPixelForma
t);
ddsd4.ddpfPixelFormat.dwFl
ags = DDPF_RGB;
ddsd4.ddpfPixelFormat.dwRB
itMask = 0x00FF0000;
ddsd4.ddpfPixelFormat.dwGB
itMask = 0x0000FF00;
ddsd4.ddpfPixelFormat.dwBB
itMask = 0x000000FF;
ddsd4.ddpfPixelFormat.dwRG
BAlphaBitM
ask = 0x00000000;
ddsd4.ddpfPixelFormat.dwRG
BBitCount = 24;
hr = m_pDD3->CreateSurface(&dds
d4, &m_pDISurface, NULL);
Thanks a lot!
Start Free Trial