本页内容

C

Qul::PlatformInterface::DrawingEngine Class

class Qul::PlatformInterface::DrawingEngine

该类为混合函数提供了一个抽象接口。更多内容...

Header: #include <platforminterface/drawingengine.h>
Since: Qt Quick Ultralite (Platform) 1.5

公共类型

(since Qt Quick Ultralite (Platform) 1.8) struct Path
(since Qt Quick Ultralite (Platform) 1.5) enum BlendMode { BlendMode_SourceOver, BlendMode_Source }

公共函数

(since Qt Quick Ultralite (Platform) 1.8) virtual Qul::PlatformInterface::DrawingEngine::Path *allocatePath(const Qul::PlatformInterface::PathData *pathData, Qul::PlatformInterface::PathFillRule fillRule)
virtual void blendAlphaMap(Qul::PlatformInterface::DrawingDevice *drawingDevice, const Qul::PlatformInterface::Point &pos, const Qul::PlatformInterface::Texture &source, const Qul::PlatformInterface::Rect &sourceRect, Qul::PlatformInterface::Rgba32 color, Qul::PlatformInterface::DrawingEngine::BlendMode blendMode = BlendMode_SourceOver)
virtual void blendImage(Qul::PlatformInterface::DrawingDevice *drawingDevice, const Qul::PlatformInterface::Point &pos, const Qul::PlatformInterface::Texture &source, const Qul::PlatformInterface::Rect &sourceRect, int sourceOpacity, Qul::PlatformInterface::DrawingEngine::BlendMode blendMode = BlendMode_SourceOver)
(since Qt Quick Ultralite (Platform) 1.8) virtual void blendPath(Qul::PlatformInterface::DrawingDevice *drawingDevice, Qul::PlatformInterface::DrawingEngine::Path *path, const Qul::PlatformInterface::Transform &transform, const Qul::PlatformInterface::Rect &clipRect, const Qul::PlatformInterface::Brush *fillBrush, const Qul::PlatformInterface::Brush *strokeBrush, int sourceOpacity, Qul::PlatformInterface::DrawingEngine::BlendMode blendMode = BlendMode_SourceOver)
virtual void blendRect(Qul::PlatformInterface::DrawingDevice *drawingDevice, const Qul::PlatformInterface::Rect &rect, Qul::PlatformInterface::Rgba32 color, Qul::PlatformInterface::DrawingEngine::BlendMode blendMode = BlendMode_SourceOver)
(since Qt Quick Ultralite (Platform) 1.6) virtual void blendRoundedRect(Qul::PlatformInterface::DrawingDevice *drawingDevice, const Qul::PlatformInterface::Rect &rect, const Qul::PlatformInterface::Rect &clipRect, Qul::PlatformInterface::Rgba32 color, int radius, Qul::PlatformInterface::DrawingEngine::BlendMode blendMode = BlendMode_SourceOver)
virtual void blendTransformedAlphaMap(Qul::PlatformInterface::DrawingDevice *drawingDevice, const Qul::PlatformInterface::Transform &transform, const Qul::PlatformInterface::RectF &destinationRect, const Qul::PlatformInterface::Texture &source, const Qul::PlatformInterface::RectF &sourceRect, const Qul::PlatformInterface::Rect &clipRect, Qul::PlatformInterface::Rgba32 color, Qul::PlatformInterface::DrawingEngine::BlendMode blendMode = BlendMode_SourceOver)
virtual void blendTransformedImage(Qul::PlatformInterface::DrawingDevice *drawingDevice, const Qul::PlatformInterface::Transform &transform, const Qul::PlatformInterface::RectF &destinationRect, const Qul::PlatformInterface::Texture &source, const Qul::PlatformInterface::RectF &sourceRect, const Qul::PlatformInterface::Rect &clipRect, int sourceOpacity, Qul::PlatformInterface::DrawingEngine::BlendMode blendMode = BlendMode_SourceOver)
(since Qt Quick Ultralite (Platform) 1.8) virtual void setStrokeProperties(Qul::PlatformInterface::DrawingEngine::Path *path, const Qul::PlatformInterface::StrokeProperties &strokeProperties)
(since Qt Quick Ultralite (Platform) 2.12) virtual Qul::PlatformInterface::RenderHints supportedRenderHints() const
virtual void synchronizeForCpuAccess(Qul::PlatformInterface::DrawingDevice *drawingDevice, const Qul::PlatformInterface::Rect &rect)

详细说明

该类的实例可用于在绘图设备上将图形元素混合在一起。根据各平台的具体实现情况,如果存在支持给定图形元素混合操作的硬件组件,则相关操作可以得到加速。

每个平台均可实现这些混合函数。如果平台没有特殊支持,则会调用默认的混合函数,该函数使用 CPU 来执行该任务。

另请参阅 “支持的目标板和开发主机”。

成员类型文档

[since Qt Quick Ultralite (Platform) 1.5] enum DrawingEngine::BlendMode

此枚举类型用于指定混合模式。

常量值
Qul::PlatformInterface::DrawingEngine::BlendMode_SourceOver0

