Jump to content

FastFind and the Pixel Values


Recommended Posts

Hello,

I am using the addon-library of FastFind.au3  found here :

 

The script I've put together is rather simple but it's returning a value that I don't understand.

#include "FastFind.au3"
#Include <WinAPI.au3>
#RequireAdmin

WinActivate ("ABC Window")

Local $xyzWindow = WinGetHandle ("ABC Window")

Local $triangleSpot = FFSnapShot (212, 216, 214, 218, 1, $xyzWindow)

ConsoleWrite ($triangleSpot&@CR)

Local $triangleData = FFGetRawData (1)
Local $splitTriangleData = StringSplit ($triangleData, "00")

Local $iMax

If isArray ($splitTriangleData) Then
   $iMax = Ubound ($splitTriangleData)
   ConsoleWrite ($iMax)
EndIf

So here's the question...

If the area I have selected is a total of 4 pixels , why is the UBound return value 26?

I thought that maybe it was getting values for the 4 along with the surrounding pixels bordering the selected area, even still , it should provide only 16 values(or so I thought). 

I feel that there is a bit of pixel data or something that I am not fully understanding. If anyone could please provide materials on what is happening I'd really appreciate it. 

Thank you for your time!

-Reiz

PS : I used terms like "triangleSpot" and such because in the actual window there is a small triangle icon that I am trying to gain the pixel data of to then search for others like it on the page. I understand the area that I am selecting is a square/rectangle and not a triangle. 

Link to comment
Share on other sites

34 minutes ago, Reizvoller said:

I feel that there is a bit of pixel data or something that I am not fully understanding. If anyone could please provide materials on what is happening I'd really appreciate it. 

I think the author of the UDF will know it best by the way a rectangle 212/216 - 214/218 has 9 pixels:

Dim $iPixels=0
For $x=212 To 214
    For $y=216 To 218
        $iPixels+=1
    Next
Next
ConsoleWrite($iPixels&@CRLF)

maybe the params are not in the order the author excpected, see result:

Dim $iPixels=0
For $x=212 To 216
    For $y=214 To 218
        $iPixels+=1
    Next
Next
ConsoleWrite($iPixels&@CRLF)

 

Link to comment
Share on other sites

As the author of the code hasn't been on this forum in over a year I am a little doubtful in successfully reaching out to them and getting a reply. With that being said thank you for the recount.

With a grid of 9 pixels being checked if I get a value of 25 out that would make sense as that is the wanted 9 and 16 "Edge" pixels.

I at this point am guessing it's how I am StringSplit -ing the FFGetRawData. I am right now using the "00" to delineate items but I'd ideally like to just count X number of characters and separate them into chunks that way. 

The output from $triangleData is FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00

It then is passed through the splitter looking for "00" which then should make blocks of "FFFFFF" , a total of 9 times.

$iMax gets it's value by Ubound ( $splitTriangleData) which gives me 20 according to my script but if the output above from triangleData is accurate, how can that be? Any ideas?

 

 

Link to comment
Share on other sites

I suggest to read the docu:

Quote

Return Value

Success:It returns a string stride with the Raw bytes of the SnapShot in 8 Hex digits (BGRA) of pixels from left to right, top to bottom ; every pixel can be accessed like this: StringMid($sStride, $pixelNo *8 +1 ,8) and you get for example 685E5B00 (blue = 68, green = 5E, red = 5B, alpha = 00).

Failure:Returns -1 and sets @ERROR

 

Remarks

This function is designed for advanced users only, as an example of how to use the GetRawData DLL function. In most cases, FFGetPixel is easier to use and fast enough.

Your script show me it's not designed for you (yet). So train your AutoIt skills and try after it again.

Edited by AutoBert
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

×
×
  • Create New...