iphone - Detecting Touch on PNGs with Alpha -
I am trying to detect a touch phenomenon on a PNG image loaded in a UIImageView. I have everything working fine except that touch is being checked for boundary rectangle around the image (as expected). What I would like to do is this test if the user has selected the part of the visible PNG, which is contrary to the UIMAZV itself.
For example if I have a horseshoe image, I want to see it only to answer the touches when you select the sides and not the center part where nothing is being prepared. I'm like a loss on this, many people with Google's same issue are aware of it, but there is no indication of where to start.
two ways: a) for you a pixel data of your image Determine that the touched pixel is a transparent pixel to make it possible for you to make it possible to pull your image into offline buffer. UIImage.CGImage from Polygon explains the basic method to use this pixel data to get access to CGContextDrawImage and CGBitmapContextGetData pixel data for. b) If you have a polygon representation of the horse's cord and uses it, then the test struck to determine the horse's cord touched. Google for "point in polygon" for algorithm probably works less, so you just need this for a few images, but if you hit a lot of testing (a lot of movement The game with some) b) can be better.
Comments
Post a Comment