Best way to do hit testing on an image?
Best way to do hit testing on an image?
- Subject: Best way to do hit testing on an image?
- From: "Karan, Cem (Civ, ARL/CISD)" <email@hidden>
- Date: Tue, 9 Dec 2008 11:27:05 -0500
- Thread-topic: Best way to do hit testing on an image?
I am in the process of creating a new interface for my program, which, for lack of any good comparison, can be thought of as a 2D scrolling game with a bunch of clickable sprites. I need to do hit testing to see if particular bitmaps have been clicked on. I have the following information available to me:
- An array of NSImages that I can get bitmaps and masks from
- The view I'm compositing the images into.
- The order I'm compositing the images (so I know which image is painted on top of which other one, letting me calculate a new bitmask)
- The location I'm compositing the images relative to the view.
What I want to know is if a user has clicked on a particular image. I know I need to do hit testing, and I know I can create my own code to do so, but I was wondering if Cocoa had some built-in method to determine if a point is within a bitmask or not. If there is a built-in way, I'd rather use that.
Thanks,
Cem Karan
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden