Re: Select a NSBezierPath
Re: Select a NSBezierPath
- Subject: Re: Select a NSBezierPath
- From: Robert Clair <email@hidden>
- Date: Mon, 20 Sep 2004 22:04:54 -0400
There is a much simpler way to do this, which Michael Johnson at Pixar
explained to me a couple of years ago. The approach he described is to
use an off-screen drawing destination, and draw each object that you
want to check for hits in a distinct color. Then, given a location,
look at the color at that point, and use the color as an index to the
object that you've hit. This technique has been used for many
years in the 3D animation industry.
This is the best way to go for a general drawing program - if for no
other reason
than it will account for line-width and for non-Bezier objects (images
with or without alpha if you
draw them as an image mask for picking purposes).
There is a caveat - if you have _lots_ of objects your colors might be
very close together in
which case you must be careful to turn off anti-aliasing and
interpolation - or else
you can wind up picking the wrong object. (Not a problem if you check
one object at a time
and clear the view each time, but I want to pick the object that is the
one visible to the user
in the view as it is drawn so I render the whole display list and then
check.)
.....Bob
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden