Jump to content
sjesper

Wondering how FindBitmaps is working?

Recommended Posts

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 by sjesper
Link to comment
Share on other sites

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 by LordJashin
Link to comment
Share on other sites

I think u missunderstod me :P 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 by LordJashin
Link to comment
Share on other sites

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. :P

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

Link to comment
Share on other sites

He's actually suggesting a function that will find all positions of a DTM in an area.. Just like FindBitmaps does with bitmap. :P

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
  • Create New...