Advertisement

Copying BitmapData to surface

Started by December 04, 2000 05:54 PM
0 comments, last by vbisme 24 years, 1 month ago
let''s say I''ve loaded data from a .bmp file into a pointer *pbmpData. Let''s the say .bmp file is a 24-bit, but my display mode is 32-bit. Thus I convert it into 32-bit and store it into *pPixelData or pPixelData[size] (samething since an array is a pointer). Now how do I transfer this to a DirectDrawSurface?
Lock the surface and use the returned pointer to copy the bitmap to. But there''s an easier way to do this whole thing. Obtain a GDI surface from your DirectDraw surface. Use CreateCompatibleDC to create a device context to select your bitmap to. The BitBlt from the created device context to the DirectDraw surface GDI context. No need to worry about surface pitches or anything like that this way.

This topic is closed to new replies.

Advertisement