Qt Convert Qpixmap To Q Image For Mac
Qt provides four classes for handling image data: PySide.QtGui.QImage, PySide. On X11, Mac and Symbian, a PySide.QtGui. QPainter functions or by converting the PySide.QtGui.QPixmap to a PySide.QtGui.QImage. However, the. QtGui.QPixmap class also supports conversion between HBITMAP and PySide.QtGui.
- Status:Closed
- Resolution: Out of scope
- Fix Version/s:Some future release
- Labels:
QImage can in some cases draw text wrongly when comparing it to how QPixmap draws it.
This only happens on Mac.
Reproducible with the following example:
- The letter '7' in the bad.png is missing a pixel.
#include <qpainter>
#include <qimage>
#include <qpixmap>
#include <qapplication>
#include <qcolor>
int main(int argc, char** argv)
{
QApplication app(argc, argv);
QPixmap pm(QSize(100, 100));
pm.fill(QColor(0, 0, 0, 0));
QFont f('Courier', 8);
f.setStyleHint(QFont::AnyStyle, QFont::NoAntialias);
QPainter ppm(&pm);
ppm.setFont(f);
ppm.setPen(Qt::white);
ppm.drawText(QRect(0, 0, 100, 100), 0x484, '012345678 abcdefg');
pm.save('good.png', 'PNG');
QImage img(QSize(100, 100), QImage::Format_ARGB32);
QPainter imgP(&img);
imgP.setFont(f);
imgP.setPen(Qt::white);
This application is very user-friendly and natural. All the windows functions are clear and separated.Search Engine:.
imgP.drawText(QRect(0, 0, 100, 100), 0x484, '012345678 abcdefg');
img.save('bad.png', 'PNG');
}
Gerrit Reviews
- Assignee:
- Simon Hausmann
- Reporter:
- Administrator
- Votes:
- 0Vote for this issue
- Watchers:
- 0Start watching this issue
- Created:
- Updated:
- Resolved: