Log in

View Full Version : finding a color nearest to mouse position



wantonman
12-31-2011, 02:20 AM
I was thinking of using GetMousePos in order to find whats closest to it.

Either color/Bitmap would do. is there such a Function that can Find A color that is closest to the position of the mouse? :santa:

Dynamite
12-31-2011, 02:23 AM
GetMousePos, create a TBox around your mouse of how ever big then do, FindColorsSpiralTolerance.

Hope I helped :)
-Boom

wantonman
12-31-2011, 02:45 AM
okay I'm going to sound crazy but how do i create a tbox?

i think it has to do with TPA's but if you have any good tutorials link em please!

[Nathan]
12-31-2011, 02:52 AM
I can't explain the TPAs as well as other members, but I'll expand on what Dynamite said.

Here is how I would do it:

Populate a TPA with all points having a given color (read tutorial)
GetMousePos(x,y)
Sort the TPA by points closest to x,y (there is a function for it I can't think of off hand)
And then use the first point in the TPA, which will be the closest point