Gradient in pdf
-
Good day. Noticed such a thing. If I draw to pdf any shape with a gradient fill, the fill becomes a picture. If a shape to fill a solid color, it will be a vector object.
I understand that to use native gradient, we need to define USE_NATIVE_GRADIENTS, but in qprintengine_pdf_p.h this definition commented.
Why is it done? Native gradient somehow reflects badly on the pdf file? Or maybe someone knows how to put pdf native gradient?Code example:
@int main(int argc, char *argv[])
{
QApplication a(argc, argv, false);QPrinter printer; printer.setColorMode(QPrinter::Color); QRect rect(printer.width()/3, printer.height()/3, printer.width()/3, printer.height()/3); QList<QBrush> brushs; QLinearGradient gradient(rect.topLeft(), rect.bottomRight()); gradient.setColorAt(0.0, Qt::white); gradient.setColorAt(1.0, Qt::green); brushs.append(QBrush(gradient)); brushs.append(QBrush(Qt::green)); for (int i = 0; i < brushs.count(); ++i) { printer.setOutputFileName(QString("output%1.pdf").arg(i)); QPainter painter(&printer); painter.setBrush(brushs.at(i)); painter.drawEllipse(rect); painter.end(); } return 0;
}@
P.S. used Qt 4.8.1, 4.8.5, 4.8.6