源图像被放置在目标图像之上。

常量值
Qul::PlatformInterface::DrawingEngine::BlendMode_Source1

源图像将直接复制到目标区域,不进行混合操作。

此枚举在Qt Quick Ultralite (Platform) 1.5中引入。

成员函数文档

[virtual, since Qt Quick Ultralite (Platform) 1.8] Qul::PlatformInterface::DrawingEngine::Path *DrawingEngine::allocatePath(const Qul::PlatformInterface::PathData *pathData, Qul::PlatformInterface::PathFillRule fillRule)

为给定的路径数据分配一个路径句柄。

该路径句柄是给定pathData 的特定于平台的表示形式,该 将由给定的fillRule 填充。

平台可以使用Path 句柄的子类来缓存与路径相关的任何平台特定数据,例如更适合硬件混合渲染的优化表示形式。这样一来,每次填充或描边路径时,就不必重新计算该优化表示形式。

平台可以假设,在Path 句柄的生命周期内(即从调用allocatePath开始到Path 句柄被删除为止),PathData 始终保持有效。

注意: 理想情况下,实现 应等到调用blendPath 后再生成填充路径的优化表示,因为如果未设置填充画笔,则无需优化表示。

默认实现返回NULL 。

该函数首次出现在Qt Quick Ultralite (Platform) 1.8 中。

[virtual] void DrawingEngine::blendAlphaMap(Qul::PlatformInterface::DrawingDevice *drawingDevice, const Qul::PlatformInterface::Point &pos, const Qul::PlatformInterface::Texture &source, const Qul::PlatformInterface::Rect &sourceRect, Qul::PlatformInterface::Rgba32 color, Qul::PlatformInterface::DrawingEngine::BlendMode blendMode = BlendMode_SourceOver)

将一个透明度贴图混合到绘图设备上。

将指定的source 中的sourceRect 与color 相乘,并使用blendMode 在pos 处与drawingDevice 进行混合。默认混合模式为BlendMode_SourceOver

默认实现首先调用synchronizeForCpuAccess ,然后使用 fallbackDrawingEngine 调用 blendAlphaMap。

[virtual] void DrawingEngine::blendImage(Qul::PlatformInterface::DrawingDevice *drawingDevice, const Qul::PlatformInterface::Point &pos, const Qul::PlatformInterface::Texture &source, const Qul::PlatformInterface::Rect &sourceRect, int sourceOpacity, Qul::PlatformInterface::DrawingEngine::BlendMode blendMode = BlendMode_SourceOver)

将图像混合到绘图设备上。

使用sourceRect 将source 指定的 与drawingDevice 在pos 处进行混合,混合方式为blendMode 。默认混合模式为BlendMode_SourceOver 。sourceOpacity 指定源图像的整体不透明度,取值范围为0到256,其中256表示完全不透明。

默认实现首先调用synchronizeForCpuAccess ,然后使用fallbackDrawingEngine调用blendImage。

[virtual, since Qt Quick Ultralite (Platform) 1.8] void DrawingEngine::blendPath(Qul::PlatformInterface::DrawingDevice *drawingDevice, Qul::PlatformInterface::DrawingEngine::Path *path, const Qul::PlatformInterface::Transform &transform, const Qul::PlatformInterface::Rect &clipRect, const Qul::PlatformInterface::Brush *fillBrush, const Qul::PlatformInterface::Brush *strokeBrush, int sourceOpacity, Qul::PlatformInterface::DrawingEngine::BlendMode blendMode = BlendMode_SourceOver)

将由路径句柄表示的路径混合到绘图设备上。

将指定的path 句柄使用给定的transform 和blendMode 进行混合,生成drawingDevice 。

如果fillBrush 未设置为NULL ,则应根据路径分配时设置的PathFillRule ,使用给定的fillBrush 对路径进行填充。

setStrokeProperties如果strokeBrush 未设置为NULL ,则应根据分配路径时设置的StrokeProperties ,使用给定的strokeBrush 对路径进行描边。

结果应由clipRect 进行裁剪,该坐标系为绘图设备坐标系。

sourceOpacity 指定源的总体不透明度,范围为 0 到 256,其中 256 表示完全不透明。

默认实现不执行任何操作。

此函数在Qt Quick Ultralite (Platform) 1.8 中引入。

[virtual] void DrawingEngine::blendRect(Qul::PlatformInterface::DrawingDevice *drawingDevice, const Qul::PlatformInterface::Rect &rect, Qul::PlatformInterface::Rgba32 color, Qul::PlatformInterface::DrawingEngine::BlendMode blendMode = BlendMode_SourceOver)

将纯色渐变填充到绘图设备上。

color 用于在drawingDevice 上使用blendMode 填充rect 。默认混合模式为BlendMode_SourceOver

默认实现首先调用synchronizeForCpuAccess ,然后使用fallbackDrawingEngine调用blendRect。

注意: 并非所有参考板的硬件都支持此 功能。有关详细信息,请参阅“支持的功能”表。

