使用两个 QPainter 实例同时在 QImage 上绘图

发布于 2025-01-04 18:40:29 字数 221 浏览 6 评论 0原文

我正在 PyQt4 中开发一个应用程序。

在我的应用程序中,我需要根据两个来源的数据绘制 QImage
(例如,想象一下定期调用的不规则定时方法来编辑图像)

为此,我需要使用 QPainter 的两个实例来编辑 QImage,并且两个实例可能同时处理图像。

如果没有特殊处理,这能正常工作吗?
如果不是,我必须采取哪些额外措施来确保所有同时编辑顺利进行而不会丢失?

I am working on an application in PyQt4.

In my application I will need to draw on a QImage according to data from two sources
(for example, imagine periodically-called irregularly-timed methods which edit the image)

For this I'll need to edit the QImage using two instances of QPainter, and both might be working on the image simultaneously.

Will this work fine without special handling?
If no, what are the additional measures I must take to ensure that all the simultaneous edits happen smoothly without loss?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

赴月观长安 2025-01-11 18:40:29

引用 QPainter::begin() 的文档:

警告:绘画设备一次只能由一名画家进行绘画。

因此,您需要将绘画同步到该图像。

To quote the docs for QPainter::begin():

Warning: A paint device can only be painted by one painter at a time.

So you would need to synchronize painting to that image.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文