Add mask option to shapes().

This lets you exclude background pixels if you're only interested
in foreground shapes and saves a significant amount of time.

Closes #26.