DDSURFACEDESC2 ddsdOld; // Alte Surface-Beschreibung
DDSURFACEDESC2 ddsdNew; // Neue Surface-Beschreibung mit 16-Bit-Daten
HRESULT ddrval;
// Alte Surface-Beschreibung laden
ZeroMemory (&ddsdOld, sizeof (ddsdOld));
ddsdOld.dwSize = sizeof (ddsdOld);
ddrval = lpDDSurf->GetSurfaceDesc (&ddsdOld);
if (ddrval != DD_OK)
{
return FALSE;
};
// Ändern der Daten für 16-Bit
ZeroMemory (&ddsdNew, sizeof (ddsdNew));
ddsdNew.dwSize = sizeof (ddsdNew);
ddsdNew.dwFlags = DDSD_PITCH | DDSD_PIXELFORMAT;
ddsdNew.ddpfPixelFormat = ddsdOld.ddpfPixelFormat;
ddsdNew.ddpfPixelFormat.dwFlags = ddsdOld.ddpfPixelFormat.dwFlags | DDPF_RGB;
ddsdNew.ddpfPixelFormat.dwRGBBitCount = 16; // Für 16 Bit
ddsdNew.lPitch = ddsdOld.dwWidth*2; // 16Bit = 2 Byte = Breite * 2
// Einstellen der neuen Surface-Beschreibung
ddrval = lpDDSurf->SetSurfaceDesc (&ddsdNew, 0);
if (ddrval != DD_OK)
{
MessageBox (NULL, "testwindow 1", NULL, MB_OK);
return FALSE;
};
MessageBox (NULL, "testwindow 2", NULL, MB_OK);
I figured out, that "SetSurfaceDesc" doesn''t work correctly, because neighter testwindow1 nor testwindow2 has been showed.
thanks for helping
changing bit-count of a surface
Hi,
I loaded a bitmap with the function "LoadBitmap" into an DirectDraw-Surface. However, the surface had an bit-depth of 24, and I just wanted 16 bpp. So I opened the help file and looked for some solution. After a few hours I had this code (which doesn''t work) :
Please help me!!!
Or tell me an Bitmap - Loading function which converts den Surface into an 16-Bit-Format.
Or tell me an Bitmap - Loading function which converts den Surface into an 16-Bit-Format.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement