|
-
Aug 2nd, 2001, 11:58 PM
#1
Thread Starter
Lively Member
Aquiring the color of pixels of large area ... Quickly ?
I tried to program an image analyzer with VB when I met a problem, I don’t know if its cause is the speed of VB. Immediate assistance required.
That is a section of my program
Public Declare Function GetPixel Lib "gdi32" (ByVal hDC As Long, ByVal x As Long, ByVal y As Long) As Long
Public Declare Function GetWindowDC Lib "user32" (ByVal hWnd As Long) As Long
Public Declare Function ReleaseDC Lib "user32" (ByVal hWnd As Long, ByVal hDC As Long) As Long
Public ImageStyle As String
Public MoniX As Integer
Public MoniY As Integer
Sub ScreenScan()
For y = MoniY To MoniY + 150
For x = MoniX To MoniX + 200
Dim hDCScreen As Long
Dim lngColor As Long
hDCScreen = GetWindowDC(0) 'gets the DC of the screen
lngColor = GetPixel(hDCScreen, x, y)
ReleaseDC 0, hDCScreen 'releases the DC: this must be done
MA.PSet (15 * (x - MoniX), 15 * (y - MoniY)), lngColor
Next x
Next y
End Sub
But this seems to take laughable amount of time to get the color of every point on the screen.
Because every time I want the color of a point, it scan the screen and then give the color of the point I want. But What I wanted to do is to scan the screen once and report the color of every point on the screen.
What Can I do to aquire color of large section of the screen QUICKLY ?
I am afraid I need Direct X
Thanks for your time.
What are the universe used for and why it's here ?
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
|