Skip to main content
GameDev.net gamedev.net
🔒 Locked

load image from buffer

Started by Roam Dec 31, 2001 at 5:23 AM 0 replies 1.2k views
Original Post
Roam
Roam
hi, many new year! Q: so I have this cool image, in a packed file, I extract the image into a buffer, the buffer now contains the image, a full BMP file. now I want to put it on a surface, so I do the follwing: HBITMAP hbm; DDSURFACEDESC2 ddsd; LPDIRECTDRAWSURFACE7 pdds = NULL; LPDIRECTDRAW7 pdd = *m_pEngine; if( source == NULL ) return NULL; PBITMAPFILEHEADER pfbmp = (PBITMAPFILEHEADER)source; PBITMAPINFO pibmp = (PBITMAPINFO)(source+sizeof(BITMAPFILEHEADER)); memset(&ddsd,0,sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT |DDSD_WIDTH; ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; ddsd.dwWidth = pibmp->bmiHeader.biWidth; ddsd.dwHeight = pibmp->bmiHeader.biHeight; if (pdd->CreateSurface(&ddsd, &pdds, NULL) != DD_OK){ ddsd.ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY; if (pdd->CreateSurface(&ddsd, &pdds, NULL) != DD_OK) return NULL; } DDCopyBitmap(pdds, hbm, 0, 0, 0, 0); DeleteObject(hbm); return pdds; now some times the thing works, but most of the time when I blit this image, I get crap. anybody knows whats the deal here? (: I am what I am, more or less
I am what I am, more or less :)and my site rockswww.geocities.com/roam_fireI think

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.