Basically it's selecting certain parts of an image in a sprite sheet, based on whether or not that particular part of the image is surrounded by transparent, or the selected mask color's pixels.
I'd say the pitfalls for that kind of function should be obvious.