[virtual, since Qt Quick Ultralite (Platform) 1.6] void DrawingEngine::blendRoundedRect(Qul::PlatformInterface::DrawingDevice *drawingDevice, const Qul::PlatformInterface::Rect &rect, const Qul::PlatformInterface::Rect &clipRect, Qul::PlatformInterface::Rgba32 color, int radius, Qul::PlatformInterface::DrawingEngine::BlendMode blendMode = BlendMode_SourceOver)

将一个圆角矩形绘制到绘图设备上。

color 用于通过blendMode 在drawingDevice 上填充rect 。默认混合模式为BlendMode_SourceOver 。混合效果必须根据提供的clipRect 进行裁剪。radius 定义用于绘制圆角矩形的圆角半径。四个角均使用相同的半径;目前无法为不同角指定不同的半径。

默认实现首先调用synchronizeForCpuAccess ,然后在备用绘图引擎上调用blendRoundedRect。

注意: 并非所有参考板的硬件都支持此 功能。有关详细信息,请参阅“支持的功能”表。

该函数首次引入于Qt Quick Ultralite (Platform) 1.6。

另请参阅 DrawingDevice::fallbackDrawingEngine()。

[virtual] void DrawingEngine::blendTransformedAlphaMap(Qul::PlatformInterface::DrawingDevice *drawingDevice, const Qul::PlatformInterface::Transform &transform, const Qul::PlatformInterface::RectF &destinationRect, const Qul::PlatformInterface::Texture &source, const Qul::PlatformInterface::RectF &sourceRect, const Qul::PlatformInterface::Rect &clipRect, Qul::PlatformInterface::Rgba32 color, Qul::PlatformInterface::DrawingEngine::BlendMode blendMode = BlendMode_SourceOver)

将经过变换的Alpha贴图渲染到绘图设备上。

将指定的source 的sourceRect 与color 相乘,并使用blendMode 在destinationRect 处与drawingDevice 进行混合。在混合操作之前,对source 应用transform 。结果应由clipRect 进行裁剪,该坐标系为绘图设备坐标系。

默认混合模式为BlendMode_SourceOver

默认实现首先调用synchronizeForCpuAccess ,然后使用备用绘制引擎(fallbackDrawingEngine)调用blendTransformedAlphaMap。

[virtual] void DrawingEngine::blendTransformedImage(Qul::PlatformInterface::DrawingDevice *drawingDevice, const Qul::PlatformInterface::Transform &transform, const Qul::PlatformInterface::RectF &destinationRect, const Qul::PlatformInterface::Texture &source, const Qul::PlatformInterface::RectF &sourceRect, const Qul::PlatformInterface::Rect &clipRect, int sourceOpacity, Qul::PlatformInterface::DrawingEngine::BlendMode blendMode = BlendMode_SourceOver)

将经过变换的图像混合到绘图设备上。

将source 的指定sourceRect ,通过blendMode 在destinationRect 处与drawingDevice 进行混合。在混合操作之前,对source 应用transform 。结果应由clipRect 进行裁剪,该坐标系为绘图设备坐标系。sourceOpacity 指定源图像的整体不透明度,范围为0到256,其中256表示完全不透明。

默认混合模式为BlendMode_SourceOver

默认实现首先调用synchronizeForCpuAccess ,然后使用fallbackDrawingEngine调用blendTransformedImage。

[virtual, since Qt Quick Ultralite (Platform) 1.8] void DrawingEngine::setStrokeProperties(Qul::PlatformInterface::DrawingEngine::Path *path, const Qul::PlatformInterface::StrokeProperties &strokeProperties)

设置给定path 句柄的笔画属性。

strokeProperties 包含相关信息,这些信息将在后续通过调用blendPath 对path 句柄进行混合时使用,前提是在调用blendPath 时已设置strokeBrush 参数。

这使得平台实现能够缓存适合硬件混合的优化表示形式,而无需在每次调用blendPath 时重新计算。

注意: 理想情况下,实现 应等待直到调用blendPath 后再生成描边路径的优化表示,因为如果未设置描边画笔,则无需优化表示。

默认实现不执行任何操作。

该函数首次引入于Qt Quick Ultralite (Platform) 1.8 版本。

[virtual, since Qt Quick Ultralite (Platform) 2.12] Qul::PlatformInterface::RenderHints DrawingEngine::supportedRenderHints() const

返回一个标志,用于指定此DrawingEngine 所支持的渲染提示。

在每次调用渲染函数之前,都会查询支持的渲染提示。如果某个提示不被支持,则应用备用渲染方案。

此函数首次引入于Qt Quick Ultralite (Platform) 2.12。

[virtual] void DrawingEngine::synchronizeForCpuAccess(Qul::PlatformInterface::DrawingDevice *drawingDevice, const Qul::PlatformInterface::Rect &rect)

将图形硬件同步,以便 CPU 访问。

drawingDevice 硬件已同步,以便CPU进行访问。这将阻塞CPU,直到图形硬件在给定的rect 中完成所有活动操作为止。

默认实现不执行任何操作。

在某些 Qt 许可证下可用。
了解更多。