Jump to content

KrinnyAit

Members
  • Posts

    8
  • Joined

  • Last visited

KrinnyAit's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. @Devilz_2 I just thought of something that might work for you. You probably want to duplicate your base snapshot twice. One for the colors you want to keep, and the second to redraw the changes onto. Duplicate Snapshot 1) Might be tedious or clunky to do it this way, but you could use FFKeepColor for the specified pixels you want to keep. Next we are going to modify this snapshot with the kept colors and all black pixels of the discarded colors. I'm assuming here that FFSetPixel uses the format 0xAARRGGBB, but you could try and set all the black pixels to an alpha of zero, essentially transparent. Use a loop. So that the black pixels might / should look like is 0xFF000000, and we need to change all of them to 0x00000000. Duplicate Snapshot 2) Now that we have them changed, use FFKeepChanges($dSS2, $dSS1). No shade variation. $dSS2 is the base duplicate of the original snapshot, which will be overwritten from the function call. $dSS1 is the colors you kept and modified all the black pixels from. In theory, since it will redraw the transparent pixels onto the existing ones, it should keep the same shade or alpha transparency of the entire snapshot, while overwriting only the kept colors. I don't have the time right now to write a test script. Edit: This probably won't work because BMP does not support transparency. So you may end up with all black pixels. I don't know how KeepChanges performs the operation. However, if the above does not work we might be able to manually stitch them together via BitOR. @DigiBox I don't think we can change the Square from SizeSearch, because that's a hard coded function inside the FastFind.dll file. FastFrench would have to add a new function for that, and since he has been absent for multiple years now, I wouldn't count on it any time soon. This box is only the scan window. What's important that you have to use an irregular rectangle shape?
  2. I think your trying to debug the hard way. If you need to just visualize the found pixels, try using the $FFDefautDebugMode to 0x04. Otherwise you need to get a list of the found colors, and set the pixel colors manually. There was an example on page 19.
  3. Can someone help with an issue I've been getting recently? Using Versions 2.1. Same issue as: Doesn't matter how I specify using #include "FastFind.au3", any script I use has 50/50 chance of the DLL and code not loading, resulting in the script exiting. I can specify a direct path to FastFind.au3 or use a generic #include, which should point to the include directory at C:\Program Files (x86)\AutoIt3\Include. Either way, both directories have the correct versions (2.1) and DLL files inside the directory. Even with "FastFind.au3" in the same working directory as the script causes this issue. When it doesn't fail, it works fine. I might try compiling a sample script and see if that helps, but I'd rather not use a compiled script every time I need to test something. I'm using SciTE Version 4.1.0, and I assume the latest Autoit Version. I'm unsure if there is a permission error for trying to access a resource unavailable to a user, but I have admin rights so that shouldn't be a problem. This never used to be a problem, until I probably recently updated my autoit version and scite version. -------------- I don't want to bump the thread again so I'll just edit my post. Has anyone used FastFind to convert the snapshot into something GDI+ can use? I haven't been able to correctly assign a snapshot to a GDI+ Bitmap. Nvm. Did it the hard way. Saved an snapshot to BMP and loaded the BMP to a GDI object. Takes an extra ~15ms to save and less than 1ms to load. For those wondering, you cannot really use the FFGetRawData to pass into a GDI Object from Memory unless you jump through the hoops of formating the data into a .BMP file format, which was my mistake. Unless someone can create a function for that and benchmark the numbers, it's much simpler to just save a BMP and load the BMP to a GDI object.
  4. I'd love a function like this myself. Sadly there isn't one. However I think we can cheat a little. If you have an image in mind, you can probably load it (call it) from windows preview, make sure it's the full resolution (click the button if needed) and then taking a snapshot of that area. Now you have a snapshot of the image you wanted to load in the first place. The other alternative is creating a blank snapshot, reading/loading the image to memory(variable), and using FFSetPixel to manually set the entire snapshot to the same as the image with a loop.
  5. Is there a way to disable the script from drawing on a window? Every time I take a snapshot, it draws a box around the client Area of a window. I'm not sure if this is because I specify a window handle in my function calls. This is problematic for me if I'm taking snapshots every 50ms or so, I'd rather not have the screen flicker. I don't know if I can specify this by modifying the DLL call, changing the debug mode, or if it's something entirely internal to the DLL. Any help would be appreciated. Found out it was a setting inside the FastFind.au3, need to disable debugger variable to 0x00.
  6. On my phone atm. If the function for color count also has coordinates then you just have to specify the right offset. (From your variable a2). I don't have the function code in front of me. I'm certain there was a function that gave a list of coordinates for all found pixels or groups. What your doing is only searching for the nearest color from the point (0,0) and showing those coordinates. Which isn't really what you want. I'll look more when I get home. Edit: So it appears the script doesn't have a function to return a list coordinates of found pixels. I was thinking of FFNearestSpot or FFBestSpot. Maybe FastFrench can add a new function to return a list of all points that match criteria from FFNearestSpot and FFBestSpot. But I think you can kind of get around this depending on the criteria you define. I think either of those two functions might work well. Depends how large / how many pixels of the same color are grouped together, that you define as spots to find. But that doesn't really solve the problem. It's not a good solution, but I was thinking to try searching through a nested loop for the X-Axis and Y-Axis. Like line scanning, while also using FFGetPixel. ;; Psudo code for finding a list of colors that match search color criteria. ;; ;; Create Snapshot 1 ;; ;; ;;This might speed up searching, keeping only the colors you want. ;; FFKeepColor($ColorToFind, $ShadeVariation=0, $ForceNewSnap=true, $Left=0, $Top=0, $Right=0, $Bottom=0, $NoSnapShot=$FFLastSnap, $WindowHandle=-1) ;; FFKeepColor($yourColor, $Tolerance, False, 0,0,1920,1080, 1, -1) ;;we're going to use the same snapshot to keep only your color ;; ;; ;;(optional) Perform FFColorCount() to get an idea of how many spots we need to find. This is probably not an exact count if the spots are larger than 1x1 pixels. ;; ;; ;;this is an example for your screen size 1920x1080? ;; For $j=0 to 1080 step $Y_stepSize ;;If you change the step size > 1 then you can skip lines to increase speed, with the cost being accuracy of results. ;; For $i=0 to 1920 step $X_stepSize ;; ;; $searchColor = FFGetPixel($i,$j) ;;I think FFGetPixel returns an array, I could be wrong. Either way this should be the color to compare to. ;; if $searchColor = $yourColor then ;; ;;add result to an array list, with (x,y) coordinates from the current ($i,$j). ;; EndIf ;; ;; ;;(optional) ;; ;;compare if the number of items in our array is greater than FFColorCount ;; ;;if yes, determine if you want to ExitLoop. Again this might lead to count accuracy problems. ;; ;; Next ;;end X-Axis ;; Next ;;end Y-Axis ;; ;; ;;Display your array list That's the best I care to work on this at the moment. If I ever get around to it I would write it myself, because I could use this type of funciton as well. Hope that helps at least. Sorry there's no better solution to finding a list of colors. Edit: WiValdiBB wrote some neater condensed code, however I feel that will run into problems if you are checking very small areas, such as 1x1 pixels or even up to 10x10 areas. This is because the exclusion function can only hold 1024 zones (rectangles) to exclude. When you have a monitor of 1920x1080, you can see that even checking one row or column of a 1x1 pixel will fail, because the limit is exceeded. With the psudo code I wrote, you can limit your search range if you need to by changing the size limits. So instead of searching an entire desktop, lets say you search the area of the last snapshot coordinates. Basically you specify a box range, and count the number of pixels within that box.
  7. Whats the bottom number being displayed represent? Time between events in nano seconds? Current date?
  8. Is it possible to add functionality for a Flood-fill algorithm (magic wand)? There used to be a script here of a magic wand on the forums, but all links on that thread do not work, and nobody posted the code. I'm specifically looking to be able to perform Flood-fills to a certain pixel, or a group of specified pixels. With or without Tolerance. Also, I'm looking to emulate the following Photoshop functions in code: Expand selection, contract selection, smooth selection, Intersect selection (selection A intersect with selection B.) Edit: Nvm about that. I found a Floodfill example for Autoit, however it is a bit slow. Edit2: Ok so I got FFKeepcolor to work despite my sample code displaying false. Is there a way to save files as png? I specifically need this for transparency. Also, how can I exclude an area that is an Ellipse shape? For example if I specify the center (x,y), and radius R.
×
×
  • Create New...