QT-painting-paintengine

本文深入探讨了QPaintEngine在Qt框架中的作用,解释了它如何为不同平台提供画布设备的抽象定义,并阐述了其相较于Qt3的QPainter/QPaintDevice::cmd()方法的优势。详细说明了QPaintEngine的实现方式及其在OpenGL、PostScript等不同后端技术上的应用,同时介绍了其创建、使用和替代机制。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

The QPaintEngine class provides an abstract definition of how QPainter draws to a given device on a given platform.


Qt 4.0 provides several premade implementations of QPaintEngine for the different painter backends we support. We provide one paint engine for each window system and painting framework we support. This includes X11 on Unix/Linux and CoreGraphics on Mac OS X. In addition we provide QPaintEngine implementations for OpenGL (accessible through QGLWidget) and PostScript (accessible through QPSPrinter on X11). Additionally there is a raster-based paint engine that is a fallback for when an engine does not support a certain capability.


If one wants to use QPainter to draw to a different backend, one must subclass QPaintEngine and reimplement all its virtual functions. The QPaintEngine implementation is then made available by subclassing QPaintDevice and reimplementing the virtual function QPaintDevice::paintEngine().


QPaintEngine is created and owned by the QPaintDevice that created it.


The big advantage of the QPaintEngine approach opposed to Qt 3's QPainter/QPaintDevice::cmd() approach is that it is now possible to adapt to multiple technologies on each platform and take advantage of each to the fullest.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值