Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QPaintEngine Class Referenceabstract

\inmodule QtGui More...

#include <qpaintengine.h>

+ Inheritance diagram for QPaintEngine:
+ Collaboration diagram for QPaintEngine:

Public Types

enum  PaintEngineFeature {
  PrimitiveTransform = 0x00000001 , PatternTransform = 0x00000002 , PixmapTransform = 0x00000004 , PatternBrush = 0x00000008 ,
  LinearGradientFill = 0x00000010 , RadialGradientFill = 0x00000020 , ConicalGradientFill = 0x00000040 , AlphaBlend = 0x00000080 ,
  PorterDuff = 0x00000100 , PainterPaths = 0x00000200 , Antialiasing = 0x00000400 , BrushStroke = 0x00000800 ,
  ConstantOpacity = 0x00001000 , MaskedBrush = 0x00002000 , PerspectiveTransform = 0x00004000 , BlendModes = 0x00008000 ,
  ObjectBoundingModeGradients = 0x00010000 , RasterOpModes = 0x00020000 , PaintOutsidePaintEvent = 0x20000000 , AllFeatures = 0xffffffff
}
 This enum is used to describe the features or capabilities that the paint engine has. More...
 
enum  DirtyFlag {
  DirtyPen = 0x0001 , DirtyBrush = 0x0002 , DirtyBrushOrigin = 0x0004 , DirtyFont = 0x0008 ,
  DirtyBackground = 0x0010 , DirtyBackgroundMode = 0x0020 , DirtyTransform = 0x0040 , DirtyClipRegion = 0x0080 ,
  DirtyClipPath = 0x0100 , DirtyHints = 0x0200 , DirtyCompositionMode = 0x0400 , DirtyClipEnabled = 0x0800 ,
  DirtyOpacity = 0x1000 , AllDirty = 0xffff
}
 \value DirtyPen The pen is dirty and needs to be updated. More...
 
enum  PolygonDrawMode { OddEvenMode , WindingMode , ConvexMode , PolylineMode }
 \value OddEvenMode The polygon should be drawn using OddEven fill rule. More...
 
enum  Type {
  X11 , Windows , QuickDraw , CoreGraphics ,
  MacPrinter , QWindowSystem , OpenGL , Picture ,
  SVG , Raster , Direct3D , Pdf ,
  OpenVG , OpenGL2 , PaintBuffer , Blitter ,
  Direct2D , User = 50 , MaxUser = 100
}
 \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 More...
 

Public Member Functions

 QPaintEngine (PaintEngineFeatures features=PaintEngineFeatures())
 Creates a paint engine with the featureset specified by caps.
 
virtual ~QPaintEngine ()
 Destroys the paint engine.
 
bool isActive () const
 Returns true if the paint engine is actively drawing; otherwise returns false.
 
void setActive (bool newState)
 Sets the active state of the paint engine to state.
 
virtual bool begin (QPaintDevice *pdev)=0
 Reimplement this function to initialise your paint engine when painting is to start on the paint device pdev.
 
virtual bool end ()=0
 Reimplement this function to finish painting on the current paint device.
 
virtual void updateState (const QPaintEngineState &state)=0
 Reimplement this function to update the state of a paint engine.
 
virtual void drawRects (const QRect *rects, int rectCount)
 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.
 
virtual void drawRects (const QRectF *rects, int rectCount)
 Draws the first rectCount rectangles in the buffer rects.
 
virtual void drawLines (const QLine *lines, int lineCount)
 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.
 
virtual void drawLines (const QLineF *lines, int lineCount)
 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.
 
virtual void drawEllipse (const QRectF &r)
 Reimplement this function to draw the largest ellipse that can be contained within rectangle rect.
 
virtual void drawEllipse (const QRect &r)
 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 of this function calls the floating point version of this function.
 
virtual void drawPath (const QPainterPath &path)
 The default implementation ignores the path and does nothing.
 
virtual void drawPoints (const QPointF *points, int pointCount)
 Draws the first pointCount points in the buffer points.
 
virtual void drawPoints (const QPoint *points, int pointCount)
 Draws the first pointCount points in the buffer points.
 
