[comp.sys.next] Picking an arbitrary shape

sritchie@cs.ubc.ca (Stuart Ritchie) (03/16/91)

I have some well-defined shapes drawn in a Custom View using
pswrap functions.  For now, the shapes consist of filled
rectangles and filled arcs.  The shapes do not overlap.

I'd like to find out which shape receives a mouse up or down
event.  Actually, for the time being, only one shape in the
view is a possible target, and therefore I only need to check
whether this one special shape was hit.

I assume that rectangles are easy, and are given to you for
free.  But what about a convex shape like a filled arc?  Is
there a way to check whether a mouse event occurs inside of
an arbitrary bounding path (bounding _box_ works for rectangles,
but not circles or arcs or Bart Simpson's.)

Come to think of it, I guess I should look at the Draw code.
But any hints are welcome!

...Stuart
---
I'm still looking for the kitchen sink in IB, anyone found it yet?

wjs@milton.u.washington.edu (William Jon Shipley) (03/16/91)

Stuart Ritchie writes:
>[has some postscript shapes]
>I'd like to find out which shape receives a mouse up or down
>event.
>
>Is there a way to check whether a mouse event occurs inside of
>an arbitrary bounding path (bounding _box_ works for rectangles,
>but not circles or arcs or Bart Simpson's.)

Yup.  Check out infill and instroke to check if your point is in an ordinary
path and inufill and inustroke to see if your point is in user path.

From the manuals (Summaries/04_OpSummary/_WindowSystemSupportOps.rtf):

x y		infill    bool
userpath	infill    bool		return true if pixel at (x, y) (or
	  				any pixels in userpath) would be
					painted by fill of current path

Cool stuff.  Only works for DPS (and probably PSL2).

-william shipley
glenn reid wannabe