[英]Generating textual images using QImage (qt)
我正在尝试使用QImage从文本创建图像。
根据此处的文档: http : //doc.qt.io/qt-5/qimage.html#Format-enum
我们不能将QImage::Format_Indexed8
与QImage QImage::Format_Indexed8
使用。 由于质量低,我无法使用QImage::Format_Mono
或QImage::Format_MonoLSB
。
我的问题是:
这个例子,它向您展示了如何使用QPainter::drawText
并使用字体:
http://doc.qt.io/archives/qt-4.7/painting-fontsampler.html
QImage::save
支持各种格式和质量级别:
http://doc.qt.io/archives/qt-4.7/qimage.html#reading-and-writing-image-files
虽然QImage
在QtCore中,但QPainter
和文本绘制例程都在QtGUI中。 因此,在Linux系统上,这将需要运行X服务器:
http://www.qtcentre.org/threads/1758-QPainter-in-console-apps
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.