virtual void drawPolygon (const QPointF *points, int pointCount, PolygonDrawMode mode)
 Reimplement this virtual function to draw the polygon defined by the pointCount first points in points, using mode mode.
 
virtual void drawPolygon (const QPoint *points, int pointCount, PolygonDrawMode mode)
 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.
 
virtual void drawPixmap (const QRectF &r, const QPixmap &pm, const QRectF &sr)=0
 Reimplement this function to draw the part of the pm specified by the sr rectangle in the given r.
 
virtual void drawTextItem (const QPointF &p, const QTextItem &textItem)
 This function draws the text item textItem at position p.
 
virtual void drawTiledPixmap (const QRectF &r, const QPixmap &pixmap, const QPointF &s)
 Reimplement this function to draw the pixmap in the given rect, starting at the given p.
 
virtual void drawImage (const QRectF &r, const QImage &pm, const QRectF &sr, Qt::ImageConversionFlags flags=Qt::AutoColor)
 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.
 
void setPaintDevice (QPaintDevice *device)
 
QPaintDevicepaintDevice () const
 Returns the device that this engine is painting on, if painting is active; otherwise returns \nullptr.
 
void setSystemClip (const QRegion &baseClip)
 
QRegion systemClip () const
 
void setSystemRect (const QRect &rect)
 
QRect systemRect () const
 
virtual QPoint coordinateOffset () const
 
virtual Type type () const =0
 Reimplement this function to return the paint engine \l{Type}.
 
void fix_neg_rect (int *x, int *y, int *w, int *h)
 
bool testDirty (DirtyFlags df)
 
void setDirty (DirtyFlags df)
 
void clearDirty (DirtyFlags df)
 
bool hasFeature (PaintEngineFeatures feature) const
 Returns true if the paint engine supports the specified feature; otherwise returns false.
 
QPainterpainter () const
 Returns the paint engine's painter.
 
void syncState ()
 
bool isExtended () const
 
virtual QPixmap createPixmap (QSize size)
 
virtual QPixmap createPixmapFromImage (QImage image, Qt::ImageConversionFlags flags=Qt::AutoColor)
 

Protected Member Functions

 QPaintEngine (QPaintEnginePrivate &data, PaintEngineFeatures devcaps=PaintEngineFeatures())
 

Protected Attributes

QPaintEngineStatestate
 
PaintEngineFeatures gccaps
 
uint active: 1
 
uint selfDestruct: 1
 
uint extended: 1
 
QScopedPointer< QPaintEnginePrivated_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
 

Detailed Description

\inmodule QtGui

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

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.

See also
QPainter, QPaintDevice::paintEngine(), {Paint System}

Definition at line 50 of file qpaintengine.h.

Member Enumeration Documentation

◆ DirtyFlag

\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.

Enumerator
DirtyPen 
DirtyBrush 
DirtyBrushOrigin 
DirtyFont 
DirtyBackground 
DirtyBackgroundMode 
DirtyTransform 
DirtyClipRegion 
DirtyClipPath 
DirtyHints 
DirtyCompositionMode 
DirtyClipEnabled 
DirtyOpacity 
AllDirty 

Definition at line 85 of file qpaintengine.h.

◆ PaintEngineFeature

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.

Enumerator
PrimitiveTransform 
PatternTransform 
PixmapTransform 
PatternBrush 
LinearGradientFill 
RadialGradientFill 
ConicalGradientFill 
AlphaBlend 
PorterDuff 
PainterPaths 
Antialiasing 
BrushStroke 
ConstantOpacity 
MaskedBrush 
PerspectiveTransform 
BlendModes 
ObjectBoundingModeGradients 
RasterOpModes 
PaintOutsidePaintEvent 
AllFeatures 

Definition at line 54 of file qpaintengine.h.

◆ PolygonDrawMode

\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 104 of file qpaintengine.h.

◆ 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 
Pdf 
OpenVG 
OpenGL2 
PaintBuffer 
Blitter 
Direct2D 
User 
MaxUser 

Definition at line 157 of file qpaintengine.h.

Constructor & Destructor Documentation

◆ QPaintEngine() [1/2]

QPaintEngine::QPaintEngine ( PaintEngineFeatures features = PaintEngineFeatures())
explicit

Creates a paint engine with the featureset specified by caps.

