6.0.0-rc4Source

QPaintEngine Class

The QPaintEngine class defines how a QPainter draws on a particular kind of paint device. More…

Header#include <QPaintEngine>
CMaketarget_link_libraries(app PRIVATE Nt::Gui)
ModuleNt GUI C++ Classes

List of all members, including inherited members

Public Types

enumType

Public Functions

virtual ~QPaintEngine()
virtual boolbegin(QPaintDevice *device)
virtual boolend()
virtual voidupdateState(const QPaintEngineState &state)
virtual voiddrawRects(const QRect *rects, int rectCount)
virtual voiddrawLines(const QLine *lines, int lineCount)
virtual voiddrawPoints(const QPoint *points, int pointCount)
virtual voiddrawEllipse(const QRect &rect)
virtual voiddrawImage(const QRect &rect, const QImage &image, const QRect &sourceRect)
virtual voiddrawAlphaMask(const QPoint &topLeft, const uchar *mask, int width, int height, qsizetype stride)
virtual voiddrawPath(const QPainterPath &path)
virtual Typetype() const
boolisActive() const
voidsetActive(bool active)
QPaintDevice *paintDevice() const
const QPaintEngineState &state() const

Protected Functions

Detailed Description

A paint engine does the drawing for a QPainter. Each QPaintDevice returns the engine that suits it from QPaintDevice::paintEngine(). Nt provides one engine, the raster engine of QImage. The painter converts all coordinates to device coordinates before it calls an engine.

See also QPainter and QPaintDevice.

Differences from Qt

The engine interface is smaller than Qt's: rectangles, lines, points, ellipses and images in device coordinates, coverage masks for glyphs, and paths with the transformation of the state. There are no polygons, pixmaps or text runs: QPainter draws polygons as paths.

Member Type Documentation

enum QPaintEngine::Type

This enum identifies the kind of an engine.

ConstantDescription
QPaintEngine::RasterThe software raster engine.
QPaintEngine::OpenGL2The OpenGL engine of QOpenGLPaintDevice, in the Nt OpenGL module.
QPaintEngine::UserThe first value for engines that applications define.
QPaintEngine::MaxUserThe last value for engines that applications define.

Member Function Documentation

[protected] QPaintEngine::QPaintEngine()

Constructs an engine.

[virtual] QPaintEngine::~QPaintEngine()

Destroys the engine.

[virtual] bool QPaintEngine::begin(QPaintDevice *device)

Starts painting on device and returns true on success. The engine must not be active already.

[virtual] void QPaintEngine::drawAlphaMask(const QPoint &topLeft, const uchar *mask, int width, int height, qsizetype stride)

Paints the color of the current pen through mask, an array of height rows of width coverage values from 0 to 255, stride bytes apart, with its top left corner at topLeft. QPainter::drawText() draws each glyph this way.

[virtual] void QPaintEngine::drawEllipse(const QRect &rect)

Draws the ellipse inscribed in rect with the current pen and brush.

[virtual] void QPaintEngine::drawImage(const QRect &rect, const QImage &image, const QRect &sourceRect)

Draws sourceRect of image scaled into rect.

[virtual] void QPaintEngine::drawLines(const QLine *lines, int lineCount)

Draws the lineCount lines at lines with the current pen.

[virtual] void QPaintEngine::drawPath(const QPainterPath &path)

Fills path with the brush and strokes it with the pen of the state, through its transformation. The raster engine draws it antialiased if the Antialiasing render hint is set. The default implementation draws the outline as lines in device coordinates.

[virtual] void QPaintEngine::drawPoints(const QPoint *points, int pointCount)

Draws the pointCount points at points with the current pen.

[virtual] void QPaintEngine::drawRects(const QRect *rects, int rectCount)

Draws the rectCount rectangles at rects with the current pen and brush.

[virtual] bool QPaintEngine::end()

Ends painting and returns true on success.

bool QPaintEngine::isActive() const

Returns true if the engine is painting.

QPaintDevice * QPaintEngine::paintDevice() const

Returns the device the engine paints on, or nullptr.

void QPaintEngine::setActive(bool active)

Sets whether the engine is active to active.

[protected] void QPaintEngine::setPaintDevice(QPaintDevice *device)

Sets the device that paintDevice() returns to device. Engines call it from begin() and end().

const QPaintEngineState & QPaintEngine::state() const

Returns the state that the painter set last.

[virtual] Type QPaintEngine::type() const

Returns the type of the engine.

[virtual] void QPaintEngine::updateState(const QPaintEngineState &state)

Makes state the state for the drawing calls that follow.