QPainter drawText on a QImage: Wrong text color???!!!
QImage tmpImage = rgb32.convertToFormat(QImage::Format_ARGB32_Premultiplied);
painter.setPen(fontColor); // The font color comes from user select on a QColorDialog
painter.setFont(QFont("Chicago", fontSize)); // The font size comes from user input
painter.drawText(penPos.x(), penPos.y(), QString::number(num)); // Draw a number on the image
rgb32 = tmpImage.convertToFormat(QImage::Format_RGB32);
Hello everyone :)
I want to draw a number on a QImage (a series of QImages) fetched from a video sequence. I used the code above.
The problem is, the text color, which comes from user select, is not printed correctly. For example, the fontColor is Qt::red, but a blue text were printed.
I also tried other compositionmode, such as
but nothing changed.
Can anybody help me?
Thanks in advanced.
- Did you try to draw text on usual image loaded to tmpImage?
- Why you use Format_ARGB32_Premultiplied? Video didn't has alpha layer.