Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
QPicturePaintEngine Class Reference

#include <qpaintengine_pic_p.h>

+ Inheritance diagram for QPicturePaintEngine:
+ Collaboration diagram for QPicturePaintEngine:

Public Member Functions

 QPicturePaintEngine ()
 
 ~QPicturePaintEngine ()
 
bool begin (QPaintDevice *pdev) override
 Reimplement this function to initialise your paint engine when painting is to start on the paint device pdev.
 
bool end () override
 Reimplement this function to finish painting on the current paint device.
 
void updateState (const QPaintEngineState &state) override
 Reimplement this function to update the state of a paint engine.
 
void updatePen (const QPen &pen)
 
void updateBrush (const QBrush &brush)
 
void updateBrushOrigin (const QPointF &origin)
 
void updateFont (const QFont &font)
 
void updateBackground (Qt::BGMode bgmode, const QBrush &bgBrush)
 
void updateMatrix (const QTransform &matrix)
 
void updateClipRegion (const QRegion &region, Qt::ClipOperation op)
 
void updateClipPath (const QPainterPath &path, Qt::ClipOperation op)
 
void updateRenderHints (QPainter::RenderHints hints)
 
void updateCompositionMode (QPainter::CompositionMode cmode)
 
void updateClipEnabled (bool enabled)
 
void updateOpacity (qreal opacity)
 
void drawEllipse (const QRectF &rect) override
 Reimplement this function to draw the largest ellipse that can be contained within rectangle rect.
 
void drawPath (const QPainterPath &path) override
 The default implementation ignores the path and does nothing.
 
void drawPolygon (const QPointF *points, int numPoints, PolygonDrawMode mode) override
 Reimplement this virtual function to draw the polygon defined by the pointCount first points in points, using mode mode.
 
void drawPixmap (const QRectF &r, const QPixmap &pm, const QRectF &sr) override
 Reimplement this function to draw the part of the pm specified by the sr rectangle in the given r.
 
void drawTiledPixmap (const QRectF &r, const QPixmap &pixmap, const QPointF &s) override
 Reimplement this function to draw the pixmap in the given rect, starting at the given p.
 
void drawImage (const QRectF &r, const QImage &image, const QRectF &sr, Qt::ImageConversionFlags flags=Qt::AutoColor) override
 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 drawTextItem (const QPointF &p, const QTextItem &ti) override
 This function draws the text item textItem at position p.
 
Type type () const override
 Reimplement this function to return the paint engine \l{Type}.
 
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.
 
- Public Member Functions inherited from QPaintEngine
 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)
 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

 QPicturePaintEngine (QPaintEnginePrivate &dptr)
 
- Protected Member Functions inherited from QPaintEngine
 QPaintEngine (QPaintEnginePrivate &data, PaintEngineFeatures devcaps=PaintEngineFeatures())
 

Additional Inherited Members

- Public Types inherited from QPaintEngine
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...
 
- Protected Attributes inherited from QPaintEngine
QPaintEngineStatestate
 
PaintEngineFeatures gccaps
 
uint active: 1
 
uint selfDestruct: 1
 
uint extended: 1
 
QScopedPointer< QPaintEnginePrivated_ptr
 

Detailed Description

Definition at line 28 of file qpaintengine_pic_p.h.

Constructor & Destructor Documentation

◆ QPicturePaintEngine() [1/2]

QPicturePaintEngine::QPicturePaintEngine ( )

Definition at line 36 of file qpaintengine_pic.cpp.

References d.

◆ ~QPicturePaintEngine()

QPicturePaintEngine::~QPicturePaintEngine ( )

Definition at line 50 of file qpaintengine_pic.cpp.

◆ QPicturePaintEngine() [2/2]

QPicturePaintEngine::QPicturePaintEngine ( QPaintEnginePrivate dptr)
protected

Definition at line 43 of file qpaintengine_pic.cpp.

References d.

Member Function Documentation

◆ begin()

bool QPicturePaintEngine::begin ( QPaintDevice pdev)
overridevirtual

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

Implements QPaintEngine.

Definition at line 54 of file qpaintengine_pic.cpp.

References QPicture::boundingRect(), d, QPicturePrivate::PdcBegin, Q_ASSERT, qDebug, qt_mfhdr_tag, QPaintEngine::setActive(), QIODeviceBase::Truncate, and QIODeviceBase::WriteOnly.

+ Here is the call graph for this function:

◆ drawEllipse()

void QPicturePaintEngine::drawEllipse ( const QRectF rect)
overridevirtual

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

The default implementation calls drawPolygon().

Reimplemented from QPaintEngine.

Definition at line 338 of file qpaintengine_pic.cpp.

References d, QPicturePrivate::PdcDrawEllipse, pos, qDebug, rect, and SERIALIZE_CMD.

◆ drawImage()

