在单声道QImage上绘制QGraphicsScene更快

时间:2015-05-18 16:37:58

标签: image qt

我必须将QGraphicsScene渲染到图像(或打印机)上。

在具有严重限制的设备类型上,使用的时间和内存可能非常大。

所以我优化了上游项目:在我渲染的位置,场景中的所有项目都是单色的(或者是单色的简单对象,或者是包含已经抖动的图像的QGraphicsPixmapItem)。

image = QImage(view->scene()->sceneRect().size().toSize(), QImage::Format_Mono);
image.fill(QColor(Qt::color0).rgb());
painter.begin(&image);
painter.setRenderHint(QPainter::Antialiasing);
view->scene()->render(&painter);
painter.end();

这一步仍然需要很长时间。

有没有办法加快速度,也许确保没有抖动(ThresholdDither)?或者其他任何可能更快的方法?

0 个答案:

没有答案