QPainterPath转成QImage

调试path路径的时候方便打印出来。


1
2
3
4
5
6
7
QImage img(300, 300, QImage::Format_ARGB32_Premultiplied);
QPainter paint(&img);
paint.fillRect(0, 0, 300, 300, Qt::white);
QPainterPath pathToFill;
paint.drawPath(pathToFill);
paint.end();
img.save("/home/zhangpf/nice.png", "PNG");