Qt 4.8
Public Functions | Public Variables | Private Functions | List of all members
QEmulationPaintEngine Class Reference

#include <qemulationpaintengine_p.h>

Inheritance diagram for QEmulationPaintEngine:
QPaintEngineEx QPaintEngine

Public Functions

virtual bool begin (QPaintDevice *pdev)
 Reimplement this function to initialise your paint engine when painting is to start on the paint device pdev. More...
 
virtual void beginNativePainting ()
 
virtual void brushChanged ()
 
virtual void brushOriginChanged ()
 
virtual void clip (const QVectorPath &path, Qt::ClipOperation op)
 
virtual void clipEnabledChanged ()
 
virtual void compositionModeChanged ()
 
virtual QPainterStatecreateState (QPainterState *orig) const
 
virtual void drawImage (const QRectF &r, const QImage &pm, const QRectF &sr, Qt::ImageConversionFlags flags)
 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. More...
 
virtual void drawPixmap (const QRectF &r, const QPixmap &pm, const QRectF &sr)
 Reimplement this function to draw the part of the pm specified by the sr rectangle in the given r. More...
 
virtual void drawPixmapFragments (const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap, QPainter::PixmapFragmentHints hints)
 
virtual void drawPixmapFragments (const QRectF *targetRects, const QRectF *sourceRects, int fragmentCount, const QPixmap &pixmap, QPainter::PixmapFragmentHints hints)
 
virtual void drawStaticTextItem (QStaticTextItem *item)
 
virtual void drawTextItem (const QPointF &p, const QTextItem &textItem)
 This function draws the text item textItem at position p. More...
 
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. More...
 
virtual bool end ()
 Reimplement this function to finish painting on the current paint device. More...
 
virtual void endNativePainting ()
 
virtual void fill (const QVectorPath &path, const QBrush &brush)
 
virtual uint flags () const
 
virtual void opacityChanged ()
 
virtual void penChanged ()
 
 QEmulationPaintEngine (QPaintEngineEx *engine)
 
virtual void renderHintsChanged ()
 
virtual void setState (QPainterState *s)
 
QPainterStatestate ()
 
const QPainterStatestate () const
 
virtual void stroke (const QVectorPath &path, const QPen &pen)
 
virtual void transformChanged ()
 
virtual Type type () const
 Reimplement this function to return the paint engine Type. More...
 
- Public Functions inherited from QPaintEngineEx
virtual void clip (const QRect &rect, Qt::ClipOperation op)
 
virtual void clip (const QRegion &region, Qt::ClipOperation op)
 
virtual void clip (const QPainterPath &path, Qt::ClipOperation op)
 
virtual void draw (const QVectorPath &path)
 
virtual void drawEllipse (const QRectF &r)
 Reimplement this function to draw the largest ellipse that can be contained within rectangle rect. More...
 
virtual void drawEllipse (const QRect &r)
 The default implementation of this function calls the floating point version of this function. More...
 
virtual void drawImage (const QPointF &pos, const QImage &image)
 
virtual void drawLines (const QLine *lines, int lineCount)
 The default implementation converts the first lineCount lines in lines to a QLineF and calls the floating point version of this function. More...
 
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. More...
 
virtual void drawPath (const QPainterPath &path)
 The default implementation ignores the path and does nothing. More...
 
virtual void drawPixmap (const QPointF &pos, const QPixmap &pm)
 
virtual void drawPoints (const QPointF *points, int pointCount)
 Draws the first pointCount points in the buffer points. More...
 
virtual void drawPoints (const QPoint *points, int pointCount)
 Draws the first pointCount points in the buffer points. More...
 
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. More...
 
virtual void drawPolygon (const QPoint *points, int pointCount, PolygonDrawMode mode)
 Reimplement this virtual function to draw the polygon defined by the pointCount first points in points, using mode mode. More...
 
virtual void drawRects (const QRect *rects, int rectCount)
 The default implementation converts the first rectCount rectangles in the buffer rects to a QRectF and calls the floating point version of this function. More...
 
