Jump to content

Advanced Pixel Search Library


FastFrench
 Share

What do you think of this library ?  

35 members have voted

  1. 1. What do you think about FastFind ?

    • It's really great, I can't imagine doing a script without it
    • It's of some use for me in my current scripts
    • I could use it some day
    • Looks nice, but of no use for me
    • I've tried it, but it doesnt fit my needs
    • Sounds good on the paper, but can't make it work (bug or too difficult to use it)
  2. 2. Have you tried it ?

    • Yes, I'm using it right now
    • Somewhat, I've done some testing, will surely use it later
    • I've downloaded it and just played a little with packaged demo scripts
    • I've downloaded it, but not tried it so far
    • Not downloaded it so far, but I probably will some day
    • It's of no interested for me.
  3. 3. What is missing or should be improved ?

    • It has all the features I may need about Pixels Handling
    • OK it's pretty fast, but couldn't it be faster ?
    • Too hard to use it, could you simplify usage ?
    • Some additional features would be nice to have (please explain in a message)
    • It really lacks some decent documentation (I still hope to find someone to help on that)
    • Some critical features are missing, can't use it (please explain in a message)
    • I found some minor bugs (please explain in a message)
    • I've found some serious bugs (please explain in a message)
    • I've never tried it so far, can't tell
    • It would be nice if you could provide easy access to the associated tool - FFShowPixel
    • I would like to use it other languages. Could you provide wrappers ? (please explain in a message)


Recommended Posts

Updated to Version 1.6 :

-> bug fix (restriction rectangles + FFColorCount)

-> New functions to export SnapShots into BMP or JPEG Files

-> New functions to create SnapShots with changes (nice for motion detection for instance) or selected colors in a previous SnapShot(FFKeepChanges & FFKeepColors).

Link to comment
Share on other sites

  • 3 weeks later...

Hello !

Many downloads, but quite few comments here. So I've started a small poll to get some feedback and better undertand Fastfind usage. It will help me to improve FastFind.

Thank you for your participation.

P.S. : version 1.7 coming soon

Link to comment
Share on other sites

Hello !

Many downloads, but quite few comments here. So I've started a small poll to get some feedback and better undertand Fastfind usage. It will help me to improve FastFind.

Thank you for your participation.

P.S. : version 1.7 coming soon

Sorry for the lack of comments, I hope that to not discourages you. You are doing an amazing job, that's for sure. In my case, I am studying the use of your library but I haven't started yet with it. I need to get some basic knowledge and experience first about the primary pixel functions from AutoIT itself (and the rest of the language of course) as I am not really a coder, and get my mind focus and clear before start with more complex things like your library. I think your library can be as "out of the blue" for me so I hope to start using it soon so I could help with some feedback. :unsure:

Thank you very much for your work and your efforts in it. Greetings.

EDIT: Oh, about the PM I will wait then for the new version. Thanx again.

Edited by Alandor
Link to comment
Share on other sites

For use with a WebCam, you can easily find the changing/moving parts with this lib (motion detection). Or also if your background has a uniform color, then you could achieve some interesting results by playing with FastFind. Now you can't do real pattern matching.

Edited by FastFrench
Link to comment
Share on other sites

One week later, still 0 answer to the poll. How exciting ! :>

I would answered the poll but I prefer to start using before that. It wouldn't be useful information. But don't think too much about it. Besides there was a crash on one of the forum harddisk recently (between sunday and tuesday I think). Also I have not seen too much movement on the forum since last friday apart from the crash.

Can't say it has no impact on motivation to continue with next versions...

Sorry to hear about that man, I know exactly that kind of feeling. But you have to know there are people REALLY interested in your work. And that's the important thing to think about. :unsure: I just can't wait to receive your last version of the library. Also I would like to ask, would it be possible you to send me 1.6 FFShowPixels even the 1.7 is near so I can start playing with It ??

Thanx very much for your work and keep on It. It worth It. If this library helps me just a 50% of what I expect it to help for my own going project........ you will save my life in more ways than you think.

P.D.: Oh, just one last thing. Be thinking of creating a webpage for accepting donations. Because as I said, if this library helps me as I think It will do..... the least I can do is donate accordingly.

Edited by Alandor
Link to comment
Share on other sites