Definition at line 662 of file qpaintengine.cpp.

References d_ptr, and QPaintEnginePrivate::q_ptr.

◆ ~QPaintEngine()

QPaintEngine::~QPaintEngine ( )
virtual

Destroys the paint engine.

Definition at line 691 of file qpaintengine.cpp.

Referenced by QOpenGL2PaintEngineEx::QOpenGL2PaintEngineEx().

+ Here is the caller graph for this function:

◆ QPaintEngine() [2/2]

QPaintEngine::QPaintEngine ( QPaintEnginePrivate & dptr,
PaintEngineFeatures caps = PaintEngineFeatures() )
protected

Definition at line 677 of file qpaintengine.cpp.

References d_ptr, and QPaintEnginePrivate::q_ptr.

Member Function Documentation

◆ begin()

bool QPaintEngine::begin ( QPaintDevice * pdev)
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.

See also
end(), isActive()

Implemented in QMacPrintEngine, QPreviewPaintEngine, QWin32PrintEngine, QRasterPaintEngine, QOpenGL2PaintEngineEx, QSvgPaintEngine, QCoreGraphicsPaintEngine, QPicturePaintEngine, QEmulationPaintEngine, QBlitterPaintEngine, QPdfEngine, QWindowsDirect2DPaintEngine, QX11PaintEngine, QAlphaPaintEngine, and QPdfPrintEngine.

◆ clearDirty()

void QPaintEngine::clearDirty ( DirtyFlags df)
inline

Definition at line 295 of file qpaintengine.h.

References Q_ASSERT, and state.

◆ coordinateOffset()

QPoint QPaintEngine::coordinateOffset ( ) const
virtual

Returns the offset from the painters origo to the engines origo. This value is used by QPainter for engines who have internal double buffering.

This function only makes sense when the engine is active.

Reimplemented in QRasterPaintEngine.

Definition at line 902 of file qpaintengine.cpp.

◆ createPixmap()

QPixmap QPaintEngine::createPixmap ( QSize size)
virtual

Creates a QPixmap optimized for this paint engine and device.

Definition at line 972 of file qpaintengine.cpp.

References QCoreApplication::instance(), QPlatformPixmap::PixmapType, QGuiApplicationPrivate::platformIntegration(), Q_UNLIKELY, and qWarning.

+ Here is the call graph for this function:

◆ createPixmapFromImage()

QPixmap QPaintEngine::createPixmapFromImage ( QImage image,
Qt::ImageConversionFlags flags = Qt::AutoColor )
virtual

Creates a QPixmap optimized for this paint engine and device.

Definition at line 989 of file qpaintengine.cpp.

References QCoreApplication::instance(), QPlatformPixmap::PixmapType, QGuiApplicationPrivate::platformIntegration(), Q_UNLIKELY, and qWarning.

+ Here is the call graph for this function:

◆ drawEllipse() [1/2]

void QPaintEngine::drawEllipse ( const QRect & r)
virtual

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 of this function calls the floating point version of this function.

Reimplemented in QCoreGraphicsPaintEngine, QPaintEngineEx, QWindowsDirect2DPaintEngine, and QX11PaintEngine.

Definition at line 489 of file qpaintengine.cpp.

References drawEllipse(), and rect.

+ Here is the call graph for this function:

◆ drawEllipse() [2/2]

void QPaintEngine::drawEllipse ( const QRectF & rect)
virtual

Reimplement this function to draw the largest ellipse that can be contained within rectangle rect.

The default implementation calls drawPolygon().

Reimplemented in QCoreGraphicsPaintEngine, QMacPrintEngine, QPaintEngineEx, QWindowsDirect2DPaintEngine, QX11PaintEngine, QSvgPaintEngine, QPicturePaintEngine, QBlitterPaintEngine, and QRasterPaintEngine.

Definition at line 471 of file qpaintengine.cpp.

References ConvexMode, drawPath(), drawPolygon(), hasFeature(), PainterPaths, and rect.

Referenced by drawEllipse(), QCoreGraphicsPaintEngine::drawEllipse(), and QX11PaintEngine::drawEllipse().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ drawImage()

