QtBase
v6.3.1
|
The QPaintEngine class provides an abstract definition of how QPainter draws to a given device on a given platform. More...
#include <qpaintengine.h>
Protected Member Functions | |
QPaintEngine (QPaintEnginePrivate &data, PaintEngineFeatures devcaps=PaintEngineFeatures()) | |
Protected Attributes | |
QPaintEngineState * | state |
PaintEngineFeatures | gccaps |
uint | active: 1 |
uint | selfDestruct: 1 |
uint | extended: 1 |
QScopedPointer< QPaintEnginePrivate > | d_ptr |
Friends | |
class | QPainterReplayer |
class | QFontEngineBox |
class | QFontEngineMac |
class | QFontEngineWin |
class | QMacPrintEngine |
class | QMacPrintEnginePrivate |
class | QFontEngineQPF2 |
class | QPainter |
class | QPainterPrivate |
class | QWidget |
class | QWidgetPrivate |
class | QWin32PaintEngine |
class | QWin32PaintEnginePrivate |
class | QMacCGContext |
class | QPreviewPaintEngine |
class | QX11GLPlatformPixmap |
The QPaintEngine class provides an abstract definition of how QPainter draws to a given device on a given platform.
\inmodule QtGui
Qt provides several premade implementations of QPaintEngine for the different painter backends we support. The primary paint engine provided is the raster paint engine, which contains a software rasterizer which supports the full feature set on all supported platforms. This is the default for painting on QWidget-based classes in e.g. on Windows, X11 and \macos, it is the backend for painting on QImage and it is used as a fallback for paint engines that do not support a certain capability. In addition we provide QPaintEngine implementations for OpenGL (accessible through QOpenGLWidget) and printing (which allows using QPainter to draw on a QPrinter object).
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.
Definition at line 86 of file qpaintengine.h.
\value DirtyPen The pen is dirty and needs to be updated.
\value DirtyBrush The brush is dirty and needs to be updated.
\value DirtyBrushOrigin The brush origin is dirty and needs to updated.
\value DirtyFont The font is dirty and needs to be updated.
\value DirtyBackground The background is dirty and needs to be updated.
\value DirtyBackgroundMode The background mode is dirty and needs to be updated.
\value DirtyTransform The transform is dirty and needs to be updated.
\value DirtyClipRegion The clip region is dirty and needs to be updated.
\value DirtyClipPath The clip path is dirty and needs to be updated.
\value DirtyHints The render hints is dirty and needs to be updated.
\value DirtyCompositionMode The composition mode is dirty and needs to be updated.
\value DirtyClipEnabled Whether clipping is enabled or not is dirty and needs to be updated.
\value DirtyOpacity The constant opacity has changed and needs to be updated as part of the state change in QPaintEngine::updateState().
\value AllDirty Convenience enum used internally.
These types are used by QPainter to trigger lazy updates of the various states in the QPaintEngine using QPaintEngine::updateState().
A paint engine must update every dirty state.
Definition at line 121 of file qpaintengine.h.
This enum is used to describe the features or capabilities that the paint engine has. If a feature is not supported by the engine, QPainter will do a best effort to emulate that feature through other means and pass on an alpha blended QImage to the engine with the emulated results. Some features cannot be emulated: AlphaBlend and PorterDuff.
\value AlphaBlend The engine can alpha blend primitives. \value Antialiasing The engine can use antialiasing to improve the appearance of rendered primitives. \value BlendModes The engine supports blending modes. \value BrushStroke The engine supports drawing strokes that contain brushes as fills, not just solid colors (e.g. a dashed gradient line of width 2). \value ConicalGradientFill The engine supports conical gradient fills. \value ConstantOpacity The engine supports the feature provided by QPainter::setOpacity(). \value LinearGradientFill The engine supports linear gradient fills. \value MaskedBrush The engine is capable of rendering brushes that has a texture with an alpha channel or a mask. \value ObjectBoundingModeGradients The engine has native support for gradients with coordinate mode QGradient::ObjectBoundingMode. Otherwise, if QPaintEngine::PatternTransform is supported, object bounding mode gradients are converted to gradients with coordinate mode QGradient::LogicalMode and a brush transform for the coordinate mapping. \value PainterPaths The engine has path support. \value PaintOutsidePaintEvent The engine is capable of painting outside of paint events. \value PatternBrush The engine is capable of rendering brushes with the brush patterns specified in Qt::BrushStyle. \value PatternTransform The engine has support for transforming brush patterns. \value PerspectiveTransform The engine has support for performing perspective transformations on primitives. \value PixmapTransform The engine can transform pixmaps, including rotation and shearing. \value PorterDuff The engine supports Porter-Duff operations \value PrimitiveTransform The engine has support for transforming drawing primitives. \value RadialGradientFill The engine supports radial gradient fills. \value RasterOpModes The engine supports bitwise raster operations. \value AllFeatures All of the above features. This enum value is usually used as a bit mask.
Definition at line 90 of file qpaintengine.h.
\value OddEvenMode The polygon should be drawn using OddEven fill rule.
\value WindingMode The polygon should be drawn using Winding fill rule.
\value ConvexMode The polygon is a convex polygon and can be drawn using specialized algorithms where available.
\value PolylineMode Only the outline of the polygon should be drawn.
Enumerator | |
---|---|
OddEvenMode | |
WindingMode | |
ConvexMode | |
PolylineMode |
Definition at line 140 of file qpaintengine.h.
enum QPaintEngine::Type |
\value X11 \value Windows \value MacPrinter \value CoreGraphics \macos's Quartz2D (CoreGraphics) \value QuickDraw \macos's QuickDraw \value QWindowSystem Qt for Embedded Linux \value OpenGL \value Picture QPicture format \value SVG Scalable Vector Graphics XML format \value Raster \value Direct3D Windows only, Direct3D based engine \value Pdf Portable Document Format \value OpenVG \value User First user type ID \value MaxUser Last user type ID \value OpenGL2 \value PaintBuffer \value Blitter \value Direct2D Windows only, Direct2D based engine
Enumerator | |
---|---|
X11 | |
Windows | |
QuickDraw | |
CoreGraphics | |
MacPrinter | |
QWindowSystem | |
OpenGL | |
Picture | |
SVG | |
Raster | |
Direct3D | |
OpenVG | |
OpenGL2 | |
PaintBuffer | |
Blitter | |
Direct2D | |
User | |
MaxUser |
Definition at line 193 of file qpaintengine.h.
|
explicit |
Creates a paint engine with the featureset specified by caps.
Definition at line 696 of file qpaintengine.cpp.
|
virtual |
Destroys the paint engine.
Definition at line 725 of file qpaintengine.cpp.
|
protected |
Definition at line 711 of file qpaintengine.cpp.
|
pure virtual |
Reimplement this function to initialise your paint engine when painting is to start on the paint device pdev. Return true if the initialization was successful; otherwise return false.
Implemented in QPdfPrintEngine, QAlphaPaintEngine, QX11PaintEngine, QWindowsDirect2DPaintEngine, QPdfEngine, QBlitterPaintEngine, QEmulationPaintEngine, QPicturePaintEngine, QCoreGraphicsPaintEngine, QOpenGL2PaintEngineEx, QRasterPaintEngine, QWin32PrintEngine, QPreviewPaintEngine, QMacPrintEngine, TestPaintEngine, DummyPaintEngine, MyPaintEngine, and PaintEngine.
|
inline |
Definition at line 331 of file qpaintengine.h.
|
virtual |
Reimplemented in QRasterPaintEngine.
Definition at line 936 of file qpaintengine.cpp.
|
virtual |
The default implementation of this function calls the floating point version of this function
Reimplemented in QX11PaintEngine, QWindowsDirect2DPaintEngine, QPaintEngineEx, and QCoreGraphicsPaintEngine.
Definition at line 523 of file qpaintengine.cpp.
Reimplement this function to draw the largest ellipse that can be contained within rectangle rect.
The default implementation calls drawPolygon().
Reimplemented in QRasterPaintEngine, QBlitterPaintEngine, QPicturePaintEngine, QX11PaintEngine, QWindowsDirect2DPaintEngine, QPaintEngineEx, QMacPrintEngine, and QCoreGraphicsPaintEngine.
Definition at line 507 of file qpaintengine.cpp.
|
virtual |
Reimplement this function to draw the part of the image specified by the sr rectangle in the given rectangle using the given conversion flags flags, to convert it to a pixmap.
Reimplemented in QWindowsDirect2DPaintEngine, QPaintEngineEx, QOpenGL2PaintEngineEx, QPdfEngine, QRasterPaintEngine, QBlitterPaintEngine, QCoreGraphicsPaintEngine, QEmulationPaintEngine, QMacPrintEngine, QX11PaintEngine, and QPicturePaintEngine.
Definition at line 620 of file qpaintengine.cpp.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
The default implementation converts the first lineCount lines in lines to a QLineF and calls the floating point version of this function.
Reimplemented in QX11PaintEngine, QPaintEngineEx, QCoreGraphicsPaintEngine, and QRasterPaintEngine.
Definition at line 818 of file qpaintengine.cpp.
The default implementation splits the list of lines in lines into lineCount separate calls to drawPath() or drawPolygon() depending on the feature set of the paint engine.
Reimplemented in QX11PaintEngine, QPdfEngine, QPaintEngineEx, QMacPrintEngine, QCoreGraphicsPaintEngine, and QRasterPaintEngine.
Definition at line 796 of file qpaintengine.cpp.
|
virtual |
The default implementation ignores the path and does nothing.
Reimplemented in QWin32PrintEngine, QPreviewPaintEngine, QAlphaPaintEngine, QX11PaintEngine, QPdfEngine, QPaintEngineEx, QPicturePaintEngine, QCoreGraphicsPaintEngine, and QMacPrintEngine.
Definition at line 741 of file qpaintengine.cpp.
|
pure virtual |
Reimplement this function to draw the part of the pm specified by the sr rectangle in the given r.
Implemented in QPdfEngine, QPaintEngineEx, QWin32PrintEngine, QPreviewPaintEngine, QAlphaPaintEngine, QX11PaintEngine, QWindowsDirect2DPaintEngine, QOpenGL2PaintEngineEx, QRasterPaintEngine, QBlitterPaintEngine, QEmulationPaintEngine, QPicturePaintEngine, QMacPrintEngine, QCoreGraphicsPaintEngine, TestPaintEngine, DummyPaintEngine, MyPaintEngine, and PaintEngine.
Draws the first pointCount points in the buffer points
The default implementation converts the first pointCount QPoints in points to QPointFs and calls the floating point version of drawPoints.
Reimplemented in QX11PaintEngine, QPaintEngineEx, QRasterPaintEngine, QBlitterPaintEngine, and QCoreGraphicsPaintEngine.
Definition at line 482 of file qpaintengine.cpp.
Draws the first pointCount points in the buffer points
Reimplemented in QX11PaintEngine, QPdfEngine, QPaintEngineEx, QRasterPaintEngine, QBlitterPaintEngine, QMacPrintEngine, and QCoreGraphicsPaintEngine.
Definition at line 438 of file qpaintengine.cpp.
|
virtual |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Reimplement this virtual function to draw the polygon defined by the pointCount first points in points, using mode mode.
Reimplemented in QX11PaintEngine, QPaintEngineEx, QRasterPaintEngine, QBlitterPaintEngine, and QCoreGraphicsPaintEngine.
Definition at line 358 of file qpaintengine.cpp.
|
virtual |
Reimplement this virtual function to draw the polygon defined by the pointCount first points in points, using mode mode.
Reimplemented in QWin32PrintEngine, QPreviewPaintEngine, QAlphaPaintEngine, QX11PaintEngine, QPdfEngine, QPaintEngineEx, QRasterPaintEngine, QBlitterPaintEngine, QMacPrintEngine, QCoreGraphicsPaintEngine, QPicturePaintEngine, and TestPaintEngine.
Definition at line 329 of file qpaintengine.cpp.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
The default implementation converts the first rectCount rectangles in the buffer rects to a QRectF and calls the floating point version of this function.
Reimplemented in QX11PaintEngine, QWindowsDirect2DPaintEngine, QPaintEngineEx, QRasterPaintEngine, QBlitterPaintEngine, and QCoreGraphicsPaintEngine.
Definition at line 854 of file qpaintengine.cpp.
Draws the first rectCount rectangles in the buffer rects. The default implementation of this function calls drawPath() or drawPolygon() depending on the feature set of the paint engine.
Reimplemented in QX11PaintEngine, QWindowsDirect2DPaintEngine, QPdfEngine, QPaintEngineEx, QRasterPaintEngine, QBlitterPaintEngine, QCoreGraphicsPaintEngine, and QMacPrintEngine.
Definition at line 884 of file qpaintengine.cpp.
This function draws the text item textItem at position p. The default implementation of this function converts the text to a QPainterPath and paints the resulting path.
Reimplemented in QCoreGraphicsPaintEngine, QPicturePaintEngine, QMacPrintEngine, QWin32PrintEngine, QPreviewPaintEngine, QAlphaPaintEngine, QX11PaintEngine, QWindowsDirect2DPaintEngine, QOpenGL2PaintEngineEx, QPdfEngine, QRasterPaintEngine, QBlitterPaintEngine, QEmulationPaintEngine, and TestPaintEngine.
Definition at line 754 of file qpaintengine.cpp.
|
virtual |
Reimplement this function to draw the pixmap in the given rect, starting at the given p. The pixmap will be drawn repeatedly until the rect is filled.
Reimplemented in QPdfEngine, QRasterPaintEngine, QBlitterPaintEngine, QWin32PrintEngine, QPreviewPaintEngine, QAlphaPaintEngine, QX11PaintEngine, QPaintEngineEx, QEmulationPaintEngine, QPicturePaintEngine, QMacPrintEngine, and QCoreGraphicsPaintEngine.
Definition at line 585 of file qpaintengine.cpp.
|
pure virtual |
Reimplement this function to finish painting on the current paint device. Return true if painting was finished successfully; otherwise return false.
Implemented in TestPaintEngine, DummyPaintEngine, MyPaintEngine, PaintEngine, QWin32PrintEngine, QPdfPrintEngine, QPreviewPaintEngine, QAlphaPaintEngine, QX11PaintEngine, QWindowsDirect2DPaintEngine, QOpenGL2PaintEngineEx, QPdfEngine, QRasterPaintEngine, QBlitterPaintEngine, QEmulationPaintEngine, QPicturePaintEngine, QMacPrintEngine, and QCoreGraphicsPaintEngine.
|
inline |
Definition at line 309 of file qpaintengine.h.
|
inline |
Returns true
if the paint engine supports the specified feature; otherwise returns false
.
Definition at line 221 of file qpaintengine.h.
|
inline |
Returns true
if the paint engine is actively drawing; otherwise returns false
.
Definition at line 150 of file qpaintengine.h.
|
inline |
QPaintDevice * QPaintEngine::paintDevice | ( | ) | const |
Returns the device that this engine is painting on, if painting is active; otherwise returns \nullptr.
Definition at line 921 of file qpaintengine.cpp.
QPainter * QPaintEngine::painter | ( | ) | const |
Returns the paint engine's painter.
Definition at line 732 of file qpaintengine.cpp.
|
inline |
Sets the active state of the paint engine to state.
Definition at line 151 of file qpaintengine.h.
|
inline |
void QPaintEngine::setPaintDevice | ( | QPaintDevice * | device | ) |
Definition at line 912 of file qpaintengine.cpp.
void QPaintEngine::syncState | ( | ) |
Definition at line 303 of file qpaintengine.cpp.
QRegion QPaintEngine::systemClip | ( | ) | const |
QRect QPaintEngine::systemRect | ( | ) | const |
|
inline |
Definition at line 321 of file qpaintengine.h.
|
pure virtual |
Reimplement this function to return the paint engine \l{Type}.
Implemented in TestPaintEngine, DummyPaintEngine, MyPaintEngine, PaintEngine, QWin32PrintEngine, QPreviewPaintEngine, QX11PaintEngine, QWindowsDirect2DPaintEngine, QOpenGL2PaintEngineEx, QPdfEngine, QRasterPaintEngine, QBlitterPaintEngine, QEmulationPaintEngine, QPicturePaintEngine, QMacPrintEngine, and QCoreGraphicsPaintEngine.
|
pure virtual |
Reimplement this function to update the state of a paint engine.
When implemented, this function is responsible for checking the paint engine's current state and update the properties that are changed. Use the QPaintEngineState::state() function to find out which properties that must be updated, then use the corresponding \l {GetFunction}{get function} to retrieve the current values for the given properties.
Implemented in QWin32PrintEngine, QPreviewPaintEngine, QAlphaPaintEngine, QX11PaintEngine, QPdfEngine, QPaintEngineEx, QPicturePaintEngine, QMacPrintEngine, QCoreGraphicsPaintEngine, TestPaintEngine, DummyPaintEngine, MyPaintEngine, and PaintEngine.
|
friend |
Definition at line 249 of file qpaintengine.h.
|
friend |
Definition at line 250 of file qpaintengine.h.
|
friend |
Definition at line 254 of file qpaintengine.h.
|
friend |
Definition at line 251 of file qpaintengine.h.
|
friend |
Definition at line 261 of file qpaintengine.h.
|
friend |
Definition at line 252 of file qpaintengine.h.
|
friend |
Definition at line 253 of file qpaintengine.h.
|
friend |
Definition at line 255 of file qpaintengine.h.
|
friend |
Definition at line 256 of file qpaintengine.h.
|
friend |
Definition at line 248 of file qpaintengine.h.
|
friend |
Definition at line 262 of file qpaintengine.h.
|
friend |
Definition at line 257 of file qpaintengine.h.
|
friend |
Definition at line 258 of file qpaintengine.h.
|
friend |
Definition at line 259 of file qpaintengine.h.
|
friend |
Definition at line 260 of file qpaintengine.h.
|
friend |
Definition at line 263 of file qpaintengine.h.
|
protected |
Definition at line 237 of file qpaintengine.h.
|
protected |
Definition at line 241 of file qpaintengine.h.
|
protected |
Definition at line 239 of file qpaintengine.h.
|
protected |
Definition at line 235 of file qpaintengine.h.
|
protected |
Definition at line 238 of file qpaintengine.h.
|
protected |
Definition at line 234 of file qpaintengine.h.