void QPicturePaintEngine::drawImage ( const QRectF r,
const QImage pm,
const QRectF sr,
Qt::ImageConversionFlags  flags = Qt::AutoColor 
)
overridevirtual

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 from QPaintEngine.

Definition at line 424 of file qpaintengine_pic.cpp.

References d, QPicturePrivate::PdcDrawImage, pos, qDebug, and SERIALIZE_CMD.

◆ drawPath()

void QPicturePaintEngine::drawPath ( const QPainterPath path)
overridevirtual

The default implementation ignores the path and does nothing.

Reimplemented from QPaintEngine.

Definition at line 350 of file qpaintengine_pic.cpp.

References d, QPicturePrivate::PdcDrawPath, pos, qDebug, and SERIALIZE_CMD.

◆ drawPixmap()

void QPicturePaintEngine::drawPixmap ( const QRectF r,
const QPixmap pm,
const QRectF sr 
)
overridevirtual

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

Implements QPaintEngine.

Definition at line 387 of file qpaintengine_pic.cpp.

References d, QPicturePrivate::PdcDrawPixmap, pos, qDebug, and SERIALIZE_CMD.

◆ drawPolygon() [1/3]

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 from QPaintEngine.

Definition at line 137 of file qpaintengine.cpp.

◆ drawPolygon() [2/3]

void QPicturePaintEngine::drawPolygon ( const QPointF points,
int  pointCount,
PolygonDrawMode  mode 
)
overridevirtual

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 from QPaintEngine.

Definition at line 362 of file qpaintengine_pic.cpp.

References d, i, QPaintEngine::OddEvenMode, QPicturePrivate::PdcDrawPolygon, QPicturePrivate::PdcDrawPolyline, QPaintEngine::PolylineMode, pos, qDebug, qint8, and SERIALIZE_CMD.

◆ drawPolygon() [3/3]

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 from QPaintEngine.

Definition at line 136 of file qpaintengine.cpp.

◆ drawTextItem()

void QPicturePaintEngine::drawTextItem ( const QPointF p,
const QTextItem textItem 
)
overridevirtual

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 from QPaintEngine.

Definition at line 443 of file qpaintengine_pic.cpp.

References QTextItem::ascent(), QTextItemInt::chars, d, QFontPrivate::dpi, QPaintEngine::drawTextItem(), QTextItem::font(), QTextItemInt::justified, QPicturePrivate::PdcDrawText2, QPicturePrivate::PdcDrawTextItem, pos, qDebug, qt_defaultDpi(), QTextItem::renderFlags(), SERIALIZE_CMD, QFont::setOverline(), QFont::setStrikeOut(), QFont::setUnderline(), QTextItem::text(), QFixed::toReal(), and QTextItemInt::width.

+ Here is the call graph for this function:

◆ drawTiledPixmap()

void QPicturePaintEngine::drawTiledPixmap ( const QRectF rect,
const QPixmap pixmap,
const QPointF p 
)
overridevirtual

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 from QPaintEngine.

Definition at line 406 of file qpaintengine_pic.cpp.

References d, QPicturePrivate::PdcDrawTiledPixmap, pixmap, pos, qDebug, and SERIALIZE_CMD.

◆ end()

bool QPicturePaintEngine::end ( )
overridevirtual

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

Implements QPaintEngine.

Definition at line 87 of file qpaintengine_pic.cpp.

References boundingRect(), d, QPicturePrivate::PdcEnd, pos, qChecksum(), qDebug, and QPaintEngine::setActive().

+ Here is the call graph for this function:

◆ type()

Type QPicturePaintEngine::type ( ) const
inlineoverridevirtual

Reimplement this function to return the paint engine \l{Type}.

Implements QPaintEngine.

Definition at line 64 of file qpaintengine_pic_p.h.

References QPaintEngine::Picture.

◆ updateBackground()

void QPicturePaintEngine::updateBackground ( Qt::BGMode  bgmode,
const QBrush bgBrush 
)

Definition at line 219 of file qpaintengine_pic.cpp.

References QBrush::color(), d, QPicturePrivate::PdcSetBkColor, QPicturePrivate::PdcSetBkMode, pos, qDebug, qint8, SERIALIZE_CMD, and QBrush::style().

Referenced by updateState().

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

◆ updateBrush()

void QPicturePaintEngine::updateBrush ( const QBrush brush)

Definition at line 176 of file qpaintengine_pic.cpp.

References d, QPicturePrivate::PdcSetBrush, pos, qDebug, and SERIALIZE_CMD.

Referenced by updateState().

+ Here is the caller graph for this function:

◆ updateBrushOrigin()

void QPicturePaintEngine::updateBrushOrigin ( const QPointF origin)

Definition at line 194 of file qpaintengine_pic.cpp.

References d, QPicturePrivate::PdcSetBrushOrigin, pos, qDebug, and SERIALIZE_CMD.

Referenced by updateState().

