Jump to content
Kandor

FindBitmap at specific coordinate

Recommended Posts

Hey Kandor, you could use FindBitmapEx() which stores ALL found bitmap results (from area) to a TPointArray.

 

Any pointers on how to use FindBitmapEx()? This is how I assume you use it:

 

FindBitmapEx(tpa,bmp,X1,Y1,X2,Y2)

 

tpa = TPointArray

bmp = Bitmap

X1,Y1 - X2,Y2 = coorindates between

Link to comment
Share on other sites

That is correct. But you have got to covered area ("coorindates between") reversed. Should be: X2-X1, and Y2-Y1.

 

Anyways.. a working example could look like this:

var
 xs,ys,xe,ye,AreaX,AreaY,i: Integer;
 bmp: TSCARBitmap;
 TPA:TPointArray;
 found: Boolean;
begin
 bmp := TSCARBitmap.create('deNoB6wAU/wsABwB0qvl3q/l7rvl5rfl3q/mCs' +
   'fmKtviRuvi20Pi50vf+/v6awfmixvmszPmqy/msy/muzPmqyfiryvjR4fjU4vf' +
   '7/v6PtLGryNLG2/nI2/nT4vnJ3fnG2fnN3vjT4vjb5vj4/Pxql4J0oY6vyc/X5' +
   'PbU4vfV4/jX5PnX5Pnc5/nj7Pn1/PxYg3leiX9pk4p0npeJrKyZub2lw8mtytK' +
   '91eDS4vDy+vppjLFtkLZ0l75+oMaJrNKVuN2hxeisz/C12fa63/rw+flukLdzl' +
   'bx5nMOAo8qIq9KQs9yZveShxO2ozPSt0vnu+PhDGLJk');
 XS := 20;
 YS := 20;
 XE := 900;
 YE := 200;
 AreaX := XE-XS;  //If you need (just to demonstrate as you had it reversed)
 AreaY := YE-YS;  //...

 Found := FindBitmapEx(TPA, bmp, XS,YS, XE,YE); // You can put this INSIDE the if-statement.
 if Found then
   for i := 0 to high(TPA) do 
   begin
     XE := TPA[i].X + bmp.width;
     YE := TPA[i].Y + bmp.height;    
     WriteLn('Found Image at: ' + PointToStr(TPA[i]) +', ' +PointToStr(Point(XE, YE)));
   end;   
end.

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