|
-
May 17th, 2001, 04:10 AM
#1
copying DD surfaces
After blitting to the primary surface using BltFx (and using some of the effects), the result in the screen has those results, but the original surface (blitting source) doesn't. That means when the picturebox comes to be repainted, it will just blit the picture with no added effects. So the effects are pretty much lost.
What I've been trying to do is to make a copy of the primary surface back to the image surface so when the picture box is reblitted the effects are 'still there'. According to the DX7 SDK a primary surface can't be duplicated with DuplicateSurface, so I'm trying to get this to work:
Code:
Dim imgDC As Long
Dim imgSurfDC As Long
imgSurfDC = imgBuffer.GetDC 'imgBuffer - surface of image
imgDC = CreateCompatibleDC(0)
SelectObject frmMain.picMain.hdc, imgDC
'copy using blit
BitBlt imgSurfDC, 0, 0, imgDesc.lWidth, imgDesc.lHeight, imgDC, 0, 0, vbSrcCopy
'clean up and delete DCs
imgBuffer.ReleaseDC imgSurfDC
DeleteDC imgDC
I can't seem to get it to work, when the picture is repainted, the old image comes out, meaning the above copy code didn't do its work (no errors though). Or if I've got it completely wrong, what should I be doing?
-
May 17th, 2001, 04:22 AM
#2
Frenzied Member
Why don't you use Blt or Blt Fast to copy the primary surface to another surface instead of using GetDC and BitBlt?
Harry.
"From one thing, know ten thousand things."
-
May 17th, 2001, 04:43 AM
#3
Thanks for the idea! Works great! Well...kind of
Code:
Call DX7.GetWindowRect(frmMain.picMain.hWnd, PrimaryRect)
retval = imgBuffer.BltFast(0, 0, Primary, PrimaryRect, DDBLTFAST_WAIT)
Since its using the co-ordinates of the picturebox relative to the screen, if I say, put half the picturebox behind the taskbar, the taskbar is copied as well.....bogus!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|