For something as simple as your specific example (triangle and circle), the link David Ronquist gives is very useful. You should definitely look at it to see some of the tools available. But for the general case, clipping, drawing, and searching is the best option.
. CGRRect CGPath.
-. .
, CGContextClipToMask().
.
, (. , , ).
- , .
( ) , CGBitmapContext. , - > 128 .