Re: Touch: Non-rectangular Touch areas
Re: Touch: Non-rectangular Touch areas
- Subject: Re: Touch: Non-rectangular Touch areas
- From: Andrew Farmer <email@hidden>
- Date: Sat, 6 Feb 2010 11:19:37 -0800
On 6 Feb 2010, at 11:05, Jens Alfke wrote:
> The easiest way to do this is to create an NSBezierPath in the shape of the trapezoid and call -containsPoint: on it; but IIRC, that class doesn't exist on iPhone. Fortunately the math for hit-testing convex polygons is pretty easy: check any computer graphics textbook for details.
Another simple approach is to use an image to do hit testing. You can either create a bitmap image for each touchable area, or a single image with a different color for each target, then test the color at the target point to determine membership. My only concern with using this approach on iPhone might be the memory usage of that image._______________________________________________
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