OK, I started to look the library for testing purposes. Although I am not fully understanding the workflow. Let's see, first, you have to take the snapshots who is always in memory right (at least until version 1.7 comes out) ?? I see you added on 1.6 version a function to save a snapshot in a file. But I don't understand yet how to choose which snapshot to save. As an example, imagine I want to take snapshot one, and then snapshot two, call the FFKeepChanges which should modify snapshot 1 to leave differences right ? How can I save to BMP that modified snapshot ??

Thanx in advance. :unsure:

EDIT: As I have seen testing the SaveBMP function, It only saves last snapshot and if there is no snapshot it creates one and saves it right ? I tried to use the parameters to save first snapshot instead of second but with no luck.

EDIT2: After looking a bit deeper into the wrapper I have a question about FFSnapShot function. Is there any reason why the return is not used to give a snapshot handle ? I mean, instead of giving you an ID using fifth calling parameter wouldn't be better to create snapshot and RECIEVE a unique ID from the function (or 0 if error) ?? Just wondering. Nothing more.

EDIT3: Also I am thinking if would be possible and not too difficult to "create" a memory snapshot from a given BMP file, or a function which based on a BMP file get the color list and size to be searched in a memory snapshot.

EDIT4: Ok, definitely something wrong is happening with FFKeepChanges and SaveBMP. It only worked once and didn't could get again to work for hours. Until now. I discover something weird. Using the example from wrapper function I did this:

#include <FastFind.au3>
FFSnapShot(0, 0, 0, 0, 1)
Sleep(5000)
FFSnapShot(0, 0, 0, 0, 2)
FFKeepChanges(1, 2)
FFSaveBMP("snapshot.bmp")

And it saved the complete last snapshot. I tried to use "FFSaveBMP("snapshot.bmp", 0, 0, 0, 0, 1)" but as said in EDIT1 with no luck. Then I thought I could switch the parameters in FFKeepChanges so that line showed like "FFKeepChanges(2, 1)" and the rest just the same. But the result was not what I expected, it showed a complete screenshot. I tried this:

#include <FastFind.au3>
FFSnapShot(0, 0, 0, 0, 1)
FFSaveBMP("snapshot1.bmp")
Sleep(5000)
FFSnapShot(0, 0, 0, 0, 2)
FFSaveBMP("snapshot2.bmp")
FFKeepChanges(2, 1)
FFSaveBMP("snapshot3.bmp")

The result were three different complete screenshots. The last FFSaveBMP didn't used the last snapshot, it created a new one. But the weird stuff comes now with this:

#include <FastFind.au3>
FFSnapShot(0, 0, 0, 0, 1)
Sleep(5000)
FFSnapShot(0, 0, 0, 0, 2)
FFKeepChanges(2, 1)
FFSaveBMP("snapshot1.bmp", 0, 0, 0, 0, 1)

This worked fine, it created a BMP file with ONLY different pixels and black all the rest. Strange thing it was not supposed to do so as the snapshot in the parameters of FFSaveBMP was the 1 and FFKeepChanges parameters are (2, 1) not (1, 2). If we change the 1 in the FFSaveBMP parameters for a 2 the result is exactly the same, black screenshot with pixel from changes only.

What I can't understand is if we write the script as it should:

#include <FastFind.au3>
FFSnapShot(0, 0, 0, 0, 1)
Sleep(5000)
FFSnapShot(0, 0, 0, 0, 2)
FFKeepChanges(1, 2)
FFSaveBMP("snapshot1.bmp", 0, 0, 0, 0, 1) (the same with 2)

The result is just a complete screenshot. As It happened before.

Resuming: It only works when FFKeepChanges is (2, 1) and SaveBMP is using parameters, but it doesn't matter which snapshot parameter.

Edited by Alandor
Link to comment
Share on other sites

Hello,

sorry for the delay, I'm pretty busy so I only come here from time to time.

OK, I started to look the library for testing purposes. Although I am not fully understanding the workflow. Let's see, first, you have to take the snapshots who is always in memory right (at least until version 1.7 comes out) ?? I see you added on 1.6 version a function to save a snapshot in a file. But I don't understand yet how to choose which snapshot to save. As an example, imagine I want to take snapshot one, and then snapshot two, call the FFKeepChanges which should modify snapshot 1 to leave differences right ? How can I save to BMP that modified snapshot ??

Thanx in advance. :unsure:

EDIT: As I have seen testing the SaveBMP function, It only saves last snapshot and if there is no snapshot it creates one and saves it right ? I tried to use the parameters to save first snapshot instead of second but with no luck.

The prototype of this function is :

Func FFSaveBMP($FileNameWithNoExtension, $ForceNewSnap=true, $Left=0, $Top=0, $Right=0, $Bottom=0, $NoSnapShot=$FFLastSnap, $WindowHandle=-1)

As you can see, the default value for "ForceNewSnap" is true, meaning a new SnapShot will be done first then saved into the .BMP file.

What you want is to save an existing SnapShot. In this case, you have to set ForceNewSnap to false.

EDIT2: After looking a bit deeper into the wrapper I have a question about FFSnapShot function. Is there any reason why the return is not used to give a snapshot handle ? I mean, instead of giving you an ID using fifth calling parameter wouldn't be better to create snapshot and RECIEVE a unique ID from the function (or 0 if error) ?? Just wondering. Nothing more.

Both way could work. I've done it to make it as simple as possible to get started with FastFind : you don't need to care about Slots as long as you only use one. That was suppposed to be the most usual usage. Now, with functions like FFKeepChanges, you have to use at least 2 different slots. Also, when you works with handles, that usually mean that you have to store them and and get some function provided to free the memory when you don't need it anymore. With FastFind, you don't need to do that (memory is reallocated when you reuse the same slot).

The way it works is : you have 1024 possible "Slots", and you're supposed to use as few as really needed.

EDIT3: Also I am thinking if would be possible and not too difficult to "create" a memory snapshot from a given BMP file, or a function which based on a BMP file get the color list and size to be searched in a memory snapshot.

That may come one day in a later version, but I'm not sure it would be very useful.

The second option doesn't really make sense for me, as the color list can't exceed 1024 colors, and a 32 bits bitmaps have good chances to exceed that number of different colors.

EDIT4: Ok, definitely something wrong is happening with FFKeepChanges and SaveBMP. It only worked once and didn't could get again to work for hours. Until now. I discover something weird. Using the example from wrapper function I did this:

#include <FastFind.au3>
FFSnapShot(0, 0, 0, 0, 1)
Sleep(5000)
FFSnapShot(0, 0, 0, 0, 2)
FFKeepChanges(1, 2)
FFSaveBMP("snapshot.bmp")

And it saved the complete last snapshot. I tried to use "FFSaveBMP("snapshot.bmp", 0, 0, 0, 0, 1)" but as said in EDIT1 with no luck. Then I thought I could switch the parameters in FFKeepChanges so that line showed like "FFKeepChanges(2, 1)" and the rest just the same. But the result was not what I expected, it showed a complete screenshot. I tried this:

#include <FastFind.au3>
FFSnapShot(0, 0, 0, 0, 1)
FFSaveBMP("snapshot1.bmp")
Sleep(5000)
FFSnapShot(0, 0, 0, 0, 2)
FFSaveBMP("snapshot2.bmp")
FFKeepChanges(2, 1)
FFSaveBMP("snapshot3.bmp")

The result were three different complete screenshots. The last FFSaveBMP didn't used the last snapshot, it created a new one. But the weird stuff comes now with this:

#include <FastFind.au3>
FFSnapShot(0, 0, 0, 0, 1)
Sleep(5000)
FFSnapShot(0, 0, 0, 0, 2)
FFKeepChanges(2, 1)
FFSaveBMP("snapshot1.bmp", 0, 0, 0, 0, 1)

This worked fine, it created a BMP file with ONLY different pixels and black all the rest. Strange thing it was not supposed to do so as the snapshot in the parameters of FFSaveBMP was the 1 and FFKeepChanges parameters are (2, 1) not (1, 2). If we change the 1 in the FFSaveBMP parameters for a 2 the result is exactly the same, black screenshot with pixel from changes only.

What I can't understand is if we write the script as it should:

#include <FastFind.au3>
FFSnapShot(0, 0, 0, 0, 1)
Sleep(5000)
FFSnapShot(0, 0, 0, 0, 2)
FFKeepChanges(1, 2)
FFSaveBMP("snapshot1.bmp", 0, 0, 0, 0, 1) (the same with 2)

The result is just a complete screenshot. As It happened before.

Resuming: It only works when FFKeepChanges is (2, 1) and SaveBMP is using parameters, but it doesn't matter which snapshot parameter.

Your last try is close to be right. You simply missed a parameter. The following code works fine:

#include <FastFind.au3>
FFSnapShot(0, 0, 0, 0, 1)
Sleep(5000)
FFSnapShot(0, 0, 0, 0, 2)
FFKeepChanges(1, 2)
FFSaveBMP("snapshot", false, 0,0,0,0, 1)

