MauricioMaia
asked on
DirectDraw Directly Surface Pixel Write
Im developing a aplication where I need to paint a bitmap (320x240) on the window a lot of times per second. I was using the drawdib function because I receive a pointer to a RGB 24 Bitmap [Byte Pixels[240*320*3]; ) Now I want to make my application do this work using DirectDraw. The way I found to do that was getting a DC to the DirectDraw surface and paint the bitmap on the DC using StrechDIBits which is a very slow function. Im wondering If there is a way to do that copying directly the bits into the surface, like some examples that I saw that lock the surface and use the LpSurface pointer to manipulate pixels. I tried do to that but a did not get a working code. Help me please.
ASKER
Thanks chofreither,
I'm having just one problem now, I think Its a simple thing to solve but I never had to do that and the examples that I found did not work. My surfaces are created with 16 bits and I need to make then 24 bits. How do I create a 24 bits surface?
I'm having just one problem now, I think Its a simple thing to solve but I never had to do that and the examples that I found did not work. My surfaces are created with 16 bits and I need to make then 24 bits. How do I create a 24 bits surface?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
What kind of problem did you have trying to do that? One thing to note is that the width of the pixel buffer is sometimes not the visible width, but rather surfacedesc.lPitch. Another problem might be that depending on the buffer format, you might have to do pixel format conversion (eg from 24 bits to 16 bits, or whatever).
For a tutorial on writing pixels to a DD surface, look here: http://www.gamedev.net/reference/articles/article588.asp
Clemens