Jump to content

Custom PixelSearch


Recommended Posts

I have built this function to search the screen for a red shade pixel inside the area of an ellipse. The problems I'm having is that obviously if I search every single pair of coordinates it is too time consuming. The other problem is that if I skip too many pixels then it won't find the hot spot coordinates. Any suggestions?

Func ScreenSearch( ByRef $Hot_Coords )

      Local $Angle
      Local Const $a = 1024
      Local Const $b = 768
      Local $Ellipse_eq
     

         For $x = 0 To 1023 Step 6
            For $y = 0 To 767 Step 4
           
           $Ellipse_eq = ($x/$a) ^2 + ($y/$b) ^2
        
            If $Ellipse_eq < 1 Or $Ellipse_eq = 1 Then                           

                If PixelGetColor($x, $y) = 0xBD0000 Then   
                  
                             $Hot_Coords[0] = $x
                             $Hot_Coords[1] = $y                      

               EndIf
           EndIf
                
               Next
         Next

EndFunc
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...