mirror of https://github.com/vitalif/phantomjs
Use Qt::transparent to resolve graphical artifacts with images with transparent background.
We need to use QImage::Format_ARGB32_Premultiplied on Windows to preserve a text hinting and antialiasing. Using the function `qRgba()` leads to wrong pixel values on a target image. Since, `QImage::fill(uint pixel)` doesn't handle the QImage::Format_ARGB32_Premultiplied format, so we need to use the another overload `QImage::fill(const QColor &color)` Issues: https://github.com/ariya/phantomjs/issues/11276 https://github.com/ariya/phantomjs/issues/11007 https://github.com/ariya/phantomjs/issues/113661.9
parent
492e7da959
commit
66f6496f2d
|
@ -990,7 +990,7 @@ QImage WebPage::renderImage()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QImage buffer(frameRect.size(), format);
|
QImage buffer(frameRect.size(), format);
|
||||||
buffer.fill(qRgba(255, 255, 255, 0));
|
buffer.fill(Qt::transparent);
|
||||||
|
|
||||||
QPainter painter;
|
QPainter painter;
|
||||||
|
|
||||||
|
@ -1004,7 +1004,7 @@ QImage WebPage::renderImage()
|
||||||
for (int y = 0; y < vtiles; ++y) {
|
for (int y = 0; y < vtiles; ++y) {
|
||||||
|
|
||||||
QImage tileBuffer(tileSize, tileSize, format);
|
QImage tileBuffer(tileSize, tileSize, format);
|
||||||
tileBuffer.fill(qRgba(255, 255, 255, 0));
|
tileBuffer.fill(Qt::transparent);
|
||||||
|
|
||||||
// Render the web page onto the small tile first
|
// Render the web page onto the small tile first
|
||||||
painter.begin(&tileBuffer);
|
painter.begin(&tileBuffer);
|
||||||
|
|
Loading…
Reference in New Issue