void QPaintEngine::drawImage ( const QRectF & r,
const QImage & pm,
const QRectF & sr,
Qt::ImageConversionFlags flags = Qt::AutoColor )
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 QPicturePaintEngine, QX11PaintEngine, QMacPrintEngine, QEmulationPaintEngine, QCoreGraphicsPaintEngine, QBlitterPaintEngine, QRasterPaintEngine, QPdfEngine, QOpenGL2PaintEngineEx, QSvgPaintEngine, QPaintEngineEx, and QWindowsDirect2DPaintEngine.

Definition at line 586 of file qpaintengine.cpp.

References QImage::copy(), drawPixmap(), QPixmap::fromImage(), qCeil(), qFloor(), and QPixmap::size().

Referenced by QX11PaintEngine::drawImage().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ drawLines() [1/2]

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

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 QRasterPaintEngine, QCoreGraphicsPaintEngine, QPaintEngineEx, and QX11PaintEngine.

Definition at line 784 of file qpaintengine.cpp.

References drawLines(), i, p1, p2, Q_ASSERT, QLine::x1(), QLine::x2(), QLine::y1(), and QLine::y2().

Referenced by drawLines(), and QCoreGraphicsPaintEngine::drawLines().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ drawLines() [2/2]

void QPaintEngine::drawLines ( const QLineF * lines,
int lineCount )
virtual

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 QRasterPaintEngine, QCoreGraphicsPaintEngine, QMacPrintEngine, QPaintEngineEx, QPdfEngine, and QX11PaintEngine.

Definition at line 762 of file qpaintengine.cpp.

References QPen::capStyle(), drawPoints(), drawPolygon(), Qt::FlatCap, i, QLineF::p1(), QLineF::p2(), QPaintEngineState::pen(), PolylineMode, and state.

+ Here is the call graph for this function:

◆ drawPath()

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

The default implementation ignores the path and does nothing.

Reimplemented in QMacPrintEngine, QCoreGraphicsPaintEngine, QPicturePaintEngine, QPaintEngineEx, QPdfEngine, QX11PaintEngine, QAlphaPaintEngine, QPreviewPaintEngine, QWin32PrintEngine, and QSvgPaintEngine.

Definition at line 707 of file qpaintengine.cpp.

References hasFeature(), PainterPaths, and qWarning.

Referenced by drawEllipse(), and drawRects().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ drawPixmap()

void QPaintEngine::drawPixmap ( const QRectF & r,
const QPixmap & pm,
const QRectF & sr )
pure virtual

Reimplement this function to draw the part of the pm specified by the sr rectangle in the given r.

Implemented in QCoreGraphicsPaintEngine, QMacPrintEngine, QPicturePaintEngine, QEmulationPaintEngine, QBlitterPaintEngine, QRasterPaintEngine, QOpenGL2PaintEngineEx, QWindowsDirect2DPaintEngine, QX11PaintEngine, QAlphaPaintEngine, QPreviewPaintEngine, QWin32PrintEngine, QSvgPaintEngine, QPaintEngineEx, and QPdfEngine.

Referenced by drawImage().

+ Here is the caller graph for this function:

◆ drawPoints() [1/2]

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

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 QCoreGraphicsPaintEngine, QBlitterPaintEngine, QRasterPaintEngine, QPaintEngineEx, and QX11PaintEngine.

Definition at line 446 of file qpaintengine.cpp.

References drawPoints(), fp, i, and Q_ASSERT.

+ Here is the call graph for this function:

◆ drawPoints() [2/2]

void QPaintEngine::drawPoints ( const QPointF * points,
int pointCount )
virtual

Draws the first pointCount points in the buffer points.

Reimplemented in QCoreGraphicsPaintEngine, QMacPrintEngine, QBlitterPaintEngine, QRasterPaintEngine, QPaintEngineEx, QPdfEngine, and QX11PaintEngine.

Definition at line 402 of file qpaintengine.cpp.

References i, Qt::NoPen, painter(), pos, rect, and Qt::RoundCap.

Referenced by drawLines(), QCoreGraphicsPaintEngine::drawPoints(), and drawPoints().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ drawPolygon() [1/2]

void QPaintEngine::drawPolygon ( const QPoint * points,
int pointCount,
PolygonDrawMode mode )
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.

Note
At least one of the drawPolygon() functions must be reimplemented.