+ Here is the caller graph for this function:

◆ updateClipEnabled()

void QPicturePaintEngine::updateClipEnabled ( bool  enabled)

Definition at line 152 of file qpaintengine_pic.cpp.

References d, enabled, QPicturePrivate::PdcSetClipEnabled, pos, qDebug, and SERIALIZE_CMD.

Referenced by updateState().

+ Here is the caller graph for this function:

◆ updateClipPath()

void QPicturePaintEngine::updateClipPath ( const QPainterPath path,
Qt::ClipOperation  op 
)

Definition at line 260 of file qpaintengine_pic.cpp.

References d, QPicturePrivate::PdcSetClipPath, pos, qDebug, qint8, and SERIALIZE_CMD.

Referenced by updateState().

+ Here is the caller graph for this function:

◆ updateClipRegion()

void QPicturePaintEngine::updateClipRegion ( const QRegion region,
Qt::ClipOperation  op 
)

Definition at line 247 of file qpaintengine_pic.cpp.

References QRegion::boundingRect(), d, QPicturePrivate::PdcSetClipRegion, pos, qDebug, qint8, and SERIALIZE_CMD.

Referenced by updateState().

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

◆ updateCompositionMode()

void QPicturePaintEngine::updateCompositionMode ( QPainter::CompositionMode  cmode)

Definition at line 140 of file qpaintengine_pic.cpp.

References d, QPicturePrivate::PdcSetCompositionMode, pos, qDebug, and SERIALIZE_CMD.

Referenced by updateState().

+ Here is the caller graph for this function:

◆ updateFont()

void QPicturePaintEngine::updateFont ( const QFont font)

Definition at line 206 of file qpaintengine_pic.cpp.

References d, font, QPicturePrivate::PdcSetFont, QFont::pointSize(), pos, qDebug, and SERIALIZE_CMD.

Referenced by updateState().

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

◆ updateMatrix()

void QPicturePaintEngine::updateMatrix ( const QTransform matrix)

Definition at line 235 of file qpaintengine_pic.cpp.

References d, QPicturePrivate::PdcSetWMatrix, pos, qDebug, qint8, and SERIALIZE_CMD.

Referenced by updateState().

+ Here is the caller graph for this function:

◆ updateOpacity()

void QPicturePaintEngine::updateOpacity ( qreal  opacity)

Definition at line 164 of file qpaintengine_pic.cpp.

References d, QPicturePrivate::PdcSetOpacity, pos, qDebug, and SERIALIZE_CMD.

Referenced by updateState().

+ Here is the caller graph for this function:

◆ updatePen()

void QPicturePaintEngine::updatePen ( const QPen pen)

Definition at line 121 of file qpaintengine_pic.cpp.

References QPen::color(), d, QPicturePrivate::PdcSetPen, pos, qDebug, SERIALIZE_CMD, QPen::style(), and QPen::width().

Referenced by updateState().

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

◆ updateRenderHints()

void QPicturePaintEngine::updateRenderHints ( QPainter::RenderHints  hints)

Definition at line 274 of file qpaintengine_pic.cpp.

References d, QPicturePrivate::PdcSetRenderHint, pos, qDebug, and SERIALIZE_CMD.

Referenced by updateState().

+ Here is the caller graph for this function:

◆ updateState()

void QPicturePaintEngine::updateState ( const QPaintEngineState state)
overridevirtual

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

Implements QPaintEngine.

Definition at line 483 of file qpaintengine_pic.cpp.

References QPaintEngineState::backgroundBrush(), QPaintEngineState::backgroundMode(), QPaintEngineState::brush(), QPaintEngineState::brushOrigin(), QPaintEngineState::clipOperation(), QPaintEngineState::clipPath(), QPaintEngineState::clipRegion(), QPaintEngineState::compositionMode(), QPaintEngine::DirtyBackground, QPaintEngine::DirtyBrush, QPaintEngine::DirtyBrushOrigin, QPaintEngine::DirtyClipEnabled, QPaintEngine::DirtyClipPath, QPaintEngine::DirtyClipRegion, QPaintEngine::DirtyCompositionMode, QPaintEngine::DirtyFont, QPaintEngine::DirtyHints, QPaintEngine::DirtyOpacity, QPaintEngine::DirtyPen, QPaintEngine::DirtyTransform, QPaintEngineState::font(), QPaintEngineState::isClipEnabled(), QPaintEngineState::opacity(), QPaintEngineState::pen(), QPaintEngineState::renderHints(), QPaintEngine::state, QPaintEngineState::state(), QPaintEngineState::transform(), updateBackground(), updateBrush(), updateBrushOrigin(), updateClipEnabled(), updateClipPath(), updateClipRegion(), updateCompositionMode(), updateFont(), updateMatrix(), updateOpacity(), updatePen(), and updateRenderHints().

+ Here is the call graph for this function:

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