virtual void drawRects (const QRectF *rects, int rectCount)
 Draws the first rectCount rectangles in the buffer rects. More...
 
virtual void drawRoundedRect (const QRectF &rect, qreal xrad, qreal yrad, Qt::SizeMode mode)
 
virtual void fillRect (const QRectF &rect, const QBrush &brush)
 
virtual void fillRect (const QRectF &rect, const QColor &color)
 
virtual QPixmapFilterpixmapFilter (int, const QPixmapFilter *)
 
 QPaintEngineEx ()
 
QPainterStatestate ()
 
const QPainterStatestate () const
 
virtual bool supportsTransformations (qreal pixelSize, const QTransform &m) const
 
virtual void sync ()
 
virtual void updateState (const QPaintEngineState &state)
 Reimplement this function to update the state of a paint engine. More...
 
- Public Functions inherited from QPaintEngine
void clearDirty (DirtyFlags df)
 
virtual QPoint coordinateOffset () const
 Returns the offset from the painters origo to the engines origo. More...
 
void fix_neg_rect (int *x, int *y, int *w, int *h)
 
virtual HDC getDC () const
 Empty default implementation. More...
 
bool hasFeature (PaintEngineFeatures feature) const
 Returns true if the paint engine supports the specified feature; otherwise returns false. More...
 
bool isActive () const
 Returns true if the paint engine is actively drawing; otherwise returns false. More...
 
bool isExtended () const
 Returns true if the paint engine is a QPaintEngineEx derivative. More...
 
QPaintDevicepaintDevice () const
 Returns the device that this engine is painting on, if painting is active; otherwise returns 0. More...
 
QPainterpainter () const
 Returns the paint engine's painter. More...
 
 QPaintEngine (PaintEngineFeatures features=0)
 Creates a paint engine with the featureset specified by caps. More...
 
virtual void releaseDC (HDC hdc) const
 Empty default implementation. More...
 
void setActive (bool newState)
 Sets the active state of the paint engine to state. More...
 
void setDirty (DirtyFlags df)
 
void setPaintDevice (QPaintDevice *device)
 
void setSystemClip (const QRegion &baseClip)
 Sets the system clip for this engine. More...
 
void setSystemRect (const QRect &rect)
 Sets the target rect for drawing within the backing store. More...
 
void syncState ()
 Updates all dirty states in this engine. More...
 
QRegion systemClip () const
 Returns the system clip. More...
 
QRect systemRect () const
 Retrieves the rect for drawing within the backing store. More...
 
bool testDirty (DirtyFlags df)
 
virtual ~QPaintEngine ()
 Destroys the paint engine. More...
 

Public Variables

QPaintEngineExreal_engine
 

Private Functions

void fillBGRect (const QRectF &r)
 

Additional Inherited Members

- Public Types inherited from QPaintEngineEx
enum  Flags { DoNotEmulate = 0x01, IsEmulationEngine = 0x02 }
 
- Public Types inherited from QPaintEngine
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
}
 QPaintEngine::updateState(). More...
 
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  PolygonDrawMode { OddEvenMode, WindingMode, ConvexMode, PolylineMode }
 
enum  Type {
  X11, Windows, QuickDraw, CoreGraphics,
  MacPrinter, QWindowSystem, PostScript, OpenGL,
  Picture, SVG, Raster, Direct3D,
  Pdf, OpenVG, OpenGL2, PaintBuffer,
  Blitter, User = 50, MaxUser = 100
}
 
- Protected Functions inherited from QPaintEngineEx
 QPaintEngineEx (QPaintEngineExPrivate &data)
 
- Protected Functions inherited from QPaintEngine
 QPaintEngine (QPaintEnginePrivate &data, PaintEngineFeatures devcaps=0)
 
- Protected Variables inherited from QPaintEngine
uint active: 1
 
QScopedPointer< QPaintEnginePrivated_ptr
 
uint extended: 1
 
PaintEngineFeatures gccaps
 
uint selfDestruct: 1
 
QPaintEngineStatestate
 

Detailed Description

Definition at line 64 of file qemulationpaintengine_p.h.

Constructors and Destructors

◆ QEmulationPaintEngine()

QEmulationPaintEngine::QEmulationPaintEngine ( QPaintEngineEx engine)

Definition at line 49 of file qemulationpaintengine.cpp.

50  : real_engine(engine)
51 {
53 }
QPaintEngineState * state
Definition: qpaintengine.h:239
QPainterState * state()

Functions

◆ begin()

bool QEmulationPaintEngine::begin ( QPaintDevice pdev)
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()

Implements QPaintEngine.

Definition at line 61 of file qemulationpaintengine.cpp.

62 {
63  return true;
64 }

◆ beginNativePainting()

void QEmulationPaintEngine::beginNativePainting ( )
virtual

Reimplemented from QPaintEngineEx.

Definition at line 312 of file qemulationpaintengine.cpp.

313 {
315 }
virtual void beginNativePainting()

◆ brushChanged()

void QEmulationPaintEngine::brushChanged ( )
virtual

Implements QPaintEngineEx.

Definition at line 276 of file qemulationpaintengine.cpp.

277 {
279 }
virtual void brushChanged()=0

◆ brushOriginChanged()

void QEmulationPaintEngine::brushOriginChanged ( )
virtual

Implements QPaintEngineEx.

Definition at line 281 of file qemulationpaintengine.cpp.

282 {
284 }
virtual void brushOriginChanged()=0

◆ clip()

void QEmulationPaintEngine::clip ( const QVectorPath path,
Qt::ClipOperation  op 
)
virtual

Implements QPaintEngineEx.

Definition at line 156 of file qemulationpaintengine.cpp.

157 {
158  real_engine->clip(path, op);
159 }
virtual void clip(const QVectorPath &path, Qt::ClipOperation op)=0

◆ clipEnabledChanged()

void QEmulationPaintEngine::clipEnabledChanged ( )
virtual

Implements QPaintEngineEx.

Definition at line 266 of file qemulationpaintengine.cpp.

267 {
269 }
virtual void clipEnabledChanged()=0

◆ compositionModeChanged()

void QEmulationPaintEngine::compositionModeChanged ( )
virtual

Implements QPaintEngineEx.

Definition at line 291 of file qemulationpaintengine.cpp.

292 {
294 }
virtual void compositionModeChanged()=0

◆ createState()

QPainterState * QEmulationPaintEngine::createState ( QPainterState orig) const
virtual

Reimplemented from QPaintEngineEx.

Definition at line 72 of file qemulationpaintengine.cpp.

73 {
74  return real_engine->createState(orig);
75 }
virtual QPainterState * createState(QPainterState *orig) const

◆ drawImage()

void QEmulationPaintEngine::drawImage ( const QRectF r,
const QImage pm,
const QRectF sr,
Qt::ImageConversionFlags  flags 
)
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.

Implements QPaintEngineEx.

Definition at line 220 of file qemulationpaintengine.cpp.

221 {
222  real_engine->drawImage(r, pm, sr, flags);
223 }
virtual void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, Qt::ImageConversionFlags flags=Qt::AutoColor)=0
Reimplement this function to draw the part of the image specified by the sr rectangle in the given re...
virtual uint flags() const

◆ drawPixmap()

void QEmulationPaintEngine::drawPixmap ( const QRectF r,
const QPixmap pm,
const QRectF sr 
)
virtual

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

Implements QPaintEngineEx.

Definition at line 161 of file qemulationpaintengine.cpp.

162 {
163  if (state()->bgMode == Qt::OpaqueMode && pm.isQBitmap())
164  fillBGRect(r);
165  real_engine->drawPixmap(r, pm, sr);
166 }
void fillBGRect(const QRectF &r)
bool isQBitmap() const
Returns true if this is a QBitmap; otherwise returns false.
Definition: qpixmap.cpp:599
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...

◆ drawPixmapFragments() [1/2]

void QEmulationPaintEngine::drawPixmapFragments ( const QPainter::PixmapFragment fragments,
int  fragmentCount,
const QPixmap pixmap,
QPainter::PixmapFragmentHints  hints 
)
virtual

Reimplemented from QPaintEngineEx.

Definition at line 225 of file qemulationpaintengine.cpp.

227 {
228  if (state()->bgMode == Qt::OpaqueMode && pixmap.isQBitmap()) {
229  qreal oldOpacity = real_engine->state()->opacity;
230  QTransform oldTransform = real_engine->state()->matrix;
231 
232  for (int i = 0; i < fragmentCount; ++i) {
233  QTransform transform = oldTransform;
234  transform.translate(fragments[i].x, fragments[i].y);
235  transform.rotate(fragments[i].rotation);
236  real_engine->state()->opacity = oldOpacity * fragments[i].opacity;
237  real_engine->state()->matrix = transform;
240 
241  qreal w = fragments[i].scaleX * fragments[i].width;
242  qreal h = fragments[i].scaleY * fragments[i].height;
243  fillBGRect(QRectF(-0.5 * w, -0.5 * h, w, h));
244  }
245 
246  real_engine->state()->opacity = oldOpacity;
247  real_engine->state()->matrix = oldTransform;
250  }
251 
252  real_engine->drawPixmapFragments(fragments, fragmentCount, pixmap, hints);
253 }
qreal scaleY
the vertical scale of the target rectangle.
Definition: qpainter.h:112
qreal width
the width of the source rectangle and is used to calculate the width of the target rectangle...
Definition: qpainter.h:109
double qreal
Definition: qglobal.h:1193
void fillBGRect(const QRectF &r)
virtual void transformChanged()=0
virtual void drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap, QPainter::PixmapFragmentHints hints)
QTransform matrix
Definition: qpainter_p.h:161
QTransform & translate(qreal dx, qreal dy)
Moves the coordinate system dx along the x axis and dy along the y axis, and returns a reference to t...
Definition: qtransform.cpp:417
qreal opacity
the opacity of the target rectangle, where 0.0 is fully transparent and 1.0 is fully opaque...
Definition: qpainter.h:114
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
QTransform & rotate(qreal a, Qt::Axis axis=Qt::ZAxis)
Rotates the coordinate system counterclockwise by the given angle about the specified axis and return...
Definition: qtransform.cpp:615
bool isQBitmap() const
Returns true if this is a QBitmap; otherwise returns false.
Definition: qpixmap.cpp:599
virtual void opacityChanged()=0
qreal scaleX
the horizontal scale of the target rectangle.
Definition: qpainter.h:111
qreal height
the height of the source rectangle and is used to calculate the height of the target rectangle...
Definition: qpainter.h:110
QPainterState * state()
The QTransform class specifies 2D transformations of a coordinate system.
Definition: qtransform.h:65

◆ drawPixmapFragments() [2/2]

void QEmulationPaintEngine::drawPixmapFragments ( const QRectF targetRects,
const QRectF sourceRects,
int  fragmentCount,
const QPixmap pixmap,
QPainter::PixmapFragmentHints  hints 
)
virtual

Reimplemented from QPaintEngineEx.

Definition at line 255 of file qemulationpaintengine.cpp.

257 {
258  if (state()->bgMode == Qt::OpaqueMode && pixmap.isQBitmap()) {
259  for (int i = 0; i < fragmentCount; ++i)
260  fillBGRect(targetRects[i]);
261  }
262 
263  real_engine->drawPixmapFragments(targetRects, sourceRects, fragmentCount, pixmap, hints);
264 }
void fillBGRect(const QRectF &r)
virtual void drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap, QPainter::PixmapFragmentHints hints)
bool isQBitmap() const
Returns true if this is a QBitmap; otherwise returns false.
Definition: qpixmap.cpp:599

◆ drawStaticTextItem()

void QEmulationPaintEngine::drawStaticTextItem ( QStaticTextItem item)
virtual

Reimplemented from QPaintEngineEx.

Definition at line 208 of file qemulationpaintengine.cpp.

209 {
211 }
virtual void drawStaticTextItem(QStaticTextItem *)

◆ drawTextItem()

void QEmulationPaintEngine::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 from QPaintEngine.

Definition at line 168 of file qemulationpaintengine.cpp.

169 {
170  if (state()->bgMode == Qt::OpaqueMode) {
171  const QTextItemInt &ti = static_cast<const QTextItemInt &>(textItem);
172  QRectF rect(p.x(), p.y() - ti.ascent.toReal(), ti.width.toReal(), (ti.ascent + ti.descent + 1).toReal());
173  fillBGRect(rect);
174  }
175 
176  QPainterState *s = state();
177  Qt::BrushStyle style = qbrush_style(s->pen.brush());
178  if (style >= Qt::LinearGradientPattern && style <= Qt::ConicalGradientPattern)
179  {
180  QPen savedPen = s->pen;
181  QGradient g = *s->pen.brush().gradient();
182 
184  QTransform mat = s->pen.brush().transform();
187  } else if (g.coordinateMode() == QGradient::ObjectBoundingMode) {
188  const QTextItemInt &ti = static_cast<const QTextItemInt &>(textItem);
189  QRectF r(p.x(), p.y() - ti.ascent.toReal(), ti.width.toReal(), (ti.ascent + ti.descent + 1).toReal());
190  mat.translate(r.x(), r.y());
191  mat.scale(r.width(), r.height());
192  }
194  QBrush brush(g);
195  brush.setTransform(mat);
196  s->pen.setBrush(brush);
197  penChanged();
198  real_engine->drawTextItem(p, textItem);
199  s->pen = savedPen;
200  penChanged();
201  return;
202  }
203  }
204 
205  real_engine->drawTextItem(p, textItem);
206 }
QPaintDevice * device() const
Returns the paint device on which this painter is currently painting, or 0 if the painter is not acti...
Definition: qpainter.cpp:1530
BrushStyle
Definition: qnamespace.h:1162
void fillBGRect(const QRectF &r)
void setBrush(const QBrush &brush)
Sets the brush used to fill strokes generated with this pen to the given brush.
Definition: qpen.cpp:808
const QGradient * gradient() const
Returns the gradient describing this brush.
Definition: qbrush.cpp:871
Qt::BrushStyle qbrush_style(const QBrush &b)
Definition: qpainter_p.h:96
CoordinateMode coordinateMode() const
Returns the coordinate mode of this gradient.
Definition: qbrush.cpp:1563
int height() const
Definition: qpaintdevice.h:92
QTransform & translate(qreal dx, qreal dy)
Moves the coordinate system dx along the x axis and dy along the y axis, and returns a reference to t...
Definition: qtransform.cpp:417
QTransform transform() const
Returns the current transformation matrix for the brush.
Definition: qbrush.h:185
The QPen class defines how a QPainter should draw lines and outlines of shapes.
Definition: qpen.h:64
qreal x() const
Returns the x-coordinate of this point.
Definition: qpoint.h:282
QPainter * painter() const
Returns the paint engine&#39;s painter.
int width() const
Definition: qpaintdevice.h:91
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
Internal QTextItem.
QBrush brush() const
Returns the brush used to fill strokes generated with this pen.
Definition: qpen.cpp:797
The QBrush class defines the fill pattern of shapes drawn by QPainter.
Definition: qbrush.h:76
The QGradient class is used in combination with QBrush to specify gradient fills. ...
Definition: qbrush.h:201
void setCoordinateMode(CoordinateMode mode)
Sets the coordinate mode of this gradient to mode.
Definition: qbrush.cpp:1578
qreal toReal() const
Definition: qfixed_p.h:77
qreal y() const
Returns the y-coordinate of this point.
Definition: qpoint.h:287
QTransform & scale(qreal sx, qreal sy)
Scales the coordinate system by sx horizontally and sy vertically, and returns a reference to the mat...
Definition: qtransform.cpp:485
static qreal toReal(Register *reg, int type, bool *ok=0)
The QTransform class specifies 2D transformations of a coordinate system.
Definition: qtransform.h:65
virtual void drawTextItem(const QPointF &p, const QTextItem &textItem)
This function draws the text item textItem at position p.

