png: add support for drawing legends