C

DrawingEngine Class

class Qul::PlatformInterface::DrawingEngine

This class provides an abstract interface for blending functions. More...

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

Public Types

struct Path
enum BlendMode { BlendMode_SourceOver, BlendMode_Source }

Public Functions

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)
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)
virtual void blendRoundedRect(Qul::PlatformInterface::DrawingDevice *drawingDevice, const PlatformInterface::Rect &rect, const PlatformInterface::Rect &clipRect, 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)
virtual void setStrokeProperties(Qul::PlatformInterface::DrawingEngine::Path *path, const Qul::PlatformInterface::StrokeProperties &strokeProperties)
virtual void synchronizeForCpuAccess(Qul::PlatformInterface::DrawingDevice *drawingDevice, const Qul::PlatformInterface::Rect &rect)

Detailed Description

An instance of this class can be used to blend graphic elements together on a drawing device. Depending on the implementation on each platform the operations can be accelerate in case there is a hardware component that available that supports the blending operation of the given graphical elements.

Each platform can implement these blending functions. In case a platform has no special support, a default blend function is called that uses the CPU to perform the task.

See also Supported target boards and development hosts.

Member Type Documentation

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

This enum type specifies blending modes.

ConstantValue
Qul::PlatformInterface::DrawingEngine::BlendMode_SourceOver0

The source is placed over the destination.

ConstantValue
Qul::PlatformInterface::DrawingEngine::BlendMode_Source1

The source is blitted over the destination without a blending operation.

This enum was introduced or modified in Qt Quick Ultralite (Platform) 1.5.

Member Function Documentation

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

Allocates a path handle for the given path data.

The path handle is a platform specific representation of the given pathData, which is to be filled by the given fillRule.

The platform can use a sub-class of the Path handle to cache any platform specific data relating to the path, for example an optimized representation more suitable for hardware blending. That way the optimized representation doesn't have to be recomputed each time the path is filled or stroked.

The platform can assume that the PathData remains valid throughout the life-time of the Path handle, meaning from the point allocatePath is called to the point that the Path handle is deleted.

Note: The implementation should ideally wait until blendPath is called before generating an optimized representation of the filled path, since if no fill brush is set then there's no need for an optimized representation.

The default implementation returns NULL.

This function was introduced in 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)

Blends an alpha map onto a drawing device.

The specified sourceRect of source is multiplied by color and blended to drawingDevice at pos using blendMode. Default blend mode is BlendMode_SourceOver

The default implementation first calls synchronizeForCpuAccess and then blendAlphaMap using the fallbackDrawingEngine.

[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)

Blends an image onto a drawing device.

The specified sourceRect of source is blended to drawingDevice at pos using blendMode. Default blend mode is BlendMode_SourceOver sourceOpacity specifies the overall opacity of the source with a range from 0 to 256, with 256 being fully opaque.

The default implementation first calls synchronizeForCpuAccess and then blendImage using the fallbackDrawingEngine.

[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)

Blends a path represented by a path handle onto a drawing device.

The specified path handle is blended to drawingDevice using the given transform and blendMode.

If fillBrush is not set to NULL, then the path should be filled by the given fillBrush according to the PathFillRule set when the path was allocated.

If strokeBrush is not set to NULL, then the path should be stroked by the given strokeBrush according to the StrokeProperties set by setStrokeProperties.

The result should be clipped by clipRect which is in drawing device coordinates.

sourceOpacity specifies the overall opacity of the source with a range from 0 to 256, with 256 being fully opaque.

The default implementation does nothing.

This function was introduced in 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)

Blends a solid color onto a drawing device.

color is used to fill rect on the drawingDevice using blendMode. Default blend mode is BlendMode_SourceOver

The default implementation first calls synchronizeForCpuAccess and then blendRect using the fallbackDrawingEngine.

Note: This feature may not be supported by hardware on all reference boards. For more information, see Supported Features table.

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

Blends a rectangle with rounded corners onto a drawing device.

color is used to fill rect on the drawingDevice using blendMode. Default blend mode is BlendMode_SourceOver The blending must be clipped against the provided clipRect. radius Defines a corner radius used to draw a rounded rectangle. The same radius is used by all 4 corners; there is currently no way to specify different radii for different corners.

The default implementation first calls synchronizeForCpuAccess and then blendRoundedRect on the fallback drawing engine.

Note: This feature may not be supported by hardware on all reference boards. For more information, see Supported Features table.

This function was introduced in Qt Quick Ultralite (Platform) 1.6.

See also 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)

Blends a transformed alpha map onto a drawing device.

The specified sourceRect of source is multiplied by color and blended to drawingDevice at destinationRect using blendMode. transform is applied to source before the blending operation. The result should be clipped by clipRect which is in drawing device coordinates.

Default blend mode is BlendMode_SourceOver

The default implementation first calls synchronizeForCpuAccess and then blendTransformedAlphaMap using the fallbackDrawingEngine.

[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)

Blends a transformed image onto a drawing device.

The specified sourceRect of source is blended to drawingDevice at destinationRect using blendMode. transform is applied to source before the blending operation. The result should be clipped by clipRect which is in drawing device coordinates. sourceOpacity specifies the overall opacity of the source with a range from 0 to 256, with 256 being fully opaque.

Default blend mode is BlendMode_SourceOver

The default implementation first calls synchronizeForCpuAccess and then blendTransformedImage using the fallbackDrawingEngine.

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

Sets the stroke properties for the given path handle.

The strokeProperties contain the information to be used when the path handle is later blended with a call to blendPath, assuming that the strokeBrush parameter is set when blendPath is called.

This allows the platform implementation to cache an optimized representation suitable for hardware blending, instead of recomputing it each time blendPath is called.

Note: The implementation should ideally wait until blendPath is called before generating an optimized representation of the stroked path, since if no stroke brush is set then there's no need for an optimized representation.

The default implementation does nothing.

This function was introduced in Qt Quick Ultralite (Platform) 1.8.

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

Synchronizes the graphics hardware for being accessed by the CPU.

The drawingDevice hardware is synchronized to be accessed by the CPU. This will block the CPU until the graphics hardware has finished all active operations in the given rect.

The default implementation does nothing.

Available under certain Qt licenses.
Find out more.