sjesper Posted July 8, 2012 Share Posted July 8, 2012 (edited) Hello :-) I was wondering how FindBitmaps is working, cause i'm planning to make a FindDTMs myself. The FindColors wouldn't be that hard. I would guess it's just copying the client to a bitmap and then looping every pixel on the bitmap and adding the coordinates when it find one to a TPA, and add the finded coordinate to a kind of "dont-use" TPA, so it wont find it anymore. Like: [sCAR]If TPAContains(DontUse, CurrentTP) then Continue;[/sCAR] But Bitmaps is not just one pixel. It can be a hundred of pixels. So i was wondering if it search for one and if it find one it would avoid those pixel it was at in the continue of the for loop? But if it does that, then what there is a bitmap in a bitmap of the same kind? Thanks :-) Edited July 8, 2012 by sjesper Quote Link to comment Share on other sites More sharing options...
LordJashin Posted July 8, 2012 Share Posted July 8, 2012 (edited) Hello :-) I was wondering how FindBitmaps is working, cause i'm planning to make a FindDTMs myself. The FindColors wouldn't be that hard. I would guess it's just copying the client to a bitmap and then looping every pixel on the bitmap and adding the coordinates when it find one to a TPA, and add the finded coordinate to a kind of "dont-use" TPA, so it wont find it anymore. Like: [sCAR]If TPAContains(DontUse) then Continue;[/sCAR] But Bitmaps is not just one pixel. It can be a hundred of pixels. So i was wondering if it search for one and if it find one it would avoid those pixel it was at in the continue of the for loop? But if it does that, then what there is a bitmap in a bitmap of the same kind? Thanks :-) Confused me lol. If you want to make a FindBitmaps function, just have a TPA returned, and maybe a boolean if they were all found. Now if you wanted to know which were found and which weren't you would need more, unless a TPoint can have a value of -1. Pixel by Pixel from scratch. You can use a Scan line method. Essentially though just get a TPA of the client, and check if the colors match. Edited July 8, 2012 by LordJashin Quote Link to comment Share on other sites More sharing options...
sjesper Posted July 8, 2012 Author Share Posted July 8, 2012 I think u missunderstod me I want to make a FindDTMs (There is only a FindDTM function (Not with a s)). So i gave an example of the FindBitmaps function and asked how the function is builed up. I do know how to use it ^^ Quote Link to comment Share on other sites More sharing options...
LordJashin Posted July 8, 2012 Share Posted July 8, 2012 (edited) I think u missunderstod me I want to make a FindDTMs (There is only a FindDTM function (Not with a s)). So i gave an example of the FindBitmaps function and asked how the function is builed up. I do know how to use it ^^ I bet Janilabo has a FindDTMs function - erased -. Same sorta concept goes for DTM's though, but with a TIntArray. Well here is his: [sCAR] function FindMultiDTM(DTMs: TIntegerArray; var X, Y: Integer; XS, YS, XE, YE: Integer): Boolean; var i, h: Integer; begin h := High(DTMs); for i := 0 to h do begin Result := (FindDTM(DTMs, X, Y, XS, YS, XE, YE)); if Result then Exit; end; end; [/sCAR] Edited July 8, 2012 by LordJashin Quote Link to comment Share on other sites More sharing options...
Janilabo Posted July 8, 2012 Share Posted July 8, 2012 I bet Janilabo has a FindDTMs function - erased -. Same sorta concept goes for DTM's though, but with a TIntArray. Well here is his: [sCAR] function FindMultiDTM(DTMs: TIntegerArray; var X, Y: Integer; XS, YS, XE, YE: Integer): Boolean; var i, h: Integer; begin h := High(DTMs); for i := 0 to h do begin Result := (FindDTM(DTMs, X, Y, XS, YS, XE, YE)); if Result then Exit; end; end; [/sCAR] He's actually suggesting a function that will find all positions of a DTM in an area.. Just like FindBitmaps does with bitmap. My function searches for multiple amount of DTM's from an area (with array), so it's totally different.. I am sure Freddy adds FindDTMs function in SCAR soon, maybe for 3.35 version? It's definitely 1 important function that is missing from SCAR.. -Jani Quote Link to comment Share on other sites More sharing options...
FHannes Posted July 8, 2012 Share Posted July 8, 2012 He's actually suggesting a function that will find all positions of a DTM in an area.. Just like FindBitmaps does with bitmap. My function searches for multiple amount of DTM's from an area (with array), so it's totally different.. I am sure Freddy adds FindDTMs function in SCAR soon, maybe for 3.35 version? It's definitely 1 important function that is missing from SCAR.. -Jani I probably won't be rewriting the DTM sytsem in 3.36, though I will soon, so FindDTMs, or FindDTMEx as I'll be naming it, probably won't be far off. Currently I've only just started rewriting the bitmap system though and I'm still working on the colorfinding API. Quote Link to comment Share on other sites More sharing options...