• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Select a NSBezierPath
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Select a NSBezierPath
      • From: "John C. Randolph" <email@hidden>
    • Re: Select a NSBezierPath
      • From: "M. Uli Kusterer" <email@hidden>
  • Prev by Date: External C Libraries and ZeroLink (was: Using External C Libraries with Objective-C)
  • Next by Date: Re: transformers? revisited but getting there..
  • Previous by thread: Select a NSBezierPath
  • Next by thread: Re: Select a NSBezierPath
  • Index(es):
    • Date
    • Thread