Reimplemented in QPicturePaintEngine, QCoreGraphicsPaintEngine, QBlitterPaintEngine, QRasterPaintEngine, QPaintEngineEx, and QX11PaintEngine.

Definition at line 322 of file qpaintengine.cpp.

References drawPolygon(), i, Q_ASSERT, Q_ASSERT_X, and qt_polygon_recursion.

+ Here is the call graph for this function:

◆ drawPolygon() [2/2]

void QPaintEngine::drawPolygon ( const QPointF * points,
int pointCount,
PolygonDrawMode mode )
virtual

Reimplement this virtual function to draw the polygon defined by the pointCount first points in points, using mode mode.

Note
At least one of the drawPolygon() functions must be reimplemented.

Reimplemented in QPicturePaintEngine, QPicturePaintEngine, QCoreGraphicsPaintEngine, QMacPrintEngine, QBlitterPaintEngine, QRasterPaintEngine, QPaintEngineEx, QPdfEngine, QX11PaintEngine, QAlphaPaintEngine, QPreviewPaintEngine, QWin32PrintEngine, and QSvgPaintEngine.

Definition at line 293 of file qpaintengine.cpp.

References drawPolygon(), i, Q_ASSERT, Q_ASSERT_X, qRound(), and qt_polygon_recursion.

Referenced by drawEllipse(), drawLines(), drawPolygon(), QCoreGraphicsPaintEngine::drawPolygon(), QX11PaintEngine::drawPolygon(), drawPolygon(), and drawRects().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ drawRects() [1/2]

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

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 QCoreGraphicsPaintEngine, QBlitterPaintEngine, QRasterPaintEngine, QPaintEngineEx, QWindowsDirect2DPaintEngine, and QX11PaintEngine.

Definition at line 820 of file qpaintengine.cpp.

References drawRects(), QRect::height(), i, Q_ASSERT, QRect::width(), QRect::x(), and QRect::y().

Referenced by drawRects(), QCoreGraphicsPaintEngine::drawRects(), and QX11PaintEngine::drawRects().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ drawRects() [2/2]

void QPaintEngine::drawRects ( const QRectF * rects,
int rectCount )
virtual

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 QMacPrintEngine, QCoreGraphicsPaintEngine, QBlitterPaintEngine, QRasterPaintEngine, QPaintEngineEx, QPdfEngine, QWindowsDirect2DPaintEngine, QX11PaintEngine, and QSvgPaintEngine.

Definition at line 850 of file qpaintengine.cpp.

References QPaintEngineState::brushNeedsResolving(), ConvexMode, drawPath(), drawPolygon(), hasFeature(), i, PainterPaths, QPaintEngineState::penNeedsResolving(), and state.

+ Here is the call graph for this function:

◆ drawTextItem()

void QPaintEngine::drawTextItem ( const QPointF & p,
const QTextItem & textItem )
virtual

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 QEmulationPaintEngine, QBlitterPaintEngine, QRasterPaintEngine, QPdfEngine, QOpenGL2PaintEngineEx, QWindowsDirect2DPaintEngine, QX11PaintEngine, QAlphaPaintEngine, QPreviewPaintEngine, QWin32PrintEngine, QMacPrintEngine, QPicturePaintEngine, QCoreGraphicsPaintEngine, and QSvgPaintEngine.

Definition at line 720 of file qpaintengine.cpp.

References QPainter::Antialiasing, QPainter::drawImage(), QPainter::fillPath(), font, QFontEngine::Format_ARGB, QTransform::fromTranslate(), i, QFont::NoAntialias, painter(), positions, QPainter::restore(), QPainter::save(), QPainter::setRenderHint(), QPainter::SmoothPixmapTransform, QPainter::TextAntialiasing, QPainter::translate(), and Qt::WindingFill.

Referenced by QPainterPrivate::drawTextItem(), QEmulationPaintEngine::drawTextItem(), QRasterPaintEngine::drawTextItem(), QPdfEngine::drawTextItem(), QOpenGL2PaintEngineEx::drawTextItem(), QWindowsDirect2DPaintEngine::drawTextItem(), QWin32PrintEngine::drawTextItem(), QMacPrintEngine::drawTextItem(), QPicturePaintEngine::drawTextItem(), QCoreGraphicsPaintEngine::drawTextItem(), and QSvgPaintEngine::drawTextItem().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ drawTiledPixmap()

