Log in

View Full Version : searching top right to bottom left



zluo
05-27-2012, 07:42 AM
how can we search a colour from top right to bottom left in a specific box?

or even better how can we search a colour from top right to bottom right?

thanks guys

P1nky
05-27-2012, 07:46 AM
for main screen: MSX1 , MSY1, MSX2 , MSY2.

If you want it to search a custom box , and not the whole main screen; Than use the color picking tool and you will see coords anywhere you hover.

YoHoJo
05-27-2012, 08:00 AM
^ Didn't fully answer the question.
He wants to search from a certain point of the screen 'outwards' to another point of the screen, right?

But still good helpful info!

zluo
05-27-2012, 08:34 AM
Yohojo that is correct and I know About normal
Color finding, I just want to know how to do what I said In first post

J J
05-27-2012, 10:07 AM
You could use FindColorsSpiralTolerance to get a TPA (Array of TPoint aka TPointArray). Once you have a TPA you can search through it or split it into a box.

procedure Test;
begin
FindColorsSpiralTolerance(X, Y, TPointArray, Color, X1, Y1, X2, Y2, Tolerance);
ClearTPAFromTPA(TPointArray, InvertTPA(TPAFromBox(X1, Y1, X2, Y2)));
WriteLn(''+ToStr(TPointArray)+'');
end;
1) Finds the colors and puts them in a TPA
2) Clear all points from the TPA except the box you specified
3) Writes in all the points in that box

Then you can click a point that is the nearest to a specific point you want. The point closest to the top left will have lower co-ordinates than points in the bottom right corner.
NearbyPointInArray(Point(X, Y), Distance, TPointArray);
Will look for the nearest point in the array you define.

Just play with that and see what you get.