When you write :

FFSaveBMP("snapshot1.bmp", 0, 0, 0, 0, 1) (the same with 2)

you keep the default value for SnapShot Slot Nb.

Also, don't need provide the extension when saving into BMP of JPG files (in fact it's better if you don't).

And you don't need also to add a suffix (1,2,3,...). If the file allready exist, FastFind will add a number as a suffixe to avoid overwrite.

Edited by FastFrench
Link to comment
Share on other sites

Hello,

sorry for the delay, I'm pretty busy so I only come here from time to time.

Don't worry first thing first. :unsure:

What you want is to save an existing SnapShot. In this case, you have to set ForceNewSnap to false.

I see. It was just that. I am afraid my coding skills are too low right now.

That may come one day in a later version, but I'm not sure it would be very useful.

Well, I just think It could be great to have an option to load a BMP file to a snapshot slot, It would expand pretty much the uses of the library. I mean sometimes you have to work on screen captures or video already taken, you can't always be physically on the computer the program is intended for, or you just can't work on realtime screen capturing. A lot of uses come to my mind that would make good use of the library with just allowing a function to load a BMP file onto a snapshot slot.

The second option doesn't really make sense for me, as the color list can't exceed 1024 colors, and a 32 bits bitmaps have good chances to exceed that number of different colors.

OK, see this way. When looking for something inside a snapshot usually is something small in most cases and It's always a good practice not to look for the entire sprite, just the most unique part. With a 1024 color list you could look for a 32 x 32 sprite which is more than enough (taking in count all pixels of sprite have a different color which in practice is not the normal thing to happen). So a function to read from a tiny BMP file the size and color list automatically can boost the workflow a lot. You could just load screenshots into a image editor, cut the little sprites you want to look for and save them to tiny bmp files. Instead of figuring by hand those colors and adding them manually. I know the FFShowPixel is suppose to help with that, but without it making this by hand is pretty much work. When you send me the tool I think It would be a lot easier but I still thinking a function loading tiny bmp files and automatically getting size and pixel colors to the list would be pretty useful and avoid a lot of extra work.

Your last try is close to be right. You simply missed a parameter. The following code works fine:

#include <FastFind.au3>
FFSnapShot(0, 0, 0, 0, 1)
Sleep(5000)
FFSnapShot(0, 0, 0, 0, 2)
FFKeepChanges(1, 2)
FFSaveBMP("snapshot", false, 0,0,0,0, 1)

Great, this would make my life a lot easier, believe me. Thanx very much. :>

Also, don't need provide the extension when saving into BMP of JPG files (in fact it's better if you don't).

And you don't need also to add a suffix (1,2,3,...). If the file allready exist, FastFind will add a number as a suffixe to avoid overwrite.

I will take the advices into account. Thanx again for your help and efforts in doing the library. Your work is much appreciated. ;) One last question, when (more or less) you think you will release the 1.7 version ??

Greetings

Link to comment
Share on other sites

One last question, when (more or less) you think you will release the 1.7 version ??

I've fixed a nasty bug yesterday in FFShowPixels 1.7. Just have to add the new dll functions in the Autoit wrapper, should not take too long. Probably be4 the end of this week.
Link to comment
Share on other sites

first of all... it looks too good to be true... itĀ“s really fast..

second.. iĀ“m a little nobish to understand the parameters of the functions.. can you explain me a little better?

FFNearestSpot($SizeSearch, $NbPixel, $PosX, $PosY, $Color, $ShadeVariation=0, $ForceNewSnap=true, $Left=0, $Top=0, $Right=0, $Bottom=0, $NoSnapShot=$FFLastSnap, $WindowHandle=-1)

$SizeSearch = ???

$NbPixel = ???

$PosX = The x coor reference for the nearest pixel where i want to find a specific color

$PosY = Same as a bove but Y coor

$color = Color that i want to look for

$ShadeVariation = Value of variations of Each component of the color that i want to look for, to look for if the main color isnĀ“t found

