Q: LPDIRECTDRAWSURFACE->HBITMAP
I want to copy the image in LPDIRECTDRAWSURFACE
into HBITMAP
I know it's possible to copy image in HBITMAP into LPDIRECTDRAWSURFACE..(we use this to load BMP image into LPDIRECTDRAWSURFACE)
but how about the reverse?
how to do it? if anyone knows plz give me the answer.
Edited by - RMZ on 1/18/00 2:14:33 AM
When you load an HBITMAP onto an LPDIRECTDRAWSURFACE (if you''re using the DDUtils.cpp functions) all you''re doing is calling a StretchBlt onto the GDI surface (if I''m not wrong). So, all you should have to do to copy the dd surface to the HBITMAP is get the GDI surface (I believe the call is ddSurface->FlipToGDISurface() or something like that) and then call StretchBlt or BitBlt on it, blitting it to an HDC or CDC (in MFC) that you have associated with your HBITMAP. But I haven''t done much straight Windows programming, so I might not be entirely accurate...
------------------------------
Jonathan Little
invader@hushmail.com
http://www.crosswinds.net/~uselessknowledge
------------------------------
Jonathan Little
invader@hushmail.com
http://www.crosswinds.net/~uselessknowledge
Here is how I did it, and I think it is a slightly easier way than Qoy's method (no offense)
I used the LPDIRECTDRAWSURFACE->GetDC() function to lock the surface and get its DC. Then you can get the DC of the destination bitmap (do it the same way you would when loading a bitmap to a surface). Then use BitBlt() (that is BitBlt, the Win32 api function, not Blt the Direct Draw function)
Once you've done that, release the two DCs, and you're done.
LPDIRECTDRAWSURFACE->ReleaseDC()
-Omalacon
Edited by - Omalacon on 1/19/00 12:07:59 AM
I used the LPDIRECTDRAWSURFACE->GetDC() function to lock the surface and get its DC. Then you can get the DC of the destination bitmap (do it the same way you would when loading a bitmap to a surface). Then use BitBlt() (that is BitBlt, the Win32 api function, not Blt the Direct Draw function)
Once you've done that, release the two DCs, and you're done.
LPDIRECTDRAWSURFACE->ReleaseDC()
-Omalacon
Edited by - Omalacon on 1/19/00 12:07:59 AM
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement