a class to draw rectangles on an image.
rewrite with the "resource" api.