Results 1 to 3 of 3

Thread: copying DD surfaces

  1. #1
    sunnyl
    Guest

    Exclamation 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?

  2. #2
    Frenzied Member HarryW's Avatar
    Join Date
    Jan 2000
    Location
    Heiho no michi
    Posts
    1,827
    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."

  3. #3
    sunnyl
    Guest

    Thumbs up

    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
  •  



Click Here to Expand Forum to Full Width