Results 1 to 4 of 4

Thread: which is faster

  1. #1

    Thread Starter
    Hyperactive Member dogfish227's Avatar
    Join Date
    Oct 2002
    Location
    GA
    Posts
    409

    which is faster

    im trying to get just 1 pixels color from a surface in DX7 should i use the

    getlockedpixel

    or getlockedarray

    DX4VB says getlockedarray is faster but im guessing that this is because you normally want to look at more that one pixel so my guess is getlockedpixel

    also

    VB Code:
    1. Sub ProcessMemory
    2. Dim Colour as Long
    3. Dim rArea as RECT
    4. Dim ddsd as DDSURFACEDESC2
    5.  
    6. rArea.Bottom=480:rArea.Right=640
    7.  
    8. MainSurf.Lock rArea,ddsd, DDLOCK_WAIT,0
    9. 'We now have access to the memory. From now until the Unlock you are treading
    10. 'on thin ice......
    11.  
    12. 'These are our two commands.
    13. Colour=Mainsurf.GetLockedPixel(100,120)
    14. Mainsurf.SetLockedPixel(100,120,Colour+10)
    15.  
    16. MainSurf.Unlock rArea
    17.  
    18. End Sub

    the rectangle rArea in this procedure, when you use it in the mainsurf.lock statement is just locking the part of the surface that is in the rectangle right ?

    last of all,
    at the end of mainsurf.lock what is the ,0 for?

    thanks for all your help

  2. #2

    Thread Starter
    Hyperactive Member dogfish227's Avatar
    Join Date
    Oct 2002
    Location
    GA
    Posts
    409
    well i ended up useing getlockedpixel it seemed much more liekly to be the faster way sense i wasnt need a whole array of pixels
    im still wandering what that ,0 is for thought??

    thanks

  3. #3
    Addicted Member
    Join Date
    Aug 2002
    Location
    Baltimore, MD
    Posts
    230
    http://msdn.microsoft.com/library/de...urfacelock.asp
    Handle to a system event that should be triggered when the surface is ready to be locked.
    This is from DX9, but should still be the same since it hasn't changed from DX7. It wasn't used in DX7.

  4. #4
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    Actually, it would be about the same. GetLockedPixel locks the surface, gets the pixel, and then unlocks it. GetLockedArray locks it, then you can get any number of pixels without a penalty, and then UnLock unlocks the surface. So, basically, it would be the same.
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

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