$forcenewsnap = If true take a new snap of the area and saves in memory, if false use the old snap take it before - ( If i use false and i never take a snapĀæwhat happend?

$left = Coor x to define the area to search

$Top = Coor y to define the area to sarch

$Right = Widht in pixel to define the area to search

$Bottom = Height in pixel to define the area to search(downest spot)

$NoSnapShot = ????

Well for now thats all... i gonna put all my doubts here..

I repeat it looks iike a big Mother****** work here and it looks very promising.. iĀ“m thinking in live color changing editor with this.. maybe dreaming but it worth...

good job!

:unsure:

Link to comment
Share on other sites

first of all... it looks too good to be true... itĀ“s really fast..

second.. iĀ“m a little nobish to understand the parameters of the functions.. can you explain me a little better?

FFNearestSpot($SizeSearch, $NbPixel, $PosX, $PosY, $Color, $ShadeVariation=0, $ForceNewSnap=true, $Left=0, $Top=0, $Right=0, $Bottom=0, $NoSnapShot=$FFLastSnap, $WindowHandle=-1)

$SizeSearch = ???

$NbPixel = ???

$PosX = The x coor reference for the nearest pixel where i want to find a specific color

$PosY = Same as a bove but Y coor

$color = Color that i want to look for

$ShadeVariation = Value of variations of Each component of the color that i want to look for, to look for if the main color isnĀ“t found

$forcenewsnap = If true take a new snap of the area and saves in memory, if false use the old snap take it before - ( If i use false and i never take a snapĀæwhat happend?

$left = Coor x to define the area to search

$Top = Coor y to define the area to sarch

$Right = Widht in pixel to define the area to search

$Bottom = Height in pixel to define the area to search(downest spot)

$NoSnapShot = ????

Well for now thats all... i gonna put all my doubts here..

I repeat it looks iike a big Mother****** work here and it looks very promising.. iĀ“m thinking in live color changing editor with this.. maybe dreaming but it worth...

good job!

:unsure:

Hello,

Here are some details :

$SizeSearch => it's the size of the 'spots'. The function will search for a $SizeSearch pixels x $SizeSearch pixels area that meet the color criteria.

$NbPixel => The function searches for spots with at least $NbPixel pixels with good colors.

$color => Color that i want to look for (or -1 to use the list of colors instead of a single color)

$forcenewsnap => If i use false and i never take a snapĀæwhat happend? : in that case, a new SnapShot is done first.

$NoSnapShot => It's the slot number you use. You can keep up to 1024 different snapshots in memory. Just Keep the default value if don't need to keep more than one SnapShot in memory.

Edited by FastFrench
Link to comment
Share on other sites

thanks for the answer..

IĀ“m doing tests whit this...

IĀ“m getting an error when i try with a picture on the windows pic viewer

I got an especific color(i use paint oolor picker to get it)but the FFNearestPixel() function doesnt find it

#requireadmin
#include "FastFind.au3"
#include <array.au3>
#include <winapi.au3>
global $color = 0x00D99272
FFSetDebugMode(0x01)
;~ $winhndl = winwaitactive("[CLASS:Photo_Lightweight_Viewer]")
;~ ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $winhndl = ' & $winhndl & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
;~ sleep(500)
$point = FFNearestPixel(@desktopwidth/2,@DesktopHeight/2,$color);,true,0,0,0,0,0,$winhndl)
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $point = ' & $point & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
_arraydisplay($point)
CloseFFDll()
Exit

i attach the pic to someone try to get it

EDIT: Also the debugmode i chose is console and when an error ocurs i get a msgbox

EDIT2 : SOLVED i think paint give me the wrong color :S itĀ“s confusing but using a shadevariation of 2 i found the color....

anyway i give you my feedback of my tests when i get it. :unsure:

Edited by monoscout999
Link to comment
Share on other sites

I've fixed a nasty bug yesterday in FFShowPixels 1.7. Just have to add the new dll functions in the Autoit wrapper, should not take too long. Probably be4 the end of this week.

Ohhhhhhhh, great. Very glad to hear that. :unsure: Thanx again. :>

Link to comment
Share on other sites

Hey, is it possible for me to take a snapshot of a hidden window using your library? I already downloaded it and played around with a function or two but I cannot get it right. I know that the FFSnapshot() can use an inactive window by specifying the $WindowHandle. When I tried using FFSaveBMP("filename") though to check what I'm capturing, it turned out to be the area occupied by the inactive window, but with the currently active window on top of it. Hence, I don't actually get to see the hidden window. And when I set the $WindowHandle to a minimized window, the saved image file was just be a black bar.

What I'm trying to achieve is to be able to use some sort of PixelSearch function on an inactive (not necessarily minimized) window. Is it possible?

Thanks! I'm a newbie so please bear with my newbie-shness.

P.S.: Attached is the saved .BMP file from the FFSnapshot(). $WindowHandle was a randomly placed inactive Paint window. I ran the test with the SCiTe as the active window.

THANKS!

Link to comment
Share on other sites

I failed to include the picture on my post. Can't get the edit button to work and also realized that I can't attached the image file because of the attachment's file size limit. Anyway, here's the snapshot taken using your FFSaveBMP("filename"): http://tinypic.com/r/hx4x9i/7

Thanks for doing the trouble of reading my posts and I'm really sorry for polluting your thread with my rubbish talk.

Link to comment
Share on other sites

Hello,

it was initialy my idea to make it possible. Unfortunately, the only way to do that seems to be by using PrintWindow Windows function, and results were not reliable at all. In fact, it depends how printing is implemented within the application you want to capture, but you can't be sure it will work. It's also somewhat OS-dependant.

So, I'd say in some cases it may work, but you can't be sure it will, neither that refresh will be reliable when the Window is not visible.

For instance, when I've tried with Notepad on Seven 64, I guess it was OK. But a "flash" Window could'nt be captured when not visible.

Link to comment
Share on other sites

hi... still testing and trying to figure out how to make it works... :S

i have this error when i run this

#requireadmin
#include "FastFind.au3"
#include <array.au3>
#include <winapi.au3>
FFSetDebugMode(0x01)
FFSnapShot()
msgbox(0,"","")
FFSnapShot()
$point = FFLocalizeChanges(1, 2)
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $point = ' & $point & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
_arraydisplay($point)
CloseFFDll()
Exit

i attached the msgbox of the debuger

Edited by monoscout999
Link to comment
Share on other sites

tottaly awersome... my own test..

#RequireAdmin
#include <array.au3>
#include "FastFind.au3"
FFSetDebugMode(0x01)
$start = timerinit()
$colors = _Getboxcolors(0,0,10,10)
$diff = timerdiff($start)
consolewrite($diff&@CRLF)
_ArrayDisplay($colors)
$start = timerinit()
$colors = _Getboxcolors2(0,0,10,10)
$diff = timerdiff($start)
consolewrite($diff&@CRLF)
_ArrayDisplay($colors)
CloseFFDll()
Func _Getboxcolors($x1,$y1,$x2,$y2)
    Select
        case $x1 > $x2
        seterror(1)
        consolewrite("error number "&@error&" Your first x coor must be less than your second x coor")
        return false
    case $y1 > $y2
        seterror(2)
        consolewrite("error number "&@error&" Your first y coor must be less than your second y coor")
        return false
EndSelect
If $x2 = 0 then $x2 = @DesktopWidth
If $y2 = 0 then $y2 = @desktopheight
local $y = $y1
local $colors[1] = [0]
    For $i = 0 to $x2 - $x1
        local $x = $x1 + $i
        _arrayadd($colors,hex(PixelGetColor($x , $y)))
        $colors[0] += 1
        If $y > $y2 then return $colors
        If $x = $x2 Then
            $y += 1
            $x = $x1
            $i = 0
        EndIf
    Next
EndFunc
Func _Getboxcolors2($x1,$y1,$x2,$y2)
    Select
        case $x1 > $x2
        seterror(1)
        consolewrite("error number "&@error&" Your first x coor must be less than your second x coor")
        return false
    case $y1 > $y2
        seterror(2)
        consolewrite("error number "&@error&" Your first y coor must be less than your second y coor")
        return false
EndSelect
If $x2 = 0 then $x2 = @DesktopWidth
If $y2 = 0 then $y2 = @desktopheight
local $y = $y1
local $colors[1] = [0]
FFSnapShot($x1,$y1,$x2,$y2)
    For $i = 0 to $x2 - $x1
        local $x = $x1 + $i
        _arrayadd($colors,hex(FFGetPixel($x , $y,0)))
        $colors[0] += 1
        If $y > $y2 then return $colors
        If $x = $x2 Then
            $y += 1
            $x = $x1
            $i = 0
        EndIf
    Next
EndFunc

Getting colors of a 10 x 10 pixels area

PixelGetColor... 2052.90918064547 ms

Your FFGetColor func... 45.218878869982 ms

I donĀ“t know a better word for that... awersome :unsure:

I need to learn C++

EDIT: I still waiting the results of the whole desktop test with pixelgetcolor() when i got it i post it... also i was thinking in a tool like this function that also tells you the amoust of a specific color component.. not the whole color... and a way to mark where a specific color was found

Edited by monoscout999
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...