ADF-Sniper
Jun 22nd, 2007, 07:11 PM
I'm trying to find colour's in an image. Its working but what im trying to say is....
If GetPixel(pctMain.hdc, x, y) = 15663343 or 65280 or 65535 Then
The problem I am having is its using up way too much cpu usage.
A little help would be good :D
Private Sub Command1_Click()
Dim x As Long, y As Long
If Not LoadPNGFile(App.Path & "\test.png", pctMain) Then
MsgBox "There was an error loading the test.png file", vbCritical, "Error"
End If
For x = 103 To Width - 103
For y = 10 To 300
If GetPixel(pctMain.hdc, x, y) = 65280 Then
MsgBox "Colour Found"
GoTo Found
Else
If GetPixel(pctMain.hdc, x, y) = 15663343 Then
MsgBox "Colour Found"
GoTo Found
Else
If GetPixel(pctMain.hdc, x, y) = 65025 Then
MsgBox "Colour Found"
GoTo Found
Else
If GetPixel(pctMain.hdc, x, y) = 65535 Then
MsgBox "Colour Found"
GoTo Found
Else
If GetPixel(pctMain.hdc, x, y) = 255 Then
MsgBox "Colour Found"
GoTo Found
Else
End If
End If
End If
End If
End If
Next
Next
If GetPixel(pctMain.hdc, x, y) = 15663343 or 65280 or 65535 Then
The problem I am having is its using up way too much cpu usage.
A little help would be good :D
Private Sub Command1_Click()
Dim x As Long, y As Long
If Not LoadPNGFile(App.Path & "\test.png", pctMain) Then
MsgBox "There was an error loading the test.png file", vbCritical, "Error"
End If
For x = 103 To Width - 103
For y = 10 To 300
If GetPixel(pctMain.hdc, x, y) = 65280 Then
MsgBox "Colour Found"
GoTo Found
Else
If GetPixel(pctMain.hdc, x, y) = 15663343 Then
MsgBox "Colour Found"
GoTo Found
Else
If GetPixel(pctMain.hdc, x, y) = 65025 Then
MsgBox "Colour Found"
GoTo Found
Else
If GetPixel(pctMain.hdc, x, y) = 65535 Then
MsgBox "Colour Found"
GoTo Found
Else
If GetPixel(pctMain.hdc, x, y) = 255 Then
MsgBox "Colour Found"
GoTo Found
Else
End If
End If
End If
End If
End If
Next
Next