void QPaintEngine::drawTiledPixmap ( const QRectF & rect,
const QPixmap & pixmap,
const QPointF & p )
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 QCoreGraphicsPaintEngine, QMacPrintEngine, QPicturePaintEngine, QEmulationPaintEngine, QPaintEngineEx, QX11PaintEngine, QAlphaPaintEngine, QPreviewPaintEngine, QWin32PrintEngine, QBlitterPaintEngine, QRasterPaintEngine, and QPdfEngine.

Definition at line 551 of file qpaintengine.cpp.

References pixmap, qt_draw_tile(), qt_fill_tile(), rect, and Qt::transparent.

Referenced by QWin32PrintEngine::drawTiledPixmap().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ end()

bool QPaintEngine::end ( )
pure virtual

Reimplement this function to finish painting on the current paint device.

Return true if painting was finished successfully; otherwise return false.

See also
begin(), isActive()

Implemented in QCoreGraphicsPaintEngine, QMacPrintEngine, QPicturePaintEngine, QEmulationPaintEngine, QBlitterPaintEngine, QRasterPaintEngine, QPdfEngine, QOpenGL2PaintEngineEx, QWindowsDirect2DPaintEngine, QX11PaintEngine, QAlphaPaintEngine, QPreviewPaintEngine, QPdfPrintEngine, QWin32PrintEngine, and QSvgPaintEngine.

◆ fix_neg_rect()

void QPaintEngine::fix_neg_rect ( int * x,
int * y,
int * w,
int * h )
inline

Definition at line 273 of file qpaintengine.h.

◆ hasFeature()

bool QPaintEngine::hasFeature ( PaintEngineFeatures feature) const
inline

Returns true if the paint engine supports the specified feature; otherwise returns false.

Definition at line 185 of file qpaintengine.h.

Referenced by drawEllipse(), drawPath(), and drawRects().

+ Here is the caller graph for this function:

◆ isActive()

◆ isExtended()

bool QPaintEngine::isExtended ( ) const
inline

Returns true if the paint engine is a QPaintEngineEx derivative.

Definition at line 190 of file qpaintengine.h.

Referenced by syncState().

+ Here is the caller graph for this function:

◆ paintDevice()

QPaintDevice * QPaintEngine::paintDevice ( ) const

Returns the device that this engine is painting on, if painting is active; otherwise returns \nullptr.

Definition at line 887 of file qpaintengine.cpp.

Referenced by QMacCGContext::QMacCGContext(), QX11PaintEngine::begin(), QPixmapConvolutionFilter::draw(), QWindowsVistaStylePrivate::drawBackground(), QBlitterPaintEngine::drawPixmap(), and QCoreGraphicsPaintEngine::drawTextItem().

+ Here is the caller graph for this function:

◆ painter()

QPainter * QPaintEngine::painter ( ) const

Returns the paint engine's painter.

Definition at line 698 of file qpaintengine.cpp.

References QPaintEngineState::painter(), and state.

Referenced by QPreviewPaintEngine::begin(), QOpenGL2PaintEngineEx::clipEnabledChanged(), QRasterPaintEngine::drawCachedGlyphs(), QPdfEngine::drawImage(), QWin32PrintEngine::drawPixmap(), QPdfEngine::drawPixmap(), drawPoints(), drawTextItem(), QEmulationPaintEngine::drawTextItem(), QCoreGraphicsPaintEngine::drawTextItem(), QEmulationPaintEngine::fill(), QAlphaPaintEngine::flushAndInit(), QPreviewPaintEngine::newPage(), QEmulationPaintEngine::stroke(), QSvgPaintEngine::updateClipState(), QCoreGraphicsPaintEngine::updateState(), QX11PaintEngine::updateState(), QAlphaPaintEngine::updateState(), and QWin32PrintEngine::updateState().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setActive()

void QPaintEngine::setActive ( bool state)
inline

Sets the active state of the paint engine to state.

See also
isActive()

Definition at line 115 of file qpaintengine.h.

References newState().

