Since your outlines are defined by paths (i.e., polygons), why not just use a routine to see whether the clicked point is inside or outside of the polygon? Here’s a simple function that I translated from Fortran (maybe from Paul Bourke’s web site?) a long time ago:
[code]
function PointInPoly(px as double, py as double, xx() as Double, yy() as Double, n as Integer) as Boolean
// description of the parameters
// px - x-coordinate of point clicked
// py - y-coordinate of point clicked.
// xx - array containing x-coordinates of vertices of polygon.
// yy - array containing y-coordinates of vertices of polygon.
// n - number of vertices in the polygon.
// inout - the signal returned:
// -1 if the point is outside of the polygon,
// 0 if the point is on an edge or at a vertex,
// 1 if the point is inside of the polygon.
Dim x(-1), y(-1), w as Double
Dim mx,my,nx,ny, inPoly as Boolean
Dim i, j, k, inout as Integer
for i=0 to n-1
x.Append (xx(i)-px)
y.Append (yy(i)-py)
next
inout=-1
For i=0 to n-1
k = i mod (n-1)
j=1+k
if x(i) >= 0.0 then
mx = True
else
mx = False
end if
if x(j) >= 0.0 then
nx = True
else
nx = False
end if
if y(i) >= 0.0 then
my = True
else
my = False
end if
if y(j) >= 0.0 then
ny = True
else
ny = False
end if
if( not ((my or ny) and (mx or nx)) or (mx and nx)) then continue
if( not (my and ny and (mx or nx) and not (mx and nx))) then
w = ((y(i)*x(j)-x(i)*y(j))/(x(j)-x(i)))
if w < 0 then
Continue
elseif w = 0 then
inout=0
exit
else // w is positive
inout=-inout
end if
else
inout=-inout
end if
next
if inout >= 0 then // if the point is on the edge of the polygon we count it as if it were inside the polygon
inPoly = True
else
inPoly = False
end if
return inPoly[/code]
This is one of many implementations of a simple algorithm where, if a vertical line through a point intersects the (closed) polygon an odd number of times the point is inside the polygon; if an even number of time than it is outside the polygon.
I use this in a lasso routine so that I can select points inside a lasso. In that case, the lasso outline is the polygon and I check each point in my target array of points to see which are inside the lasso. However, it should work for you simple case for a polygon of arbitrary complexity as long as the polygon does not cross itself.