◆ drawTiledPixmap()

void QEmulationPaintEngine::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 from QPaintEngineEx.

Definition at line 213 of file qemulationpaintengine.cpp.

214 {
215  if (state()->bgMode == Qt::OpaqueMode && pixmap.isQBitmap())
216  fillBGRect(r);
217  real_engine->drawTiledPixmap(r, pixmap, s);
218 }
void fillBGRect(const QRectF &r)
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...
bool isQBitmap() const
Returns true if this is a QBitmap; otherwise returns false.
Definition: qpixmap.cpp:599

◆ end()

bool QEmulationPaintEngine::end ( )
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()

Implements QPaintEngine.

Definition at line 66 of file qemulationpaintengine.cpp.

67 {
68  return true;
69 }

◆ endNativePainting()

void QEmulationPaintEngine::endNativePainting ( )
virtual

Reimplemented from QPaintEngineEx.

Definition at line 317 of file qemulationpaintengine.cpp.

318 {
320 }
virtual void endNativePainting()

◆ fill()

void QEmulationPaintEngine::fill ( const QVectorPath path,
const QBrush brush 
)
virtual

Implements QPaintEngineEx.

Definition at line 77 of file qemulationpaintengine.cpp.

78 {
79  QPainterState *s = state();
80 
81  if (s->bgMode == Qt::OpaqueMode) {
82  Qt::BrushStyle style = brush.style();
83  if (style >= Qt::Dense1Pattern && style <= Qt::DiagCrossPattern)
84  real_engine->fill(path, s->bgBrush);
85  }
86 
87  Qt::BrushStyle style = qbrush_style(brush);
88  if (style >= Qt::LinearGradientPattern && style <= Qt::ConicalGradientPattern) {
89  const QGradient *g = brush.gradient();
90 
93  QBrush copy = brush;
94  QTransform mat = copy.transform();
96  copy.setTransform(mat);
97  real_engine->fill(path, copy);
98  return;
99  } else if (g->coordinateMode() == QGradient::ObjectBoundingMode) {
100  QBrush copy = brush;
101  QTransform mat = copy.transform();
102  QRectF r = path.controlPointRect();
103  mat.translate(r.x(), r.y());
104  mat.scale(r.width(), r.height());
105  copy.setTransform(mat);
106  real_engine->fill(path, copy);
107  return;
108  }
109  }
110  }
111 
112  real_engine->fill(path, brush);
113 }
QPaintDevice * device() const
Returns the paint device on which this painter is currently painting, or 0 if the painter is not acti...
Definition: qpainter.cpp:1530
qreal y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:667
BrushStyle
Definition: qnamespace.h:1162
const QGradient * gradient() const
Returns the gradient describing this brush.
Definition: qbrush.cpp:871
Qt::BrushStyle qbrush_style(const QBrush &b)
Definition: qpainter_p.h:96
void setTransform(const QTransform &)
Sets matrix as an explicit transformation matrix on the current brush.
Definition: qbrush.cpp:968
CoordinateMode coordinateMode() const
Returns the coordinate mode of this gradient.
Definition: qbrush.cpp:1563
int height() const
Definition: qpaintdevice.h:92
QTransform & translate(qreal dx, qreal dy)
Moves the coordinate system dx along the x axis and dy along the y axis, and returns a reference to t...
Definition: qtransform.cpp:417
QTransform transform() const
Returns the current transformation matrix for the brush.
Definition: qbrush.h:185
QBrush bgBrush
Definition: qpainter_p.h:154
QRectF controlPointRect() const
QPainter * painter() const
Returns the paint engine&#39;s painter.
int width() const
Definition: qpaintdevice.h:91
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
qreal height() const
Returns the height of the rectangle.
Definition: qrect.h:710
qreal width() const
Returns the width of the rectangle.
Definition: qrect.h:707
Qt::BrushStyle style() const
Returns the brush style.
Definition: qbrush.h:182
The QBrush class defines the fill pattern of shapes drawn by QPainter.
Definition: qbrush.h:76
The QGradient class is used in combination with QBrush to specify gradient fills. ...
Definition: qbrush.h:201
qreal x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:664
virtual void fill(const QVectorPath &path, const QBrush &brush)=0
QTransform & scale(qreal sx, qreal sy)
Scales the coordinate system by sx horizontally and sy vertically, and returns a reference to the mat...
Definition: qtransform.cpp:485
Qt::BGMode bgMode
Definition: qpainter_p.h:171
The QTransform class specifies 2D transformations of a coordinate system.
Definition: qtransform.h:65