Referenced by QMacPrintEngine::begin(), QRasterPaintEngine::begin(), QCoreGraphicsPaintEngine::begin(), QPicturePaintEngine::begin(), QPdfEngine::begin(), QWindowsDirect2DPaintEngine::begin(), QX11PaintEngine::begin(), QCoreGraphicsPaintEngine::end(), QPicturePaintEngine::end(), QPdfEngine::end(), and QX11PaintEngine::end().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setDirty()

void QPaintEngine::setDirty ( DirtyFlags df)
inline

Definition at line 290 of file qpaintengine.h.

References Q_ASSERT, and state.

Referenced by QRasterPaintEngine::begin(), QCoreGraphicsPaintEngine::begin(), and QX11PaintEngine::begin().

+ Here is the caller graph for this function:

◆ setPaintDevice()

void QPaintEngine::setPaintDevice ( QPaintDevice * device)

Sets the paintdevice that this engine operates on to device

Definition at line 878 of file qpaintengine.cpp.

References device.

◆ setSystemClip()

void QPaintEngine::setSystemClip ( const QRegion & region)

Sets the system clip for this engine. The system clip defines the basis area that the engine has to draw in. All clips that are set will be an intersection with the system clip.

Reset the systemclip to no clip by setting an empty region.

Definition at line 916 of file qpaintengine.cpp.

References d.

Referenced by QX11PaintEngine::begin(), and QX11PaintEngine::end().

+ Here is the caller graph for this function:

◆ setSystemRect()

void QPaintEngine::setSystemRect ( const QRect & rect)

Sets the target rect for drawing within the backing store. This function should ONLY be used by the backing store.

Definition at line 947 of file qpaintengine.cpp.

References isActive(), qWarning, and rect.

+ Here is the call graph for this function:

◆ syncState()

void QPaintEngine::syncState ( )

Updates all dirty states in this engine. This function should ONLY be used when drawing with native handles directly and immediate sync from QPainters state to the native state is required.

Definition at line 267 of file qpaintengine.cpp.

References isExtended(), Q_ASSERT, state, and updateState().

Referenced by QMacCGContext::QMacCGContext().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ systemClip()

QRegion QPaintEngine::systemClip ( ) const

Returns the system clip. The system clip is read only while the painter is active. An empty region indicates that system clip is not in use.

Definition at line 936 of file qpaintengine.cpp.

Referenced by QOpenGL2PaintEngineEx::begin(), QWindowsDirect2DPaintEngine::begin(), QX11PaintEngine::begin(), QWindowsVistaStylePrivate::drawBackgroundDirectly(), QQC2::QWindowsXPStylePrivate::drawBackgroundDirectly(), QX11PaintEngine::updateBrush(), QX11PaintEngine::updateClipRegion_dev(), and QX11PaintEngine::updatePen().

+ Here is the caller graph for this function:

◆ systemRect()

QRect QPaintEngine::systemRect ( ) const

Retrieves the rect for drawing within the backing store. This function should ONLY be used by the backing store.

Definition at line 962 of file qpaintengine.cpp.

Referenced by QWidgetPrivate::drawWidget().

+ Here is the caller graph for this function:

◆ testDirty()

bool QPaintEngine::testDirty ( DirtyFlags df)
inline

Definition at line 285 of file qpaintengine.h.

References Q_ASSERT, and state.

◆ type()

◆ updateState()

void QPaintEngine::updateState ( const QPaintEngineState & state)
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.

See also
QPaintEngineState

Implemented in QCoreGraphicsPaintEngine, QMacPrintEngine, QPicturePaintEngine, QPaintEngineEx, QPdfEngine, QX11PaintEngine, QAlphaPaintEngine, QPreviewPaintEngine, QWin32PrintEngine, and QSvgPaintEngine.

Referenced by syncState().

+ Here is the caller graph for this function:

Friends And Related Symbol Documentation

◆ QFontEngineBox

friend class QFontEngineBox
friend

Definition at line 213 of file qpaintengine.h.

◆ QFontEngineMac

friend class QFontEngineMac
friend

Definition at line 214 of file qpaintengine.h.

◆ QFontEngineQPF2

friend class QFontEngineQPF2
friend

Definition at line 218 of file qpaintengine.h.

◆ QFontEngineWin

friend class QFontEngineWin
friend

Definition at line 215 of file qpaintengine.h.

◆ QMacCGContext

friend class QMacCGContext
friend

Definition at line 225 of file qpaintengine.h.

◆ QMacPrintEngine

friend class QMacPrintEngine
friend

Definition at line 216 of file qpaintengine.h.

◆ QMacPrintEnginePrivate

friend class QMacPrintEnginePrivate
friend

Definition at line 217 of file qpaintengine.h.

◆ QPainter

◆ QPainterPrivate

friend class QPainterPrivate
friend

Definition at line 220 of file qpaintengine.h.

◆ QPainterReplayer

friend class QPainterReplayer
friend

Definition at line 212 of file qpaintengine.h.

◆ QPreviewPaintEngine

friend class QPreviewPaintEngine
friend

Definition at line 226 of file qpaintengine.h.

◆ QWidget

friend class QWidget
friend

Definition at line 221 of file qpaintengine.h.

◆ QWidgetPrivate

friend class QWidgetPrivate
friend

Definition at line 222 of file qpaintengine.h.

◆ QWin32PaintEngine

friend class QWin32PaintEngine
friend

Definition at line 223 of file qpaintengine.h.

◆ QWin32PaintEnginePrivate

friend class QWin32PaintEnginePrivate
friend

Definition at line 224 of file qpaintengine.h.

◆ QX11GLPlatformPixmap

friend class QX11GLPlatformPixmap
friend

Definition at line 227 of file qpaintengine.h.

Member Data Documentation

◆ active

uint QPaintEngine::active
protected

Definition at line 201 of file qpaintengine.h.

◆ d_ptr

QScopedPointer<QPaintEnginePrivate> QPaintEngine::d_ptr
protected

Definition at line 205 of file qpaintengine.h.

Referenced by QPaintEngine(), and QPaintEngine().

◆ extended

uint QPaintEngine::extended
protected

◆ gccaps

◆ selfDestruct

uint QPaintEngine::selfDestruct
protected

Definition at line 202 of file qpaintengine.h.

◆ state

QPaintEngineState* QPaintEngine::state
protected

Definition at line 198 of file qpaintengine.h.

Referenced by QEmulationPaintEngine::QEmulationPaintEngine(), QMacPrintEngine::begin(), QCoreGraphicsPaintEngine::drawEllipse(), QSvgPaintEngine::drawEllipse(), QCoreGraphicsPaintEngine::drawImage(), QSvgPaintEngine::drawImage(), drawLines(), QCoreGraphicsPaintEngine::drawLines(), QCoreGraphicsPaintEngine::drawPath(), QSvgPaintEngine::drawPath(), QCoreGraphicsPaintEngine::drawPixmap(), QCoreGraphicsPaintEngine::drawPoints(), QCoreGraphicsPaintEngine::drawPolygon(), QSvgPaintEngine::drawPolygon(), drawRects(), QCoreGraphicsPaintEngine::drawRects(), QSvgPaintEngine::drawRects(), QWin32PrintEngine::drawTextItem(), QCoreGraphicsPaintEngine::drawTextItem(), QCoreGraphicsPaintEngine::drawTiledPixmap(), QAlphaPaintEngine::flushAndInit(), QPreviewPaintEngine::newPage(), painter(), QMacPrintEngine::printerState(), QPaintEngineEx::setState(), QEmulationPaintEngine::setState(), QPaintEnginePrivate::setSystemTransform(), QPaintEnginePrivate::setSystemTransformAndViewport(), QPaintEnginePrivate::setSystemViewport(), QEmulationPaintEngine::state(), QPaintEngineEx::state(), QEmulationPaintEngine::state(), QPaintEngineEx::state(), syncState(), QSvgPaintEngine::updateClipState(), QCoreGraphicsPaintEngine::updateState(), QMacPrintEngine::updateState(), QPicturePaintEngine::updateState(), QPdfEngine::updateState(), QX11PaintEngine::updateState(), QAlphaPaintEngine::updateState(), QPreviewPaintEngine::updateState(), QWin32PrintEngine::updateState(), QSvgPaintEngine::updateState(), and QPainterPrivate::updateStateImpl().


The documentation for this class was generated from the following files: