This code sample demonstrates how to make an image from a portion of another image, as well as a few ways of indicating a selected rectangle or region.
This sample requires OS X 10.4 or higher.