🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Direct Draw and DIBs

Started by
1 comment, last by Jerec 24 years, 7 months ago
This isn't quite what you want, but it may be of some help (if it works ).

You could make a DC:

HDC hdcImage;
hdcImage = CreateCompatibleDC( NULL );

Then get a DC to the DDraw surface:

HDC hdc;
lpDDSBitmap->GetDC( &hdc );

Now BitBlt into hdcImage:

DDSURFACEDESC2 ddsd;
ddsd.dwSize = sizeof( ddsd );
ddsd.dwFlags = DDSD_HEIGHT | DDSD_WIDTH;
lpDDSBitmap->GetSurfaceDesc( &ddsd );

BitBlt( hdcImage, 0, 0, ddsd.dwWidth, ddsd.dwHeight, hdc, 0, 0, SRCCOPY );

And, of course, release the DC:

lpDDSBitmap->ReleaseDC( hdc );

------------------
- mallen22@concentric.net
- http://members.tripod.com/mxf_entertainment/

Advertisement
I am making a level editor in windows for a Direct Draw tiled game. I use a windowed direct draw surface as the view, and load all my images into direct draw surfaces. I would like to create a modeless dialog box that the user selects tiles from, but I can't draw direct draw surfaces to a dialog box. The only way to draw the tile images to the dialog that I can think of is to use DIBs, but I'd like to avoid re-reading the bmp files into DIB classes... I was wondering if anyone knows a way to draw a DIB in windows using the data from a direct draw surface. I was thinking that I could lock the surface and use the lpImage pointer as the data when drawing a DIB, or something like that, but it doesn't work... Any ideas?

-Jerec

JerecCM Software"Oro?"
I don't think that is what he needs to do.

I would like to comment on your question too. You don't have to read bitmaps the whole time. All you do is read a bitmap into memory. Into a uchar array (for example) since DIB's use 256 colors most of the time. If you have set your DIB up properly, and have your array with bitmaps. You can just copy that data to the place in the DIB. It's not too difficult. I believe I have some code laying around here....well, at home, I'm at college now.

I made myself a level editor using DIB sections, because I hate directdraw in windowed mode. I didn't finish it due to a lack of interest, but I can show you, I guess. It's win32 code. Oh, I will give you the set up code then.

------------------
Dance with me......

This topic is closed to new replies.

Advertisement