◆ fillBGRect()

void QEmulationPaintEngine::fillBGRect ( const QRectF r)
private

Definition at line 322 of file qemulationpaintengine.cpp.

Referenced by drawPixmap(), drawPixmapFragments(), drawTextItem(), and drawTiledPixmap().

323 {
324  qreal pts[] = { r.x(), r.y(), r.x() + r.width(), r.y(),
325  r.x() + r.width(), r.y() + r.height(), r.x(), r.y() + r.height() };
327  real_engine->fill(vp, state()->bgBrush);
328 }
qreal y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:667
double qreal
Definition: qglobal.h:1193
qreal height() const
Returns the height of the rectangle.
Definition: qrect.h:710
qreal width() const
Returns the width of the rectangle.
Definition: qrect.h:707
qreal x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:664
virtual void fill(const QVectorPath &path, const QBrush &brush)=0

◆ flags()

virtual uint QEmulationPaintEngine::flags ( ) const
inlinevirtual

◆ opacityChanged()

void QEmulationPaintEngine::opacityChanged ( )
virtual

Implements QPaintEngineEx.

Definition at line 286 of file qemulationpaintengine.cpp.

287 {
289 }
virtual void opacityChanged()=0

◆ penChanged()

void QEmulationPaintEngine::penChanged ( )
virtual

Implements QPaintEngineEx.

Definition at line 271 of file qemulationpaintengine.cpp.

Referenced by drawTextItem().

272 {
274 }
virtual void penChanged()=0

◆ renderHintsChanged()

void QEmulationPaintEngine::renderHintsChanged ( )
virtual

Implements QPaintEngineEx.

Definition at line 296 of file qemulationpaintengine.cpp.

297 {
299 }
virtual void renderHintsChanged()=0

◆ setState()

void QEmulationPaintEngine::setState ( QPainterState s)
virtual

Reimplemented from QPaintEngineEx.

Definition at line 306 of file qemulationpaintengine.cpp.

307 {
309  real_engine->setState(s);
310 }
QPaintEngineState * state
Definition: qpaintengine.h:239
virtual void setState(QPainterState *s)

◆ state() [1/2]

QPainterState* QEmulationPaintEngine::state ( )
inline

◆ state() [2/2]

const QPainterState* QEmulationPaintEngine::state ( ) const
inline

Definition at line 107 of file qemulationpaintengine_p.h.

107 { return (const QPainterState *)QPaintEngine::state; }
QPaintEngineState * state
Definition: qpaintengine.h:239

◆ stroke()

void QEmulationPaintEngine::stroke ( const QVectorPath path,
const QPen pen 
)
virtual

Reimplemented from QPaintEngineEx.

Definition at line 115 of file qemulationpaintengine.cpp.

