So following on from this question here: Rounded buttons, I think I need to create a kind of map of the edges of the view, lets say I have a view that looks like this:

The button isn’t going to be blue or any specific colour so we can’t check if where the user touched is blue, suggested by one of the answers in the last question.
Lets say I receive a touch event, and I get the position of the touch inside this view, the view is rect and I only want to take in input if they press on the part that is blue. How can I figure out this?
Let’s assume that the bounding box for the graphic exactly fills the view. We can proceed as follows. The area of interest is bounded by two concentric circles and by the view. (The circle center is the bottom right corner of the view.) When we get a touch, we just need to compute the distance from the touch coordinate to the bottom right corner and compare that to the two circle radii. (You can avoid a square root by comparing the squared distance to the squared radii.) If the distance falls between the radii, the touch is in the blue (or whatever color). We don’t need to compute whether the touch is within the bounding box; we already know that since the event was delivered to the view.
Here’s some sample code. It’s for a detector that determines whether a point is within two concentric circles (an annulus) and, if it is, which quadrant it hit.