|
-
Aug 15th, 2001, 02:32 PM
#1
Thread Starter
Member
Pixel Color Detection
How do i check what color the pixel is in a certain size box? I want to make a box that is about 100x100 pixels in the center of the screen, that checks for certain colors then if it detects them it executes a function.
Everyone is a begginer at some time, but we all get our fame.
-
Aug 15th, 2001, 02:45 PM
#2
Good Ol' Platypus
VB Code:
Declare Function GetPixel.... () ... 'whatever goes here!
Type RECT
Left as Long
Right as Long
Top as Long
Bottom as Long
End Type
Function Check(R as RECT) 'R is the box that you have, for a 100x100 set this to .bottom = 100, .right = 100
Dim A
Dim H
For A = R.Top to R.Bottom
For H = R.Left to R.Right
If GetPixel(mypicturebox.hDC, A, H) = RGB(0,0,0) Then 'checks for black
Myfunction()
Exit For
Exit For
Exit Function
End If
Next H
Next A
End Function
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Aug 15th, 2001, 03:57 PM
#3
Addicted Member
Here's the API declaration...
Code:
Declare Function GetPixel Lib "gdi32" Alias "GetPixel" _
(ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long
alternatively you can use the picture point method...
Code:
if picture1.point(x,y)=vbblack then
- Dim A
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
|