116 {
117  QPainterState *s = state();
118 
119  if (s->bgMode == Qt::OpaqueMode && pen.style() > Qt::SolidLine) {
120  QPen bgPen = pen;
121  bgPen.setBrush(s->bgBrush);
122  bgPen.setStyle(Qt::SolidLine);
123  real_engine->stroke(path, bgPen);
124  }
125 
126  QBrush brush = pen.brush();
127  QPen copy = pen;
128  Qt::BrushStyle style = qbrush_style(brush);
129  if (style >= Qt::LinearGradientPattern && style <= Qt::ConicalGradientPattern) {
130  const QGradient *g = brush.gradient();
131 
134  QTransform mat = brush.transform();
136  brush.setTransform(mat);
137  copy.setBrush(brush);
138  real_engine->stroke(path, copy);
139  return;
140  } else if (g->coordinateMode() == QGradient::ObjectBoundingMode) {
141  QTransform mat = brush.transform();
142  QRectF r = path.controlPointRect();
143  mat.translate(r.x(), r.y());
144  mat.scale(r.width(), r.height());
145  brush.setTransform(mat);
146  copy.setBrush(brush);
147  real_engine->stroke(path, copy);
148  return;
149  }
150  }
151  }
152 
153  real_engine->stroke(path, pen);
154 }
QPaintDevice * device() const
Returns the paint device on which this painter is currently painting, or 0 if the painter is not acti...
Definition: qpainter.cpp:1530
qreal y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:667
BrushStyle
Definition: qnamespace.h:1162
void setBrush(const QBrush &brush)
Sets the brush used to fill strokes generated with this pen to the given brush.
Definition: qpen.cpp:808
const QGradient * gradient() const
Returns the gradient describing this brush.
Definition: qbrush.cpp:871
Qt::BrushStyle qbrush_style(const QBrush &b)
Definition: qpainter_p.h:96
void setTransform(const QTransform &)
Sets matrix as an explicit transformation matrix on the current brush.
Definition: qbrush.cpp:968
Qt::PenStyle style() const
Returns the pen style.
Definition: qpen.cpp:428
CoordinateMode coordinateMode() const
Returns the coordinate mode of this gradient.
Definition: qbrush.cpp:1563
int height() const
Definition: qpaintdevice.h:92
QTransform & translate(qreal dx, qreal dy)
Moves the coordinate system dx along the x axis and dy along the y axis, and returns a reference to t...
Definition: qtransform.cpp:417
QTransform transform() const
Returns the current transformation matrix for the brush.
Definition: qbrush.h:185
The QPen class defines how a QPainter should draw lines and outlines of shapes.
Definition: qpen.h:64
QBrush bgBrush
Definition: qpainter_p.h:154
QRectF controlPointRect() const
virtual void stroke(const QVectorPath &path, const QPen &pen)
QPainter * painter() const
Returns the paint engine&#39;s painter.
int width() const
Definition: qpaintdevice.h:91
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
qreal height() const
Returns the height of the rectangle.
Definition: qrect.h:710
qreal width() const
Returns the width of the rectangle.
Definition: qrect.h:707
QBrush brush() const
Returns the brush used to fill strokes generated with this pen.
Definition: qpen.cpp:797
The QBrush class defines the fill pattern of shapes drawn by QPainter.
Definition: qbrush.h:76
The QGradient class is used in combination with QBrush to specify gradient fills. ...
Definition: qbrush.h:201
qreal x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:664
QTransform & scale(qreal sx, qreal sy)
Scales the coordinate system by sx horizontally and sy vertically, and returns a reference to the mat...
Definition: qtransform.cpp:485
Qt::BGMode bgMode
Definition: qpainter_p.h:171
void setStyle(Qt::PenStyle)
Sets the pen style to the given style.
Definition: qpen.cpp:450
The QTransform class specifies 2D transformations of a coordinate system.
Definition: qtransform.h:65

◆ transformChanged()

void QEmulationPaintEngine::transformChanged ( )
virtual

Implements QPaintEngineEx.

Definition at line 301 of file qemulationpaintengine.cpp.

302 {
304 }
virtual void transformChanged()=0

◆ type()

QPaintEngine::Type QEmulationPaintEngine::type ( ) const
virtual

Reimplement this function to return the paint engine Type.

Implements QPaintEngine.

Definition at line 56 of file qemulationpaintengine.cpp.

57 {
58  return real_engine->type();
59 }
virtual Type type() const =0
Reimplement this function to return the paint engine Type.

Properties

◆ real_engine

QPaintEngineEx* QEmulationPaintEngine::real_engine

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