Create a bitmapped graphics context and render the view into that context. Then for each DogView, create a UIBezierPath, and use moveToPoint
, addLineToPoint
, and closePath
to draw an outline where the DogView would be. Then call fillWithBlendMode:alpha:
with an alpha of 0.0 to clear that region of the drawing.
I like to use UIGraphicsBeginImageContext
to create the bitmapped graphics context since it only needs a size, which you can get from the view's bounds. Here's the general framework.
UIGraphicsBeginImageContext( view.bounds.size );
CGContextRef context = UIGraphicsGetCurrentContext();
// drawing stuff goes here
UIImage *result = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();